var siteWidth = 950;// sidbredd: 874; totalt med partners: 1074;
var linkBlueColor 	 = '#164764';
var linkBlueBGColor1 = '#242038';
var linkBlueBGColor2 = '#545068';

window.onresize = resize;
function resize() {
	adjust();
}
function getLeftPos() {
	var screenWidth;
	var leftPosMin = 30;
	if (document.body.offsetWidth)		// The IE-way enligt källor...
		screenWidth = document.body.offsetWidth;
	else if (window.innerWidth)			// The NS-way enligt samma källor...
		screenWidth = window.innerWidth;
	else
		return leftPosMin;
	return Math.max(leftPosMin, Math.round( (screenWidth/2) - (siteWidth/2)) );
}
// Called when site is first loaded
function init() {
	adjust();
	/*
	if (document.getElementById)
		document.getElementById('mainFrame').style.visibility = 'visible';
	else
		alert('ej stöd för getElById!');
		*/
}

// Called whenever the site needs to move...
function adjust() {
	if (document.getElementById)
		document.getElementById('mainFrame').style.left = getLeftPos()+'px';
	//else
		//alert('ej stöd för getElById!');
}

function hideSubMenu(id) {
	if (document.getElementById)
		document.getElementById('subMenu'+id).style.visibility = 'hidden';
	//else
		//alert('ej stöd för getElById!');
}

function showSubMenu(id) {
	if (document.getElementById)
		document.getElementById('subMenu'+id).style.visibility = 'visible';
	//else
		//alert('ej stöd för getElById!');
}



function menuLevel2Hover(linkId) {
	if (document.getElementById) {
		document.getElementById(linkId).style.color = 'white';
		//document.getElementById(linkId).style.textDecoration = 'underline';
		document.getElementById(linkId+'Container').style.backgroundColor = linkBlueBGColor2;
		document.getElementById(linkId+'Container').style.cursor = 'pointer';
	}// else
		//alert('ej stöd för getElById!');
}
function menuLevel2Restore(linkId) {
	if (document.getElementById) {
		document.getElementById(linkId).style.color = linkBlueColor;
		//document.getElementById(linkId).style.textDecoration = 'none';
		document.getElementById(linkId+'Container').style.background = 'none';
		document.getElementById(linkId+'Container').style.cursor = 'default';
	}// else
		//alert('ej stöd för getElById!');
}
function menuLevel2Click(siteId) {
	siteFrame.location.href = 'iframeSite.php?siteId='+siteId;
}

function menuLevel1Hover(linkId) {
	if (document.getElementById) {
		document.getElementById(linkId).style.color = 'white';
		//document.getElementById(linkId).style.textDecoration = 'underline';
		document.getElementById(linkId+'Container').style.backgroundColor = linkBlueBGColor1;
		document.getElementById(linkId+'Container').style.cursor = 'pointer';
	}// else
		//alert('ej stöd för getElById!');
}
function menuLevel1Restore(linkId) {
	menuLevel2Restore(linkId);
}
function menuLevel1Click(siteId) {
	menuLevel2Click(siteId);
}
