var element = new Array('_ctl0_SmallSizeTextButton', '_ctl0_MediumSizeTextButton', '_ctl0_LargeSizeTextButton');
var cookieName = 'textSize';
var container = 'all';

function ChangeSize(id)
{
	var e = GetElement(container);
	var imagePath = '/planes-medicare/images/button/text_size';
	var imageExtension = '.gif';
	
	if(id == element[0]) e.style.fontSize = "1em";
	else if(id == element[1]) e.style.fontSize = "1.2em";
	else e.style.fontSize = "1.3em";	
	
	for(i = 0; i < 3; i++)
	{
		var imageElement = GetElement(element[i]);
		var imageId = element[i];
		if(imageId == id) imageElement.src = imagePath + (i + 1) + "_active" + imageExtension;
		else imageElement.src = imagePath + (i + 1) + imageExtension;
	}	
	
	if(GetCookie(cookieName) != id) SetCookie(cookieName, id, 10000);
}

function GetElement(elementId) 
{ 
	if(document.all) return document.all[elementId]; 
	else return document.getElementById(elementId);  
}

function GetExpiryDate(noDays)
{
	var UTCstring;
	Today = new Date();
	noMilli = Date.parse(Today);
	Today.setTime(noMilli + noDays * 24 * 60 * 60 * 1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function GetCookie(cookieName)
{
	var cookieString="" + document.cookie;
	var index1 = cookieString.indexOf(cookieName);
	if (index1 == -1 || cookieName == "") return ""; 
	var index2 = cookieString.indexOf(';', index1);
	if (index2 == -1) index2 = cookieString.length; 
	return unescape(cookieString.substring(index1 + cookieName.length + 1,index2));
}

function SetCookie(name, value, duration)
{
	cookieString = name + "=" + escape(value) + ";EXPIRES=" + GetExpiryDate(duration) + ";PATH=/";
	document.cookie = cookieString;
	if(!GetCookie(name)) return false;
	else return true;
}

function SetTextSize()
{
	currentSize = GetCookie(cookieName);
	if(currentSize == "") currentSize = element[0];
	ChangeSize(currentSize);
}



/*	function changeSize(size, id) {
		e = document.getElementById(id);
		if (size == 's')
			e.style.fontSize = ".8em";
		if (size == 'm')
			e.style.fontSize = "1em";
		if (size == 'l')
			e.style.fontSize = "1.2em";
	}

	function changeSize(size, id) {
		e = document.getElementById(id);
		if (size == 's')
			e.style.fontSize = ".8em";
		if (size == 'm')
			e.style.fontSize = "1em";
		if (size == 'l')
			e.style.fontSize = "1.2em";
	}
	
*/
	
	function volver(){
		window.location= "#top";
	}
	
	function volverGeneric(link){
		window.location= link;
	}
	
	function clickButton(e, buttonid){ 
		var bt = document.getElementById(buttonid);
		if (typeof bt == 'object'){ 
			if(navigator.appName.indexOf("Netscape")>(-1)){ 
				if (e.keyCode == 13){ 
					bt.click(); 
					return false; 
				} 
			} 
			if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
				if (event.keyCode == 13){ 
					bt.click(); 
					return false; 
				} 
			} 
		}
	}
	
// Counter function
/* Dynamic Version by: Nannette Thacker
http://www.shiningstar.net
Original by :  Ronnie T. Moore
Web Site:  The JavaScript Source
Use one function for multiple text areas on a page
Limit the number of characters per textarea */

function textCounter(field,cntfield,maxlimit) 
{
	if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	else
			cntfield.value = maxlimit - field.value.length;
}

function openWin( windowURL, windowName, windowFeatures ) 
{ 
	/*window.close();*/
	window.open( windowURL, windowName, windowFeatures ); 	
}	
