//
// Requires global definintions of variables ns4, ns6, ie4 and ie5
//
// Normally this file is included in the standard templates of a Skanska web site.
//
// Created by Anders Bouvin, Skanska IT Solutions
//


var ns4 = false;
var ns6 = false;
var ie4 = false;
var ie5 = false;
	

// Testing browser type and version and setting some variables accordingly
if(strBrowserGroup == 'ns4')
	ns4 = true;
else if(strBrowserGroup == 'ns6')
	ns6 = true;
else if(strBrowserGroup == 'ie4')
	ie4 = true;
else if(strBrowserGroup == 'ie5')
	ie5 = true;


// Opens a div, inserts som HTML and places it at position intX, intY.
function ShowPullupMenu(strHTML, intLeft, intHeight)
{
	var objPopupElement;
	var intDeltaX = 0;
	var intDeltaY = 0;
	
	//alert(fncGetWindowHeight() + '\n' + intLeft + '\n' + intHeight);
	
	objPopupElement = fncGetObj('objBottomMenuFlap');
	if(ns6) // Netscape 6 specific div/style features
	{
		objPopupElement.innerHTML = strHTML;
		intDeltaX = window.pageXOffset;
		intDeltaY = -3 + window.pageYOffset;
	}
	else if(ns4) // Netscape 4 specific layer features
	{
		objPopupElement.document.write(strHTML);
		objPopupElement.document.close();
		intDeltaX = 4 + window.pageXOffset;
		intDeltaY = 3 + window.pageYOffset;
	}
	else if(ie4 || ie5) // Explorer specific div/style features
	{
		objPopupElement.innerHTML = strHTML;
		intDeltaX = document.body.scrollLeft;
		intDeltaY = document.body.scrollTop;
	}
	else // Assume that the rest of the browsers handle div/style features like below
	{
		objPopupElement.innerHTML = strHTML;
		intDeltaX = document.body.scrollLeft;
		intDeltaY = document.body.scrollTop;
	}
	fncSetObjPosY(objPopupElement, intLeft + intDeltaX);
	fncSetObjPosX(objPopupElement, fncGetWindowHeight() - intHeight + intDeltaY);
	fncShowObj(objPopupElement);
	//alert(fncGetObjHeight(objPopupElement));
}
	
	
// Hide and reset the popup div-tag.
function HidePullupMenu()
{
	var objPopupElement;
	objPopupElement = fncGetObj('objBottomMenuFlap');
	if(ns6) // Netscape 6 specific div/style features
	{
		objPopupElement.innerHTML = '';
	}
	else if(ns4) // Netscape 4 specific layer features
	{
		objPopupElement.document.writeln('');
		objPopupElement.document.close();
	}
	else if(ie4 || ie5) // Explorer specific div/style features
	{
		objPopupElement.innerHTML = '';
	}
	else // Assume that the rest of the browsers handle div/style features like below
	{
		objPopupElement.innerHTML = '';
	}
	fncHideObj(objPopupElement);
}


function AddFavorites()
{
	window.external.addFavorite(frameurl, document.title + ' ' + pagename);
}
