/*Font Controller script starts here*/
fontControl = {
adjustFont : function(link,id,size)
{
	var elmID = null;
	var newSize = null;
	var currentLink = null;
	var container = null;
	
	try
	{
		elmID = id;
		newSize = size;
		currentLink = link;

		if(typeof elmID == null || elmID == "undefined" ||
	      	typeof newSize == null || newSize == "undefined" ||
		     	typeof currentLink == null || currentLink == "undefined")
		{
			return false;
		}
		else
		{
			container =	document.getElementById(elmID);
		
			if(typeof container == null || container == "undefined")
			{
				return false;
			}
			else
			{
				container.style.fontSize = newSize + "px";
			}
			fontControl.changeAnchorText(currentLink);
		}
	}
	catch(e)
	{
		// do something here
	}
},
		
changeAnchorText : function(currentLink)
{
	var linkArr = new Array();
	linkArr[0] = document.getElementById("txt0");
	linkArr[1] = document.getElementById("txt1");
	linkArr[2] = document.getElementById("txt2");
			
	for(i = 0; i < linkArr.length ; i++)
	{
		if(typeof linkArr[i] == "undefined" || linkArr[i] == null)
		{
			return false; 
		}		
		else
		{
			if(linkArr[i].id == currentLink)
			{
				linkArr[i].className = currentLink + " active";
			}
			else
			{
				linkArr[i].className = linkArr[i].id;
			}
		}
	}		
}
}
/*Font Controller script ends here*/

/*Contact us information kit link script starts here*/
	var phone = document.getElementById("phnumber"); //To get the list element from the page
	var sendinfokit = document.getElementById("send-info-kit"); //To get the list element from the page
	var sendinfokiturl = document.getElementById("send-info-kit-url"); //To get the list element from the page
	var haverepcall = document.getElementById("have-rep-call"); //To get the list element from the page
	var haverepcallurl = document.getElementById("have-rep-call-url"); //To get the list element from the page	
	//Sets phone number
	if(typeof phonenumber != 'undefined'){
		phone.innerHTML = phonenumber;
	}
	
	//Sets information kit
	if(typeof showinfokit != 'undefined' && showinfokit=='Y' && typeof infokiturl != 'undefined')
	{
		sendinfokiturl.href="javascript:popWin('"+infokiturl+"',617,380,80,80);"; // Set the url from the page variable
	}
	else 
	{	
		sendinfokit.style.display="none"; //Set the display from the page variable
	}
	
	//Sets rep call
	if(typeof showrepcall != 'undefined' && showrepcall=='Y' && typeof showrepcallbuttonname != 'undefined' && typeof showrepcallcampaign != 'undefined' && typeof showrepcallcell != 'undefined')
	{
		haverepcallurl.href="javascript:popWin('"+eleadscaptureurl+"/eleadscapture/leadCapture/displaycontactme?campaign="+showrepcallcampaign+"&buttonName="+showrepcallbuttonname+"&cell="+showrepcallcell+"',800,700,80,80);"; // Set the url from the page variable		
	}
	else 
	{	
		haverepcall.style.display="none"; //Set the display from the page variable
	}
/*Contact us information kit link script ends here*/

/*pop up window script starts here*/
function leaveFidelity(url) {
var message ="You are about to leave Fidelity.com for a site that is unaffiliated with Fidelity. Fidelity has not been involved in the preparation of the content supplied at the unaffiliated site and does not guarantee or assume any responsibility for its content.";
if (confirm(message)) {
window.open (url, "newwindow", config="height=380,width=617,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=no,directories=no,status=no");
}
}
function popWin(theURL) {
var infowindow;
var infowindow2;
// Popup width and height are optional second and third parameters to this function
var theHeight = 420;
var theWidth = 245;
if (popWin.arguments.length == 3)
{
theWidth = popWin.arguments[1];
theHeight = popWin.arguments[2];
}
var xPosition = 450;
var yPosition = 250;
if (popWin.arguments.length == 5)
{
theWidth = popWin.arguments[1];
theHeight = popWin.arguments[2];
xPosition = 200;
yPosition = 240;
}

if(theWidth == 245) {
infowindow=window.open (theURL, 'infowindow','width='+theWidth+',height='+theHeight+',left='+xPosition+',top='+yPosition+',location=no,resizable=yes,menubar=no,status=no,toolbar=no,scrollbars=yes');
infowindow.opener=self;
infowindow.focus();
}
else {
infowindow2=window.open (theURL, 'infowindow2','width='+theWidth+',height='+theHeight+',left='+xPosition+',top='+yPosition+',location=no,resizable=yes,menubar=no,status=no,toolbar=no,scrollbars=yes');
infowindow2.opener=self;
infowindow2.focus();
}
if(window.infowindow) {
window.infowindow.close();
}
if(window.infowindow2) {
window.infowindow2.close();
} 
}
/*pop up window script ends here*/

/*Pop up div script starts here*/

var lastElement;
function showDiv(caller,divId, element) {
	var div = document.getElementById(divId);
	lastElement = caller;
	div.style.display="block";
	div.style.top = (getAbsoluteTop(caller)+24)+"px";
	div.style.left = (getAbsoluteLeft(caller)+caller.offsetWidth/2-div.offsetWidth/2)+"px";
	if(document.getElementById(element))
		document.getElementById(element).focus();
}
function hideDiv(divId) {
	var div = document.getElementById(divId);
	div.style.display="none";
	if(lastElement)
		lastElement.focus();
}

/*ACC QC TOOL script */
var so;
var i=0;
function showHideFlash(status){
	var flashDiv2 = document.getElementById('flashDiv2');
	var div = document.getElementById('accqcDiv');
	var eleadsURL = eleadscaptureurl + "/eleadscapture/leadCapture/displaycontactme?campaign=08126%26buttonName=ACCQC%26cell=104";

	if (flashDiv2.style.display == "block" && status == "hide"){
		flashDiv2.style.display = "none";
		i=0;
		
		// hide the grayed out background
		div.style.display="none";
		
	} else {
	
		flashDiv2.style.display = "block";
		if (flashDiv2.style.display == "block" && i==0){
			i++;
			so = new SWFObject("/products/annuities/accqc/ACCQC.swf", "gateway", "802", "1100", "8", "");
			so.addParam("wmode", "transparent");
			so.addParam("scale", "noscale");
			so.addVariable("CLOSER", "javascript:showHideFlash('hide')");
			so.addVariable("trackerPath", "/products/annuities/accqc/assets/tracking/");
			so.addVariable("path_XML", "/products/annuities/accqc/assets/data/accqc_settings.xml");
			so.addVariable("URL02", eleadsURL);
			so.write("flashDiv2");
		}
		window.scrollTo(0,25)
		// show the grayed out background
		div.style.display="block";
		
		var layerBg = document.getElementById('layerBackground');
		var Bheight = (document.height || document.body.offsetHeight);
		var Bwidth = (document.width || document.body.offsetWidth)
		//Bheight = Bheight < 1400 ? Bheight :1400;
		layerBg.style.height = Bheight+"px";
		layerBg.style.width = Bwidth+"px";
		layerBg.style.display="block";
	}
	
}

function ofPopWinCustom(theURL,iHeight,iWidth) {
newWindow = window.open(theURL,'subWindowCustom','toolbar=no,location=no,scrollbars=yes,status=no,menubar=no,resizable=yes,left=250,top=100,height='+ iHeight +',width='+ iWidth + ',fullscreen=no')
newWindow.focus()
}