// JavaScript Document

function checkOrderForm() 
{

missinginfo = "";
if(document.oForm.fname.value == "") {
missinginfo += "\n     -  First Name";
}

if(document.oForm.lname.value == "") {
missinginfo += "\n     -  Last Name";
}

if(document.oForm.position.value == "") {
missinginfo += "\n     -  Position";
}

if(document.oForm.cname.value == "") {
missinginfo += "\n     -  Company";
}

if(document.oForm.phone.value == "") {
missinginfo += "\n     -  Phone";
}

if(document.oForm.mobile.value == "") {
missinginfo += "\n     -  Mobile";
}

if ((document.oForm.email.value == "") || 
(document.oForm.email.value.indexOf('@') == -1) || 
(document.oForm.email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Email";
}

if(document.oForm.accept.checked == false)
{
	missinginfo += "\n     -  Agree to Terms & Conditions";
}


if (missinginfo != "") 
{
	missinginfo ="_____________________________\n" +
	"There is some error in fields:\n" +
	missinginfo + "\n_____________________________" +
	"\nPlease correct and submit again!";
	alert(missinginfo);
	return false;
}
else return true;
}



function checkContactForm() 
{
missinginfo = "";

if(document.contactForm.fname.value == "") {
missinginfo += "\n     -  First Name";
}
if(document.contactForm.lname.value == "") {
missinginfo += "\n     -  Last Name";
}

if(document.contactForm.phone.value == "") {
missinginfo += "\n     -  Phone";
}

if ((document.contactForm.email.value == "") || 
(document.contactForm.email.value.indexOf('@') == -1) || 
(document.contactForm.email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Email";
}

if(document.contactForm.comments.value == "") {
missinginfo += "\n     -  Comments";
}

if (missinginfo != "") 
{
	missinginfo ="_____________________________\n" +
	"There is some error in fields:\n" +
	missinginfo + "\n_____________________________" +
	"\nPlease correct and submit again!";
	alert(missinginfo);
	return false;
}
else 
{
	document.contactForm.submit();
	window.location="http://www.myproqatar.com/mypro/contact-thanks";
	return true;
}

}

function checkLightStyleForm() 
{
sLen = document.optionsForm.opt.length;
abc = 0;
missinginfo = "";
//alert("outside for")
	for(i=0;i<sLen;i++)
	{
		//alert("outside if")
		if(document.optionsForm.opt[i].checked == true) 
		{
			//alert("inside if")
			abc = 1;
		}
	}
	
	if(abc == 0)
	{
	  missinginfo += "\n     -  Lighting style not selected";
	}	

if (missinginfo != "") 
{
	missinginfo ="_____________________________\n" +
	"There is some error in fields:\n" +
	missinginfo + "\n_____________________________" +
	"\nPlease correct and submit again!";
	alert(missinginfo);
	return false;
}
else 
{
	document.optionsForm.submit();
	//window.location="http://www.ramikhalil.net/mypro/contact-thanks";
	return true;
}

}
