/* JavaScript Library */

var ns4 = (document.layers)?1:0;
var dom = (document.getElementById && !document.all);
var ie4 = (document.all)?1:0;
var opr = navigator.userAgent.indexOf("Opera");
var moz = navigator.appName=="Netscape" && navigator.appCodeName=="Mozilla" && !document.all;
var mac = navigator.userAgent.indexOf("Mac")!= -1;

window.status = "HMG Logistics-ãüÃ÷ÎïÁ÷"; // writes Javascript default message in browser status bar

// calculate the height of a layer
function getDivsHeight() {
	var iDivsHeight = 0;
	for(var i=0; i < arguments.length; i++) {
		if (document.getElementById(arguments[i]))
			iDivsHeight += document.getElementById(arguments[i]).offsetHeight;
	}
	return iDivsHeight;
}

// set the height of the back main layer in order to move the footer
function setDivContentMinHeight() {
	var oDivcontent, iWinInnerHeight, tmpHeight;
	var mozCorrection = moz ? -1 : 0;
	oDivcontent = document.getElementById(arguments[0]); //assumes first passed object as name for the content area layer
	oStopperDiv = document.getElementById(arguments[1]); // retrieve stopper div object
	
	iWinInnerHeight = document.body.clientHeight; // store window height of the inner browser area temporarily

	if (arguments.length == 4) {
		tmpHeight = getDivsHeight(arguments[2], arguments[3]);
	}
	else if (arguments.length == 3) {
		tmpHeight = getDivsHeight(arguments[2]);
	} // calculate the height of the page elements except the content area; using the getDivsHeight function
	
	if(oStopperDiv) {
		if (iWinInnerHeight > (tmpHeight + oStopperDiv.offsetTop + oStopperDiv.offsetHeight)) {
			oDivcontent.style.height = iWinInnerHeight - tmpHeight + mozCorrection;
		} else {
			oDivcontent.style.height = oStopperDiv.offsetTop + oStopperDiv.offsetHeight + mozCorrection;
		}
	}
		//if there is more space on the page than the header and footer height, than the main layer is set to a new height
}

// Wrapper function to apply the changes to the footer / main layers if DOM browser detected
// loadEvent triggers a bugfix for MSIE 5.0 and footer bar placement, "true" is for function calls in onLoad events,
// "false" is default and for onResize events

function init(loadEvent) {
	if (!ns4) {
		setDivContentMinHeight('main', 'stopper', 'header', 'footer');
		footero=document.getElementById('footer');
		if (footero)
			footero.style.visibility='visible';
	}
	if (loadEvent && ie4 && !ns4 && ((navigator.appVersion.indexOf("MSIE 5.0")!= -1) || (mac))) {
		window.resizeBy(1,1);
		window.resizeBy(-1,-1);
	}
}

// popup window opener service function for standard content pages
function showPopUp(zielFrame, parameter) {
        var newWindow = window.open("about:blank", zielFrame, parameter);
        newWindow.focus();    
}



function SetCookie(name, value, expires, path, domain, secure)
{
	var cookie = name + "=" + escape(value);
	if (expires != null)
		cookie += "; expires=" + expires.toGMTString();
	if (path != null)
		cookie += "; path=" + path;
	if (domain != null)
		cookie += "; domain=" + domain;
	if (secure != null)
		cookie += "; secure";
	document.cookie = cookie;
}


function getCookieVal(offset)
{
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return(unescape(document.cookie.substring(offset, endstr)));
}

function GetCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	var value = null;
	while (i < clen)
	{
		var j = i  + alen;
		if (document.cookie.substring(i, j) == arg)
		{
			value = getCookieVal(j);
			break;
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break;
	}
	return(value);
}

function DeleteCookie(name, path, domain)
{
	if (GetCookie(name) != null)
	{
		var cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
		if (path != null)
			cookie += "; path=" + path;
		if (domain != null)
			cookie += "; domain=" + domain;
		document.cookie = cookie;
	}
}


<!-- // Activate cloak for older browsers
var winNew;
var fIsIe = (document.all != null);

