function lightbox(whatAction, whatObject) {

	var windowHeight = document.documentElement.clientHeight; //enables IE6 Workaround

	var theAction = whatAction;
	var theObject = whatObject;

	if(theAction == "hide") {

		document.getElementById(theObject).style.display = "none";
		//document.getElementById("cover").style.display = "none";

		}

	if(theAction == "show") {

		document.getElementById(theObject).style.display = "block";
		//document.getElementById("cover").style.display = "block";
		//document.getElementById("cover").style.height = windowHeight; //IE6 Workaround

		}
}



function showMe(what) {

	var theObj = "caption" + what;
	document.getElementById(theObj).style.visibility = "visible";
}

function hideMe(what) {

	var theObj = "caption" + what;
	document.getElementById(theObj).style.visibility = "hidden";
}




function submitInquiryForm1() {

	var thisForm = document.getElementById("inqFrm1");
	var alertMsg = "We're sorry.\nThere was a problem with the information you provided.\n\n";


	var emailVal = document.getElementById("asstEmail").value;
	var emailErrors = 0;
	var phoneErrors = 0;
	var checkErrors = 0;

	var section1CheckCount = 0;
	for(i=0;i<=4;i++) {
			if(thisForm[i].checked) { section1CheckCount++; }
		}


	if(section1CheckCount == 0) {
		checkErrors++;
		document.getElementById("assistanceSection1").style.backgroundColor = "#990000";
		document.getElementById("assistanceSection1").style.color = "#ffffff";
		}
	else{
		document.getElementById("assistanceSection1").style.backgroundColor = "#ececec";
		document.getElementById("assistanceSection1").style.color = "#444444";
		}

	var section2CheckCount = 0;
	for(i=6;i<=13;i++) {
			if(thisForm[i].checked) { section2CheckCount++; }
		}


	if(section2CheckCount == 0) {
		checkErrors++;
		document.getElementById("assistanceSection2").style.backgroundColor = "#990000";
		document.getElementById("assistanceSection2").style.color = "#ffffff";
		}
		else{
		document.getElementById("assistanceSection2").style.backgroundColor = "#ececec";
		document.getElementById("assistanceSection2").style.color = "#444444";
		}

	if(section1CheckCount==0 || section2CheckCount==0 ) {

		alertMsg = alertMsg + "- Please complete the section(s) marked in red.\n";

		}


	if(emailVal=="" || emailVal.length < 6 || emailVal.indexOf("@")==-1 || emailVal.indexOf(".")==-1) {
					emailErrors++;
					}



	var phoneVal = document.getElementById("asstPhone").value;

	if(phoneVal=="" || phoneVal.length < 10) {
					phoneErrors++;
				}

	if(phoneErrors > 0 && emailErrors > 0) {

			alertMsg = alertMsg + "- Please provide a phone number or e-mail address.\n";

		}

	if((phoneErrors==0 || emailErrors==0) && checkErrors==0) {

		thisForm.submit();
		lightbox('hide', 'inquiryForm3');
		lightbox('show', 'thankYouPanel');

		//document.getElementById("asstFormbutton").innerHTML = "<b>Thank you for your interest in ViolaPark. We will contact you soon.</b>";

		}
	else {
			alert(alertMsg);
			}

	}


function submitInquiryForm() {

	var thisForm = document.getElementById("inqFrm");

	var checkErrors = 0;

	var alertMsg = "We're sorry.\nThere was a problem with the information you provided.\n\n";

	var section1CheckCount = 0;
	for(i=0;i<=4;i++) {
			if(thisForm[i].checked) { section1CheckCount++; }
		}


	if(section1CheckCount == 0) {
		checkErrors++;
		document.getElementById("inqFormSection1").style.backgroundColor = "#990000";
		document.getElementById("inqFormSection1").style.color = "#ffffff";
		}
	else{
		document.getElementById("inqFormSection1").style.backgroundColor = "#ececec";
		document.getElementById("inqFormSection1").style.color = "#444444";
		}

	var section2CheckCount = 0;
	for(i=6;i<=13;i++) {
			if(thisForm[i].checked) { section2CheckCount++; }
		}


	if(section2CheckCount == 0) {
		checkErrors++;
		document.getElementById("inqFormSection2").style.backgroundColor = "#990000";
		document.getElementById("inqFormSection2").style.color = "#ffffff";
		}
		else{
		document.getElementById("inqFormSection2").style.backgroundColor = "#ececec";
		document.getElementById("inqFormSection2").style.color = "#444444";
		}

	if(section1CheckCount==0 || section2CheckCount==0 ) {

		alertMsg = alertMsg + "- Please complete the section(s) marked in red.\n";

		}

	var emailVal = document.getElementById("email").value;
	var emailErrors = 0;

	if(emailVal=="" || emailVal.length < 6 || emailVal.indexOf("@")==-1 || emailVal.indexOf(".")==-1) {
					emailErrors++;
					}

	if(thisForm.contactvia[0].checked && emailErrors > 0) {

				alertMsg = alertMsg + "- Please enter a valid e-mail address, or select 'phone' as your contact preference.\n";
		};



	var phoneVal = document.getElementById("phone").value;
	var phoneErrors = 0;

	if(phoneVal=="" || phoneVal.length < 10) {
					phoneErrors++;
					}

	if(thisForm.contactvia[1].checked && phoneErrors > 0) {
		alertMsg = alertMsg + "- Please enter a valid phone number, including area code, or select 'email' as your contact preference.\n"
		};

	if((phoneErrors==0 || emailErrors==0) && checkErrors==0) {

		thisForm.submit();
		lightbox('hide', 'inquiryForm');
		lightbox('show', 'thankYouPanel');
		//document.getElementById("formbutton2").innerHTML = "<b>Thank you for your interest in ViolaPark. We will contact you soon.</b>";

		}
	else {
			alert(alertMsg);
			}

	}









