var EnvXML = '<?xml version="1.0" encoding="iso-8859-1" ?><env_def xmlns="http://tempuri.org/environment_def.xsd"><env_ref name="production">test</env_ref><env name="development"><development name="sUrlAllstate">http://wwwdev.allstate.com/</development><development name="sUrlAllstateSecure">https://wwwdev.allstate.com/</development><development name="sUrlAllstateBuy">https://buyassembly.allstate.com/</development><development name="sUrlAllstateTermLife">https://termlife.allstate.com/</development><development name="sUrlinsurance">http://insurancedev.allstate.com/</development><development name="sUrlHomeInsurance">http://home-insurance-dev.allstate.com/</development><development name="sUrlAutoInsurance">http://auto-insurance-dev.allstate.com/</development><development name="sUrlLifeInsurance">http://life-insurancedev.allstate.com/</development><development name="sUrlCarInsuranceQuote">http://car-insurance-quote-dev.allstate.com/</development><development name="sUrlHomeInsuranceQuote">http://home-insurance-quote.allstate.com/</development><development name="sUrlAllstateBank">http://www.allstatebank.com/</development><development name="sUrlCCC">https://ccdev.allstate.com/</development><development name="sUrlAgent">http://agentdev.allstate.com/</development><development name="sUrlInvestor">http://ir.allstate.com/</development><development name="sUrlEspanol">http://www.miallstate.com/</development><development name="sUrlNewAutoQuote">https://quote-dev.allstate.com/</development></env><env name="assembly"><assembly name="sUrlAllstate">http://wwwassembly.allstate.com/</assembly><assembly name="sUrlAllstateSecure">https://wwwassembly.allstate.com/</assembly><assembly name="sUrlAllstateBuy">https://buyassembly.allstate.com/</assembly><assembly name="sUrlAllstateTermLife">https://termlife.allstate.com/</assembly><assembly name="sUrlinsurance">http://insuranceassembly.allstate.com/</assembly><assembly name="sUrlHomeInsurance">http://home-insurance-assembly.allstate.com/</assembly><assembly name="sUrlAutoInsurance">http://auto-insurance-assembly.allstate.com/</assembly><assembly name="sUrlLifeInsurance">http://life-insuranceassembly.allstate.com/</assembly><assembly name="sUrlCarInsuranceQuote">http://car-insurance-quote-assembly.allstate.com/</assembly><assembly name="sUrlHomeInsuranceQuote">http://home-insurance-quote.allstate.com/</assembly><assembly name="sUrlAllstateBank">http://www.allstatebank.com/</assembly><assembly name="sUrlCCC">https://ccrassembly.allstate.com/</assembly><assembly name="sUrlAgent">http://agentassembly.allstate.com/</assembly><assembly name="sUrlInvestor">http://ir.allstate.com/</assembly><assembly name="sUrlEspanol">http://www.miallstate.com/</assembly><assembly name="sUrlNewAutoQuote">https://quote-assembly.allstate.com</assembly></env><env name="assemblyb"><assemblyb name="sUrlAllstate">http://wwwassemblyb.allstate.com/</assemblyb><assemblyb name="sUrlAllstateSecure">https://wwwassemblyb.allstate.com/</assemblyb><assemblyb name="sUrlAllstateBuy">https://buyassembly.allstate.com/</assemblyb><assemblyb name="sUrlAllstateTermLife">https://termlife.allstate.com/</assemblyb><assemblyb name="sUrlinsurance">http://insuranceassemblyb.allstate.com/</assemblyb><assemblyb name="sUrlHomeInsurance">http://homeinsuranceassemblyb.allstate.com/</assemblyb><assemblyb name="sUrlAutoInsurance">http://autoinsuranceassemblyb.allstate.com/</assemblyb><assemblyb name="sUrlLifeInsurance">http://lifeinsuranceassemblyb.allstate.com/</assemblyb><assemblyb name="sUrlCarInsuranceQuote">http://car-insurance-quote-assemblyb.allstate.com/</assemblyb><assemblyb name="sUrlHomeInsuranceQuote">http://home-insurance-quote.allstate.com/</assemblyb><assemblyb name="sUrlAllstateBank">http://www.allstatebank.com/</assemblyb><assemblyb name="sUrlCCC">https://ccrassembly.allstate.com/</assemblyb><assemblyb name="sUrlAgent">http://agentassemblyb.allstate.com/</assemblyb><assemblyb name="sUrlInvestor">http://ir.allstate.com/</assemblyb><assemblyb name="sUrlEspanol">http://www.miallstate.com/</assemblyb><assemblyb name="sUrlNewAutoQuote">https://quote-assembly.allstate.com</assemblyb></env><env name="staging"><staging name="sUrlAllstate">http://wwwstaging.allstate.com/</staging><staging name="sUrlAllstateSecure">https://wwwstaging.allstate.com/</staging><staging name="sUrlAllstateBuy">https://buy.allstate.com/</staging><staging name="sUrlAllstateTermLife">https://termlife.allstate.com/</staging><staging name="sUrlinsurance">http://insurance-staging.allstate.com/</staging><staging name="sUrlHomeInsurance">http://home-insurance-staging.allstate.com/</staging><staging name="sUrlAutoInsurance">http://auto-insurance-staging.allstate.com/</staging><staging name="sUrlLifeInsurance">http://life-insurance-staging.allstate.com/</staging><staging name="sUrlCarInsuranceQuote">http://car-insurance-quote-staging.allstate.com/</staging><staging name="sUrlHomeInsuranceQuote">http://home-insurance-quote.allstate.com/</staging><staging name="sUrlAllstateBank">http://www.allstatebank.com/</staging><staging name="sUrlCCC">https://cccstaging.allstate.com/</staging><staging name="sUrlAgent">http://agentstaging.allstate.com/</staging><staging name="sUrlInvestor">http://ir.allstate.com/</staging><staging name="sUrlEspanol">http://www.miallstate.com/</staging><staging name="sUrlNewAutoQuote">https://quote-staging.allstate.com/</staging></env><env name="production"><production name="sUrlAllstate">http://www.allstate.com/</production><production name="sUrlAllstateSecure">https://www.allstate.com/</production><production name="sUrlAllstateBuy">https://buy.allstate.com/</production><production name="sUrlAllstateTermLife">https://termlife.allstate.com/</production><production name="sUrlinsurance">http://insurance.allstate.com/</production><production name="sUrlHomeInsurance">http://home-insurance.allstate.com/</production><production name="sUrlAutoInsurance">http://auto-insurance.allstate.com/</production><production name="sUrlLifeInsurance">http://life-insurance.allstate.com/</production><production name="sUrlCarInsuranceQuote">http://car-insurance-quote.allstate.com/</production><production name="sUrlHomeInsuranceQuote">http://home-insurance-quote.allstate.com/</production><production name="sUrlAllstateBank">http://www.allstatebank.com/</production><production name="sUrlCCC">https://customercare.allstate.com/</production><production name="sUrlAgent">http://agent.allstate.com/</production><production name="sUrlInvestor">http://ir.allstate.com/</production><production name="sUrlEspanol">http://www.miallstate.com/</production><production name="sUrlNewAutoQuote">https://quote.allstate.com/</production></env></env_def>';var HFXML = '<?xml version="1.0"?><Mainheader_Footer xmlns="http://tempuri.org/header_footer.xsd"><MenuDropDown id="dropmenu1"><menuHeaderImageOn>/images/800_allstateproducts.gif</menuHeaderImageOn><menuHeaderImageOff>/images/800_allstateproducts_over.gif</menuHeaderImageOff><Links><LinkId>ICTHeader_AutoInsurance</LinkId><LinkText>Auto Insurance</LinkText><LinkUrl>{sUrlAllstate}auto-insurance.aspx</LinkUrl></Links><Links><LinkId>ICTHeader_AutoInsuranceGuide</LinkId><LinkText>Auto Insurance Guide</LinkText><LinkUrl>{sUrlAllstate}tools/autoinsuranceguide/guide.aspx</LinkUrl></Links><Links><LinkId>ICTHeader_MotorcycleInsurance</LinkId><LinkText>Motorcycle Insurance</LinkText><LinkUrl>{sUrlAllstate}auto-insurance/motorcycle-insurance.aspx</LinkUrl></Links><Links><LinkId>ICTHeader_HomeInsurance</LinkId><LinkText>Home Insurance</LinkText><LinkUrl>{sUrlHomeInsurance}</LinkUrl></Links><Links><LinkId>ICTHeader_BusinessInsurance</LinkId><LinkText>Business Insurance</LinkText><LinkUrl>{sUrlinsurance}business-insurance.aspx</LinkUrl></Links><Links><LinkId>ICTHeader_AllInsuranceProducts</LinkId><LinkText>All Insurance Products</LinkText><LinkUrl>{sUrlAllstate}products/</LinkUrl></Links><Links CssClass="dottedLineSeperation"><LinkId>ICTHeader_OtherProducts</LinkId><LinkText>Other Products &amp; Services</LinkText><LinkUrl>{sUrlinsurance}other-products-main.aspx</LinkUrl></Links><Links><LinkId>ICTHeader_Annuities</LinkId><LinkText>Annuities</LinkText><LinkUrl>{sUrlAllstate}Finance/FinancialProducts/Annuities/PageRender.asp?Page=main.htm</LinkUrl></Links><Links><LinkId>ICTHeader_IRAs</LinkId><LinkText>IRAs</LinkText><LinkUrl>{sUrlAllstate}Finance/FinancialProducts/savingsbanking/PageRender.asp?page=individualretirementaccountsiras.htm</LinkUrl></Links><Links><LinkId>ICTHeader_LifeInsurance</LinkId><LinkText>Life Insurance</LinkText><LinkUrl>{sUrlLifeInsurance}</LinkUrl></Links><Links><LinkId>ICTHeader_MutualFunds</LinkId><LinkText>Mutual Funds</LinkText><LinkUrl>{sUrlAllstate}Finance/FinancialProducts/MutualFunds/PageRender.asp?Page=main.htm</LinkUrl></Links><Links><LinkId>ICTHeader_SavingsBanking</LinkId><LinkText>Savings &amp; Banking</LinkText><LinkUrl>{sUrlAllstateBank}</LinkUrl></Links><Links><LinkId>ICTHeader_FinancialProducts</LinkId><LinkText>All Financial Products</LinkText><LinkUrl>{sUrlAllstate}products/</LinkUrl></Links></MenuDropDown><MenuDropDown id="dropmenu2"><menuHeaderImageOn>/images/800_getaquote.gif</menuHeaderImageOn><menuHeaderImageOff>/images/800_getaquote_over.gif</menuHeaderImageOff><Links><LinkId>ICTHeader_AutoInsuranceQuote</LinkId><LinkText>Auto Insurance</LinkText><LinkUrl>{sUrlNewAutoQuote}</LinkUrl></Links><Links><LinkId>ICTHeader_HomeInsuranceQuote</LinkId><LinkText> Home Insurance</LinkText><LinkUrl>{sUrlHomeInsuranceQuote}</LinkUrl></Links><Links><LinkId>ICTHeader_LifeInsuranceQuote</LinkId><LinkText>Life Insurance</LinkText><LinkUrl>{sUrlAllstateTermLife}</LinkUrl></Links><Links><LinkId>ICTHeader_RenterInsuranceQuote</LinkId><LinkText>Renter Insurance</LinkText><LinkUrl>{sUrlHomeInsuranceQuote}</LinkUrl></Links><Links><LinkId>ICTHeader_CondoInsuranceQuote</LinkId><LinkText>Condo Insurance</LinkText><LinkUrl>{sUrlHomeInsuranceQuote}</LinkUrl></Links><Links><LinkId>ICTHeader_MotorcycleInsuranceQuote</LinkId><LinkText>Motorcycle Insurance</LinkText><LinkUrl>{sUrlAllstate}products/other/motorcycle/motorcycle.aspx</LinkUrl></Links></MenuDropDown><MenuDropDown id="dropmenu3"><menuHeaderImageOn>/images/800_customercare.gif</menuHeaderImageOn><menuHeaderImageOff>/images/800_customercare_over.gif</menuHeaderImageOff><Links><LinkId>ICTHeader_CustomerCareCenter</LinkId><LinkText>Customer Care Center</LinkText><LinkUrl>{sUrlCCC}</LinkUrl></Links><Links><LinkId>ICTHeader_ClaimCenter</LinkId><LinkText>Claim Center</LinkText><LinkUrl>{sUrlAllstate}ClaimsCenter/</LinkUrl></Links><Links><LinkId>ICTHeader_CATInfoCenter&gt;</LinkId><LinkText>Catastrophe Information</LinkText><LinkUrl>{sUrlAllstate}Catastrophe/PageRender.asp,3FPage,3Dmain.htm</LinkUrl></Links></MenuDropDown><MenuDropDown id="dropmenu4"><menuHeaderImageOn>/images/800_aboutallstate.gif</menuHeaderImageOn><menuHeaderImageOff>/images/800_aboutallstate_over.gif</menuHeaderImageOff><Links><LinkId>ICTHeader_AboutOverview</LinkId><LinkText>Overview</LinkText><LinkUrl>{sUrlAllstate}About/</LinkUrl></Links><Links><LinkId>ICTHeader_CareerOpportunities</LinkId><LinkText>Career Opportunities</LinkText><LinkUrl>{sUrlAllstate}Careers/</LinkUrl></Links><Links><LinkId>ICTHeader_CorporateGovernance</LinkId><LinkText>Corporate Governance</LinkText><LinkUrl>{sUrlInvestor}phoenix.zhtml?c=93125&amp;p=irol-govhighlights</LinkUrl></Links><Links><LinkId>ICTHeader_InvestorRelations</LinkId><LinkText>Investor Relations</LinkText><LinkUrl>{sUrlInvestor}</LinkUrl></Links><Links><LinkId>ICTHeader_MediaNewsroom</LinkId><LinkText>Media Newsroom</LinkText><LinkUrl>{sUrlAllstate}Media/</LinkUrl></Links><Links><LinkId>ICTHeader_CommunityCommitment</LinkId><LinkText>Community Commitment</LinkText><LinkUrl>{sUrlAllstate}Community/</LinkUrl></Links></MenuDropDown><topNav><TopLinks sLinkName="agent"><TopLinkId>ICTHeader_FindAnAgent</TopLinkId><TopLinkText>Find an Agent</TopLinkText><TopLinkUrl>{sUrlAgent}</TopLinkUrl></TopLinks><TopLinks><TopLinkId>ICTHeader_EnEspanol</TopLinkId><TopLinkText>En Espa&#241;ol</TopLinkText><TopLinkUrl>{sUrlEspanol}</TopLinkUrl></TopLinks><TopLinks><TopLinkId>ICTHeader_ContactUs</TopLinkId><TopLinkText>Contact Us</TopLinkText><TopLinkUrl>{sUrlAllstate}ContactUs/</TopLinkUrl></TopLinks><TopLinks><TopLinkId>ICTHeader_PrivacyStatement</TopLinkId><TopLinkText>Privacy Statement</TopLinkText><TopLinkUrl>{sUrlAllstate}about/priv.asp</TopLinkUrl></TopLinks><TopLinks noSeparationsLine="lastItem"><TopLinkId>ICTHeader_SiteMap</TopLinkId><TopLinkText>Site Map</TopLinkText><TopLinkUrl>{sUrlAllstate}sitemap/</TopLinkUrl></TopLinks></topNav><footer><FooterLinks><FooterLinkId>ICTFooter_PrivacyStatement</FooterLinkId><FooterLinkText>Privacy Statement</FooterLinkText><FooterLinkUrl>{sUrlAllstate}about/priv.asp</FooterLinkUrl></FooterLinks><FooterLinks><FooterLinkId>ICTFooter_TermsofUse</FooterLinkId><FooterLinkText>Terms of Use</FooterLinkText><FooterLinkUrl>{sUrlAllstate}about/PageRender.asp,3FPage,3Dterms.htm</FooterLinkUrl></FooterLinks><FooterLinks noSeparationsLine="yes"><FooterLinkId>ICTFooter_UnderwritingCompanies</FooterLinkId><FooterLinkText>Underwriting Companies</FooterLinkText><FooterLinkUrl>{sUrlAllstate}ContactUs/nameloc.asp</FooterLinkUrl></FooterLinks><FooterLinks lastItem="yes"><FooterLinkId>ICTHeader_Allstate</FooterLinkId><FooterLinkText>Allstate Insurance Company</FooterLinkText><FooterLinkUrl>{sUrlAllstate}</FooterLinkUrl></FooterLinks></footer><header_Logo><header_LogoUrl>{sUrlAllstate}</header_LogoUrl><header_LogoId>ICTHeader_AllstateHome</header_LogoId><header_LogoImage>/images/allstate_logo.gif</header_LogoImage></header_Logo></Mainheader_Footer>';


