function notAvailableMessage()
{
	alert("Este \355tem no funciona en esta demostraci\363n.");
}

/********************************************************************
 * globals
 ********************************************************************/															
var isNS = (document.layers); 
var isIE4 = (document.all);
var undefined; // create a null variable undefined becuase older browsers (IE5) don't know the keyword undefined yet
var isNS = (document.layers); 

//check if IE 6 on page load
var browser=navigator.userAgent;
if(browser.indexOf("MSIE")!=-1){
	var isIE=true;	
}
if ((verOffset=browser.indexOf("MSIE"))!=-1) {
	versionNum = parseFloat(browser.substring(verOffset+5,browser.length));
	if(versionNum==6){
		var isIE6=true;	
	}
}

// IE6 Flicker bug 
ie = document.all;
if(ie) {
	try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(err) {}
}


// WINDOW ONLOAD MANAGER
function womOn(){
	window.onload = womGo;
}
function womGo(){
	for(var i = 0;i < woms.length;i++)
		eval(woms[i]);
}
function womAdd(func){
	woms[woms.length] = func;
}
var woms = new Array();
womAdd('getExistingFontSize()');
womOn();


// SHOW ROLLOVER LAYERS FOR THE PROGRESS METER BY LOOPING THROUGH CHILD NODES OF THE PROGRESS METER DIV
function showProgressMeter() {
	if (document.all&&document.getElementById && document.getElementById("progress_meter")) {
		navRoot = document.getElementById("progress_meter");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";				
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
	

// TEXT SIZER
var currentFontSize;
var currentFontSize;
var defaultFont='62.5%';
var mediumFont='75%';
var maximumFont='85%';
var path="/";
var domain=".amfam.com"
/**
* This functionality retrives the existing font from the cookie and based on the 
* cookie value this will call respective javascript functionality. If the cookie 
* value is null then it will set the default value.
*/
function getExistingFontSize(){
	var useragent = navigator.userAgent;
	var isiPhone = !!useragent.match(/iPhone/i);
	var isiPad = !!useragent.match(/iPad/i);
	var isiPod = !!useragent.match(/iPod/i);
	var isChrome = !!useragent.match(/Chrome/i);
	var isAndroid = !!useragent.match(/Android/i);
	if(!isiPhone && !isiPod && !isAndroid) {	
	var existingFontSize = getFontSizeCookie("fontSize");
	
	if (existingFontSize!=null){
		if (existingFontSize==defaultFont){
			

			defaults();
	
		}else if (existingFontSize==mediumFont){
			setMiniFontSize();			
		}else if (existingFontSize==maximumFont){
			setMaxFontSize();
		}
	}else{
		
		//alert("no cookie - common");
		defaults();
	
	}	
};
}

/**
 * This function sets the default font size to the document's body style
 * and sets the fontSize cookie
 */
function defaults(){
	document.body.style.fontSize=defaultFont;
	setFontSizeCookie("fontSize",defaultFont,null,path,domain);
}

/**
 * This function sets the large font size to the document's body style
 * and sets the fontSize cookie
 */
function setMaxFontSize(){
	document.body.style.fontSize=maximumFont;
	setFontSizeCookie("fontSize",maximumFont,null,path,domain);
}

/**
 * This function sets the medium font size to the document's body style
 * and sets the fontSize cookie
 */
function setMiniFontSize(){
	document.body.style.fontSize=mediumFont;
	setFontSizeCookie("fontSize",mediumFont,null,path,domain);
}


/** getFontSizeCookie */
function getFontSizeCookie(cookieName){
	if (document.cookie.length > 0) { 
		var startOfCookie = document.cookie.indexOf(cookieName+"="); 
		if (startOfCookie != -1) { 
			startOfCookie += cookieName.length+1;
			var endOfCookie = document.cookie.indexOf(";", startOfCookie);
			if (endOfCookie == -1) 
				endOfCookie = document.cookie.length;
				return unescape(document.cookie.substring(startOfCookie, endOfCookie)); 
			} 
	}
	return null; 
}

/** setFontSizeCookie */
function setFontSizeCookie(cookieName, cookieValue, cookieExpiredays, path, domain) {
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (cookieExpiredays * 24 * 3600 * 1000));
	document.cookie = cookieName + "=" + escape(cookieValue) + 
	((cookieExpiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString())
	+ ( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" );
}

function PrintThisPage(layer_id) {

   var sOption="toolbar=no,location=no,directories=no,menubar=no,";
       sOption+="scrollbars=yes,width=790,height=600,left=100,top=25";
var sLayerID = document.getElementById(layer_id).innerHTML;
  
   var sWinHTML = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
	                 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.amfamlatino.com/enes/sdweb/site_files/css/print_app.css\"><title>"+document.title+"</title>\n" +
	                 "<script type=\"text/javascript\" src=\"https://web.amfam.com/site_files/js/getElementsByClassName.js\"></script>\n" +
	                 "<script type=\"text/javascript\" src=\"https://web.amfam.com/site_files/js/disableElements.js\"></script>\n" +
	                 "</head>\n" +
	                 "<body>\n" +
	                 "<div id=\"header\"><h1><a href=\"http://www.amfamlatino.com/enes/default.asp\"><img src=\"https://www.amfamlatino.com/enes/sdweb/site_files/images/amfam/header/amfam_logo.gif\"\></a></h1></div>\n" +
	                 "<div id=\"toolbar\"><ul><li><a href=\"javascript:void(0)\" onclick=\"window.print();\"><img src=\"https://web.amfam.com/site_files/images/amfam/tool_bar/ico_print.gif\"/></a>\n" + 
	                 "<a href=\"javascript:void(0)\" onclick=\"window.print();\">Print This Page</a></li></ul></div>\n" +
					 "<div id=\"" + layer_id + "\">" + sLayerID + "</div>\n" +
			      	 "</body></html>\n";
  
   var winprint=window.open("","",sOption);
       winprint.document.open();
	   winprint.document.write(sWinHTML);
	   winprint.document.close();
       winprint.focus();
}

function PrintThisPageTran(layer_id) {

   var sOption="toolbar=no,location=no,directories=no,menubar=no,";
   sOption+="scrollbars=yes,width=775,height=600,left=100,top=25";
   var sLayerID = document.getElementById(layer_id).innerHTML;
  
      var sWinHTML = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
	                 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"https://www.amfamlatino.com/enes/sdweb/site_files/css/print_app.css\"><title>"+document.title+"</title>\n" +
	                 "<script type=\"text/javascript\" src=\"https://web.amfam.com/site_files/js/getElementsByClassName.js\"></script>\n" +
	                 "<script type=\"text/javascript\" src=\"https://web.amfam.com/site_files/js/disableElements.js\"></script>\n" +
	                 "</head>\n" +
	                 "<body>\n" +
	                 "<div id=\"amfam_logo\"><img src=\"https://www.amfamlatino.com/enes/sdweb/site_files/images/amfam/header/amfam_logo.gif\" alt=\"American Family Insurance\" /></div>\n" +
	                 "<div id=\"toolbar\"><ul><li><a href=\"javascript:void(0)\" onclick=\"window.print();\"><img src=\"https://web.amfam.com/site_files/images/amfam/tool_bar/ico_print.gif\"/></a>\n" + 
	                 "<a href=\"javascript:void(0)\" onclick=\"window.print();\">Print This Page</a></li></ul></div>\n" +
					 "<div id=\"" + layer_id + "\">" + sLayerID + "</div>\n" +
			      	 "</body></html>\n";
  
   var winprint=window.open("","",sOption);
       winprint.document.open();
	   winprint.document.write(sWinHTML);
	   winprint.document.close();
       winprint.focus();
}





/*
=====================================
       Javascript functions for Help Popup Html File
=====================================
*/

function openWin(newUrl, nam, width, height) {
 var props;
 var thisWin;
 var lft = ((parseInt(document.body.clientWidth) - parseInt(width)) /2)
 var tp = ((parseInt(document.body.clientHeight) - parseInt(height)) /2)
 props = 'scrollbars,location=no,resizable=no,toolbar=no,directories=no,menubar=no,status=no,width=' + width + ',height=' + height + ',top=' + tp + ',left=' + lft;
 thisWin = window.open(newUrl, nam, props);
 // If the window was opened, set focus, else display error
 if (thisWin != null){
   // if window already open, 
   // resize to make sure it gets sized appropriately
   //thisWin.resizeTo( width, height );
   thisWin.focus();
 } else {
   alert('La ventana puede no estar abierta. Aseg\372rese de que en su escritorio no est\351 abierta una ventana de di\341logo.');
 }
}

function clearField(field) {
	myType = field.type;
	if (myType == 'checkbox' || myType == 'radio' || myType == undefined)
	    try{for (i = 0; i < 20; i++) field[i].checked = false;}catch (e){}            
	if (myType == 'hidden' || myType == 'password' || myType == 'text' || myType == 'textarea')
	    field.value = "";
	if (myType == 'select-one' || myType == 'select-multiple')
	    field.selectedIndex = 0;
}



function openPopupOffScreen(xURL, name){
	var adjTop = 0;
	var adjLeft = 0;		
	var options = "width=300,height=300,left=" + adjLeft + ",top=" + adjTop + ",resizable=yes,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no";
	window.open(xURL, name, options);
}


// Open Centered Pop Up Window
function openWindow(theURL,winName,w,h) { //v2.0
	var winleft = (screen.width - w) / 2;
    var winUp = (screen.height - h) / 2;
    winProp = 'width='+w+',height='+h+',left='+winleft+',top='+winUp+',scrollbars=no,resizable=no'
	window.open(theURL,winName,winProp);
}

