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;
}