//Possible prefixes ActiveX strings for DOM DOcument
var ARR_ACTIVEX = ["MSXML4.DOMDocument", "MSXML3.DOMDocument", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XmlDom"];

//When the proper prefix is found, store it here
var STR_ACTIVEX = "";

//browser detection
var isMSIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1;
var isMoz = document.implementation && document.implementation.createDocument;

//-----------------------------------------------------------------
// IE Initialization
//-----------------------------------------------------------------

//if this is IE, determine which string to use
if (isMSIE) {
    //define found flag
    var bFound = false;
    
    //iterate through strings to determine which one to use (NCZ, 1/30/02)
    for (var i=0; i < ARR_ACTIVEX.length && !bFound; i++) {
    
        //set up try...catch block for trial and error of strings (NCZ, 1/30/02)
        try {
        
            //try to create the object, it will cause an error if it doesn't work (NCZ, 1/30/02)
            var objXML = new ActiveXObject(ARR_ACTIVEX[i]);
            
            //if it gets to this point, the string worked, so save it and return
            //the DOM Document (NCZ, 1/30/02)
            STR_ACTIVEX = ARR_ACTIVEX[i];
            bFound = true                
        
        } catch (objException) { 
        } //End: try
    } //End: for

    //if we didn't find the string, send an error (NCZ, 1/30/02)
    if (!bFound)
       throw "No DOM DOcument found on your computer."

} //End: if

//-----------------------------------------------------------------
// Mozilla Initialization
//-----------------------------------------------------------------
if (isMoz) {
    

    
    //add the loadXML() method to the Document class
    Document.prototype.loadXML = function(strXML) {
    
    
        //change the readystate
        changeReadyState(this, 1);

        //create a DOMParser
        var objDOMParser = new DOMParser();
        
        
        
        //create new document from string
        var objDoc = objDOMParser.parseFromString(strXML, "text/xml");

        //make sure to remove all nodes from the document
		while (this.hasChildNodes())
			this.removeChild(this.lastChild);
            
        //add the nodes from the new document
        for (var i=0; i < objDoc.childNodes.length; i++) {
            
            //import the node
            var objImportedNode = this.importNode(objDoc.childNodes[i], true);
            
            //append the child to the current document
            this.appendChild(objImportedNode);
        
        } //End: for
        
        //we can't fire the onload event, so we fake it
        handleOnLoad(this);
        
    } //End: function
    
    //add the getter for the .xml attribute
    Node.prototype.__defineGetter__("xml", _Node_getXML);
    
    //add the readystate attribute for a Document
    Document.prototype.readyState = "0";
    
    //save a reference to the original load() method
    Document.prototype.__load__ = Document.prototype.load;

    //create our own load() method
    Document.prototype.load = _Document_load;
    
    //add the onreadystatechange attribute
    Document.prototype.onreadystatechange = null;
    
    //add the parseError attribute
    Document.prototype.parseError = 0;
    
} //End: if


//  This factory will serve as the entry point for other XML-related
//  implementations.
//-----------------------------------------------------------------
function DocXML() { }


//  This function creates a XML Document according to which browser
//  is being used.
//-----------------------------------------------------------------
DocXML.createDOMDocument = function(strNamespaceURI, strRootTagName) {

    //variable for the created DOM Document
    var objDOM = null;
    
    //determine if this is a standards-compliant browser like Mozilla
    if (isMoz) {
    
        //create the DOM Document the standards way
        objDOM = document.implementation.createDocument(strNamespaceURI, strRootTagName, null);    
    
        //add the event listener for the load event
        objDOM.addEventListener("load", _Document_onload, false);
        
    } else if (isMSIE) {
    
        //create the DOM Document the IE way
        objDOM = new ActiveXObject(STR_ACTIVEX);

        //if there is a root tag name, we need to preload the DOM
        if (strRootTagName) {
       
            //If there is both a namespace and root tag name, then
            //create an artifical namespace reference and load the XML.  
            if (strNamespaceURI) {
                objDOM.loadXML("<a0:" + strRootTagName + " xmlns:a0=\"" + strNamespaceURI + "\" />");
            } else {
                objDOM.loadXML("<" + strRootTagName + "/>");        
            }
        
        }
    }
    
    //return the object
    return objDOM;
}


//  This is the attribute getter for the .xml attribute.
//-----------------------------------------------------------------
function _Node_getXML() {
    
    //create a new XMLSerializer
    var objXMLSerializer = new XMLSerializer;
    
    //get the XML string
    var strXML = objXMLSerializer.serializeToString(this);
    
    //return the XML string
    return strXML;
}


// Description
//  This function replaces the native load() method to allow for
//  readyState changes.
//-----------------------------------------------------------------
function _Document_load(strURL) {

    //set the parseError to 0
    this.parseError = 0;

    //change the readyState
    changeReadyState(this, 1);
    
    //watch for errors
    try {
        //call the original load method
        this.__load__(strURL);
        
    } catch (objException) {
    
        //set the parseError attribute
        this.parseError = -9999999;
        
        //change the readystate
        changeReadyState(this, 4);

    } // End: try...catch
}

// Description
//  This function is the event handler for the load event.
//-----------------------------------------------------------------
function _Document_onload() {

    //handle the onload event
    handleOnLoad(this);
}


// Description
//  This function handles the load event on the Document object.
//-----------------------------------------------------------------
function handleOnLoad(objDOMDocument) {
    //check for a parsing error
    if (!objDOMDocument.documentElement || objDOMDocument.documentElement.tagName == "parsererror")
        objDOMDocument.parseError = -9999999;

    //change the readyState
    changeReadyState(objDOMDocument, 4);
}


// Description
//  This function changes the readyState of a Document to the desired
//  state and runs any event handler the user has assigned.
//-----------------------------------------------------------------
function changeReadyState(objDOMDocument, iReadyState) {

    //change the readyState
    objDOMDocument.readyState = iReadyState;
    
    //if there is an onreadystatechange event handler, run it
    if (objDOMDocument.onreadystatechange != null && typeof objDOMDocument.onreadystatechange == "function")
        objDOMDocument.onreadystatechange();
}


// This script will render the Allstate master header for any page needing it.
//
// The master header consists of the top banner of the page, the navigation bar, the thin
// white spacer below the navigation bar and optionally the blue bar.
//
// Note that there are two terms used through the documentation and script:
//		1)	Calling Site -	The site from which this script is called and needing a header.
//		2) Source Site  -	The site from which the images, includes, etc. are retrieved from.
// The only public method of this script is BuildHeaderHtml.
//	The MainHeader.inc for allstate, agent and customercare would look like:
//
//		and to use it would be as follows:
//

//
//	For external sites all that would be needed would be:

               
// Initialize some variables.
var BTTN_NONE = 0;
var BTTN_PRODUCTS = 10;
var BTTN_CUST_CARE = 20;
var BTTN_AGENT = 30;
var BTTN_FINANCIAL = 40;
var BTTN_TOOLS = 50;
var BTTN_BANK = 60;
var blnPopupTargetSurvey;
var iHdrPopId;
var sectionID = -1;
var spanish = "spanish";
var gsBarColor = "#000066";

// If the calling site did not set the following three variables, then we shall set them here.
if (!gbAWSFlag)
	var gbAWSFlag=false;
	
if (!gsApplAllstate)
	var gsApplAllstate="www.allstate.com";

if (!gsApplBank)
	var gsApplBank="www.allstatebank.com";

if (!gsApplCustCare)
	var gsApplCustCare="customercare.allstate.com";

if (!gsApplAgent)
	var gsApplAgent="agent.allstate.com";

if (!gsProdURL)
	var gsProdURL="";
	
if (!gsApplInsurance)
	var gsApplInsurance="insurance.allstate.com";

if (!gsApplAutoInsurance)
	var gsApplAutoInsurance="auto-insurance.allstate.com";

if (!gsApplHomeInsurance)
	var gsApplHomeInsurance="home-insurance.allstate.com";
	
if (!gsApplLifeInsurance)
	var gsApplLifeInsurance="life-insurance.allstate.com";	
	
if (!gsApplCarInsuranceQuote)
	var gsApplCarInsuranceQuote="car-insurance-quote.allstate.com";
	
if (!gsApplHomeInsuranceQuote)
	var gsApplHomeInsuranceQuote="home-insurance-quote.allstate.com";
			
// Set where the calling site should get it's images, includes, general.css, etc.

if (gsSourceWebSite)
{
	if (gsSourceWebSite.toUpperCase() == "LOCALHOST")
		gsSourceWebSite = "";
	else
		gsSourceWebSite = document.location.protocol + "//" + gsApplAllstate;
}
else
	var gsSourceWebSite = document.location.protocol + "//" + gsApplAllstate;
	
	
//Begins new Header Code

	//Environment XML file


	var EnvXMLFILE = DocXML.createDOMDocument();
	EnvXMLFILE.loadXML(EnvXML);
	

	//var EnvXmlFile = gsSourceWebSite + "/includes/environment_def.xml";

    //var envXmlDoc = LoadXML(EnvXmlFile);
    var envXmlDoc = EnvXMLFILE;


    
	var sEnvRoot =  envXmlDoc.documentElement; 
	//current environment name
    var sCurrent_Env = sEnvRoot.firstChild.getAttribute("name");
    //links to current environment
    var envLinks = sEnvRoot.getElementsByTagName(sCurrent_Env);
    


	var HFXMLFILE = DocXML.createDOMDocument();
	HFXMLFILE.loadXML(HFXML);    
 
    //Dropdown xml file
     //var xmlFileLinks = gsSourceWebSite + "/includes/header_footer.xml";
     //var xmlDoc = LoadXML(xmlFileLinks);
     
     	var xmlDoc = HFXMLFILE;

//Function to get all the dropdown links from the xml and pass the whole URL to the buildLinkURL function 
//which builds the url including the domain for the specific environment.
function getLinks(sLinks)
    {
       for (j=0;j<sLinks.length;j++)
        {
            string = '<a href="';            
            string += buildLinkURL(sLinks[j].getElementsByTagName("LinkUrl")[0].firstChild.nodeValue);           
            string += '" id="';
            string += sLinks[j].getElementsByTagName("LinkId")[0].firstChild.nodeValue;     
            string += '" class="';            
            //Add dotted seperation line            
            string += sLinks[j].getAttribute("CssClass");
            string +='"><ul class="DropDownList"><li class="bulletSquare">';
            string +=  sLinks[j].getElementsByTagName("LinkText")[0].firstChild.nodeValue;
            string += '</li></ul></a>';
            document.write(string);
        }
    }

//Function to get the logo link and image from the xml and pass the whole URL to the 
//buildLinkURL function which builds the URL including the domain for the specific environment.

function getHeaderLinks(sHeaderLogo)
    {
       for (j=0;j<sHeaderLogo.length;j++)
        {
            string = '<a href="';            
            string += buildLinkURL(sHeaderLogo[j].getElementsByTagName("header_LogoUrl")[0].firstChild.nodeValue);           
            string += '"';
            string += 'id="';
            string += sHeaderLogo[j].getElementsByTagName("header_LogoId")[0].firstChild.nodeValue;     
            string += '">';
            string += '<img src="' + gsSourceWebSite + '';
            string +=  sHeaderLogo[j].getElementsByTagName("header_LogoImage")[0].firstChild.nodeValue;
            string += '"';
            string += 'border=0></a><br>';	
            document.write(string);
        }
    }

//Function to get all the top navigation header links from the xml and pass the whole URL to the buildLinkURL function 
//which builds the url including the domain for the specific environment.
function getLinksTopNav(sTopLinks)
    {
       for (j=0;j<sTopLinks.length;j++)
        {
            string = '<a href="'; //Moved href closer to the anchor tag per SEO requirement
            string += buildLinkURL(sTopLinks[j].getElementsByTagName("TopLinkUrl")[0].firstChild.nodeValue);
            string += '" id="'; 
            string += sTopLinks[j].getElementsByTagName("TopLinkId")[0].firstChild.nodeValue;
            string +='">';
            
             if( sTopLinks[j].getAttribute("sLinkName")== "agent")	//test for the attribute agent to bold the agent link per requirement
             {
				string += '<strong>';
				string += sTopLinks[j].getElementsByTagName("TopLinkText")[0].firstChild.nodeValue;
				string += '</strong>';
             }
             else
             {
				string += sTopLinks[j].getElementsByTagName("TopLinkText")[0].firstChild.nodeValue;
			 }
			 string += '</a>';
			 
			 if (sTopLinks[j].getAttribute("noSeparationsLine")=="lastItem")		//test for the attribute lastItem to not display seperation line
			 {
				string += '&nbsp;&nbsp;';				
			 }
			 else
			 {
				string += '&nbsp;&nbsp;<label style="COLOR:#ffffff">|&nbsp;&nbsp;</label>';	
			 }
            document.write(string);
        }
    }
    
 
 //Function to build url string passed in from the XML nodes. This function strips out the domain variable and the link from each node
 // it then performs a match between the attributes of the parent node of the environment XML file and the children to make sure the right environment 
 // is selected.  Once a match is made, another match is made between the xml tag name of the environment file and the variable form the dropdown links
 // if a match is found, the replace function is used to replace the variable with the correct environment for all the links in the header.   
 function buildLinkURL(sUrl) {
	var iUrlStart;
	var iUrlEnd;
	var iLinkStart;
	var iLinkEnd;
	var urlEnv;
	var sLink;
	var sProtocol = "http://";
	
	if (sUrl != "" || sUrl != null)	
	{
		//strip out the { brackets from the xml
		iUrlStart = sUrl.indexOf("{");
		iUrlEnd = sUrl.indexOf("}", iUrlStart);
		urlEnv = unescape(sUrl.substring(iUrlStart + 1 , iUrlEnd));	
		
		//strip out the link from the xml
		iLinkStart = sUrl.indexOf("}");
		sLink = unescape(sUrl.substring(iLinkStart + 1));
	}
	
	
	for(q=0; q<envLinks.length; q++)
	{
		if (urlEnv.match(envLinks[q].getAttribute("name")))
		{					
			var surlEnv =urlEnv.replace(urlEnv,envLinks[q].firstChild.nodeValue);
		}
	}	
	
	sUrl = surlEnv + sLink;
	return sUrl;	
  }  
  
   	 
// Function to load the xml files.
function oldLoadXML(xmlFile)
{
	var xmlDoc; 
    var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined'); 
    var ie = (typeof window.ActiveXObject != 'undefined'); 

	if (moz) { 
	xmlDoc = document.implementation.createDocument("", "", null)
	xmlDoc.async=false;	
	} else if (ie) { 
	xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
	xmlDoc.async = false; 
	while(xmlDoc.readyState != 4) {} 
	} 
	xmlDoc.load(xmlFile);
	return (xmlDoc);
	} 
//End new header code
	
	
	

DisplayAWSHeaderFooter();
	
function WindowPopUp(piHeight, piWidth, piTop, piLeft, piScrollBars, piResizeable, psURL) 
{
	objAgent = navigator.userAgent;
	
	sWindowName = "";
	
	sParams  = "";
	sParams += "toolbar=0,";
	sParams += "location=0,";
	sParams += "directories=0,";
	sParams += "status=0,";
	sParams += "menubar=0,"; 
	sParams += "scrollbars=" + piScrollBars + ",";
	sParams += "resizable=" + piResizeable + ",";
	sParams += "top=" + piTop + ",";
	sParams += "left=" + piLeft + ",";
	sParams += "height=" + piHeight + ",";
	sParams += "width=" + piWidth;			
   		
	// 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(psURL, sWindowName , sParams);
	} 
	else 
	{
		var win = window.open(psURL, sWindowName, sParams);
		
		// Set the focus to the pop-up window.
		if (win) 
		{
			win.focus();
		}
	}
}	

