//Project #741 - Javascript removal. functions from PersMeasureDefine.inc are moved to PersMeasureVarDefine.js
	
	    function GetURL(sDest, sType, sAdId) {
                var sURL = "/imeasure/go.asp?dest=" + escape(sDest) + "&adserver=" + sWAAdServer + "&type=" + sType + "&cat1=" + sWAPublisher + "&cat2=" + sWASource + "&cat3=" + sAdId + "&cat4=" + ""; 
                return sURL;
        }
        
        function GetURLExt(sDest, sType, sAdId, sCat4) {
                var sURL = "/imeasure/go.asp?dest=" + escape(sDest) + "&adserver=" + sWAAdServer + "&type=" + sType + "&cat1=" + sWAPublisher + "&cat2=" + sWASource + "&cat3=" + sAdId + "&cat4=" + sCat4; 
                return sURL;
        }
        
        function StringReplace(sStrOrig, sStrFind, sStrRepl) {
                var iPos = sStrOrig.indexOf(sStrFind);  
                while (iPos != -1) {
                        sStrBefore = sStrOrig.substring(0, iPos);
                        sStrAfter = sStrOrig.substring(iPos + sStrFind.length, sStrOrig.length);
                        sStrOrig = sStrBefore + sStrRepl + sStrAfter;
                        iPos = sStrOrig.indexOf(sStrFind);
                }
        
                return sStrOrig;
        }

        function Click(sAdId, sDest) {
                sDest = StringReplace(sDest,"#PAGENAME#",sWACurPageName);
                window.location.href = 'http' + sWASSL + '://' + sServerName + GetURL(sDest, "c", sAdId);
                return true;
        }
        
        function ClickLink(sAdId, sDest) {
				sDest = StringReplace(sDest,"#PAGENAME#",sWACurPageName);
                window.location.href = 'http' + sWASSL + '://' + sServerName + GetURL(sDest, "l", sAdId);
                return true;
        }       

        function ClickPopupWindow(sAdId, sDest, iTop, iLeft, iHeight, iWidth, sScrollBars, sResizeable) {
                
                sDest = StringReplace(sDest,"#PAGENAME#",sWACurPageName);
                
                objAgent = navigator.userAgent;
                
                sWindowName = '';
                
                sParams  = "";
                sParams += "toolbar=0,";
                sParams += "location=0,";
                sParams += "directories=0,";
                sParams += "status=0,";
                sParams += "menubar=0,";
                sParams += "scrollbars=" + sScrollBars + ",";
                sParams += "resizable=" + sResizeable + ",";
                sParams += "top=" + iTop + ",";
                sParams += "left=" + iLeft + ",";
                sParams += "height=" + iHeight + ",";
                sParams += "width=" + iWidth;                   
                    
            sURL = 'http' + sWASSL + '://' + sServerName + GetURL(sDest, "c", sAdId);
                
                //AOL on Windows 95 & 98 does not support setting a window to a var 
                if ((objAgent.indexOf("AOL") != -1) && ((objAgent.indexOf("Windows 98") != -1) || (objAgent.indexOf("Windows 95") != -1))){
                        window.open(sURL, sWindowName , sParams);
                } else {
                        var win = open(sURL, sWindowName , sParams);
                        
                        //Set the focus to the pop-up window.
                        if (win) {
                                win.focus();
                        }
                }               
        } 
    


	function DirectToAgentLocator(gsApplAgent){
		var frmFindAgent=document.frmFindAgent;
		var sAgentTypeURL = '';
		
		sAgentTypeURL = "http://" + gsApplAgent + "/AgentLocator/SearchResultsPage.aspx?ST=1&ZipCode=" + frmFindAgent.txtFindAgentZipCode.value;
		frmFindAgent.method = 'POST';
		frmFindAgent.action = sAgentTypeURL;
		frmFindAgent.submit();
		return true;
	}
	
	function DirectToGetAQuote(gsQNB,gsApplAllstate){
		var fGetQuote=document.frmGetAQuote;
		var sProdURL = '';
				
		var sProdState = '';
		for (var i=0; i < fGetQuote.selProductState.options.length; i++)
		{
			if ((fGetQuote.selProductState.options[i].selected==true))
			{
				sProdState = fGetQuote.selProductState.options[i].value;
				break;
			}
		}
		
		for (var r=0; r < fGetQuote.optProduct.length; r++)
		{
			if (fGetQuote.optProduct[r].checked)
			{
				break;
			}
		}

		if (fGetQuote.optProduct[0].checked=="1" && sProdState != ''){	
			sProdURL = "https://" + gsQNB + "/auto/GetStarted.asp?a=1&m=4&State=" + sProdState;
		}
		else if (fGetQuote.optProduct[0].checked=="1" && sProdState == ''){
			sProdURL = "http://" + gsQNB + "/auto/intro.asp?a=4&m=4";
		}	
		else if (fGetQuote.optProduct[r].value=="Li"){
			sProdURL = "https://termlife.allstate.com/quotestart.asp";
		}	
		else {
			sProdURL = "https://" + gsQNB + "/prop/intro.asp?a=4&m=4&State=" + sProdState + "&Product=" + fGetQuote.optProduct[r].value;
		}
		fGetQuote.method = 'POST';
		fGetQuote.action = sProdURL;
		fGetQuote.submit();
		return true;
	}     
   
   
   //This code is for the new HOMEPAGESPLIT project# 830. Code to be removed or modify after trial run. - Msoyy
   
  function DirectToGetAQuoteSplit(gsQNB,gsApplAllstate){
 		var fGetQuote=document.frmGetAQuote;
		var sProdURL = '';
		var sQuoteAction = '';
				
		var sProdState = '';
		var sProduct = '';
		
		for (var i=0; i < fGetQuote.selProductState.options.length; i++)
		{
			if ((fGetQuote.selProductState.options[i].selected==true))
			{
				sProdState = fGetQuote.selProductState.options[i].value;
				break;
			}
		}
		
		for (var r=0; r < fGetQuote.optProduct.options.length; r++)
		{
			if ((fGetQuote.optProduct.options[r].selected==true))
			{
				sProduct =  fGetQuote.optProduct.options[r].value;				
				break;
			}
		}
		
		for (var s=0; s < fGetQuote.quoteAction.options.length; s++)
		{
			if ((fGetQuote.quoteAction.options[s].selected==true))
			{
				sQuoteAction = fGetQuote.quoteAction.options[s].value;				
				break;
			}
		}
		
		//added code to display error box and logic to check for state, product and action from the drop down boxes - msoyy	
		if (sProdState =="0" || sProduct == "0" || sQuoteAction=="0" || sQuoteAction=="" )
		{
		Validate();
		}
		else
		{
			if (sProduct=="Au" && sProdState != ''  && sQuoteAction == "Start New Quote"){
			sProdURL = "https://" + gsQNB + "/auto/GetStarted.asp?a=1&m=4&State=" + sProdState;
			}
			else if ((sProduct=="Au" || sProduct =="Ho" || sProduct=="Co" || sProduct=="Re") && (sProdState != ''  && sQuoteAction == "Retrieve Saved Quote")){
			sProdURL = "https://" + gsQNB + "/prop/Login.asp?A=1&m=10&RS=1&State=" + sProdState;
			}		
			else if (sProduct=="Au" && sProdState != ''  && sQuoteAction == "Learn Before You Quote"){
			sProdURL = "http://" + gsApplAllstate + "/Tools/AutoInsuranceGuide/guide.aspx?State=" + sProdState;
			}
			else if (sProduct =="Ho" && sProdState != ''  && sQuoteAction == "Start New Quote"){
				sProdURL = "http://" + gsQNB + "/prop/intro.asp?a=4&m=4&State=" + sProdState + "&Product=" + fGetQuote.optProduct.options[r].value;
			}	
			else if (sProduct=="Li" && sProdState != ''  && sQuoteAction == "Start New Quote"){
				sProdURL = "https://termlife.allstate.com/quotestart.asp";
			}
			else if (sProduct=="Li" && sProdState != ''  && sQuoteAction == "Retrieve Saved Quote"){
			sProdURL = "https://termlife.allstate.com/appstartup.asp";
			}
			else 
			{
			sProdURL = "https://" + gsQNB + "/prop/intro.asp?a=4&m=4&State=" + sProdState + "&Product=" + fGetQuote.optProduct.options[r].value;
			}
			fGetQuote.method = 'POST';
			fGetQuote.action = sProdURL;
			fGetQuote.submit();
			return true;
		}	
	}     

   function DirectToThirdPartySplit(gsQNB,gsApplAllstate){
		var fGetQuote=document.frmGetAQuote;
		var sProdURL = '';
				
		var sProdState = '';
		var sProduct = '';
		for (var i=0; i < fGetQuote.selProductState.options.length; i++)
		{
			if ((fGetQuote.selProductState.options[i].selected==true))
			{
				sProdState = fGetQuote.selProductState.options[i].value;
				break;
			}
		}
		
		for (var r=0; r < fGetQuote.optProduct.options.length; r++)
		{
			if ((fGetQuote.optProduct.options[r].selected==true))
			{
				sProduct =  fGetQuote.optProduct.options[r].value;
				break;
			}
		}

		if (sProduct == "Au" && sProdState == "ME"){
     	    sProdURL = "https://" + gsQNB + "/auto/GetStarted.asp?a=1&m=4&State=" + sProdState;
		}
		else if (sProduct == "Au" && sProdState == "MA"){
		    sProdURL = "https://" + gsQNB + "/auto/GetStarted.asp?a=1&m=4&State=" + sProdState;
		}				
		else if (sProduct == "Au" && sProdState == "UT"){
		    sProdURL = "https://" + gsQNB + "/auto/GetStarted.asp?a=1&m=4&State=" + sProdState;
		}		
		else if (sProduct == "Au" && sProdState == "NY"){
		    sProdURL = "https://" + gsQNB + "/auto/GetStarted.asp?a=1&m=4&State=" + sProdState;
		} 
		else if (sProduct == "Au" && sProdState != ''){
		    sProdURL = "https://" + gsQNB + "/auto/getthirdpartyinfo.asp?cStateID=" + sProdState + "&ins=Auto&Campaign=222220000003360";
		}
		else if (sProduct == "Ho" && sProdState == ''){
			sProdURL = "http://" + gsQNB + "/auto/intro.asp?a=4&m=4";
		}	
		else if (sProduct == "Li"){
			sProdURL = "https://termlife.allstate.com/quotestart.asp";
		}	
		else {
			sProdURL = "https://" + gsQNB + "/prop/intro.asp?a=4&m=4&State=" + sProdState + "&Product=" + fGetQuote.optProduct.options[r].value;
		}
		fGetQuote.method = 'POST';
		fGetQuote.action = sProdURL;
		fGetQuote.submit();
		return true;
	}        
   
   
   
   
   
   
   
   
