/* Great Grace JS Document */

<!--
//SUBMIT VALIDATION SCRIPT ---------------------------------------------------
	function checkMandatory()
	{
		var error_string = "";
//check the text field first name
		if(window.document.getElementById("greatgraceform").fname.value == "")
		{
			error_string += "Your first name is a required field.\n";
		//	theForm.fname.focus();
		//	return (false);
		}
		
//check the text field last name
		
		if(window.document.getElementById("greatgraceform").lname.value == "")
		{
			error_string += "Your last name is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
//check the text field email
		var emailver ="no";
		var emailad=window.document.getElementById("greatgraceform").email.value;
		var the_at = emailad.indexOf("@");
		var the_dot = emailad.lastIndexOf(".");
		var a_space = emailad.indexOf(" ");
		if ((the_at != -1) && //if there's an '@'
			(the_at != 0) && // and it's not at position 0
			(the_dot !=-1) && // and there's a '.'
			(the_dot > the_at +1) && // and something between the '@' and '.'
			(the_dot < emailad.length -1) && //and something after the '.'
			(a_space == -1)) // and there are no spaces
			{emailver ="yes";
			}
		if (emailver =="no")
		{
			error_string += "Your email is a required field.\n";
		//	theForm.email.focus();
		//	return (false);
		}


//check the text field subject
		
		if(window.document.getElementById("greatgraceform").subject.value == "")
		{
			error_string += "The subject is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}



//check checkboxes
		var checkboxes = "no";
			if ((window.document.getElementById("greatgraceform").comment1.checked == true) ||
			 (window.document.getElementById("greatgraceform").comment2.checked == true) ||
			 (window.document.getElementById("greatgraceform").comment3.checked == true) ||
			 (window.document.getElementById("greatgraceform").comment4.checked == true) ||
			 (window.document.getElementById("greatgraceform").comment5.checked == true) ||
			 (window.document.getElementById("greatgraceform").comment6.checked == true))
			 {
			checkboxes = "yes";
			}
			if (checkboxes =="no")
			{
				error_string += "Please select a Requested Information Checkbox.\n";
			}

			
//return commands					
		if (error_string !== "")
		{	
			error_string = "We found the following omissions in your form: \n" + error_string;
			alert(error_string);
			return false;
			}
		
}



//PREVIEW WINDOW SCRIPT ------------------------------------------------------
	function diswind() 
		{DispWin = window.open('', 'NewWin',
		'toolbar=yes, status=no, width=600, height=600, scrollbars, resizable');
		
//Comments or Suggestions		
		var fmcomment=new Array()

		if (window.document.getElementById("greatgraceform").comment1.checked == true)
		{
		fmcomment[0] = "Want More Information"
		}
		if (window.document.getElementById("greatgraceform").comment2.checked == true)
		{
		fmcomment[1] = "Need Immediate Help"
		}
		if (window.document.getElementById("greatgraceform").comment3.checked == true)
		{
		fmcomment[2] = "Want To Help"
		}
		if (window.document.getElementById("greatgraceform").comment4.checked == true)
		{
		fmcomment[3] = "Booking Information"
		}
		if (window.document.getElementById("greatgraceform").comment5.checked == true)
		{
		fmcomment[4] = "Comments, Compliments, Suggestions"
		}
		if (window.document.getElementById("greatgraceform").comment6.checked == true)
		{
		fmcomment[5] = "Share Story"
		}

		

	


//	var finish = "no"
		message = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><title>Great Grace International</title><link rel='stylesheet' type='text/css' href='../css/normalize.css'/><link rel='stylesheet' type='text/css' media='screen, print' href='../css/printform.css'/></head><body><div id='contents'><h1>Oasis Community Church</h1><h2>Contact Form Information</h2><div id='leftcolumn'>";
		<!--message = "<html><head><title>Caregiving 101 Form Information</title></head><body><ul><li><b>First Name: </b>" + document.cgform.fname.value;"</li>"-->
		message += "<ul><li><span>First Name: </span>" + document.getElementById('greatgraceform').fname.value + "</li>";
		message += "<li><span>Last Name: </span>" + document.getElementById('greatgraceform').lname.value + "</li>";
		message += "<li><span>Company: </span>" + document.getElementById('greatgraceform').company.value + "</li>";
		message += "<li><span>Address: </span>" + document.getElementById('greatgraceform').address.value + "</li>";
		message += "<li><span>City: </span>" + document.getElementById('greatgraceform').city.value + "</li>";
		message += "<li><span>State: </span>" + document.getElementById('greatgraceform').state.value + "</li>";
		message += "<li><span>Zip: </span>" + document.getElementById('greatgraceform').zip.value + "</li>";
		message += "<li><span>Country: </span>" + document.getElementById('greatgraceform').country.value + "</li>";
		message += "<li><span>Phone: </span>" + document.getElementById('greatgraceform').phone.value + "</li>";
		message += "<li><span>Email: </span>" + document.getElementById('greatgraceform').email.value + "</li>";
		message += "<li><span>Website: </span>" + document.getElementById('greatgraceform').website.value + "</li>";
		message += "<li><span>Subject: </span>" + document.getElementById('greatgraceform').subject.value + "</li>";
		message += "<li><span>Requested Information: </span>" + fmcomment + "</li>";

		message += "<li><span>Specific Request: </span>" + document.getElementById('greatgraceform').specificrequest.value + "</li>";
/*		message += <input type="button" value="Display" name="display" style="margin-left: 150px;" onClick=finish = "yes";/>*/
		message += "</ul><p class='printlink'><a href='javascript:window.print()'>Print This Page</a></p></div></div></body></html>";
		
		DispWin.document.write(message);
//		DispWin.document.writeln(<INPUT TYPE=\"BUTTON\" VALUE=\"Send\" onClick=\"finish = yes\">);
//		DispWin.document.writeln("</FORM>");
		DispWin.document.close();
		}
		
		
