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&amp;hidedate=yes&amp;N=' + escape(sInputName) + '&DT=' + escape(window.eval(sInputName).value), 'CalPop', 'toolbar=0,width=378,height=225');
}

function CG_popup(url,w,h,scrollbar){
	if (w == "")
		open(url,'newWin','toolbar=yes,location=yes,directiries=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes,status=yes');
	else{
		screenWidth = window.screen.width;
		l = (screenWidth - w) / 2;
		screenHeight = window.screen.height;
		t = (screenHeight - h) / 2;
		if (scrollbar)
			scrollbar = "yes"
		else
			scrollbar = "no"
		open(url,'upload','width='+w+',height='+h+',left='+l+',top='+t+',status=yes,scrollbars='+scrollbar);
	}
}

function CG_selectDate(fieldName){

	url = "selectDateeb74.html?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);
}

function CG_encryptedEmail(arr_str){
	var encryptedStr = '';
	for (var i=0; i<arr_str.length; i++){
 		encryptedStr += String.fromCharCode(arr_str[i]);
	}
	document.location.href = "mailto:" + encryptedStr;
}