function LoadNewImage(sImgFilePath)
{
	imgNew = new Image();
	imgNew.src = sImgFilePath;
	return imgNew;
}

function ChangeImage(sID, sImgFilePath)
{
	document[sID].src = sImgFilePath;
}


function ChangeColorOver(sID)
{
	document.getElementById(sID).color = "#04379A";
}

function ChangeColorOut(sID)
{
	document.getElementById(sID).color = "#4C4B4B";
}


function ICTGetCookie (psTargetCookieName, psOptionalCookiesToSrch) 
{
	// The parameters are case insensitive.
	
	var sResult = null;
	
	if (!psOptionalCookiesToSrch) {
		// The optional parameter was omitted.
		var sAllCookies = "; " + document.cookie + ";";
		var sCookieDelim = "; ";
	}
	else
	{
		var sAllCookies = "&" + psOptionalCookiesToSrch + "&";
		var sCookieDelim = "&";
	}
	
	var sAllCookiesLower = sAllCookies.toLowerCase();
	
	var psTargetCookieName = sCookieDelim + psTargetCookieName.toLowerCase() + "=";
	var iTargetCookieStart = sAllCookiesLower.indexOf(psTargetCookieName);
	var iTargetCookieEnd;

	if (iTargetCookieStart != -1) {
		iTargetCookieStart += psTargetCookieName.length;
		iTargetCookieEnd = sAllCookiesLower.indexOf(sCookieDelim, iTargetCookieStart);
		sResult = unescape(sAllCookies.substring(iTargetCookieStart, iTargetCookieEnd));
	}
	
	return sResult;
}

