var lastactive = "";
var lastHash = location.hash.replace("#", "");
var isIE = (browserName=="Microsoft Internet Explorer")? true : false;
var hIframe=null;
var locationId = "";

if(isIE) {
	hIframe = document.createElement('iframe');
	hIframe.setAttribute("id","hIframe");
	hIframe.setAttribute("name","hIframe");
	hIframe.setAttribute("height","100");
	hIframe.setAttribute("width","100");
	hIframe.setAttribute("src","/iefix.asp?"+location.hash.replace("#",""));
	hIframe.setAttribute("style","display: none; position: absolute; top:0px; left: 0px;");
}
function getLocationInformation(page) {
	commonAjax("/functions/getlocationpage.wu?LocationId=" + locationId + "&p=" + page, "locationDescription", "locationDescription","Effect.ScrollTo('menu-item-"+page.toLowerCase()+"');");
}
/*
function toggleActive(id) {
	buttons = document.getElementById("aboutMenu").getElementsByTagName("a");
	if(buttons!=null) {
		for(var i=0; i<buttons.length; i++) {
			if(buttons[i].title==id&&buttons[i].childNodes[0].src.indexOf("_active.jpg")==-1) {
				buttons[i].childNodes[0].src=buttons[i].childNodes[0].src.replace(".jpg","_active.jpg");
			} else {
				buttons[i].childNodes[0].src=buttons[i].childNodes[0].src.replace("_active.jpg",".jpg");
			}
		}
	}
}
*/
function loadUrl()	{
		if(lastHash.toLowerCase()==location.hash.toLowerCase()||location.hash=="") {
			return;
		}
		lastHash = location.hash;
		if(location.hash.toLowerCase()=="#kommentarer") {
			return;
		}
		if(isIE) { hIframe.setAttribute("src","/iefix.asp?" + location.hash.replace("#","")); }
		getLocationInformation(location.hash.replace("#",""));
		initState(location.hash);
}
function initState(strHash) {
	if(isIE) {
		document.body.appendChild(hIframe);
		document.getElementById("hIframe").style.display = "none";
		hIframe.setAttribute("src","/iefix.asp?"+location.hash.replace("#",""));
	}
	/*
	if(location.hash==""&&lastHash=="")
		location.hash="Information";
	else if(location.hash=="")
		location.hash = lastHash.replace("#","");
		*/
	loadUrl();
	setInterval(loadUrl, 100);
}
function StartFlash() {
	var header = o("locationImageContainer");
	var image = o("locationImage");
	var heightSWF = header.offsetHeight;
	var urlSWF = "/images/content/location/fader.swf?v=1.2.1";
	var genHTML = "";
	genHTML = '<object type="application/x-shockwave-flash" data="'+urlSWF+'" width="480" height="'+heightSWF+'" id="VideoPlayback">\n';
	genHTML += '<param name="movie" value="'+urlSWF+'">\n';
	genHTML += '<param name="allowScriptAcess" value="sameDomain">\n';
	genHTML += '<param name="scale" value="noScale">\n';
	genHTML += '<param name="salign" value="TL">\n';
	genHTML += '<param name="wmode" value="opaque">\n';
	genHTML += '<param name="bgcolor" value="#FFFFFF">\n';
	genHTML += '<param name="FlashVars" value="playerMode=embedded&LocationId=' + locationId + '">\n';
	if(isIE) genHTML += '<embed type="application/x-shockwave-flash" src="' + urlSWF + '" quality="best" wmode="opaque" bgcolor="#FFFFFF" flashvars="playerMode=embedded&LocationId=' + locationId + '" width="480" height="' + heightSWF + '"></embed>\n';
	genHTML += '</object>';
	header.style.height = heightSWF + "px";
	header.style.backgroundImage = "url('" + image.src  + "')";
	header.style.backgroundRepeat = "no-repeat";
	header.innerHTML = genHTML;
}
