function openCenteredWindow(mypage, w, h, scroll, resizable, menubar, toolbar) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resizable+',menubar='+menubar+',toolbar='+toolbar
    win = window.open(mypage,'',winprops)
}

function CalculatorPopup() {
    openCenteredWindow('http://www.calcpartner.com/csSurvivorneeds.asp?POPUP','501','493','yes','no','no','no');
}
function threesixfiveDetailsPopup() {
    openCenteredWindow('http://www.aaa-travelaccident.com/product.aspx?brandoverride=enlighten','800','493','yes','no','no','no');
}
function threesixfiveFaqPopup() {
    openCenteredWindow('http://www.aaa-travelaccident.com/faq.aspx?brandoverride=enlighten','800','493','yes','no','no','no');
}
function TermLifeDetailsPopup() {
    openCenteredWindow('http://www.aaalifequote.com/product.aspx?brandoverride=enlighten','800','493','yes','no','no','no');
}
function TermLifeFaqPopup() {
    openCenteredWindow('http://www.aaalifequote.com/faqs.aspx?brandoverride=enlighten','800','493','yes','no','no','no');
}
function MLTADetailsPopup() {
    openCenteredWindow('http://www.aaa-memberloyalty.com/product.aspx?brandoverride=enlighten','800','493','yes','no','no','no');
}
function MLTAFaqPopup() {
    openCenteredWindow('http://www.aaa-memberloyalty.com/faq.aspx?brandoverride=enlighten','800','493','yes','no','no','no');
}
function getCookie(c_name)
{
	if (document.cookie.indexOf(c_name) != -1) // checks if a cookie is stored at all in the document.cookie object
 	{
 		c_start=document.cookie.indexOf(c_name + "=")
  		if (c_start!=-1) // check to see if our specific cookie is stored
    	{ 
    		c_start=c_start + c_name.length+1  
    		c_end=document.cookie.indexOf(";",c_start)
    		if (c_end==-1) 
    			c_end=document.cookie.length
    		return unescape(document.cookie.substring(c_start,c_end)) // return the value
    	} 
  	}
	return null
}

function setCookie(c_name,value,expiredays)
{
	document.cookie=c_name+ "=" +escape(value); // store the cookie name, cookie value and the expiration date in the document.cookie object
}

function setIframeParameters(whichForm) {
	if ( getCookie("clubName")  != "undefined") {
		var iframeClubName = getCookie("clubName");
		var iframeCampaignName = getCookie("campaignName");
		var iframeCreativeName = getCookie("creativeName");
		var iframeCampaignCode= getCookie("campaignCode");
	}
	else {
		var iframeClubName = "999";
		var iframeCreativeName = "T";
		var iframeCampaignCode= "99";	
		var iframeCampaignName =  "";
		if (whichForm == "term") {
			iframeCampaignName =  "T";
		}
		else { 
			if ( whichForm == "365" ) {
				iframeCampaignName =  "F";
			}
			else {
				iframeCampaignName =  "L";
			}
		}
	}
	document.getElementById("external_iframe").src = document.getElementById("external_iframe").src + "&club=" + iframeClubName + "&ca=" + iframeCampaignName + "&c=" + iframeCreativeName + "&campaignCode=" + iframeCampaignCode;
}

function Browseris() {
    var agt = navigator.userAgent.toLowerCase();
    this.osver = 1.0;
    if (agt) {
        var stOSVer = agt.substring(agt.indexOf("windows ") + 11);
        this.osver = parseFloat(stOSVer);
    }
    this.major = parseInt(navigator.appVersion);
    this.nav = ((agt.indexOf('mozilla') != -1) && ((agt.indexOf('spoofer') == -1) && (agt.indexOf('compatible') == -1)));
    this.nav6 = this.nav && (this.major == 5);
    this.nav6up = this.nav && (this.major >= 5);
    this.nav7up = false;
    if (this.nav6up) {
        var navIdx = agt.indexOf("netscape/");
        if (navIdx >= 0)
            this.nav7up = parseInt(agt.substring(navIdx + 9)) >= 7;
    }
    this.ie = (agt.indexOf("msie") != -1);
    this.aol = this.ie && agt.indexOf(" aol ") != -1;
    if (this.ie) {
        var stIEVer = agt.substring(agt.indexOf("msie ") + 5);
        this.iever = parseInt(stIEVer);
        this.verIEFull = parseFloat(stIEVer);
    }
    else
        this.iever = 0;
    this.ie4up = this.ie && (this.major >= 4);
    this.ie5up = this.ie && (this.iever >= 5);
    this.ie55up = this.ie && (this.verIEFull >= 5.5);
    this.ie6up = this.ie && (this.iever >= 6);
    this.winnt = ((agt.indexOf("winnt") != -1) || (agt.indexOf("windows nt") != -1));
    this.win32 = ((this.major >= 4) && (navigator.platform == "Win32")) ||
    (agt.indexOf("win32") != -1) || (agt.indexOf("32bit") != -1);
    this.mac = (agt.indexOf("mac") != -1);
    this.w3c = this.nav6up;
    this.safari = (agt.indexOf("safari") != -1);
    this.safari125up = false;
    if (this.safari && this.major >= 5) {
        var navIdx = agt.indexOf("safari/");
        if (navIdx >= 0)
            this.safari125up = parseInt(agt.substring(navIdx + 7)) >= 125;
    }
}
var browseris = new Browseris();