function getCalendar(ControlToAddDate)
{
	var windowTop=event.clientY;
	var windowLeft=event.clientX-323;
	window.open('showcalendar.asp?field='+ControlToAddDate,'calendar','width=323,height=200,left='+windowLeft+',top='+windowTop)
}
	function setColor(el, bg) {
	  if (el.style) el.style.backgroundColor = bg;
	}

	function testEmailAddress(src) {
		var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
		var regex = new RegExp(emailReg);
		return regex.test(src);
	}

	function testIsNumeric(src){
		var alphaReg = "^([0-9]+)$";
		var regex = new RegExp(alphaReg);
		return regex.test(src);
	}

	function testIsValidPhone(src){
		var stripped = src.replace(/[\(\)\.\-\ ]/g, '');
		return !(isNaN(parseInt(stripped)));
	}

	function testPrice(src){
		var alphaReg = "^([0-9]+(\.[0-9]+)?)$";
		var regex = new RegExp(alphaReg);
		return regex.test(src);
	}

	function testLatin(src){
	//var latinReg = "^([0-9]+)$";
		var latinReg = "[A-Za-z0-9_]";
		var regex = new RegExp(latinReg);
		return regex.test(src);
	}

	function checkJpgFile(fileName)
	{
		//jpg,jpeg
//		alert(fileName)
		if ((fileName.indexOf('.jpg') < 0)&& (fileName.indexOf('.JPG') < 0) && 
		    (fileName.indexOf('.jpeg') < 0) && (fileName.indexOf('.JPEG') <0))
			return false;
		else
			return true;
	}

function trimSpaces(passedControl){
		//Trim Trailing Spaces
		while(''+passedControl.value.charAt(passedControl.value.length-1)==' ')
			passedControl.value=passedControl.value.substring(0,passedControl.value.length-1);
					
		//Trim Leading Spaces
		while(''+passedControl.value.charAt(0)==' ')
			passedControl.value=passedControl.value.substring(1,passedControl.value.length);
		return passedControl.value;
	}
	
		function openWindow(URL,w,h,s){
		if(!s)s='auto'
		window.open(URL,null,"width="+w+", height="+h+",status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
		}
		function openModalDialog(url, t,l,w,h){
		if (document.layers){
			document.captureEvents(Event.MOUSEDOWN);
			document.onmousedown=checkFocus;
			isBlocked=true;
			
			myWin=window.open(url,"newWin","top="+t+",left="+l+",width="+w+",height="+h);
			myWin.focus();
		}
		if (document.all)
			window.showModalDialog(url,"","dialogTop:"+t+"px;dialogLeft:"+l+"px;dialogWidth:"+w+"px;dialogHeight:"+h+"px");
	}
var bgBad = "red";
var bgGood = "white";