function parseCookie(name) {
  var str = ""
  var a = document.cookie.split(";")
  for (var i=0; i<a.length; i++) {
    a[i] = a[i].replace(/(^\s*)|(\s*$)/g, "");
    if (a[i].substring(0,name.length) == name)
      str = a[i].substring(name.length+1)
      str = unescape(str)
  }
  var a = str.split("&")
  var obj = new Object()
  if (str.length)
    for (i=0; i<a.length; i++) {
      temp = a[i].split("=")
      obj[temp[0]] = temp[1]
    } return obj
}

function addToCookie(cookieName,key,value) {
  var cookies = parseCookie(cookieName)
  cookies[key] = value
  var d = new Date()
  d.setFullYear(d.getFullYear()+1)
  var cookieStr = cookieName + "="
  for (var item in cookies)
    cookieStr += item + "=" + cookies[item] + "&"
  cookieStr = cookieStr.substring(0,cookieStr.length-1)
  //cookieStr = cookieStr + "; expires=" + d.toUTCString()
  cookieStr = cookieStr + "; path=/"

 if ( cookieName.indexOf("AWSNav") > -1 || cookieName.indexOf("AWSFlag") > -1)
 {
  	cookieStr += "; domain=allstate.com"
 }

 document.cookie = cookieStr

}

function getCookie(name,key) {
  var cookies = parseCookie(name)
  return cookies[key]
}

function AWSGetCookie (psTargetCookieName, psOptionalCookiesToSrch) 
{
	// The parameters are case insensitive.
	
	var sResult = "";
	
	if ((psTargetCookieName == "AWSFlag"))
	{
		if (!psOptionalCookiesToSrch) {
			// The optional parameter was omitted.
			var sAllCookies = "; " + document.cookie + "; ";
			var sCookieDelim = "; ";
		}
		else
		{
			var sAllCookies = "&" + psOptionalCookiesToSrch + "&";
			var sCookieDelim = "&";
		}
		
		var sAllCookiesLower = sAllCookies.toLowerCase();
		
		var psTargetCookieName = sCookieDelim + psTargetCookieName.toLowerCase() + "=";
		var iTargetCookieStart = sAllCookiesLower.indexOf(psTargetCookieName);
		var iTargetCookieEnd;

		if (iTargetCookieStart != -1) {
			iTargetCookieStart += psTargetCookieName.length;
			iTargetCookieEnd = sAllCookiesLower.indexOf(sCookieDelim, iTargetCookieStart);
			sResult = unescape(sAllCookies.substring(iTargetCookieStart, iTargetCookieEnd));
		}
	}
	else
	{
		sResult = getCookie("AWSNav",psTargetCookieName)
		if (sResult==null)
			sResult="";
	}
	
	return sResult;
}

function ICTGetSubCookie (psTargetCookieName, psSubCookieName) 
{
	// The parameter is case insensitive.
	
	var sResult = null;
	
	sResult = ICTGetCookie(psSubCookieName, ICTGetCookie(psTargetCookieName));
	
	return sResult;
}

function GetQueryString (psTargetQSName) 
{
	// The parameter is case insensitive.
	
	var sResult = null;
	if (psTargetQSName == "AgentName" || psTargetQSName == "LName" || psTargetQSName == "Calc")
	{
		var sAllQSs = document.location.search + "&";
		var psTargetQSName = psTargetQSName + "=";
	}
	else
	{
		var sAllQSs = document.location.search.toLowerCase() + "&";
		var psTargetQSName = psTargetQSName.toLowerCase() + "=";
	}
	
	var iTargetQSStart = sAllQSs.indexOf(psTargetQSName);
	var iTargetQSEnd;
		
	if (iTargetQSStart != -1) {
		iTargetQSStart += psTargetQSName.length;
		iTargetQSEnd = sAllQSs.indexOf("&", iTargetQSStart);
		sResult = unescape(sAllQSs.substring(iTargetQSStart, iTargetQSEnd));
	}
	
	return sResult;
}

function DisplayAWSHeaderFooter(){
	
	if (gbAWSFlag == true)
	{	
		var currURL = document.location.href.toLowerCase();
		
		if ( currURL.indexOf("leadfusion.com") > 0 )
		{
			//Indicate that the section is planning tools
			sectionID = 4;
			var refURL = document.referrer.toLowerCase();
			if ( GetDomain(refURL) != GetDomain(currURL) )
			{
				document.cookie = "AWSFlag=N" + "; path=/; domain=allstate.com";
				PopulateAWSCookie();
			}
		}
		else
		{
			//init AWSFlag=N on pages where the AWS passes agent query string values.	
			// 5/17/2004 added some more to correct USD#9043877 - cjf		
			if ( (currURL.indexOf("auto/intro.asp?a=1") > 0) ||
				//06-08-2004-Added for olympic project 
				(currURL.indexOf("auto/qqinfo.asp?a=1&m=50") > 0) || 
				//End olympic add
				(currURL.indexOf("prop/intro.asp?a=1") > 0) ||
				(currURL.indexOf("prop/login.asp?a=1") > 0) ||
				(currURL.indexOf("efs_processemail.asp?a=1") > 0) ||
				(currURL.indexOf("ahp_processemail.asp?a=1") > 0) ||
				(currURL.indexOf("rfp_contactinfo.asp?a=1") > 0) ||
				(currURL.indexOf("rfp_preprocessemail.asp") > 0) )	
			{
				document.cookie = "AWSFlag=N" + "; path=/; domain=allstate.com";
			}	
			PopulateAWSCookie();
		}
	}
	else
	{
		document.cookie = "AWSFlag=N" + "; path=/; domain=allstate.com";
	}	
}

