// GLOBAL FUNCTIONS

var m_loadTimer = null;


function setWindowStatus(szStatus)
{
	window.status = szStatus;
	return (true);
}

function getContentLoadLayer(szAddPath)
{
	var content = '';
	content = '<img border="0" src="' + szAddPath + 'images/load.gif" width="200" height="50">';
	return (content);
}

function createLoadLayer(szAddPath)
{
	var nWidth = getWinWidth();
	var nHeight = getWinHeight();
	var nLeft = parseInt((nWidth - 200)/2);
	var nTop = parseInt((nHeight - 50)/2);
	var content = getContentLoadLayer(szAddPath);
	createLayer("LoadDoc", nLeft, nTop, 200, 50, false, content);
}

function checkLoadDoc()
{
	if (m_loadTimer != null)
		window.clearTimeout(m_loadTimer);
	if (document.all)
	{
		if (getVisibleLayer("LoadDoc"))
			hideLayer("LoadDoc");
	}
	else {
		if (!getVisibleLayer("LoadDoc"))
			showLayer("LoadDoc");
		m_loadTimer = setTimeout("checkLoadDoc()", 1);
	}
}

function getContentCloseUISLayer(szAddPath)
{
	var content = '';
	content = '<img border="0" src="' + szAddPath + 'images/cuInSec.gif" width="300" height="50">';
	return (content);
}

function createCloseUISLayer(szAddPath)
{
	var nWidth = getWinWidth();
	var nHeight = getWinHeight();
	var nLeft = parseInt((nWidth - 300)/2);
	var nTop = parseInt((nHeight - 50)/2);
	var content = getContentCloseUISLayer(szAddPath);
	createLayer("CloseUIS", nLeft, nTop, 300, 50, false, content);
}

function checkLoadDoc_CloseUIS()
{
	if (m_loadTimer != null)
		window.clearTimeout(m_loadTimer);
	if (document.all)
	{
		if (getVisibleLayer("CloseUIS"))
			hideLayer("CloseUIS");
	}
	else {
		if (!getVisibleLayer("CloseUIS"))
			showLayer("CloseUIS");
		m_loadTimer = setTimeout("checkLoadDoc_CloseUIS()", 1);
	}
}

function createStaffWin(szFind)
{
	var szHomepage = "http://climpc7.natgeo.lu.se/INES/English/WPview/index.asp?" + szFind;
	window.open(szHomepage, "", "resizable=no, width=520, height=540, scrollbars=yes");
}

function writeSendEMailToPerson(szFirst, szSecond, szAddress, szMouseOver, szTitleLink, szStart, szEnd, szLinkClass)
{
	if (szSecond.length > 0)
		szFirst += ".";
	if (szLinkClass.length > 0)
		szLinkClass = ' class="' + szLinkClass + '"';
	
	document.writeln(szStart + '<a href="mailto:' + szFirst + szSecond + '@' + szAddress + '"' + szLinkClass);
	document.writeln(' onMouseOver="setWindowStatus(\'' + szMouseOver + '\'); return (true);"');
	document.writeln(' onMouseOut="setWindowStatus(\'\');">' + szTitleLink + '</a>' + szEnd);
}

function writePersonalLinkAndEMail(szBeforeText, szTextLink, szTargetLink, szHrefLink, szMouseOverLink, szClassLink, szFirstEMail, szSecondEMail, szAddressEMail, szMouseOverEMail, szTextEMail, szClassEMail, szEnd)
{
	var szStart = '';
	szStart = szBeforeText + '<a target="' + szTargetLink + '" class="' + szClassLink + '" \n';
	szStart += 'href="' + szHrefLink + '" \n';
	szStart += 'onMouseOver="setWindowStatus(\'' +  szMouseOverLink + '\'); return (true);" \n';
	szStart += 'onMouseOut="setWindowStatus(\'\');">' + szTextLink + '</a><font class="TextNormal">&nbsp;</font>';
	writeSendEMailToPerson(szFirstEMail, szSecondEMail, szAddressEMail, szMouseOverEMail, szTextEMail, szStart, szEnd, szClassEMail);
}