function getPage(theUrl){
	document.location.href = theUrl;
}



function validateForm(){
	return checkInputFields();
}


function checkInputFields(){
	var submitForm = true;
	var formElementCount = document.forms[0].elements.length;
	var thisForm = document.forms[0];
	
	for(i=0; i<formElementCount;i++){
		var thisElement = document.forms[0].elements[i];
		if (thisElement.name != "Submit" && thisElement.name != "Comments" && thisElement.name != "Phone_Ext" && thisElement.name != "Address_2" && thisElement.name != "Club_Member_Of" && thisElement.name != "How_Far_Travel_To_Play" && thisElement.name != "Event_Date" && thisElement.name != "Past_Event_Type_Golf" && thisElement.name != "Past_Event_Type_Meeting" && thisElement.name != "Past_Event_Tye_Banquets" && thisElement.name != "Past_Event_Tye_Wedding" && thisElement.name != "Past_Event_Type_Party" && thisElement.name != "Past_Event_Type_Social" && thisElement.name != "Other_Golf_Destination" && thisElement.name != "If_Member_At_Other_Club_Which" && thisElement.name != "Brand_Of_Putter" && thisElement.name != "Other_Brand_Of_Clothing"){
			var thisName = thisElement.name;
			if(thisElement.value == ""){
					//alert(thisName);
					document.getElementById(thisName).style.visibility = "visible";
					document.getElementById(thisName).style.display = "block";
					if(thisElement.name == "zipCode" && thisForm.state.value == ""){
						document.getElementById(thisName).style.marginTop="-12px";
					}
					
					writeIt("<span style='color:#FF0000;'>*Required</span><br />", thisName);
					submitForm = false;
			}else{
				document.getElementById(thisName).style.visibility = "hidden";
				document.getElementById(thisName).style.display = "none";
				writeIt("", thisName);
			}
		}
		
	}
	
	//ALL FORMS EXCEPT "EMAIL TO A FRIEND"
	if(document.forms[0].name != "emailSite"){
	
		if(!thisForm.gender[0].checked && !thisForm.gender[1].checked){
				document.getElementById("gender").style.visibility = "visible";
				document.getElementById("gender").style.display = "block";
				writeIt("<span style='color:#FF0000;'>*Required</span><br />", "gender");
				submitForm = false;
		}else{
				document.getElementById("gender").style.visibility = "hidden";
				document.getElementById("gender").style.display = "none";
				writeIt("", "gender");
		}
				
			
			
			
		if(!thisForm.Email_Type_Personal.checked && !thisForm.Email_Type_Business.checked){
			document.getElementById("Email_Type_Personal").style.visibility = "visible";
			document.getElementById("Email_Type_Personal").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Email_Type_Personal");
			submitForm = false;
		}else{
			document.getElementById("Email_Type_Personal").style.visibility = "hidden";
			document.getElementById("Email_Type_Personal").style.display = "none";
			writeIt("", "Email_Type_Personal");
		}
		
		if(!thisForm.Address_Type_Business.checked && !thisForm.Address_Type_Home.checked && !thisForm.Address_Type_Seasonal.checked){
			document.getElementById("Address_Type_Business").style.visibility = "visible";
			document.getElementById("Address_Type_Business").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Address_Type_Business");
			submitForm = false;
		}else{
			document.getElementById("Address_Type_Business").style.visibility = "hidden";
			document.getElementById("Address_Type_Business").style.display = "none";
			writeIt("", "Address_Type_Business");
		}
	}
	
	
	
	//CONTACT US FORM or OUTING RFP or WIN OUTING FOR 8 UNIQUE FIELDS
	if(document.forms[0].name == "contactUs" || document.forms[0].name == "outingRFP" || document.forms[0].name == "winOutingFor8"){
		if(!thisForm.Phone_Type_Business.checked && !thisForm.Phone_Type_Home.checked && !thisForm.Phone_Type_Resident.checked){
			document.getElementById("Phone_Type_Business").style.visibility = "visible";
			document.getElementById("Phone_Type_Business").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Phone_Type_Business");
			submitForm = false;
		}else{
			document.getElementById("Phone_Type_Business").style.visibility = "hidden";
			document.getElementById("Phone_Type_Business").style.display = "none";
			writeIt("", "Phone_Type_Business");
		}
	}
	
	//OUTING RFP FORM UNIQUE FIELDS
	if(document.forms[0].name == "outingRFP"){
		if(!thisForm.Event_Type_Golf.checked && !thisForm.Event_Type_Meetings.checked && !thisForm.Event_Type_Banquets.checked && !thisForm.Event_Type_Weddings.checked && !thisForm.Event_Type_Party.checked && !thisForm.Event_Type_Social.checked){
			document.getElementById("Event_Type_Golf").style.visibility = "visible";
			document.getElementById("Event_Type_Golf").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Event_Type_Golf");
			submitForm = false;
		}else{
			document.getElementById("Event_Type_Golf").style.visibility = "hidden";
			document.getElementById("Event_Type_Golf").style.display = "none";
			writeIt("", "Event_Type_Golf");
		}
		
		if(!thisForm.Held_Event_At_Our_Facility[0].checked && !thisForm.Held_Event_At_Our_Facility[1].checked){
			document.getElementById("Held_Event_At_Our_Facility").style.visibility = "visible";
			document.getElementById("Held_Event_At_Our_Facility").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Held_Event_At_Our_Facility");
			submitForm = false;
		}else{
				document.getElementById("Held_Event_At_Our_Facility").style.visibility = "hidden";
				document.getElementById("Held_Event_At_Our_Facility").style.display = "none";
				writeIt("", "Held_Event_At_Our_Facility");
		}
		
		if(!thisForm.Decision_Maker[0].checked && !thisForm.Decision_Maker[1].checked){
			document.getElementById("Decision_Maker").style.visibility = "visible";
			document.getElementById("Decision_Maker").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Decision_Maker");
			submitForm = false;
		}else{
				document.getElementById("Decision_Maker").style.visibility = "hidden";
				document.getElementById("Decision_Maker").style.display = "none";
				writeIt("", "Decision_Maker");
		}
	}
	
	
	//WIN OUTING FOR 8 UNIQUE FIELDS
	if(document.forms[0].name == "winOutingFor8"){
		
		if(!thisForm.Company_Hold_Golf_Outings[0].checked && !thisForm.Company_Hold_Golf_Outings[1].checked){
			document.getElementById("Company_Hold_Golf_Outings").style.visibility = "visible";
			document.getElementById("Company_Hold_Golf_Outings").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Company_Hold_Golf_Outings");
			submitForm = false;
		}else{
				document.getElementById("Company_Hold_Golf_Outings").style.visibility = "hidden";
				document.getElementById("Company_Hold_Golf_Outings").style.display = "none";
				writeIt("", "Company_Hold_Golf_Outings");
		}
		
		if(!thisForm.Company_Hold_Offsite_Meetings[0].checked && !thisForm.Company_Hold_Offsite_Meetings[1].checked){
			document.getElementById("Company_Hold_Offsite_Meetings").style.visibility = "visible";
			document.getElementById("Company_Hold_Offsite_Meetings").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Company_Hold_Offsite_Meetings");
			submitForm = false;
		}else{
				document.getElementById("Company_Hold_Offsite_Meetings").style.visibility = "hidden";
				document.getElementById("Company_Hold_Offsite_Meetings").style.display = "none";
				writeIt("", "Company_Hold_Offsite_Meetings");
		}
		
		
		if(!thisForm.Member_At_Other_Club[0].checked && !thisForm.Member_At_Other_Club[1].checked){
			document.getElementById("Member_At_Other_Club").style.visibility = "visible";
			document.getElementById("Member_At_Other_Club").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Member_At_Other_Club");
			submitForm = false;
		}else{
				document.getElementById("Member_At_Other_Club").style.visibility = "hidden";
				document.getElementById("Member_At_Other_Club").style.display = "none";
				writeIt("", "Member_At_Other_Club");
		}
		
		
		
		if(!thisForm.Spouse_Play_Golf[0].checked && !thisForm.Spouse_Play_Golf[1].checked){
			document.getElementById("Spouse_Play_Golf").style.visibility = "visible";
			document.getElementById("Spouse_Play_Golf").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Spouse_Play_Golf");
			submitForm = false;
		}else{
				document.getElementById("Spouse_Play_Golf").style.visibility = "hidden";
				document.getElementById("Spouse_Play_Golf").style.display = "none";
				writeIt("", "Spouse_Play_Golf");
		}
		
		
		if(!thisForm.Took_Golf_Vacations_Florida.checked && !thisForm.Took_Golf_Vacations_South_Carolina.checked && !thisForm.Took_Golf_Vacations_Arizona.checked && !thisForm.Took_Golf_Vacations_MidWest.checked && !thisForm.Took_Golf_Vacations_Scotland.checked && !thisForm.Took_Golf_Vacations_South_Africa.checked && !thisForm.Took_Golf_Vacations_Carribean.checked && !thisForm.Took_Golf_Vacations_Spain.checked && !thisForm.Took_Golf_Vacations_Other.checked && !thisForm.Took_Golf_Vacations_North_Carolina.checked && !thisForm.Took_Golf_Vacations_California.checked && !thisForm.Took_Golf_Vacations_Nevada.checked && !thisForm.Took_Golf_Vacations_Ireland.checked && !thisForm.Took_Golf_Vacations_EnglandWales.checked && !thisForm.Took_Golf_Vacations_Asia.checked && !thisForm.Took_Golf_Vacations_South_America.checked && !thisForm.Took_Golf_Vacations_Portugal.checked){
			document.getElementById("Took_Golf_Vacations_Florida").style.visibility = "visible";
			document.getElementById("Took_Golf_Vacations_Florida").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Took_Golf_Vacations_Florida");
			submitForm = false;
		}else{
			document.getElementById("Took_Golf_Vacations_Florida").style.visibility = "hidden";
			document.getElementById("Took_Golf_Vacations_Florida").style.display = "none";
			writeIt("", "Took_Golf_Vacations_Florida");
		}
		
		if(!thisForm.Membership_Interest[0].checked && !thisForm.Membership_Interest[1].checked){
			document.getElementById("Membership_Interest").style.visibility = "visible";
			document.getElementById("Membership_Interest").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Membership_Interest");
			submitForm = false;
		}else{
				document.getElementById("Membership_Interest").style.visibility = "hidden";
				document.getElementById("Membership_Interest").style.display = "none";
				writeIt("", "Membership_Interest");
		}
		
		
		if(!thisForm.Day_Like_To_Play_Monday.checked && !thisForm.Day_Like_To_Play_Tuesday.checked && !thisForm.Day_Like_To_Play_Wednesday.checked && !thisForm.Day_Like_To_Play_Thursday.checked && !thisForm.Day_Like_To_Play_Friday.checked && !thisForm.Day_Like_To_Play_Saturday.checked && !thisForm.Day_Like_To_Play_Sunday.checked){
			document.getElementById("Day_Like_To_Play_Monday").style.visibility = "visible";
			document.getElementById("Day_Like_To_Play_Monday").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Day_Like_To_Play_Monday");
			submitForm = false;
		}else{
			document.getElementById("Day_Like_To_Play_Monday").style.visibility = "hidden";
			document.getElementById("Day_Like_To_Play_Monday").style.display = "none";
			writeIt("", "Day_Like_To_Play_Monday");
		}
		
		
		if(!thisForm.Typically_Play_When_Weekdays_AM.checked && !thisForm.Typically_Play_When_Weekends_AM.checked && !thisForm.Typically_Play_When_Various_Times.checked && !thisForm.Typically_Play_When_Weekdays_PM.checked && !thisForm.Typically_Play_When_Weekends_PM.checked){
			document.getElementById("Typically_Play_When_Weekdays_AM").style.visibility = "visible";
			document.getElementById("Typically_Play_When_Weekdays_AM").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Typically_Play_When_Weekdays_AM");
			submitForm = false;
		}else{
			document.getElementById("Typically_Play_When_Weekdays_AM").style.visibility = "hidden";
			document.getElementById("Typically_Play_When_Weekdays_AM").style.display = "none";
			writeIt("", "Typically_Play_When_Weekdays_AM");
		}
		
		if(!thisForm.Brand_Of_Clothing_Adidas.checked && !thisForm.Brand_Of_Clothing_CutterBuck.checked && !thisForm.Brand_Of_Clothing_Nike.checked && !thisForm.Brand_Of_Clothing_Ashworth.checked && !thisForm.Brand_Of_Clothing_Izod.checked && !thisForm.Brand_Of_Clothing_Other.checked){
			document.getElementById("Brand_Of_Clothing_Adidas").style.visibility = "visible";
			document.getElementById("Brand_Of_Clothing_Adidas").style.display = "block";
			writeIt("<span style='color:#FF0000;'>*Required</span><br />", "Brand_Of_Clothing_Adidas");
			submitForm = false;
		}else{
			document.getElementById("Brand_Of_Clothing_Adidas").style.visibility = "hidden";
			document.getElementById("Brand_Of_Clothing_Adidas").style.display = "none";
			writeIt("", "Brand_Of_Clothing_Adidas");
		}
		
		
	}
	

	if(submitForm){
		writeIt("", "submitMessage");
		return true;
		
	}else{
		document.getElementById("submitMessage").style.height = "25px";
		document.getElementById("submitMessage").style.marginTop = "10px";
		writeIt("<span style='color:#FF0000;'>*Please make sure required fields are filled in.</span><br />", "submitMessage");
		return false;
		
	}
}