function DisplayAWSCalcHeader(){
	
	var currURL = document.location.href.toLowerCase();
	
	if (currURL.indexOf("leadfusion.com") > 0)
	{
	
		//USD - 32858
		if ((AWSGetCookie("AWSFlag") == "Y") && (gbAWSFlag == true))	
		//if (AWSGetCookie("AWSFlag") == "Y")
		{	
		document.write('<TABLE cellspacing=0 cellpadding=0 border=0 width=778px>');
			document.write('<TR>');
				document.write('<TD width=15px>');
					document.write('&nbsp;');
				document.write('</TD>');
				document.write('<TD>');
					document.write('<FONT style="FONT-SIZE: 10px; FONT-FAMILY: Arial; Color: #000000"><br>');
					document.write('<a href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/PlanningTools">PlanningTools</a>');
					document.write(' / ' + (AWSGetCookie("Calc")) + '</font><br>');
				document.write('</TD>');
			document.write('</TR>');
			document.write('<TR>');
				document.write('<td colspan=2 height=17px>');
						document.write('<IMG border=0 height=1 src="' + gsSourceWebSite + '/Images/ClearSpacer.gif" width=156>');
					document.write('</TD>');
			document.write('</TR>');
			document.write('<TR>');
				document.write('<TD width=15px>');
					document.write('&nbsp;');
				document.write('</TD>');
				document.write('<TD>');
					document.write('<FONT style="FONT-SIZE: 18px; FONT-FAMILY: Arial; Color: #7D1717">Planning Tools</font>');
				document.write('</TD>');
			document.write('</TR>');
			document.write('<TR>');
			document.write('<td colspan=2 height=14px >');
						document.write('<IMG border=0 height=1 src="' + gsSourceWebSite + '/Images/ClearSpacer.gif" width=156>');
					document.write('</TD>');
			document.write('</TR>');
		document.write('</TABLE>');

		document.write('<TABLE cellspacing=0 cellpadding=0 border=0 width=778px>');
			document.write('<TR>');
				document.write('<TD width=15px>');
					document.write('&nbsp;');
				document.write('</TD>');
				document.write('<TD align=left vAlign=top width=778px>');
		}
		else
		{
			document.write('<TABLE cellspacing=0 cellpadding=0 border=0 width=778px>');
			document.write('<TR>');
				document.write('<TD align=center vAlign=top width=778px>');
		
		}
					document.write('<FONT style="FONT-SIZE: 11px; FONT-FAMILY: Arial; Color: #000000">Please see the <b>Important Note </b> below that includes, among other items, information regarding rates of return, the applicability of this tool, and the value of obtaining personal advice from qualified professionals.</font>');
				document.write('</TD>');
			document.write('</TR>');
		document.write('</TABLE>');
	
	}

}

function GetDomain(URL){
	var sDomain;
	var iDomainStart;
	var iDomainEnd;

	if (URL != "" || URL != null)	
	{
		iDomainStart = URL.indexOf("//");
		iDomainEnd = URL.indexOf("/", iDomainStart + 2);
			
		sDomain = unescape(URL.substring(iDomainStart + 2, iDomainEnd));
	}
	
	return sDomain;	
}

function PopulateAWSCookie(){				
<!-- If AWSFlag is not set to "Y" read query string and set agent web site cookies. -->
	if (AWSGetCookie("AWSFlag") != "Y")
	{	
		var stmpcookie
		//Assign Customer friendly e-mail address (CFEA) 	
		addToCookie("AWSNav","CFEA",(GetQueryString("cfea")))
		//Assign agent type
		stmpcookie = "agenttype=" + (GetQueryString("agenttype"))
		document.cookie = stmpcookie + "; path=/"
		addToCookie("AWSNav","AgentType",(GetQueryString("agenttype")))
		//Assign PFR indicator	
		addToCookie("AWSNav","PFR",(GetQueryString("pfr")))
		//Assign agent name 	
		addToCookie("AWSNav","AgentName",(GetQueryString("AgentName")))
		//Assign agent phone 
		stmpcookie = "AgentPhone=" + (GetQueryString("agentphone"))
		document.cookie = stmpcookie  + "; path=/"
		addToCookie("AWSNav","AgentPhone",(GetQueryString("agentphone")))

		//Assign agent license states 
		if (GetQueryString("lstate") != null)
		{
			addToCookie("AWSNav","LicenseState",(GetQueryString("lstate").toUpperCase()))
		}
		else
		{
			//document.cookie = "LicenseState=";
			addToCookie("AWSNav","LicenseState","")
		}
		//Assign agent license numbers 
		addToCookie("AWSNav","LicenseNum",(GetQueryString("lnum")))
		//Assign agent license name 
		addToCookie("AWSNav","LicenseName",(GetQueryString("LName")))
		//Assign BinderID for bread crumbs 
		addToCookie("AWSNav","BinderID",(GetQueryString("binderid")))
		//Assign ProductID for bread crumbs 
		addToCookie("AWSNav","ProdID",(GetQueryString("prodid")))
		//Assign Calc for Calculator breadcrumbs
		addToCookie("AWSNav","Calc",(GetQueryString("Calc")))

		if (GetQueryString("awsflag") == "y")
		{
			document.cookie = "AWSFlag=Y" + "; path=/; domain=allstate.com";
			ConvertStateAbbrevations()
		}
	}	
}

function ConvertStateAbbrevations () 
{	
	//used for AWS in footer.js 
	var sLicStateList = (AWSGetCookie("LicenseState"));
	var sLicStateLong = "";
	var spacer = "";
	
	if ((sLicStateList != "") || (sLicStateList != null))
	{	
		//only one value given
		if (sLicStateList.indexOf(",")== -1)
		{
		  sLicStateLong = GetFullNameofState(sLicStateList);
		  addToCookie("AWSNav","OfficeState",sLicStateLong)
		  addToCookie("AWSNav","OfficeStateCd",sLicStateList)
		}
		else
		{	
			//populate values in to array 
			var State_array=sLicStateList.split(",");
			var i=0;
			
			addToCookie("AWSNav","OfficeState",(GetFullNameofState(State_array[0])))
			addToCookie("AWSNav","OfficeStateCd",(State_array[0]))
			
			while (i < State_array.length)
			{	
				if (i == 0)
				{
					spacer = "";
				}
				else
				{
					if (i == (State_array.length - 1))
					{
						spacer = " and ";
					}
				}
				
				if ((i != 0) && (i != (State_array.length - 1)))
				{
					{spacer = ", ";}
				}
				
				sLicStateLong = (sLicStateLong + spacer+ GetFullNameofState(State_array[i]));
				i+=1;	
			}
		}
		addToCookie("AWSNav","LicStateListLong",(sLicStateLong))
		
	}
}

function DetermineStateLicNum(sState)
{	
	//used for AWS in footer.js 
	var sLicStateList = (AWSGetCookie("LicenseState"));
	var sLicNumList = (AWSGetCookie("LicenseNum"));
	var sLicNum ="";
	
	if ((sLicStateList != "") || (sLicStateList != null) || (sLicNumList != "") || (sLicNumList != null))
	{	
		//only one value given
		if (sLicStateList.indexOf(",")== -1)
		{
		  sLicNum = (AWSGetCookie("LicenseNum"));
		}
		else
		{	
			//populate values in to array 
			var State_array=sLicStateList.split(",");
			var LicNum_array=sLicNumList.split(",");
			var i=0;
			
			if (State_array.length == LicNum_array.length)
			{ 
				while (i < State_array.length)
				{	
					if (State_array[i] == sState)
					{
						sLicNum = LicNum_array[i];
						break
					}
					i+=1;	
				}
			}	
		}
	}
	
	return sLicNum;
}

function DetermineStateLicName(sState)
{	
	//used for AWS in footer.js 
	var sLicStateList = (AWSGetCookie("LicenseState"));
	var sLicNameList = (AWSGetCookie("LicenseName"));
	var sLicName = "";
	
	if ((sLicStateList != "") || (sLicStateList != null) || (sLicNameList != "") || (sLicNameList != null))
	{	
		//only one value given
		if (sLicStateList.indexOf(",")== -1)
		{
		  sLicName = (AWSGetCookie("LicenseName"));
		}
		else
		{	
			//populate values in to array 
			var State_array=sLicStateList.split(",");
			var LicName_array=sLicNameList.split(",");
			var i=0;
			
			if (State_array.length == LicName_array.length)
			{
				while (i < State_array.length)
				{	
				if (State_array[i] == sState)
				{
					sLicName = LicName_array[i];
					break
				}
					i+=1;	
				}
			}
		}
	}
	
	return sLicName;
}

function DetermineIfMAIState () 
{
	var sMAIStateList = "AL,AZ,CA,CO,CT,FL,GA,IL,IN,KS,KY,LA,MD,MI,MS,MO,NJ,NM,NY,NC,OH,OK,OR,PA,SC,TN,TX,UT,VA,WI";
	var bMAIState = false;
	var sLicStateList = (AWSGetCookie("OfficeStateCd"));
	
	if ((sLicStateList != "") || (sLicStateList != null))
	{	
		//only one value given
		if (sLicStateList.indexOf(",")== -1)
		{
			if (sMAIStateList.indexOf(sLicStateList) != -1)
				{
					bMAIState = true;
				}
		}
		else
		{	
			//populate values in to array 
			var State_array=sLicStateList.split(",");
			var i=0;
			
			while (i < State_array.length)
			{	
				if (sMAIStateList.indexOf(State_array[i]) != -1)
				{	
					bMAIState = true;
					break
				}
				i+=1;	
			}
		}
	}
	
	return bMAIState;
}

