// JavaScript Document

function checkEmail() {
     e=document.form1.email.value;
     reZipe = new RegExp(/^\w+([\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/);
    if (!reZipe.test(e)) {
          alert("E-Mail Is Not Valid");
		  document.form1.email.focus();
        return false;
    }
    return true;
}

function verify()
{
     s=document.form1.statecode.value;
     s1=document.form1.type.value;

     if (s1=="") {
          alert("Insurance Type Is Not Select");
		  document.form1.type.focus();
          return false;
     } else if (s==""){
          alert("Your State Is Not Select");
		  document.form1.statecode.focus();
          return false;
     }

	return true;
}

function postform(theForm)
{
	var statecode = document.form1.statecode.value;
	var type = document.form1.type.value;
	var tid = document.form1.tid.value;
if (verify()){
	var mine = window.open('http://usgeneralinsurance.com/quotes.php?tid=' + tid + '&zip=' + statecode + '&type=' + type);
	if(mine){}
	else{
		window.location.href='http://usgeneralinsurance.com/quotes.php?tid=' + tid + '&zip=' + statecode + '&type=' + type;
		return false ;
		mine.close()

	 	}
	return true;
} else{ return false;}
}

function sure(theForm)
{
	var statecode = document.form1.statecode.value;
	var type = document.form1.type.value;
	var tid = document.form1.tid.value;
	window.location.href='http://usgeneralinsurance.com/feature.php?tid=' + tid + '&zip=' + statecode + '&type=' + type;
}

