var PopupWindow = ""
var hideTimeOut = "";
var hideLayerFlag = 0;
var myLayersArray = new Array();
var days = 7;

//************************************************************************************************
function createCookie(name,value,days)
{
    if (days)
    {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "expires=" + date.toGMTString();
    }
    else
    {
        var expires = "";
    }
    var strCreateCookie = name + "=" + value + "; " + expires + "; path=/;";
    document.cookie =  strCreateCookie;
}

//************************************************************************************************
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
//************************************************************************************************
function loadSelectedSettings()
{
     strSize = readCookie('fontselection'); 
     switch (strSize)
     {
        case 'small':
            changeTextSize(12,'Image6','images/button_font_small_h.gif');
            break;        
        case 'large':
            changeTextSize(16,'Image8','images/button_font_large_h.gif');
            break;       
        default:
            changeTextSize(14,'Image7','images/button_font_medium_h.gif');
            break;     
     }
}


//************************************************************************************************
function OpenPopUp(windowsname,address,width,height,scrollbars,resizable)
{
	var w = 480, h = 340;
		
	if (document.all || document.layers)
	{
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	
	var popW = width, popH = height;	
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	
	if(PopupWindow)
	{
		if(!PopupWindow.closed)
		{
			PopupWindow.close();
		}
	}
	PopupWindow = window.open(address, windowsname,'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',status=1,toolbar=0,location=0,menubar=0,directories=0');
	PopupWindow.focus();
}
		    
function changeTextSize(intFontSize,objName,strImageURL)
{
    document.getElementById("idBodyText").style.fontSize = intFontSize + "px";
    resetSelectedIcon();
    changeSelectedIcon(objName,strImageURL);
}
function resetSelectedIcon()
{
    document.getElementById("Image6").src = "images/button_font_small.gif";
    document.getElementById("Image7").src = "images/button_font_medium.gif";
    document.getElementById("Image8").src = "images/button_font_large.gif";
    
}
function changeSelectedIcon(objName,strImageURL)
{
    var object = eval("document.getElementById('" + objName + "')");
    object.src = strImageURL;
}