function num_ctrl(evt)
{
	var charCode = ( evt.which ) ? evt.which : event.keyCode;
	return ( (charCode >= 48 && charCode <= 57) || (charCode == 8) );
}

function chr_ctrl(evt, o)
{
	//alert(o.value);
	var charCode = ( evt.which ) ? evt.which : event.keyCode;
	//alert(charCode);
	var ret = (charCode == 60 || charCode == 62 || charCode == 39 || charCode == 34 || charCode == 92 || charCode == 45 || charCode == 40 || charCode == 41 || charCode == 59 || charCode == 38 || charCode == 37 || charCode == 42 || charCode == 58 || charCode == 61)
	return !ret;
}

function ctrl(e, o)
{
	//alert(o.value);
	if (o.value.toUpperCase().indexOf(" AND ") > -1)
	{
		o.value = o.value.replace(/ AND /gi, " ");
		ctrl(e, o);
	}
	if (o.value.toUpperCase().indexOf(" OR ") > -1)
	{
		o.value = o.value.replace(/ OR /gi, " ");
		ctrl(e, o);
	}
}