// Default PPC value goes here
var defaultPPCValue = '';

function getQueryStringParamValue(strQStrParam)
{
var strURL = document.location.href;
var strQStrParamValue = '';
	if (strURL.indexOf('?') != -1)
	{
		strQStrParamValue = strURL.substr(strURL.indexOf('?') + 1);
		if (strQStrParamValue.indexOf(strQStrParam) != -1)
		{
			strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf(strQStrParam));
			strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf('=') + 1);
			//alert(strQStrParamValue);
			if (strQStrParamValue.indexOf('&') != -1)
			strQStrParamValue = strQStrParamValue.substr(0, strQStrParamValue.indexOf('&'));
			return strQStrParamValue;
		}else{
			strQStrParamValue = defaultPPCValue;
			//alert(strQStrParamValue);
			return strQStrParamValue;
		}
	}else{
		strQStrParamValue = defaultPPCValue;
		//alert(strQStrParamValue);
		return strQStrParamValue;
	}
}
 
function setPPC(){
 var elqForm = document.demoform;
 if (elqForm)
  elqForm.elements['ppc'].value = getQueryStringParamValue('ppc');
}



function validate()

{
 if (!document.demoform.first_name.value.match == null || document.demoform.first_name.value == "")
  
{
     alert("Please enter your First Name.");
     document.demoform.first_name.focus();
     document.demoform.first_name.blur();
     document.demoform.first_name.select();
     return false;
}

  if (!document.demoform.last_name.value.match == null || document.demoform.last_name.value == "")
  
{
     alert("Please enter your Last Name.");
     document.demoform.last_name.focus();
     document.demoform.last_name.blur();
     document.demoform.last_name.select();
     return false;
}
 
  if (!document.demoform.email.value.match == null || document.demoform.email.value == "")
   
  {
     alert("Please use a valid work email address, not a webmail account such as: Yahoo, Gmail, Hotmail, AOL, MSN, etc.");
     document.demoform.email.focus();
     document.demoform.email.blur();
     document.demoform.email.select();
     return false;
  }
   

if (!document.demoform.email.value.match(/\b(^(\S+@).+((\.com)|(\.biz)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi) || document.demoform.email.value.match(/you@domain.com$/))
   
  {
     alert("Please use a valid work email address, not a webmail account such as: Yahoo, Gmail, Hotmail, AOL, MSN, etc.");
     document.demoform.email.focus();
     document.demoform.email.blur();
     document.demoform.email.select();
     return false;
  } 
 
if (!document.demoform.company.value.match == null || document.demoform.company.value == "")
  
{
     alert("Please enter your Company's name.");
     document.demoform.company.focus();
     document.demoform.company.blur();
     document.demoform.company.select();
     return false;
}

if (document.demoform.title.value == "")
  
{
     alert("Please provide your Job Title.");
     document.demoform.title.focus();
     return false;
} 

if  (!document.demoform.phone.value.match == null || document.demoform.phone.value == "")
  {
     alert("Please enter your Work Phone Number, including area code.");
     document.demoform.phone.focus();
     document.demoform.phone.blur();
     document.demoform.phone.select();
     return false;
}



if (!document.demoform.city.value.match == null || document.demoform.city.value == "")
  
{
     alert("Please enter your City's name.");
     document.demoform.city.focus();
     document.demoform.city.blur();
     document.demoform.city.select();
     return false;
}

if (document.demoform.state.value == "")
  
{
     alert("Please select your State.");
     document.demoform.state.focus();
       return false;
}

if (document.demoform.country.value == "")
  
{
     alert("Please select your Country.");
     document.demoform.country.focus();
       return false;
}


if (document.demoform.number_of_employees.value == "")
  
{
     alert("Please select the Company Size.");
     document.demoform.number_of_employees.focus();
       return false;
}

if (document.demoform.industry.value == "")
  
{
     alert("Please select your Industry.");
     document.demoform.industry.focus();
       return false;
}

return true;

}