function GetFullNameofState(sState) 
{	
	switch(sState)
	{ 
	case 'AL': 
		sState = "Alabama";
		break
	case 'AK': 
		sState = "Alaska";
		break
	case 'AZ': 
		sState = "Arizona";
		break
	case 'AR': 
		sState = "Arkansas";
		break
	case 'CA': 
		sState = "California";
		break
	case 'CO': 
		sState = "Colorado";
		break
	case 'CT': 
		sState = "Connecticut";
		break
	case 'DE': 
		sState = "Delaware";
		break
	case 'DC': 
		sState = "District of Columbia";
		break
	case 'FL': 
		sState = "Florida";
		break
	case 'GA': 
		sState = "Georgia";
		break
	case 'HI': 
		sState = "Hawaii";
		break
	case 'ID': 
		sState = "Idaho";
		break
	case 'IL': 
		sState = "Illinois";
		break
	case 'IN': 
		sState = "Indiana";
		break
	case 'IA': 
		sState = "Iowa";
		break
	case 'KS': 
		sState = "Kansas";
		break
	case 'KY': 
		sState = "Kentucky";
		break
	case 'LA': 
		sState = "Louisiana";
		break
	case 'ME': 
		sState = "Maine";
		break	
	case 'MD': 
		sState = "Maryland";
		break
	case 'MA': 
		sState = "Massachusetts";
		break	
	case 'MI': 
		sState = "Michigan";
		break	
	case 'MN': 
		sState = "Minnesota";
		break
	case 'MS': 
		sState = "Mississippi";
		break
	case 'MO': 
		sState = "Missouri";
		break
	case 'MT': 
		sState = "Montana";
		break
	case 'NE': 
		sState = "Nebraska";
		break
	case 'NV': 
		sState = "Nevada";
		break
	case 'NH': 
		sState = "New Hampshire";
		break	
	case 'NJ': 
		sState = "New Jersey";
		break
	case 'NM': 
		sState = "New Mexico";
		break	
	case 'NY': 
		sState = "New York";
		break
	case 'NC': 
		sState = "North Carolina";
		break
	case 'ND': 
		sState = "North Dakota";
		break
	case 'OH': 
		sState = "Ohio";
		break
	case 'OK': 
		sState = "Oklahoma";
		break
	case 'OR': 
		sState = "Oregon";
		break
	case 'PA': 
		sState = "Pennsylvania";
		break
	case 'PR': 
		sState = "Puerto Rico";
		break	
	case 'RI': 
		sState = "Rhode Island";
		break
	case 'SC': 
		sState = "South Carolina";
		break
	case 'SD': 
		sState = "South Dakota";
		break
	case 'TN': 
		sState = "Tennessee";
		break
	case 'TX': 
		sState = "Texas";
		break	
	case 'UT': 
		sState = "Utah";
		break
	case 'VT': 
		sState = "Vermont";
		break
	case 'VA': 
		sState = "Virginia";
		break
	case 'WA': 
		sState = "Washington";
		break
	case 'WV': 
		sState = "West Virginia";
		break
	case 'WI': 
		sState = "Wisconsin";
		break
	case 'WY': 
		sState = "Wyoming";
		break	
	} 
	
	return sState;
}

function SurveyPopup(psSurveyID, psSurveyTimeout, psSurveyQueryString)
{ 
 // This function can be overriden in a specific page just be defining it there.
  
 var iHeight;
 var iWidth;
 
 if (gsProdURL == "customercare.allstate.com")
 {
  iHeight = 520;
  iWidth  = 490;
 }
 else
 {
  iHeight = 520;
  iWidth  = 436;
 }

	WindowPopUp(iHeight, iWidth, 25, 250, 1, 0, "http://" + gsApplAgent + "/Survey/Survey.asp?SurveyID=" + psSurveyID + psSurveyQueryString);
}

function SurveyPopupDetermination(psSurveyId, psSurveyNextPopChk, psSurveyTimeOut, psSurveyQueryString)
{	
	// This function can be overriden in a specific page just be defining it there.
	//
	// Parameters:
	//		psSurveyId 			- A number representing the survey to be popped up.
	//		psSurveyNextPopChk	- Specifiy a N if you want to pop this survey irregardless if they have received a
	//								survey in the last sixty days.
	//							  Specifiy a Y if you want the process to check if the user is eligible to see a survey.
	//		psSurveyTimeOut		- Specify a number indicating the number of days the psSurveyId survey should expire in.
	//		psSurveyQueryString	- Here is where additional information can be passed to the survey engine.
	//
	//	SurveyPopupDetermination(45, "Y", 60, "?Addl_ZipCode=60173&Addl_Price=1326.23&Addl_Blah=WhoKnows");
	//
	// Prior to 7/31/2002:
	//		1) The Survey Engine put a simple cookie named "AllstateSurvey" with
	// 		either a value of Displayed or Processed.
	//		2) AllstateSurvey cookie expired after 60 days.
	// 	3) Both 1 and 2 are no longer valid.
	// Now:
	//		1) The cookie never expires.
	//		2) Cookie Sample   = AllstateSurvey=NextPop=08-05-2002&Status2=Displayed&Expire2=09-04-2002&Status25=Processed&Expire25=11-24-2002&...
	//		3) QueryStr Sample = ?SurveyID=25&SurveyEvent=OnLoad&SurveyTimeout=365&SurveyNextPopChk=n
	//		4) Rule that a survey can only been seen by a user if the previous survey has 
	// 		expired, however, the query string "SurveyNextPopChk" can bypass this check.
	//		5) Each survey has it's own expiration date stored as the Expire# subcookie.
	psSurveyNextPopChk = psSurveyNextPopChk.toLowerCase();
	var sAllstateSurvey = ICTGetCookie("AllstateSurvey");
	var sDateNextPopIsEligible = ICTGetSubCookie("AllstateSurvey", "NextPop");	
	blnPopupTargetSurvey = true;
	
	if (sAllstateSurvey != null) {
		// Note: If the NextPop subcookie doesn't exist, the lDateNextPopIsEligibleInMS date will be 12/31/1969.\
		var dNextPopIsEl = new Date(sDateNextPopIsEligible);
		var lDateNextPopIsEligibleInMS = dNextPopIsEl.getTime();
		var dCurrDate = new Date();
		var lCurDateInMS = dCurrDate.getTime();
		
		if ((psSurveyNextPopChk == "y") & (lDateNextPopIsEligibleInMS > lCurDateInMS)) {
			// A request was made for the standard popup check AND
			// the survey is not eligible to be popped.
			blnPopupTargetSurvey = false;
		}
		else {
			// Check to see if the user can see the target survey.
			// Note: If the Expire# subcookie doesn't exist, 
			//			the lTargetSurveyExpireInMS date will relect 12/31/1969.
			var dTargetSurveyExp = new Date(ICTGetSubCookie("AllstateSurvey", "Expire" + GetQueryString("surveyid")));
			var lTargetSurveyExpireInMS = dTargetSurveyExp.getTime();
			if (lTargetSurveyExpireInMS > lCurDateInMS) {
				blnPopupTargetSurvey = false;
			}
		}
	}
		
			
	if (blnPopupTargetSurvey == true) {
		SurveyPopup(psSurveyId, psSurveyTimeOut, psSurveyQueryString);
	}
}

function SurveyOnLoad() 
{
	// This function can be overriden in a specific page just be defining it there.
	
	if (document.location.search.indexOf("surveyevent=onload") > 0) {	
		SurveyPopupDetermination(GetQueryString("surveyid"), GetQueryString("surveynextpopchk"), GetQueryString("surveytimeout"), document.location.search.toLowerCase());
	}	
}

function SurveyOnUnLoad() 
{
	// This function can be overriden in a specific page just be defining it there.
	
	if (document.location.search.indexOf("surveyevent=onunload") > 0) {	
		SurveyPopupDetermination(GetQueryString("surveyid"), GetQueryString("surveynextpopchk"), GetQueryString("surveytimeout"), document.location.search.toLowerCase());
	}	
}

function CCCPageOnLoad() 
{
	// Intentionally left blank.
}

function SurveyinQuote(calledfrom, Addl_State, Addl_Type, Addl_Price, Addl_Zip, Addl_Company, Addl_Age, Addl_Quoteduration, Addl_Drivers, Addl_Alstar, Addl_Cars)
{
// calledfrom key:

// '0' = Auto quick quote by other means or property quick quote
// '1' = Auto or property full quote
// '2' = Auto quick quote (using Auto Coverage Guide)
//8-20-2003 cjf added back in to fix AHD Request Detail 7665055

var randomint6=Math.floor(6*Math.random()+1);
var randomint2=Math.floor(2*Math.random()+1);


var Addl_String = new String("&Addl_Info=Addl_State=" + Addl_State + "~Addl_Type=" + Addl_Type + "~Addl_Price="
				+ Addl_Price +"~Addl_Zip=" + Addl_Zip + "~Addl_Company=" + Addl_Company + 
				"~Addl_Age=" + Addl_Age + "~Addl_Drivers=" + Addl_Drivers +  "~Addl_Alstar=" 
				+ Addl_Alstar + "~Addl_Cars=" + Addl_Cars);

var CGcheck = ICTGetCookie("AllstateCovGuide");


if (CGcheck == "1")
	{
	calledfrom = 2;	
	}

switch (calledfrom)
	{
	case 0:				
		if (randomint6 == 1)
			{
			SurveyPopupDetermination(64,"Y",60,Addl_String);
			}
		else if (randomint6 == 2)
			{
			SurveyPopupDetermination(65,"Y",60,Addl_String);
			}
		break;		
	case 1:

		if (randomint2 == 1)
			{SurveyPopupDetermination(66,"Y",60,Addl_String);}
		else
			{SurveyPopupDetermination(67,"Y",60,Addl_String);}
		break;	
	case 2:

		SurveyPopupDetermination(68,"Y",60,Addl_String);
		break;
		
	}							 

}


function PageOnLoad() 
{
	imgDummy = LoadNewImage(gsSourceWebSite + "/Images/AllNavProductsOn_Btn.gif");
	imgDummy = LoadNewImage(gsSourceWebSite + "/Images/AllNavCareOn_Btn.gif");
	imgDummy = LoadNewImage(gsSourceWebSite + "/Images/AllNavAgentOn_Btn.gif");
	imgDummy = LoadNewImage(gsSourceWebSite + "/Images/AllNavFinancialOn_Btn.gif");
	imgDummy = LoadNewImage(gsSourceWebSite + "/Images/AllNavBankOn_Btn.gif");
	
	//cjf 8/08/2003 making the necessary changes to remove the WEbIQ Survey from the web
	//WebIQSurveyPopUp();
	
	SurveyOnLoad();
	
	CCCPageOnLoad();
}
//cjf 8/08/2003 removal of the WebIQ Survey from the site
function WebIQSurveyPopUp(){
	//if(isWebIQEntryPage() && IsSurveyEligibleForPopup()){
	//	WebIQCookieCheck();
	//}
}