function openWin(szUrl, szName, nWidth, nHeight, nTop, nLeft, fMenu, fBrowser)
{
	// Set default top and left
	if (nTop == null)
		nTop = 25;

	if (nLeft == null)
		nLeft = 25;

	if (fMenu == null)
		fMenu = false;

	if (fBrowser == null)
		fBrowser = false;

	// Close any existing window
	if ((winNew != null) && (! winNew.closed))
		{
		winNew.close();

		// For some reason IE 5 has problems with winNew.close(), get 'winNew not object'.
		// Putting a "wait" in seems to work
		if (fIsIe)
			setTimeout("openSubWin('" + szUrl + "','" + szName + "'," + nWidth + "," +
			                       nHeight + "," + nTop + "," + nLeft + "," + fMenu + "," +
			                       fBrowser + ")", 500);
		else
			openSubWin(szUrl, szName, nWidth, nHeight, nTop, nLeft, fMenu, fBrowser);
		}
	else
		openSubWin(szUrl, szName, nWidth, nHeight, nTop, nLeft, fMenu, fBrowser);
}

function openSubWin(szUrl, szName, nWidth, nHeight, nTop, nLeft, fMenu, fBrowser)
{
var szMenu, szBrowser, szStatus;

	if (fMenu)
	{ szMenu = "yes"; szStatus = "yes"; }
	else
	{ szMenu = "no"; szStatus = "no"; }

	if (fBrowser)
		szBrowser = "yes";
	else
		szBrowser = "no"; 

	if (fIsIe)
		{
		if ((szUrl.indexOf('.asp') > -1) || (szUrl.indexOf('.htm') > -1) || (szUrl.indexOf('.html') > -1) || 
		    (szUrl.charAt(szUrl.length - 1) == "/"))
			winNew = window.open(szUrl, szName,
			                     "channelmode=no,directories=" + szBrowser + ",fullscreen=no,toolbar=" + szBrowser + ",location=" + szBrowser +
			                     ",menubar=" + szMenu + ",resizable=yes,scrollbars=yes,status=" + szStatus +
			                     ",top=" + nTop + ",left=" + nLeft +
			                     ",width=" + nWidth + ",height=" + nHeight, false);  // IE
		else
			winNew = window.open(szUrl, szName,
			                     "channelmode=no,directories=" + szBrowser + ",fullscreen=no,toolbar=" + szBrowser + ",location=" + szBrowser +
			                     ",menubar=" + szMenu + ",resizable=yes,scrollbars=yes,status=" + szStatus +
			                     ",top=" + nTop + ",left=" + nLeft +
			                     ",width=" + nWidth + ",height=" + nHeight, false);  // IE
		winNew.focus();
		}
	else
		{
		if ((szUrl.indexOf('.do') > -1) || (szUrl.indexOf('.md') > -1) || (szUrl.indexOf('.mp') > -1) ||
		    (szUrl.indexOf('.pdf') > -1) || (szUrl.indexOf('.pot') > -1) || (szUrl.indexOf('.pp') > -1) ||
		    (szUrl.indexOf('.vs') > -1) || (szUrl.indexOf('.xl') > -1))
			window.location = szUrl;
		else if (szUrl.indexOf('.nsf') > -1)
			{
			winNew = window.open(szUrl, szName,
			                     "directories=" + szBrowser + ",toolbar=" + szBrowser + ",location=" + szBrowser + ",menubar=" + szMenu +
			                     ",resizable=yes,scrollbars=yes,status=" + szStatus + 
			                     ",screenY=" + nTop + ",screenX=" + nLeft +
			                     ",width=" + nWidth + ",height=" + nHeight);  // Netscape
			winNew.focus();
			}
		else
			{
			winNew = window.open(szUrl, szName,
			                     "directories=" + szBrowser + ",toolbar=" + szBrowser + ",location=" + szBrowser + ",menubar=" + szMenu +
			                     ",resizable=yes,scrollbars=yes,status=" + szStatus +
			                     ",screenY=" + nTop + ",screenX=" + nLeft +
			                     ",width=" + nWidth + ",height=" + nHeight);  // Netscape
			winNew.focus();
			}
		}
}

// Deactivate cloak -->
