function contactUsSubmission(thisform)
  {
    if(thisform.firstname.value=='')
    {
      alert("First name field is required. Please fill it in.");
      return false;
    }
    if(thisform.lastname.value=='')
    {
      alert("Last name field is required. Please fill it in.");
      return false;
    }
    if(thisform.email.value=='')
    {
      alert("Email field is required. Please fill it in.");
      return false;
    }
	if(thisform.state.value=='')
    {
      alert("State field is required. Please fill it in.");
      return false;
    }
	if(thisform.postalcode.value=='')
    {
      alert("Postal Code field is required. Please fill it in.");
      return false;
    }
	if(thisform.country.value=='')
    {
      alert("Country field is required. Please fill it in.");
      return false;
    }
    if(thisform.industry.value=='')
    {
      alert("Industry field is required. Please fill it in.");
      return false;
    }
	if(thisform.phonenumber.value=='')
    {
      alert("Phone Number field is required. Please fill it in.");
      return false;
    }
	if(thisform.reasonforcontact.value=='')
    {
      alert("Reason for Contact field is required. Please fill it in.");
      return false;
    }
    //if all is OK submit the form

    thisform.submit();
  }


function whitePaperSubmission (){
	var btn = valButton(document.download.whitepaper);
	
	if (btn == null) {
		alert('Please select a white paper you wish to download');
		return false;
	}
	
	if(document.download.firstname.value == null || document.download.firstname.value == '') { 
		alert('Please input your first name'); 
		document.download.firstname.focus();
		return false;
	} 
	if(document.download.lastname.value == null || document.download.lastname.value == '') { 
		alert('Please input your last name'); 
		document.download.lastname.focus();
		return false;
	} 

	if(document.download.company.value == null || document.download.company.value == '') { 
		alert('Please input your company name'); 
		document.download.company.focus();
		return false;
	} 
	if(document.download.email.value == null || document.download.email.value == '') { 
		alert('Please input your email'); 
		document.download.email.focus();
		return false;
	} 
	if (echeck(document.download.email.value)==false){
		document.download.email.value="";
		document.download.email.focus();
		return false;
	}
	

	if(document.download.phonenumber.value == null || document.download.phonenumber.value == '') { 
		alert('Please input your phone number'); 
		document.download.phonenumber.focus();
		return false;
	} 

	document.download.submit();
}


function PromotionSubmission (){
	
	if(document.download.firstname.value == null || document.download.firstname.value == '') { 
		alert('Please input your first name'); 
		document.download.firstname.focus();
		return false;
	} 
	if(document.download.lastname.value == null || document.download.lastname.value == '') { 
		alert('Please input your last name'); 
		document.download.lastname.focus();
		return false;
	} 

	if(document.download.company.value == null || document.download.company.value == '') { 
		alert('Please input your company name'); 
		document.download.company.focus();
		return false;
	} 
	if(document.download.email.value == null || document.download.email.value == '') { 
		alert('Please input your email'); 
		document.download.email.focus();
		return false;
	} 
	if (echeck(document.download.email.value)==false){
		document.download.email.value="";
		document.download.email.focus();
		return false;
	}
	

	if(document.download.phonenumber.value == null || document.download.phonenumber.value == '') { 
		alert('Please input your phone number'); 
		document.download.phonenumber.focus();
		return false;
	} 

	document.download.submit();
}

function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Please input your valid email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please input your valid email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please input your valid email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please input your valid email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please input your valid email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please input your valid email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please input your valid email address")
		    return false
		 }

 		 return true					
	}



function showCap() {
document.getElementById("CPT").style.display="block";

}