function isWebIQEntryPage(){
	
	var currUrl = document.location.href.toLowerCase();
	
	var homePageUrl = gsApplAllstate + "/Home/Home.asp";
	homePageUrl = homePageUrl.toLowerCase();
	
	var agentPageUrl = gsApplAgent + "/Alocator.asp";
	agentPageUrl = agentPageUrl.toLowerCase();
	
	var cccPageUrl = gsApplCustCare;
	cccPageUrl = cccPageUrl.toLowerCase();
	
	//var buyPageUrl1 = "buy.allstate.com/auto/GetStarted.asp";
	var buyPageUrl1 = "Y0001-Web0198-S.allstate.com/auto/GetStarted.asp";
	buyPageUrl1 = buyPageUrl1.toLowerCase();
	
	//var buyPageUrl2 = "buy.allstate.com/prop/QQIntro.Asp";
	var buyPageUrl2 = "Y0001-Web0198-S.allstate.com/prop/QQIntro.Asp";
	buyPageUrl2 = buyPageUrl2.toLowerCase();
	
	if((currUrl.indexOf(homePageUrl) > 0) ||
		(currUrl.indexOf(agentPageUrl) > 0) ||
		(currUrl.indexOf(cccPageUrl) > 0) ||
		(currUrl.indexOf(buyPageUrl1) > 0) ||
		(currUrl.indexOf(buyPageUrl2) > 0)){
			
			return true;
		}
	return false;
}

function IsSurveyEligibleForPopup()
{	
	var sAllstateSurvey = ICTGetCookie("AllstateSurvey");
	var sDateNextPopIsEligible = ICTGetSubCookie("AllstateSurvey", "NextPop");	
	var blnIsEligible = true;
	
	if (sAllstateSurvey != null) {
		// Note: If the NextPop subcookie doesn't exist, the lDateNextPopIsEligibleInMS date will be 12/31/1969.\
		var dNextPopIsEl = new Date(sDateNextPopIsEligible);
		var lDateNextPopIsEligibleInMS = dNextPopIsEl.getTime();
		var dCurrDate = new Date();
		var lCurDateInMS = dCurrDate.getTime();
		
		if (lDateNextPopIsEligibleInMS > lCurDateInMS) {
			// A request was made for the standard popup check AND
			// the survey is not eligible to be popped.
			blnIsEligible = false;
		}
	}
		
	return blnIsEligible;
}


function PageOnUnLoad() 
{
	SurveyOnUnLoad();
}

function Level2DropDownNavigate()
{
	for (var i=0; i < document.frmNavForm.selLev2Nav.options.length; i++)
	{
		if ((document.frmNavForm.selLev2Nav.options[i].selected==true) && (document.frmNavForm.selLev2Nav.options[i].value != "0"))
		{
			window.location.href = document.frmNavForm.selLev2Nav.options[i].value;
		}
	}
}

function goToUrlwoPopUp(psURL)
{
	launchPFRSurvey = false;
	window.location.href = psURL;
}

function MastHeadPopup(piHdrPopId)
{
	if (screen.height > 600)
		var iVariance = 145
	else
		var iVariance = 65
		
	WindowPopUp(329, 218, screen.height / 2 - iVariance, 0, 0, 0, "http://" + gsApplAllstate + "/includes/MainHeaderPopup.asp?PopupId=" + piHdrPopId + "&ParentWindow=" + window.location.href);
}

function MastHeadAutoPopup(piHdrPopId)
{
	var sAllstateAutoMastHeadPopup = ICTGetCookie("AllstateMastHeadPopup");
	
	if (sAllstateAutoMastHeadPopup == null) {
		document.cookie = "AllstateMastHeadPopup=Displayed" + "; path=/; domain=.allstate.com; expires=Thu, 18-Jan-38 00:00:01 GMT";
		MastHeadPopup(piHdrPopId);
	}	
}


