
function CreateBookmarkLink()
	{
		title="Insurance";
		url="http://www.insurancecc.com/";
	
		if (window.sidebar)
		{  
			// Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external )
		{ 
			// IE Favorite
			window.external.AddFavorite( url, title);
		}
		else if(window.opera && window.print)
		{ 
			// Opera Hotlist
			return true; 
		}
	}
	
	function goToCounterPage()
	{		
		window.location.href="mytest.php";
	}



function AutoRedirect(theForm) 
{
	var myRef ;
 	var strURL = "";
  	var strInsChecked = "";
	var strInsChecked = "&noinsurance=no";
	//alert(document.getElementById('rblInsurance').checked);
	if (document.getElementById('rblInsurance').checked==false)
	{
		strURL= "http://insurancecc.com/auto_results.html";
   		strURL = strURL + "?zipcode=" + document.getElementById('zip').value;
   		strURL = strURL + "&refby=615408";
	} else {
		strURL= "http://insurancecc.com/Common/Landing.php";
   		strURL = strURL + "?zip=" + document.getElementById('zip').value;
		strURL = strURL + "&refby=615408";
		strURL = strURL + "&type=" + document.getElementById('InsuranceType').value;
		strURL = strURL + "&noinsurance=yes";
	}
	window.location= strURL;
	return false;	
}


function OpenNewFormAuto(theForm){
	
 	var myRef ;
 	var strURL = "";
  	var strInsChecked = "";
  	//var strInsChecked = "&noinsurance=no";
 
  	strURL= "http://insurancecc.com/auto.php";    
   	strURL = strURL + "?zip=" + document.getElementById('zip').value;
 	//alert(strURL);
	  /*if (document.getElementById('rblInsurance').checked)
	   {
	          strInsChecked = "&noinsurance=yes";
	   } */
		
		//strURL = strURL + strInsChecked;
		//alert(strURL);
		strURL = strURL + "&refby=615408";
		strURL = strURL + "&type=" + document.getElementById('InsuranceType').value;
				
		//window.location=strURL;
		window.open(strURL,null,"fullscreen=yes, toolbars=yes, scrollbars=yes, menubar=yes, location=yes");
		window.location="auto_bw.html?zipcode=" + document.getElementById('zip').value; 	

}






function OpenNewForm(theForm)
{

 var myRef ;
 var strURL = ""; 
 
  strURL = "http://insurancecc.com/Common/Landing.php";
    
     strURL = strURL + "?zip=" + document.getElementById('zip').value;
    

  	strURL = strURL + "&refby=615408";
    strURL = strURL + "&type=" + document.getElementById('InsuranceType').value;
    
  if(document.getElementById('InsuranceType').value=='Life')	
	strURL= 'life-popup.php?zip_code='+document.getElementById('zip').value;
	//window.open(strURL);

	/*if(document.getElementById('InsuranceType').value=='Life')	{
	window.open(strURL,null,"fullscreen=yes, toolbars=yes, scrollbars=yes, menubar=yes, location=yes, width=1000,height=900");
	}*/
	
	 /*if(document.getElementById('InsuranceType').value=='Renter'){
	 	window.open(strURL,null,"fullscreen=yes, toolbars=yes, scrollbars=yes, menubar=yes, location=yes, width=1000,height=900");
	 }*/
	
	/* if(document.getElementById('InsuranceType').value=='Home'){
	 	
	 	window.open(strURL,null,"fullscreen=yes, toolbars=yes, scrollbars=yes, menubar=yes, location=yes, width=1000,height=900");
	 }*/
	 
	if(document.getElementById('InsuranceType').value=='Health')	
	{
/// 2nd Step
	datetimepopup(strURL);
}
else
{	
  window.open(strURL,null,"fullscreen=yes, toolbars=yes, scrollbars=yes, menubar=yes, location=yes, width=1000,height=900");
}
   
}


function redirect(theForm) 
{

           
	var strErr = "";

	if(document.getElementById('zip').value=="")

	{

		strErr = strErr + "Please enter zip code.\n";

		theForm.ZipCode.focus();

	}

     if (strErr != "")

     {

           alert(strErr);

           return false;

     }

     else

    {
        if(document.getElementById('InsuranceType').value =="Auto")
        	{
			    window.location="auto_bw.html?zipcode=" + document.getElementById('zip').value;
			   // window.location="auto_results.html?zipcode=" + document.getElementById('zip').value;
            }
		if(document.getElementById('InsuranceType').value =="Health")
        	{
			   datetimeredirection();	
            }
			
		if(document.getElementById('InsuranceType').value =="Home")
			{
			 window.location="home_results.html?zipcode=" + document.getElementById('zip').value;
            }
			
		if(document.getElementById('InsuranceType').value =="Life")
        	{
			    window.location="life_results.html?zipcode=" + document.getElementById('zip').value;
            }
        if(document.getElementById('InsuranceType').value =="Renter")
        	{
			    window.location="home_results.html?zipcode=" + document.getElementById('zip').value;
            }				
     }


}

function ValidateForm(theForm)

{

	var strErr = "";

	

	if(document.getElementById('InsuranceType').value=="")
	{
		strErr = strErr + "Please select insurance type.";
	}

	
	if(theForm.ZipCode.value=="")

	{

		strErr = strErr + "Please enter zip code.\n";

		theForm.ZipCode.focus();

	}

	else

        {        

          if(theForm.ZipCode.value.length!=5)

        	{

          		strErr = strErr + "Please enter valid zip code.\n";

        		theForm.ZipCode.focus();

        	}
        }

  
 if (strErr != "")
     {
           alert(strErr);
           return false;
     }
     else{
	if(theForm.InsuranceType.value == 'Auto'){ // For Auto 
        	OpenNewFormAuto(theForm);
        } else {	// For Others
     		OpenNewForm(theForm);
	}
     }
}	


function datetimeredirection()
{
	var now = new Date();
	var hr= eval(now.getHours());
	var dday= eval(now.getDay());
	//Condition for 6AM to 7PM and Monday to Friday- LeadCo
	if ((hr>=7 && hr<19) && (dday>=1 && dday<=5))	 
	window.location='health-popup.php?zip_code='+document.getElementById('zip').value;
	//else  
	//window.location='health_results.html?zipcode='+document.getElementById('zip').value;
}

function datetimepopup(strURL)
{
	var now = new Date();
	var hr= eval(now.getHours()); 
	var dday= eval(now.getDay());
	if ((hr>=6 && hr<19) && (dday>=1 && dday<=5))	//Condition for 6AM to 7PM and Monday to Friday- LeadCo	
	{
	}
	else{
		window.location=strURL;
		//window.open(strURL,null,"fullscreen=yes, toolbars=yes, scrollbars=yes, menubar=yes, location=yes, width=1000,height=900");
	}
}