function writeIt(text,id){
	
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = '<P CLASS="testclass">' + text + '</P>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}


function checkGuestRates(){
	var confirmNum = document.guestRates.confirmNum.value;
	if(confirmNum.length == 8){
		return true;
	}
	
	if(confirmNum.length > 0 && confirmNum.length < 8){
		writeIt("<span style='color:#FF0000;'>*Please enter a correct confirmation number.</span><br /><br />", "confirmNumDiv");
		return false;
	}
	if(confirmNum.length > 8){
		writeIt("<span style='color:#FF0000;'>*Please enter a correct confirmation number.</span><br /><br />", "confirmNumDiv");
		return false;
	}
	if(confirmNum == ""){
		writeIt("<span style='color:#FF0000;'>*Enter a confirmation number.</span><br /><br />", "confirmNumDiv");
		return false;
	}
	
}

function showPreview(img, x, y){
			 
	var contentX = (x * 33) + 'px';
	
	var contentY = y+'px';
	 
	var contentImg_1 = "<a href='#' onClick='hidePreview()'><img src='";
	var contentImg_2 =  "' border='0' /> </a>";
	
	var contentCopyright = "<img src='images/scoreCard_imageCopyright.gif' alt='Hole Graphics by Players\' Book Publications © 2005 Tel: 800 557-4370' />"

	//document.getElementById("previewFrame").style.visibility="visible";
	document.getElementById("previewFrame").style.display="block";
	
	document.getElementById("previewFrame").style.marginLeft= contentX;
	document.getElementById("previewFrame").style.top= contentY;
	
	document.getElementById('previewContent').innerHTML= contentImg_1 + img + contentImg_2 + contentCopyright;
}

function hidePreview(){
	//document.getElementById("previewFrame").style.visibility="hide";
	document.getElementById("previewFrame").style.display="none";
}

function embedFlashHeader(){
		var line1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="780" height="173" id="flashHeader" align="middle">';
		var line2 = '<param name="allowScriptAccess" value="sameDomain" />';
		var line3 = '<param name="movie" value="swf/flashHeader.swf" />';
		var line4 = '<param name="quality" value="high" />';
		var line5 = '<param name="scale" value="exactfit" />';
		var line6 = '<param name="bgcolor" value="#ffffff" />';
		var line7 = '<embed src="swf/flashHeader.swf" quality="high" scale="exactfit" bgcolor="#ffffff" width="780" height="173" name="flashHeader" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		var line8 = '</object>';
		
		document.write(line1+line2+line3+line4+line5+line6+line7+line8)
}


function embedYardageBook(){
		var line1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="500" height="525" id="yardageBook" align="middle">';
		var line2 = '<param name="allowScriptAccess" value="sameDomain" />';
		var line3 = '<param name="movie" value="swf/yardageBook.swf" />';
		var line4 = '<param name="quality" value="high" />';
		var line5 = '<param name="scale" value="exactfit" />';
		var line6 = '<param name="bgcolor" value="#ffffff" />';
		var line7 = '<embed src="swf/yardageBook.swf" quality="high" scale="exactfit" bgcolor="#ffffff" width="500" height="525" name="yardageBook" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		var line8 = '</object>';
		
		document.write(line1+line2+line3+line4+line5+line6+line7+line8)
}

function scoreCardThumb(img, imgTitle){
	var thumbWindow = window.open("","thumbWin","width=290, height=450, resizable, scrollbars=no");
	thumbWindow.document.write("<html><head><title>Shingle Creek Golf Club</title></head><body style='background-color:#40791C; font-family:Arial, Helvetica, sans-serif;'>"+
							   "<center><span style='font-size:12px; font-weight:bold; color:#FFFFFF'>"+imgTitle+"</span>"+
							   
							   "<div style='width:250px; height:370px; margin-bottom:-10px; padding:1px 1px 1px 1px; border: 1px solid #FFFFFF;'>"+
							   "<a href='Javascript:window.close();'><img src='"+ img +"' border='0' alt='image of "+ imgTitle +"'></a>"+
							   "</div>"+
							   "<span style='font-size:10px; color:#FFFFFF'>"+
							   "<br>Hole Graphics By Players' Book Publications © 2005 <br> 800-557-4370"+
							   "</span>"+
							   "</center></body></html>");
	thumbWindow.document.close();
	thumbWindow.focus();
}

function showMap(img){
	var mapWindow = window.open("","mapWin","width=480, height=394, resizable, scrollbars=no");
	
	mapWindow.document.write("<html><head><title>Shingle Creek Golf Club</title></head><body style='background-color:#FFFFFF; font-family:Arial, Helvetica, sans-serif;'>"+
							   "<center>"+
							   
							   "<div style='width:450px; height:364px; margin-bottom:-10px; padding:1px 1px 1px 1px; border: 1px solid #006600;'>"+
							   "<a href='Javascript:window.close();'><img src='"+ img +"' border='0' alt='image of Shingle Creek Street Map'></a>"+
							   "</div>"+
							   "</center></body></html>");
	
	mapWindow.document.close();
	mapWindow.focus();
}