function BuildHeaderHtml(searchBoxBool,blnBlueBar)
// This is the only public method and is responsbile for building the HTML necessary
// to build the header.
// iButtonNumberOn - Which button, if any, should be turned on.  Use the BTTN_ constants defined above.
// blnBlueBar - true or false as to whether the blue bar (i.e. peripheral section) to show.
{
	if ((AWSGetCookie("AWSFlag") == "Y") && (gbAWSFlag == true))
	{	
		document.write('<link rel="stylesheet" type="text/css" href="' + gsSourceWebSite + '/Includes/General.css">');
		//8/25 cjf commented out for WebIQ Pop-up removal - NTNI testing
		//document.write('<script language="JavaScript" src="' + gsSourceWebSite + '' + document.location.protocol + '//' + gsApplAllstate + '/Includes/webiq.js"></script>');	
		document.write('<table border="0" width="779px" Height="69px"; cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">');	
		
			document.write('<tr>');
				document.write('<!-- Global Links -->');
					document.write('<!-- Alstate.com -->');
						document.write('<td valign=middle Height="20px">');
							document.write('<a id="ICTAWS_Home" href="http://' + gsApplAllstate + '/Home/Home.asp">');
							document.write('<IMG alt="Allstate.com" Border="0"');
							document.write('src="' + gsSourceWebSite + '/images/gl_nav_allstateCom.gif"></a>');
					
					if (AWSGetCookie("AgentType") == "6" || AWSGetCookie("AgentType") == "8" || AWSGetCookie("AgentType") == "41" || AWSGetCookie("AgentType") == "40")
					{	
						<!-- MAI state -->
						if (DetermineIfMAIState())
						{	
							document.write('<!-- Get a Quote -->');
							document.write('<a id="ICTAWS_GetAQuote" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/GetAQuote/">');
							document.write('<IMG alt="Get a Quote" Border="0"');
							document.write('src="' + gsSourceWebSite + '/images/gl_nav_quote.gif"></a>');
						}
						else
						{	
						<!-- non MAI state -->
							document.write('<!-- Request Quote -->');
							document.write('<a id="ICTAWS_SendEmail" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/ContactMe/SendEmail.aspx?task=rfp">');
							document.write('<IMG alt="Request a Quote" Border="0"');
							document.write('src="' + gsSourceWebSite + '/images/gl_nav_requestQuote.gif"></a>');
						}
					document.write('<!-- Contact Me -->');
							document.write('<a id="ICTAWS_ContactMe" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/ContactMe/">');
							document.write('<IMG alt="Contact Me" Border="0"');
							document.write('src="' + gsSourceWebSite + '/images/gl_nav_contactMe.gif"></a>');
					}
					document.write('<!-- Join Our Mailing List -->');
							document.write('<a id="ICTAWS_MailingList" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/JoinOurMailingList/">');
							document.write('<IMG alt="Join Mailing List" Border="0"');
							document.write('src="' + gsSourceWebSite + '/images/gl_nav_join.gif"></a>');
					document.write('</td>');
				
				document.write('<td valign=top align=middle rowspan="2">');
					document.write('<IMG alt="Allstate"');
					document.write('src="' + gsSourceWebSite + '/images/img_ll_wave_1.gif">');
					
				document.write('<!-- Display agent/agency name and phone -->');
					document.write('<BR><B><FONT style="FONT-SIZE: 15px; FONT-FAMILY: Arial; Color: #003399"><B>' + (AWSGetCookie("AgentName")) + '</B></font></B>');
					document.write('&nbsp;&nbsp;&nbsp;');
					document.write('<B><font style="FONT-SIZE: 15px; FONT-FAMILY: Arial; Color: #666666"><B>' + (AWSGetCookie("AgentPhone")) + '</B></font></B>');
					document.write('</td>');
			document.write('</tr>');
			
		document.write('<!-- Agent Masthead -->');
				document.write('<tr Width="354px">');
					document.write('<td Height="30px">');
						//document.write('<a href="http://' + gsApplAllstate + '/Home/Home.asp">');
						document.write('<IMG alt="Allstate" border="0"');
						document.write('src="' + gsSourceWebSite + '/images/img_ll_logo.gif">');
						document.write('<IMG alt="Allstate"');
						document.write('src="' + gsSourceWebSite + '/images/img_ll_wave_2.gif">');
					document.write('</td>');
				document.write('</tr>');
								
		if (AWSGetCookie("AgentType") == "6" || AWSGetCookie("AgentType") == "8" || AWSGetCookie("AgentType") == "41" || AWSGetCookie("AgentType") == "40")
		{ 
			var currURL = document.location.href.toLowerCase();
			document.write('<!-- Main Navigation -->')
				document.write('<tr>');

						document.write('<td colspan="2">');
						document.write('<IMG alt="Allstate"');
						
				if ( sectionID == 4 )
					document.write('src="' + gsSourceWebSite + '/images/img_grad_white.gif">');
				else
					document.write('src="' + gsSourceWebSite + '/images/img_grad_gray.gif">');
					
				document.write('<!-- Welcome Button -->')
						document.write('<a id="ICTAWS_Welcome" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/Welcome/?currDomain=' + GetDomain(currURL) + '"');
						document.write('><IMG alt="Welcome" border=0 height=31 NAME="Welcome"');
						
				if ( sectionID == 1 )
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_welcome_on.gif"></a>');
				else
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_welcome_off.gif"></a>');
					
				document.write('<!-- Agency Info Button -->')
						document.write('<a id="ICTAWS_AgencyInfo" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/AgencyInfo/"');
						document.write('><IMG alt="Agency Info" border=0 height=31 NAME="AgencyInfo"');
				
				if ( sectionID == 2 )
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_agencyInfo_on.gif"></a>');
				else
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_agencyInfo_off.gif"></a>');
					
				document.write('<!-- Products Button -->')
						document.write('<a id="ICTAWS_AllstateProducts" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/AllstateProducts/"');
						document.write('><IMG alt="Products" border=0 height=31 NAME="Products"');
						
				if ( sectionID == 3 )
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_allProducts_on.gif"></a>');
				else
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_allProducts_off.gif"></a>');
					
				document.write('<!-- Planning Tools Button -->')
						document.write('<a id="ICTAWS_PlanningTools" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/PlanningTools/"');
						document.write('><IMG alt="Planning Tools" border=0 height=31 NAME="PlanTools"');
			
				//If the section is planning tools then highlight the button
				if ( sectionID == 4 )
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_planTools_on.gif"></a>');
				else
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_planTools_off.gif"></a>');
					
				document.write('<!-- Policy & Claims Services Button -->')
						document.write('<a id="ICTAWS_AccountServices" href="http://' + gsApplAgent + '/' + (AWSGetCookie("CFEA")) + '/AccountServices"');
						document.write('><IMG alt="Policy & Claim Service" border=0 height=31 NAME="PolicyServices"');
				
				if ( sectionID == 5 )
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_policyServices_on.gif"></a>');
				else
					document.write('src="' + gsSourceWebSite + '/Images/btn_gl_policyServices_off.gif"></a>');
					
					document.write('</td>');
			document.write('</tr>');
		}
		else if ( AWSGetCookie("AgentType") == "13" )
		{
			document.write('<!-- Main Navigation -->')
			document.write('<tr>');
			document.write('<td colspan="2">');
			document.write('<IMG alt="Allstate"');
			document.write('src="' + gsSourceWebSite + '/images/img_grad_grayEFS.gif">');
			document.write('<IMG alt=""');
			document.write('src="' + gsSourceWebSite + '/images/img_grad_EFSshadow_gray.gif">');
			document.write('</td>');
			document.write('</tr>');
		}
		document.write('</table>');
		
		DisplayAWSCalcHeader();
	}//end AWS header
	else 
	{
		//Begins new Header
		var sRoot = xmlDoc.documentElement;
		var sRootElement =xmlDoc.documentElement.firstChild;
		var sLinks = sRootElement.getElementsByTagName('Links');
		var sHeaderLogo  = sRoot.getElementsByTagName('header_Logo');
		var sTopLinks = sRoot.getElementsByTagName('TopLinks');
		var string;
		
		document.write('<link rel="stylesheet" type="text/css" href="' + gsSourceWebSite + '/Includes/General.css">');
		document.write('<link href="' + gsSourceWebSite + '/includes/NewHeader.css" type="text/css" rel="stylesheet">');
		document.write('<script language="javascript" src="' + gsSourceWebSite + '/includes/NewHeader1024.js"></script>');
		document.write('<table cellSpacing="0" cellPadding="0" width="780" border="0" ID="Table2" class="mainHeaderTbl800">');
		document.write('    <tr>');
		document.write('        <td vAlign="top" width="780">');
		document.write('			<table cellSpacing="0" cellPadding="0" width="780" border="0" ID="Table3">');
		document.write('                <tr>');
		document.write('                    <td vAlign="top" width="185"><IMG vspace="8" src="' + gsSourceWebSite + '/images/spacer.gif"><br>');
												getHeaderLinks(sHeaderLogo);
		document.write('                        <IMG vspace="9" src="' + gsSourceWebSite + '/images/spacer.gif">');
		document.write('                    </td>');
		document.write('                    <td width="558">');
										
										//searchBoxBool flag value of 1 displays search box for the application
										if (searchBoxBool == 1)
											{ 
		document.write('                        <table cellspacing="0" cellpadding="0" border="0" width="591">');
		document.write('                            <tr>');
		document.write('                                <td class="topMenuNav" vAlign="top" width="386"><IMG vspace="8" src="' + gsSourceWebSite + '/images/spacer.gif">');
														
														//Get all links 
														getLinksTopNav(sTopLinks);
														
		document.write('                                </td>');											
		document.write('                                <td vAlign="top" align="left" width="200">');
		document.write('                                        <form id=searchForm action="http://search.atomz.com/search" method="post">');
		document.write('                                               <div id="searchBoxText">');
		document.write('                                                    <input id="Hidden1" type="hidden" value="' + searchNumber + '" name="sp_a">');
		document.write('                                                    <input id="Hidden2" type="hidden" value="' + searchAllow + '" name="sp_p">');
		document.write('                                                    <input id="Hidden3" type="hidden" value="' + searchEnvironment + '" name="sp_t">');
		document.write('                                                    <input id="searchURL" type="hidden" value="' + searchString + '"  name="searchURL">');
		document.write('                                                    <input id="searchText" name="sp_q" type="text" onkeypress="handleKeyPress()" autocomplete=on>');
		document.write('                                                 </div>');
		document.write('                                                <div>');
		document.write('                                                <img src="' + gsSourceWebSite + '/images/clearspacer.gif" hspace="81"><input type="image" name="Imagebutton2" id="Imagebutton2"  class="SubmitSearch" src="' + gsSourceWebSite + '/images/search_arrow.gif" onclick="javascript:noPostBack();">');	
		document.write('                                                 </div>');
		document.write('                                        </form>');
		document.write('                                </td>');																						
		document.write('                                <td>');
		document.write('                                </td>');
		document.write('                            </tr>');
		document.write('                        </table>');
											}
											else
											{
		document.write('						<table cellspacing="0" cellpadding="0" border="0" width="591">');
		document.write('                            <tr>');
		document.write('                                <td class="topMenuNav" vAlign="top" width="591"><IMG height="8" width="200" src="' + gsSourceWebSite + '/images/spacer.gif">');
														
														//Get all links 
														getLinksTopNav(sTopLinks);
														
		document.write('                                </td>');
		document.write('                            </tr>');
		document.write('                         </table>');
											}
											//end search logic
											
		document.write('                    </td>');
		document.write('                </tr>');
		document.write('            </table>');
		document.write('        </td>');
		document.write('    </tr>');
		document.write('    <tr>');
		document.write('        <td vAlign="top" width="776">');
		document.write('            <table cellSpacing="0" cellPadding="0" width="776" border="0" ID="Table4">');
		document.write('                <tr>');
		document.write('                    <td width="2">');
		document.write('                        <IMG hspace="2" src="' + gsSourceWebSite + '/images/spacer.gif">');
		document.write('                    </td>');
		document.write('                    <td width="768" class="mainMenuBackGrnd800" valign="top">');
		document.write('                        <div><img id="AllstateProducts800" src="' + gsSourceWebSite +  sRoot.getElementsByTagName("menuHeaderImageOn")[0].firstChild.nodeValue + '" onmouseover="AllstateMenu8X6.Menudrop(this,event,&quot;dropmenu1&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOn")[0].firstChild.nodeValue + '&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOff")[0].firstChild.nodeValue + '&quot;)"></div>');
		document.write('                        <div><img id="getAQuote800" src="' + gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOn")[1].firstChild.nodeValue + '" onmouseover="AllstateMenu8X6.Menudrop(this,event,&quot;dropmenu2&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOn")[1].firstChild.nodeValue + '&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOff")[1].firstChild.nodeValue + '&quot;)"></div>');
		document.write('                        <div><img id="customerCare800" src="' + gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOn")[2].firstChild.nodeValue + '" onmouseover="AllstateMenu8X6.Menudrop(this,event,&quot;dropmenu3&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOn")[2].firstChild.nodeValue + '&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOff")[2].firstChild.nodeValue + '&quot;)"></div>');
		document.write('                        <div><img id="aboutAllstate800" src="' + gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOn")[3].firstChild.nodeValue + '" onmouseover="AllstateMenu8X6.Menudrop(this,event,&quot;dropmenu4&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOn")[3].firstChild.nodeValue + '&quot;,&quot;'+ gsSourceWebSite + sRoot.getElementsByTagName("menuHeaderImageOff")[3].firstChild.nodeValue + '&quot;)"></div>');
		document.write('                    </td>');
		document.write('                </tr>');
		document.write('            </table>');
		document.write('        </td>');
		document.write('    </tr>');
		
		document.write('    <!--Allstaste Products Menu-->');
		document.write('    <div class="dropmenudiv1800" id="dropmenu1">');
		document.write('        <div class="innerDiv">');
			                
							//Get all links 
							getLinks(sLinks);
			                                        
		document.write('        </div>');
		document.write('    </div>');
		document.write('    <!--Get A Quote Menu -->');
		document.write('    <DIV class="dropmenudiv2800" id="dropmenu2">');
		document.write('        <div class="innerDiv">');                           
							sRootElement = sRootElement.nextSibling;
							sLinks = sRootElement.getElementsByTagName('Links');
			                
							//Get all links 
							getLinks(sLinks);
			                
		document.write('        </div>');
		document.write('    </DIV>');
		document.write('    <!--Customer Care Menu -->');
		document.write('    <DIV class="dropmenudiv3800" id="dropmenu3">');
		document.write('        <div class="innerDiv">');
							sRootElement = sRootElement.nextSibling;
							sLinks = sRootElement.getElementsByTagName('Links');
			
							//Get all links 
							getLinks(sLinks);
			                
		document.write('    </div>');
		document.write('    </DIV>');
		document.write('    <!--About Allstate Menu -->');
		document.write('    <div class="dropmenudiv4800" id="dropmenu4">');
		document.write('        <div class="innerDiv">');

							sRootElement = sRootElement.nextSibling;
							sLinks = sRootElement.getElementsByTagName('Links');
			
							//Get all links 
							getLinks(sLinks);
			                
		document.write('        </div>');
		document.write('    </div>');			
		document.write('</table>');
		//Ends new header
		
		DisplayAWSCalcHeader();
		}//end else not AWS
		
		
		if (blnBlueBar == true)
		{	
			
				gsBarColor = "#000066"; // Original color
			
			document.write('<!-- Main Section -->');
			document.write('<table border="0" width="780" cellspacing="0" cellpadding="0">');
			document.write('  <tr>');
			if ((AWSGetCookie("AWSFlag") == "Y") && (gbAWSFlag == true))
			
			{
				document.write('     <td width="156" align="middle" bgcolor="#FFFFFF" valign="top">');
				document.write('			<!-- Left Side Section -->');
				document.write('			<table border="0" width="100%" cellspacing="0" cellpadding="0">');
				document.write('			  <tr>');
				document.write('			    <td height="1" width="100%"><IMG border=0 height=1 src="' + gsSourceWebSite + '/Images/ClearSpacer.gif" width=156></td>');
				document.write('			  </tr>');
				document.write('			</table>');
			}
			else
			{
				
					document.write('     <td width="156" align="center" bgcolor="' + gsBarColor + '" valign="top">');
				
				document.write('			<!-- Left Side Section -->');
				document.write('			<table border="0" width="100%" cellspacing="0" cellpadding="0">');
				document.write('			  <tr>');
				document.write('			    <td height="1" width="100%"><IMG border=0 height=1 src="' + gsSourceWebSite + '/Images/ClearSpacer.gif" width=156></td>');
				document.write('			  </tr>');
				document.write('			</table>');
			}
		}//end if (blnBlueBar == true)			
}




