/* CareGiving JS Document */

<!--
//SUBMIT VALIDATION SCRIPT ---------------------------------------------------
	function checkMandatory()
	{
		var error_string = "";
//check the text field husband first name
		if(window.document.getElementById("marclassform").hfname.value == "")
		{
			error_string += "First Name (M) is a required field.\n";
		//	theForm.fname.focus();
		//	return (false);
		}
		
//check the text field last name
		
		if(window.document.getElementById("marclassform").hlname.value == "")
		{
			error_string += "Last Name (M) is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
//check the text field wife first name
		if(window.document.getElementById("marclassform").wfname.value == "")
		{
			error_string += "First Name (F) is a required field.\n";
		//	theForm.fname.focus();
		//	return (false);
		}
		
//check the text field last name
		
		//if(window.document.marclassform.wlname.value == "")
		//{
		//	error_string += "Last Name (F) is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		//}
		
//check the text field address
		
		if(window.document.getElementById("marclassform").address.value == "")
		{
			error_string += "Address is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
//check the text field city
		
		if(window.document.getElementById("marclassform").city.value == "")
		{
			error_string += "City is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
//check the text field state
		
		if(window.document.getElementById("marclassform").state.value == "")
		{
			error_string += "State is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
//check the text field country
		
		if(window.document.getElementById("marclassform").country.value == "")
		{
			error_string += "Country is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
				
//check the text field zip
		
		if(window.document.getElementById("marclassform").zip.value == "")
		{
			error_string += "Zipcode is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
				
//check the text field Husband cell phone
		
		if(window.document.getElementById("marclassform").hcphone.value == "")
		{
			error_string += "Cellphone (M) is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
				
//check the text field wife cell phone
		
		if(window.document.getElementById("marclassform").wcphone.value == "")
		{
			error_string += "Cellphone (F) is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
				
//check the text field husband work phone
		
		if(window.document.getElementById("marclassform").hwphone.value == "")
		{
			error_string += "Workphone (M) is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
				
//check the text field wife work phone
		
		if(window.document.getElementById("marclassform").wwphone.value == "")
		{
			error_string += "Workphone (F) is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
		
		
				
//check the text field husband email
	
		var emailver ="no";
		var emailad=window.document.getElementById("marclassform").hemail.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 += "Email (M) is a required field.\n";
		}

	
				
//check the text field wife email
		

	
		var wemailver ="no";
		var wemailad=window.document.getElementById("marclassform").wemail.value;
		var wthe_at = wemailad.indexOf("@");
		var wthe_dot = wemailad.lastIndexOf(".");
		var wa_space = wemailad.indexOf(" ");
		if ((wthe_at != -1) && //if there's an '@'
			(wthe_at != 0) && // and it's not at position 0
			(wthe_dot !=-1) && // and there's a '.'
			(wthe_dot > wthe_at +1) && // and something between the '@' and '.'
			(wthe_dot < wemailad.length -1) && //and something after the '.'
			(wa_space == -1)) // and there are no spaces
			{wemailver ="yes";
			}
		if (wemailver =="no")
		{
			error_string += "Email (F) is a required field.\n";
		}

	
				
//check the text field years married
		
		if(window.document.getElementById("marclassform").ymarried.value == "")
		{
			error_string += "Years Married is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
	
				
//check the text field number of children
		
		if(window.document.getElementById("marclassform").nchildren.value == "")
		{
			error_string += "Number of Children is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
	
//check ages of children by number of children
		var childages = "no";
		var childrencount = "no";
		var childerror = "no";
		var childnumber = window.document.getElementById("marclassform").nchildren.value;
		if((childnumber > 0) &&
		(childnumber !== ""))
		{childrencount ="yes";
		}
		if ((window.document.getElementById("marclassform").a1.value !== "") ||
		(window.document.getElementById("marclassform").a2.value !== "") ||
		(window.document.getElementById("marclassform").a3.value !== "") ||
		(window.document.getElementById("marclassform").a4.value !== "") ||
		(window.document.getElementById("marclassform").a5.value !== "") ||
		(window.document.getElementById("marclassform").a6.value !== "") ||
		(window.document.getElementById("marclassform").a7.value !== "") ||
		(window.document.getElementById("marclassform").a8.value !== ""))
		{childages ="yes";
			}
		if((childages == "no") &&
		(childrencount == "yes"))
		{childerror ="yes";
			}
		if(childerror =="yes")
		{
			error_string += "Children Ages is a required field.\n";
		}
	

				
//check the text field payee name
		
		if(window.document.getElementById("marclassform").payee.value == "")
		{
			error_string += "Name of Payee is a required field.\n";
		//	theForm.lname.focus();
		//	return (false);
		}
	



			
//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');



		
//Children's ages	

		var ta1 = "";
		var ta2 = "";
		var ta3 = "";
		var ta4 = "";
		var ta5 = "";
		var ta6 = "";
		var ta7 = "";
		var ta8 = "";

		if((window.document.getElementById("marclassform").a1.value !== "") &&
		(window.document.getElementById("marclassform").a1.value > 0))
		{ta1 = window.document.getElementById("marclassform").a1.value;
		}
		if((window.document.getElementById("marclassform").a2.value !== "") &&
		(window.document.getElementById("marclassform").a2.value > 0))
		{ta2 = window.document.getElementById("marclassform").a2.value;
		}
		if((window.document.getElementById("marclassform").a3.value !== "") &&
		(window.document.getElementById("marclassform").a3.value > 0))
		{ta3 = window.document.getElementById("marclassform").a3.value;
		}
		if((window.document.getElementById("marclassform").a4.value !== "") &&
		(window.document.getElementById("marclassform").a4.value > 0))
		{ta4 = window.document.getElementById("marclassform").a4.value;
		}
		if((window.document.getElementById("marclassform").a5.value !== "") &&
		(window.document.getElementById("marclassform").a5.value > 0))
		{ta5 = window.document.getElementById("marclassform").a5.value;
		}
		if((window.document.getElementById("marclassform").a6.value !== "") &&
		(window.document.getElementById("marclassform").a6.value > 0))
		{ta6 = window.document.getElementById("marclassform").a6.value;
		}
		if((window.document.getElementById("marclassform").a7.value !== "") &&
		(window.document.getElementById("marclassform").a7.value > 0))
		{ta7 = window.document.getElementById("marclassform").a7.value;
		}
		if((window.document.getElementById("marclassform").a8.value !== "") &&
		(window.document.getElementById("marclassform").a8.value > 0))
		{ta8 = window.document.getElementById("marclassform").a8.value;
		}

//Total Ages of children		
		var totalages=new Array(8);
		totalages[0] = ta1;
		totalages[1] = ta2;
		totalages[2] = ta3;
		totalages[3] = ta4;
		totalages[4] = ta5;
		totalages[5] = ta6;
		totalages[6] = ta7;
		totalages[7] = ta8;
		
		var femalelnamecheck="yes";
		var femalelname="";
		if ((document.getElementById("marclassform").wlname.value == "") ||
			 (document.getElementById("marclassform").wlname.value == "if different"))
			 {femalelnamecheck = "no";
			 }
		if (femalelnamecheck == "yes")
		{femalelname="<li><span>Last Name (F): </span>" + document.getElementById("marclassform").wlname.value + "</li>";
		}
				 
		

//	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>Marriage 101 Form Information</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>Marriage 101</h1><h2>Class Registration Form</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 (M): </span>" + document.getElementById("marclassform").hfname.value + "</li>";
		message += "<li><span>Last Name (M): </span>" + document.getElementById("marclassform").hlname.value + "</li>";
		message += "<li><span>First Name (F): </span>" + document.getElementById("marclassform").wfname.value + "</li>";
		//message += "<li><span>Last Name (F): </span>" + document.marclassform.wlname.value;"</li>"
		/*message += "<li><span>Last Name (F): </span>" + femalelname;"</li>"*/
		message += femalelname;
		message += "<li><span>Address: </span>" + document.getElementById("marclassform").address.value + "</li>";
		message += "<li><span>City: </span>" + document.getElementById("marclassform").city.value + "</li>";
		message += "<li><span>State: </span>" + document.getElementById("marclassform").state.value + "</li>";
		message += "<li><span>Zip: </span>" + document.getElementById("marclassform").zip.value + "</li>";
		message += "<li><span>Country: </span>" + document.getElementById("marclassform").country.value + "</li>";
		message += "<li><span>Cellphone (M): </span>" + document.getElementById("marclassform").hcphone.value + "</li>";
		message += "<li><span>Cellphone (F): </span>" + document.getElementById("marclassform").wcphone.value + "</li>";
		message += "<li><span>Workphone (M): </span>" + document.getElementById("marclassform").hwphone.value + "</li>";
		message += "<li><span>Workphone (F): </span>" + document.getElementById("marclassform").wwphone.value + "</li>";
		message += "<li><span>Email (M): </span>" + document.getElementById("marclassform").hemail.value + "</li>";
		message += "<li><span>Email (F): </span>" + document.getElementById("marclassform").wemail.value + "</li>";
		message += "<li><span>Years Married: </span>" + document.getElementById("marclassform").ymarried.value + "</li>";
		message += "<li><span>Number of Children: </span>" + document.getElementById("marclassform").nchildren.value + "</li>";
		message += "<li><span>Child('s) Age(s): </span>" + totalages + "</li>";

		message += "<li><span>Extra Information: </span>" + document.getElementById("marclassform").specificrequest.value + "</li>";
		message += "</ul><ul><li><h6>Bob &amp; Starr Calo&ndash;oy</h6></li>"
		message += "<li><span>6619 Laurelhill Drive</span></li>"
		message += "<li><span>San Antonio, Texas 78229</span></li>"
		message += "<li><span>Office: 210.521.8668</span></li>"

		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();
		}
		
		
