function CG_validateForm(theForm){
	for (i=0; i< theForm.length; i++){
		theField = theForm.elements[i];
		if(theField.id == "required"){
			if(theField.type == "select-one"){
				if(theField.options[theField.selectedIndex].value == ""){
					alert("Please Select " + theField.name + ".");
					theField.focus();
					return false;
				}
			}
			else{
				if(theField.value == ""){
					alert("Please Enter " + theField.name + ".");
					theField.focus();
					return false;
				}
			}
		}
		if(theField.id == "email"){
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theField.value))){
				alert("Email address is Incorrect");
				theField.focus();
				return false;
			}
		}
		if (theField.id == "strCAPTCHA"){
			if (theField.value == ""){
				alert("Please Enter Secure Code.");
				theField.focus();
				return false;
			}
		}
	}

	return true;
}

function CG_CalPop(sInputName){	
	window.open('http://www2.cybergolf.com/appointments/calendar/Calendar.asp?birthday=yes&hidedate=yes&N=' + escape(sInputName) + '&DT=' + escape(window.eval(sInputName).value), 'CalPop', 'toolbar=0,width=378,height=225');
}

function CG_popup(url,w,h){
	screenWidth = window.screen.width;
	l = (screenWidth - w) / 2;
	screenHeight = window.screen.height;
	t = (screenHeight - h) / 2;
	open(url,'upload','width='+w+',height='+h+',left='+l+',top='+t+',status=yes');
}

function CG_selectDate(fieldName){

	url = "selectDate.asp?fieldName="+fieldName;
	pageWidth = 180;
	screenWidth = window.screen.width;
	l = (screenWidth - pageWidth) / 2;
	pageHeight = 235;
	screenHeight = window.screen.height;
	t = (screenHeight - pageHeight) / 2;
	uploadWin = window.open(url,'date','width='+pageWidth+',height='+pageHeight+',left='+l+',top='+t);
}

