/********************************************************************************
                        FontSizer.js
********************************************************************************/

/*******************************************************************************
* Adapted from a script by:
* Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
* Coded by: Taewook Kang (http://www.txkang.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code

* Cookie/ "smart" & other functionality tweaks by Varun Parekh, Bankers Life and Casualty
* 2006 update: removed 2 button (increase | decrease) functionality and set to 3 fixed size options.
*******************************************************************************/

//Specify affected tags. Add or remove from list:
// add: 'div', before the p to affect top nav drop downs.
// remove: 'span' to not affect footer
if (document.title != "Bankers Conseco Life Insurance Company - We specialize in seniors") //if not the homepage then
{
	var tgs = new Array('div','p','li','span'); 
}
else
{
	var tgs = new Array('div'); //affect navigation on homepage
}
//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large');
var startSz = 1; // x-small
var d = document,cEl = null,sz = startSz,i,j,cTags;

/********************************************
Size Value		Relative Size	Cookie Value
--------------------------------------------
-1 : 			xx-small		0
0 : 			x-small			1  DEFAULT
1 : 			small			2
2 : 			medium			3
3 : 			large			4
********************************************/

function ts( trgt,inc ) 
{
	if (!document.getElementById) return
	sz = inc;
	
	if ( sz < 0 ) sz = 0;

	if ( sz > 4 ) sz = 4;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) 
	{
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
	setCookie();
}

var YourFontSize;

function getSize() 
{
	precacheImgs(); // pre-load the mouse over images
		
	if(document.cookie)
	{
		index = document.cookie.indexOf("BLCFont");
		if (index != -1)
		{
			YourFontSize = document.cookie.substring(8,9).toString();
			
			//alert (YourFontSize);
			
			switch (YourFontSize)
			{
				//case "0": 
				//	ts( "body",-1 )
				//	break;
				case "1": 
					ts( "body",1 )
					break;
				case "2": 
					ts( "body",2 )
					break;
				case "3": 
					ts( "body",3 )
					break;
				//case "4": 
				//	ts( "body",3 )
				//	break;
				default : ts( "body",1 )
			}
		}
	} 
}

function setCookie() 
{
	// document.cookie="BLCFont="+sz+"; expires=Monday, 04-Apr-2010 05:00:00 GMT"; // "Never Expiring" cookie
	document.cookie="BLCFont="+sz; // Cookie expires at end of session
}


var aryImgs=new Array(); //Array of images to precache
function precacheImgs()
{
	for (i=0; i<precacheImgs.arguments.length;i++)
	{
		aryImgs[i]=new Image();
		aryImgs[i].src=precacheImgs.arguments[i];
	}
}
precacheImgs("Images/font_smallON.gif","Images/font_mediumON.gif","Images/font_largeON.gif");


//************** Open Center Window Function
 function openCenteredWindow(url, height, width, name, parms) {
     if (height <= 1) { height = Math.floor(screen.height * height); }
     if (width <= 1) { width = Math.floor(screen.width * width); }
  var left = Math.floor( (screen.width - width) / 2);
     var top = Math.floor( (screen.height - height) / 2);
     var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
     if (parms) { winParms += "," + parms; }
     var win = window.open(url, name, winParms);
     if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
     return win;
 }
//************** End Open Center Window Function

//************** Frame Busting Function
if (window != top) top.location.href = location.href;
//************** End Frame Busting Function