var WindowTemp;
function popup_open(popupfile, popupname, popupwidth, popupheight, resize, status, scroll, tool, menu)
{
	//titlebar=0;
	var winleft = (screen.width - popupwidth) / 2;
	var wintop = (screen.height - popupheight) / 2;
	var params = "width=" + popupwidth + ",height=" + popupheight + ",top=" + wintop + ",left=" + winleft + ",resizable=" + resize + ",status=" + status + ",scrollbars=" + scroll + ",toolbar=" + tool + ",location=0,directories=0,menubar=" + menu + "";
	if((navigator.appName.indexOf("Explorer")!=-1)&&(parseInt(navigator.appVersion.substring(0,1))<4))
	{
		newwin = window.open(popupfile,popupname,params);
	}
	else
	{
		if(WindowTemp)
		{
			if(!WindowTemp.closed)
			{
				WindowTemp.close();
				WindowTemp="";
			}
		}

		newwin = window.open(popupfile,popupname,params);
		WindowTemp = newwin;
		WindowTemp.name = "WindowTemp";
		newwin="";
	}
}

function TransformEnterKpress(evt,myObj)
{
	evt = (evt) ? evt : ((event) ? event : null);
	if (evt)
	{
		var charCode = (document.all) ? event.keyCode : evt.which;
		if (charCode == 13)
		{
			for (j = 0; j < document.forms[0].length; j++)
			{
				if (document.forms[0].elements[j].name == myObj.name)
				{
					document.forms[0].elements[j+1].focus();
					break;
				}
			}
			return false;
		}
	}
}

function BlockEnterKpress(evt,myObj)
{
	evt = (evt) ? evt : ((event) ? event : null);
	if (evt)
	{
		var charCode = (document.all) ? event.keyCode : evt.which;
		if (charCode == 13)
		{
			return false;
		}
	}
}

function PreloadImageMenu(imgMenuPath, arrImagesNames)
{
	/*
		esempio variabile arrImagesNames = new Array("img01.gif","img01Over.gif","img02.gif","img01Over.gif");
	*/	
	var arrPreloadImages = new Array();

	for (i=0; i<arrImagesNames.length; i++)
	{
		arrPreloadImages[i] = new Image();
		arrPreloadImages[i].src = imgMenuPath + arrImagesNames[i];
	}
}
function RollOverMenu(imgMenuPath, imgObj, imgSrc)
{
	imgObj.src = imgMenuPath + imgSrc;
}

function ReloadPageOpener(urlReload)
{
	window.opener.location = urlReload;
	//window.opener.reload();
}

/* ################################ div ################################ */
// Global variables
var pgDivId = "FooterScroll";

function loadXMLDoc()
{
	req = false;
	// branch for native XMLHttpRequest object
	if(window.XMLHttpRequest)
	{
		try
		{
			req = new XMLHttpRequest();
		}
		catch(e)
		{
			req = false;
		}
	}
	// branch for IE/Windows ActiveX version
	else if(window.ActiveXObject)
	{
		try
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req = false;
			}
		}
	}

	return req;
}

function GetDataFromServer(sFhId, sPageURL)
{
	var oXmlHttp;
	oXmlHttp=loadXMLDoc();
	var sUrl;
	sUrl=sPageURL + "?FhId=" + sFhId
	oXmlHttp.open("GET", sUrl, true);

	oXmlHttp.onreadystatechange=function()
	{
		if (oXmlHttp.readyState==4)
		{
			if (oXmlHttp.responseText!="")
			{
				setContentDiv(oXmlHttp.responseText);
			}
		}
	}
	oXmlHttp.send(null)
}

function setContentDiv(sDivContent)
{
	var divCalPage;
	divCalPage=document.getElementById(pgDivId);

	var sInnerHtml;
	sInnerHtml=sDivContent;
	divCalPage.innerHTML = sInnerHtml;

	getcontent_width(false);
}



// goTo URL
// ========
// Source: http://www.mcli.dist.maricopa.edu/show/interact/js_ex3.html
//
// Makes a clickable link.  Same as <a href>

function goTo (page) {
/* This function is called from the navigation menu
   to jump to the designated URL. Empty values
   are ignored and "--" indicates a menu seperator    */
   
    if (page != "" ) {
        if (page == "--" ) {
            resetMenu();
        } else {
            document.location.href = page;
        }
    }
    return false;
}

