// JavaScript Document
var xmlHttp = createXmlHttpRequestObject(); 

// retrieves the XMLHttpRequest object
function createXmlHttpRequestObject() 
{	
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // if running Internet Explorer
  if(window.ActiveXObject)
  {
    try
    {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // if running Mozilla or other browsers
  else
  {
    try 
    {
      xmlHttp = new XMLHttpRequest();
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
 
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}


function handleServerResponse1(dText, whatUID, whatUIDContent) 
{
	
	whatDivCont = document.getElementById(dText);
	//whatDivCont.innerHTML = "<img border='0' src='fileadmin/template/main/images/ajax-loader.gif' class='ajaxGalleryLoader' />";			
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		if(titleArray1.item(0).firstChild)
		{
		var helloMessage1=titleArray1.item(0).firstChild.data;
		}
		
		
		var titleArray2 = xmlRoot.getElementsByTagName("obj2");
		if(titleArray2.item(0).firstChild)
		{
		var helloMessage2=titleArray2.item(0).firstChild.data;
		}
		
		var titleArray3 = xmlRoot.getElementsByTagName("obj3");
		if(titleArray3.item(0).firstChild)
		{
		var helloMessage3=titleArray3.item(0).firstChild.data;
		}
		
		var titleArray4 = xmlRoot.getElementsByTagName("obj4");
		if(titleArray4.item(0).firstChild)
		{
		var helloMessage4=titleArray4.item(0).firstChild.data;
		}
		
		var titleArray5 = xmlRoot.getElementsByTagName("obj5");
		if(titleArray5.item(0).firstChild)
		{
		var helloMessage5=titleArray5.item(0).firstChild.data;
		}
		
		
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
				
		if(helloMessage4.length>3) eval(helloMessage4);
		
		document.getElementById(whatCurnPlace).innerHTML=helloMessage1;
		if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
		{
			document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="block";
		}
		if(firstTimeLoadedThisContent==1)
		{
			
			firstTimeLoadedThisContent=0;
		}
									
		firstTimeLoadedThisContent=0;
		if(helloMessage2.length>3) eval(helloMessage2);
		
		if(whatUID + "" + whatUIDContent == recentHash[1] + "" + recentHash[2])
		{
			if(helloMessage5.length>3) eval(helloMessage5);
			
		}
						
		if(document.getElementById("controlStageBehaviour"))
		{
			
			cSB=document.getElementById("controlStageBehaviour");
			cSB.innerHTML=arrAllContent;
			
		}	
		if(arrAllContent[nextContentToLoad]==0 && nextContentToLoad<arrAllContent.length-1)
		{
			if(typeof(isLoadedContentThis)!="undefined") window.clearInterval(isLoadedContentThis);
			var isLoadedContentThis=window.setTimeout(function (){loadContentNext(nextContentToLoad)}, 10);
		}		
	}
  }
}


function loadContent(whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList)
{	
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
		
		var folderpath="fileadmin/template/main/php/";
		
		var date = new Date();
		var timestamp = date.getTime();	
		
		var params = "whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&maxListItem=" + maxListItem + "&whatForm=" + 1 + "&timestamp=" + timestamp;
		if(typeof(recentHash[6])!="undefined" && recentHash[6].substr(0,5)=="nList")
		{
			params +="&goToDeepLink=" + recentHash[5];
		}
		if(typeof(recentHash[6])!="undefined" && recentHash[6]=="newsletter")
		{
			params +="&whatStep=" + recentHash[4] + "&whatUIDDMS=" + recentHash[5];
		}
		
		xmlHttp.open("POST", folderpath + "contentAjax_xml.php", true);
		
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse1(objContainer, whatUID, whatUIDContent);
		}
		xmlHttp.send(params);
	
}

function loadContentScript(whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList)
{
	recentHash = window.location.hash;
		recentHash = recentHash.split("|");
		
		var folderpath="fileadmin/template/main/php/";
		
		var date = new Date();
		var timestamp = date.getTime();	
		
		var params = "whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&maxListItem=" + maxListItem + "&whatForm=" + 1 + "&timestamp=" + timestamp;
		if(typeof(recentHash[6])!="undefined" && recentHash[6].substr(0,5)=="nList")
		{
			params +="&goToDeepLink=" + recentHash[5];
		}
		
		xmlHttp.open("POST", folderpath + "contentAjax_xml.php", true);
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse50();
		}
		xmlHttp.send(params);
}


function handleServerResponse50() 
{		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray5 = xmlRoot.getElementsByTagName("obj5");
		var helloMessage5=titleArray5.item(0).firstChild.data;
		
		if(helloMessage5.length>3) eval(helloMessage5);
		
		
		if(arrAllContent[nextContentToLoad]==0 && nextContentToLoad<arrAllContent.length-1)
		{
			if(typeof(isLoadedContentThis)!="undefined") window.clearInterval(isLoadedContentThis);
			var isLoadedContentThis=window.setTimeout(function (){loadContentNext(nextContentToLoad)}, 10);
		}	
	}
  }
}


function handleServerResponse2() 
{		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
				
		if(helloMessage1.length>3)
		{
			eval(helloMessage1);		
		}
		loadContent(whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList, isLoadedThisContent);
	}
  }
}


function loadContentNext(whatOrderIs)
{
	
	var folderpath="fileadmin/template/main/php/";
		
	var date = new Date();
	var timestamp = date.getTime();
	
	var params ="whatOrderIs=" + whatOrderIs + "&timestamp=" + timestamp;
		
	xmlHttp.open("POST", folderpath + "contentNextAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse2();
	}
	xmlHttp.send(params);
}


function loadContentWithAnimArrow(whatWay, dText)
{
	
	if(typeof(startMin)!="undefined") delete startMin;
	if(typeof(endMax)!="undefined") delete endMax;
	whatDivCont = document.getElementById(dText);
	recentHash = window.location.hash;
	recentHash = recentHash.split("|");
	
	if(recentHash[1]=="54") return false;
	
		switch(whatWay)
		{
			case "next":
				nPlace=parseInt(recentHash[3].substr(6))+1;
			break;
			case "prev":
				nPlace=parseInt(recentHash[3].substr(6))-1;
			break;
		}
		if(recentHash[1]!="53")
		{
			if(nPlace==-1) return false;		
			if(nPlace==whatIsMaxListItem) return false;
		}
		if(recentHash[1]=="53")
		{
			if(nPlace==whatIsMaxListItem-1) return false;		
			if(nPlace==arrAllContent.length-1) return false;
		}
		
	
	whatMin=whatDivCont.offsetLeft;
	whatMax=nPlace*732*-1;
	
	if(typeof(contentSlideshowTimer)!="undefined")
	{
		window.clearInterval(contentSlideshowTimer);		
	}
	if(arrAllContent[nPlace]!=0)
	{
		if(whatMin!=whatMax)
		{		
			if(typeof(animationIsOn)=="undefined")
			{
				if(soundActiveOnClick==1)
				{
						callToActionscript();
				}
				var contentSlideshowTimer=window.setInterval(function() {moveContentNext(whatDivCont, whatMin, whatMax, contentSlideshowTimer, whatWay, nPlace)}, 10);
			}
		}
		else
		{
			return false;
		}
	}
	else
	{
		if(typeof(contentSlideshowTimer)=="undefined")
		{
			if(soundActiveOnClick==1)
			{
					//callToActionscript();
			}
		}
			loadContentWithAnim1(whatWay, dText, nPlace, recentHash[1], recentHash[2]);
	}	
}


function handleServerResponse20(whatWay, dText, nPlace) 
{		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray3 = xmlRoot.getElementsByTagName("obj3");
		var helloMessage3=titleArray3.item(0).firstChild.data;
		
		if(helloMessage3==1)
		{		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
		var titleArray2 = xmlRoot.getElementsByTagName("obj2");
		var helloMessage2=titleArray2.item(0).firstChild.data;
		
		loadContentWithAnim(whatWay, dText, nPlace, helloMessage1, helloMessage1, helloMessage2);
		}
		else
		{
			return false;
		}		
	
	}
  }
}



function loadContentWithAnim1(whatWay, dText, nPlace, whatUID, whatUIDContent)
{	
	var folderpath="fileadmin/template/main/php/";
	
	recentHash = window.location.hash;
	recentHash = recentHash.split("|");
		
	var date = new Date();
	var timestamp = date.getTime();
	
	var params ="whatWay=" + whatWay + "&whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent + "&timestamp=" + timestamp;
		
	xmlHttp.open("POST", folderpath + "contentNextAnimAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse20(whatWay, dText, nPlace);
	}
	xmlHttp.send(params);
}


function moveContentNext(bigObj, whatMin, whatMax, contentSlideshowTimer, whatWay, nPlace)
{
	if(typeof(startMin)=="undefined" && typeof(endMax)=="undefined")
	{
		startMin=whatMin;
		endMax=whatMax;
	}
	animationIsOn=1;	
	switch(whatWay)
	{
		case "next":
		step100=endMax-startMin;
		if(endMax-startMin<200)
		{
			startMin +=step100/5;			
		}
		else
		{
			startMin +=step100/2;	
		}
		
		if(startMin<=endMax+1)
		{
			startMin=endMax;
			window.clearInterval(contentSlideshowTimer);		
			
			
			delete animationIsOn;
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");			
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="none";
				
				if(BrowserDetect.browser=="Explorer")
				{
					document.getElementById(recentHash[3]).innerHTML="&nbsp;";
					arrAllContent[recentHash[3].substr(6)]=0;
				}
			}
			window.location.hash="!"+arrWhatStringHash[nPlace];
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			document.title = recentHash[0].substr(2) + " - " + " HALVORSMINDE";
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="block";
			}
			if(recentHash[1]=="54")
			{
				loadSearchContentScript(recentHash[4], recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
			else
			{
				loadContentScript(recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
		}	
		bigObj.style.left=startMin + "px";
		break;
		
		case "prev":
		step100=startMin-endMax;
		if((startMin-endMax)<200)
		{
			startMin -=step100/5;
		}
		else
		{
			startMin -=step100/2;
		}		
		if(startMin>=endMax-1)
		{
			startMin=endMax;
			window.clearInterval(contentSlideshowTimer);			
			delete animationIsOn;
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="none";
				if(BrowserDetect.browser=="Explorer")
				{
					document.getElementById(recentHash[3]).innerHTML="&nbsp;";
					arrAllContent[recentHash[3].substr(6)]=0;
				}
			}
			
			
			window.location.hash="!"+arrWhatStringHash[nPlace];
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			document.title = recentHash[0].substr(2) + " - " + " HALVORSMINDE";	
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="block";
			}
			if(recentHash[1]=="54")
			{
				loadSearchContentScript(recentHash[4], recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
			else
			{
				loadContentScript(recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
		}	
		bigObj.style.left=startMin + "px";
		break;
	}	
}


function handleServerResponse100() 
{
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		eval(helloMessage1);		
    } 
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}


function goToContentFromMedia(whatUID)
{
	var folderpath="fileadmin/template/main/php/";
		
		var date = new Date();
		var timestamp = date.getTime();	
		
		var params = "whatUID=" + whatUID + "&timestamp=" + timestamp;		
		
		xmlHttp.open("POST", folderpath + "contentAjaxFromMedia_xml.php", true);
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse100();
		}
		xmlHttp.send(params);
}


function loadContentWithAnim(whatWay, dText, nPlace, whatUID, whatUID, whatUIDContent)
{
	if(typeof(startMin)!="undefined") delete startMin;
	if(typeof(endMax)!="undefined") delete endMax;
	whatDivCont = document.getElementById(dText);
	recentHash = window.location.hash;
	recentHash = recentHash.split("|");
	
	if(whatUID!="53")
	{			
		if(nPlace==-1) return false;
		if(nPlace==whatIsMaxListItem) return false;
	}
	if(whatUID=="53")
	{	
		if(nPlace==whatIsMaxListItem-1) return false;
		if(nPlace==arrAllContent.length-1) return false;
	}
	
	
	whatMin=whatDivCont.offsetLeft;
	whatMax=nPlace*732*-1;
	
	if(typeof(contentSlideshowTimer)!="undefined")
	{
		window.clearInterval(contentSlideshowTimer);		
	}
	if(arrAllContent[nPlace]!=0)
	{
		if(whatMin!=whatMax)
		{
			if(whatMin>whatMax) whatWay="next";
			if(whatMin<whatMax) whatWay="prev";
			
				if(typeof(animationIsOn)=="undefined")
				{	
					if(soundActiveOnClick==1)
					{
						callToActionscript();
					}
					var contentSlideshowTimer=window.setInterval(function() {moveContentNext(whatDivCont, whatMin, whatMax, contentSlideshowTimer, whatWay, nPlace)}, 10);
				}
		}
		else
		{
			return false;
		}
	}
	else if(arrAllContent[nPlace]==0)
	{
		if(soundActiveOnClick==1)
		{
			callToActionscript();
		}
		loadContent1(whatUID, dText, maxListItem, whatUIDContent, "nPlace" + nPlace, whatMin, whatMax, whatWay);
	}	
}


function loadContentWithAnim3(whatWay, dText, whatPageInList, whatUID, whatUID, whatUIDContent, whatStringHashExtra)
{
	if(typeof(startMin)!="undefined") delete startMin;
	if(typeof(endMax)!="undefined") delete endMax;
	whatDivCont = document.getElementById(dText);
	recentHashExtra = whatStringHashExtra.split("|");
	
	if(whatUID!="53")
	{			
		if(whatPageInList==-1) return false;
		if(whatPageInList==whatIsMaxListItem) return false;
	}
	if(whatUID=="53")
	{	
		if(whatPageInList==whatIsMaxListItem-1) return false;
		if(whatPageInList==arrAllContent.length-1) return false;
	}
	
	
	whatMin=whatDivCont.offsetLeft;
	whatMax=whatPageInList*732*-1;
	
	if(typeof(contentSlideshowTimer)!="undefined")
	{
		window.clearInterval(contentSlideshowTimer);		
	}
	
	var folderpath="fileadmin/template/main/php/";
		
		var date = new Date();
		var timestamp = date.getTime();	
		
		var params = "whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&maxListItem=" + maxListItem + "&whatForm=" + 1 + "&timestamp=" + timestamp;
		if(typeof(recentHashExtra[2])!="undefined" && recentHashExtra[2].substr(0,5)=="nList")
		{
			params +="&goToDeepLink=" + recentHashExtra[1];
		}
		
		xmlHttp.open("POST", folderpath + "contentAjax_xml.php", true);
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse10(dText, whatUID, whatMin, whatMax, whatWay);
		}
		xmlHttp.send(params);
}



function loadNewsWithAnim(whatWay, dText, nPlace, whatUID, whatUID, whatUIDContent)
{
	if(typeof(startMin)!="undefined") delete startMin;
	if(typeof(endMax)!="undefined") delete endMax;
	whatDivCont = document.getElementById(dText);
	recentHash = window.location.hash;
	recentHash = recentHash.split("|");
			
	if(nPlace==-1) return false;
	
	whatMin=whatDivCont.offsetLeft;
	whatMax=nPlace*732*-1;
	
	if(typeof(contentSlideshowTimer)!="undefined")
	{
		window.clearInterval(contentSlideshowTimer);		
	}
	if(arrAllContent[nPlace]!=0)
	{
		if(whatMin!=whatMax)
		{
			if(whatMin>whatMax) whatWay="next";
			if(whatMin<whatMax) whatWay="prev";
		
			if(typeof(animationIsOn)=="undefined")
			{
				var contentSlideshowTimer=window.setInterval(function() {moveContentNext(whatDivCont, whatMin, whatMax, contentSlideshowTimer, whatWay, nPlace)}, 10);
			}
		}
		else
		{
			return false;
		}
	}
	else if(arrAllContent[nPlace]==0)
	{
			loadNews1(whatUID, dText, maxListItem, whatUIDContent, "nPlace" + nPlace, whatMin, whatMax, whatWay);
	}
}


function loadContent1(whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList, whatMin, whatMax, whatWay)
{	
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
		
		var folderpath="fileadmin/template/main/php/";
		
		var date = new Date();
		var timestamp = date.getTime();	
		
		var params = "whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&maxListItem=" + maxListItem + "&whatForm=" + 1 + "&timestamp=" + timestamp;
		
		
		xmlHttp.open("POST", folderpath + "contentAjax_xml.php", true);
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse10(objContainer, whatUID, whatMin, whatMax, whatWay);
		}
		xmlHttp.send(params);	
}


function loadNews1(whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList, whatMin, whatMax, whatWay)
{	
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
		
		var folderpath="fileadmin/template/main/php/";
		
		var date = new Date();
		var timestamp = date.getTime();	
		
		var params = "whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&maxListItem=" + maxListItem + "&whatForm=" + 1 + "&timestamp=" + timestamp;
		
		
		xmlHttp.open("POST", folderpath + "contentAjax_xml.php", true);
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse10(objContainer, whatUID, whatMin, whatMax, whatWay);
		}
		xmlHttp.send(params);	
}


function handleServerResponse10(dText, whatUID, whatMin, whatMax, whatWay) 
{
	
	whatDivCont = document.getElementById(dText);
	//whatDivCont.innerHTML = "<img border='0' src='fileadmin/template/main/images/ajax-loader.gif' class='ajaxGalleryLoader' />";			
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
		var titleArray2 = xmlRoot.getElementsByTagName("obj2");
		var helloMessage2=titleArray2.item(0).firstChild.data;
		
		var titleArray3 = xmlRoot.getElementsByTagName("obj3");
		var helloMessage3=titleArray3.item(0).firstChild.data;
		
		var titleArray4 = xmlRoot.getElementsByTagName("obj4");
		var helloMessage4=titleArray4.item(0).firstChild.data;
		
		
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
		
		whatContentFilmBefore="myflash" + recentHash[1] + "" + recentHash[2];
		whatContentFilmBeforeOuterDiv=recentHash[3];
		
		window.location.hash="!"+helloMessage3;
		
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
				
		whatCurnPlace=recentHash[3];		
		
		if(helloMessage4.length>3) eval(helloMessage4);
		
		document.getElementById(whatCurnPlace).innerHTML=helloMessage1;
		
		if(helloMessage2.length>3) eval(helloMessage2);
				
		if(document.getElementById("controlStageBehaviour"))
		{
			
			cSB=document.getElementById("controlStageBehaviour");
			cSB.innerHTML=arrAllContent;
			
		}
		
		if(typeof(contentSlideshowTimer)!="undefined")
		{
			window.clearInterval(contentSlideshowTimer);		
		}
		
		if(arrAllContent[nextContentToLoad]==0 && nextContentToLoad<arrAllContent.length-1)
		{
			if(typeof(isLoadedContentThis)!="undefined") window.clearInterval(isLoadedContentThis);
			var isLoadedContentThis=window.setTimeout(function (){loadContentNext(nextContentToLoad)}, 10);
		}	
		
		if(typeof(animationIsOn)=="undefined")
		{
			
			var contentSlideshowTimer=window.setInterval(function() {moveContentNext1(whatDivCont, whatMin, whatMax, contentSlideshowTimer, whatWay, whatCurnPlace.substr(6))}, 10);
		}
	}
  }
}


function moveContentNext1(bigObj, whatMin, whatMax, contentSlideshowTimer, whatWay, nPlace)
{
	if(typeof(startMin)=="undefined" && typeof(endMax)=="undefined")
	{
		startMin=whatMin;
		endMax=whatMax;		
	}
	animationIsOn=1;
	switch(whatWay)
	{
		case "next":
		step100=endMax-startMin;
		if(endMax-startMin<200)
		{
			startMin +=step100/5;		
		}
		else
		{
			startMin +=step100/2;	
		}
		
		if(startMin<=endMax+1)
		{
			startMin=endMax;
			window.clearInterval(contentSlideshowTimer);
			
			delete animationIsOn;
			
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			document.title = recentHash[0].substr(2) + " - " + " HALVORSMINDE";
			
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="block";
			}
			if(document.getElementById(whatContentFilmBefore))
			{
				document.getElementById(whatContentFilmBefore).style.display="none";
				if(BrowserDetect.browser=="Explorer")
				{
					document.getElementById(whatContentFilmBeforeOuterDiv).innerHTML="&nbsp;";
					arrAllContent[whatContentFilmBeforeOuterDiv.substr(6)]=0;
				}
			}
			
			
			if(recentHash[1]=="54")
			{
				loadSearchContentScript(recentHash[4], recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
			else
			{
				loadContentScript(recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
		}	
		bigObj.style.left=startMin + "px";
		break;
		
		case "prev":
		step100=startMin-endMax;
		if((startMin-endMax)<200)
		{
			startMin -=step100/5;
		}
		else
		{
			startMin -=step100/2;
		}		
		if(startMin>=endMax-1)
		{
			startMin=endMax;
			window.clearInterval(contentSlideshowTimer);			
			delete animationIsOn;
			
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			document.title = recentHash[0].substr(2) + " - " + " HALVORSMINDE";	
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="block";
			}
			if(document.getElementById(whatContentFilmBefore))
			{
				document.getElementById(whatContentFilmBefore).style.display="none";
				if(BrowserDetect.browser=="Explorer")
				{
					document.getElementById(whatContentFilmBeforeOuterDiv).innerHTML="&nbsp;";
					arrAllContent[whatContentFilmBeforeOuterDiv.substr(6)]=0;
				}
			}
			if(recentHash[1]=="54")
			{
			loadSearchContentScript(recentHash[4], recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
			else
			{
				loadContentScript(recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			}
		}	
		bigObj.style.left=startMin + "px";
		break;
	}	
}


function overList(objS, bClassCheck, bClass, bClassNormal)
{
	if(objS.className==bClassCheck)
	{
		objS.className=bClassCheck;
	}
	else if(objS.className == bClassNormal)
	{
		objS.className=bClass;
	}
}

function outList(objS, bClassCheck, bClass, bClassNormal)
{	
	if(objS.className==bClassCheck)
	{
		objS.className=bClassCheck;
	}
	else if(objS.className == bClass)
	{
		objS.className=bClassNormal;
	}
}



function loadGallery(whatUID, objContainer)
{
	recentHash = window.location.hash;
	recentHash = recentHash.split("|");
	
	var folderpath="fileadmin/template/main/php/";
	
	var date = new Date();
	var timestamp = date.getTime();	
	
	var params = "whatUID=" + recentHash[1] + "&whatUIDA=" + whatUID + "&whatUIDContent=" + recentHash[2] + "&nPlace=" + recentHash[3] + "&objContainer=" + objContainer + "&whatForm=" + 2 + "&timestamp=" + timestamp;
		
	xmlHttp.open("POST", folderpath + "slideShowAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse4(objContainer);
	}
	xmlHttp.send(params);
}


function handleServerResponse4(objContainer) 
{
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
		var titleArray2 = xmlRoot.getElementsByTagName("obj2");
		var helloMessage2=titleArray2.item(0).firstChild.data;
		
		eval(helloMessage2);
		
		document.getElementById(objContainer).innerHTML=helloMessage1;
    } 
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}


function handleServerResponse3() 
{
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		eval(helloMessage1);
		
		if(arrAllContent[nextContentToLoad]==0 && nextContentToLoad<arrAllContent.length-1)
		{
			if(typeof(isLoadedContentThis)!="undefined") window.clearInterval(isLoadedContentThis);
			var isLoadedContentThis=window.setTimeout(function (){loadContentNext(nextContentToLoad)}, 10);
		}
    } 
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}


function startSlideshow1(whatWay, countMax, whatPosition, whatUID)
{
	whatPosition=parseInt(whatPosition);
	countMax=parseInt(countMax);
		
	var folderpath="fileadmin/template/main/php/";
	
	var date = new Date();
	var timestamp = date.getTime();	
	
	var params = "whatUID=" + whatUID + "&whatPosition=" + whatPosition + "&whatWay=" + whatWay + "&whatForm=" + 1 + "&timestamp=" + timestamp;
	
	xmlHttp.open("POST", folderpath + "slideShowAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse3();
	}
	xmlHttp.send(params);
	
}


function startSlideshow(curImg, whatPosition, imgWidth, imgHeight, countMax, whatUID)
{
	whatPosition=parseInt(whatPosition);
	if(!document.getElementById("theDivBack"))
	{
		var divBack=document.createElement("div");
		divBack.id="theDivBack";
		divBack.className="theDivBackClass";
		document.getElementsByTagName("body")[0].insertBefore(divBack, document.getElementsByTagName("body")[0].firstChild);
	}
	if(document.getElementById("theDivBack"))
	{
		divBack=document.getElementById("theDivBack");
	}
	if(!document.getElementById("theDivWhiteCont"))
	{
		var divWhiteCont=document.createElement("div");
		divWhiteCont.id="theDivWhiteCont";
		document.getElementsByTagName("body")[0].insertBefore(divWhiteCont, document.getElementsByTagName("body")[0].firstChild);
	}
	if(document.getElementById("theDivWhiteCont"))
	{
		divWhiteCont=document.getElementById("theDivWhiteCont");
	}
	if(!document.getElementById("theDivWhite"))
	{
		var divWhite=document.createElement("div");
		divWhite.id="theDivWhite";
		divWhite.className="theDivWhiteClass";
		divWhiteCont.appendChild(divWhite);
	}
	if(document.getElementById("theDivWhite"))
	{
		divWhite=document.getElementById("theDivWhite");
	}
	if(!document.getElementById("theDivWhiteInner"))
	{
		var divWhiteInner=document.createElement("div");
		divWhiteInner.id="theDivWhiteInner";
		divWhite.appendChild(divWhiteInner);
	}
	if(document.getElementById("theDivWhiteInner"))
	{
		divWhiteInner=document.getElementById("theDivWhiteInner");
	}
	
		divWhiteInner.innerHTML="<img border='0' src='fileadmin/template/main/images/ajax-loader.gif' class='ajaxGalleryLoader' />";	
	
		
	var divDisplayInfo=document.createElement("div");
	divDisplayInfo.id="theDivDisplayInfo";
	if(document.getElementById("theDivDisplayInfo"))
	{
		divDisplayInfo=document.getElementById("theDivDisplayInfo");
	}
	divDisplayInfo.style.display="none";
	divWhite.insertBefore(divDisplayInfo, divWhite.firstChild);
	divDisplayInfo.innerHTML="<div id='infoSlideShow'>Billede " + (whatPosition+1) + " af " + countMax + "</div><div id='closeSlideShow'><img border='0' src='fileadmin/template/main/images/slideShowClose.jpg' /></div>";
		
	var divDisplayArrows=document.createElement("div");
	divDisplayArrows.id="theDivDisplayArrows";
	if(document.getElementById("theDivDisplayArrows"))
	{
		divDisplayArrows=document.getElementById("theDivDisplayArrows");
	}
		
		divDisplayArrows.style.display="none";
		divDisplayArrows.innerHTML="<div id='arrSSLeft'><img border='0' src='fileadmin/template/main/images/slideShowPrev.png' onclick='startSlideshow1(\"prev\", \"" + countMax + "\", \"" + whatPosition + "\", \"" + whatUID + "\");' /></div><div id='arrSSRight'><img border='0' src='fileadmin/template/main/images/slideShowNext.png' onclick='startSlideshow1(\"next\", \"" + countMax + "\", \"" + whatPosition + "\", \"" + whatUID + "\");' /></div>";
	
		document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
if(keycode==39)
{
	startSlideshow1("next", countMax, whatPosition, whatUID);
}
else if(keycode==37)
{
	startSlideshow1("prev", countMax, whatPosition, whatUID);
}
}
	
		
		curWhiteWidth=divWhiteInner.offsetWidth;
		curWhiteHeight=divWhiteInner.offsetHeight;
		
		
			
		document.getElementById("closeSlideShow").onclick=function()
		{
			divBack.parentNode.removeChild(divBack);
			divWhiteCont.parentNode.removeChild(divWhiteCont);
			if(typeof(imgSlideshowTimer)!="undefined")
			{
				window.clearInterval(imgSlideshowTimer);		
			}
			delete whatStepW;
			delete whatStepH;
			delete isFinishedW;
			delete isFinishedH;
			divDisplayInfo.style.display="none";
			divDisplayArrows.style.display="none";
		}
		
		if(typeof(imgSlideshowTimer)!="undefined")
		{
			window.clearInterval(imgSlideshowTimer);		
		}
		
		var curImgLoads=new Image();
		curImgLoads.src=curImg;
		curImgLoads.onload=function()
		{
			var imgSlideshowTimer=window.setInterval(function() {resizeWhite(divWhiteInner, divWhite, curWhiteWidth, curWhiteHeight, imgWidth, imgHeight, imgSlideshowTimer, curImg, divDisplayInfo, divDisplayArrows)}, 10);
		}
		
	
}


function resizeWhite(d1, d1out, d1WS, d1HS, imgW, imgH, curIntervalName, curImg, divDInfo, divDArrows)
{
	if(typeof(whatStepW)=="undefined")
	{
		whatStepW=d1WS;		
		//alert(whatStepW + " :: " + d1WS);
	}
	if(typeof(whatStepH)=="undefined")
	{
		whatStepH=d1HS;
	}
	if(imgW>d1WS)
	{
		step1=parseInt(imgW)-parseInt(whatStepW);
	
		whatStepW +=step1/10;		
		if(whatStepW>=(imgW-1))
		{
			whatStepW=imgW;
			isFinishedW=1;
		}
		whatStepW1=parseInt(whatStepW)+10;
		d1.style.width = parseInt(whatStepW) + "px";
		d1out.style.width = whatStepW1 + "px";
	}
	if(imgW<d1WS)
	{
		step1=parseInt(whatStepW)-parseInt(imgW);
	
		whatStepW -=step1/10;
		
		if(whatStepW<=(parseInt(imgW)+1))
		{
			whatStepW=imgW;
			isFinishedW=1;
		}	
		
		whatStepW1=parseInt(whatStepW)+10;
		d1.style.width = parseInt(whatStepW) + "px";
		d1out.style.width = whatStepW1 + "px";
	}
	
	if(imgH>d1HS)
	{
		step2=parseInt(imgH)-parseInt(whatStepH);
	
		whatStepH +=step2/10;
		
		if(whatStepH>=(imgH-1))
		{
			whatStepH=imgH;
			isFinishedH=1;
		}
		whatStepH1=parseInt(whatStepH)+10;
		d1.style.height = parseInt(whatStepH) + "px";
		d1out.style.height = whatStepH1 + "px";
	}
	
	if(imgH<d1HS)
	{
		step2=parseInt(whatStepH)-parseInt(imgH);
	
		whatStepH -=step2/10;
		
		if(whatStepH<=(parseInt(imgH)+1))
		{
			whatStepH=imgH;
			isFinishedH=1;
		}
		whatStepH1=parseInt(whatStepH)+10;
		d1.style.height = parseInt(whatStepH) + "px";
		d1out.style.height = whatStepH1 + "px";
	}
	
	if(parseInt(imgW)==parseInt(d1WS))
	{
		whatStepW=imgW;
		isFinishedW=1;
		
		whatStepW1=parseInt(whatStepW)+10;
		d1.style.width = parseInt(whatStepW) + "px";
		d1out.style.width = whatStepW1 + "px";
	}
	
	if(parseInt(imgH)==parseInt(d1HS))
	{
		whatStepH=imgH;
		isFinishedH=1;
		
		whatStepH1=parseInt(whatStepH)+10;
		d1.style.height = parseInt(whatStepH) + "px";
		d1out.style.height = whatStepH1 + "px";
	}
	
	if(typeof(isFinishedW)!="undefined" && isFinishedW==1 && typeof(isFinishedH)!="undefined" && isFinishedH==1)
	{
		window.clearInterval(curIntervalName);		
		d1.innerHTML="<img border='0' src='" + curImg + "' />";
		divDInfo.style.width=whatStepW + "px";
		divDInfo.style.top = whatStepH + "px";
		divDInfo.style.display = "block";
		
		divDArrows.style.width=whatStepW + "px";
		divDArrows.style.display = "block";
		d1.appendChild(divDArrows);	
		
		delete whatStepW;
		delete whatStepH;
		delete isFinishedW;
		delete isFinishedH;
	}
}


function loadEmployerContent(whatUID, whatUIDContent, whatPageInList, whatUIDA, objContainer, whatObj)
{
	var folderpath="fileadmin/template/main/php/";
	
	var date = new Date();
	var timestamp = date.getTime();	
	
	var params = "whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&whatForm=" + 1 + "&whatUIDA=" + whatUIDA + "&objContainer="+ objContainer + "&timestamp=" + timestamp;
		
	xmlHttp.open("POST", folderpath + "employerAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse5(objContainer, whatUID);
	}
	xmlHttp.send(params);
}


function loadEmployerContent1(whatWay, objContainer)
{
	recentHash = window.location.hash;
	recentHash = recentHash.split("|");
	
	var folderpath="fileadmin/template/main/php/";
	
	var date = new Date();
	var timestamp = date.getTime();	
	
	var params = "whatUID=" + recentHash[1] + "&whatUIDContent=" + recentHash[2] +"&nPlace=" + recentHash[3] + "&whatForm=" + 1 + "&whatUIDA=" + recentHash[5] + "&timestamp=" + timestamp;
	params +="&whatWay1=" + whatWay;
	
	xmlHttp.open("POST", folderpath + "employerAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse5('blockAInfo', recentHash[1]);
	}
	xmlHttp.send(params);
}


function handleServerResponse5(dText, whatUID) 
{
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		whatDivCont = document.getElementById(dText);
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
		var titleArray2 = xmlRoot.getElementsByTagName("obj2");
		var helloMessage2=titleArray2.item(0).firstChild.data;
		
		var titleArray3 = xmlRoot.getElementsByTagName("obj3");
		var helloMessage3=titleArray3.item(0).firstChild.data;
		
		whatDivCont.innerHTML=helloMessage1;
		
		if(helloMessage2.length>3) eval(helloMessage2);
		
		window.location.hash="!"+helloMessage3;
		
		if(arrAllContent[nextContentToLoad]==0 && nextContentToLoad<arrAllContent.length-1)
		{
			if(typeof(isLoadedContentThis)!="undefined") window.clearInterval(isLoadedContentThis);
			var isLoadedContentThis=window.setTimeout(function (){loadContentNext(nextContentToLoad)}, 10);
		}
		
    } 
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}


function clearValue(obj)
{
	if(obj.value=="Skriv søgeord her...")
	{
		obj.value="";
	}
}

function setValue(obj)
{
	if(obj.value=="" || obj.value.length<3)
	{
		obj.value="Skriv søgeord her...";
	}
}

function validateFormSubmit(obj, whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList)
{
	curForm=document.getElementsByTagName('form')[0];
	curObj=document.getElementById(obj);
	if(curObj.value=="")
	{
		alert("Search criteria may not be an empty string");
		return false;
	}
	else if(curObj.value.length<3)
	{
		alert("Search word must have at least 3 characters!");
		return false;
	}
	else if(curObj.value!="" && curObj.value.length>=3)
	{
		if(curObj.value=="Skriv søgeord her...")
		{
			alert("You are not provided to use this text as search criteria \"Skriv søgeord her... \" ");
			return false;
		}
		if(curObj.value!="Skriv søgeord her...")
		{
			loadSearchContent(curObj.value, whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList);
		}
	}
}


function validateFormSubmitContent(whatForm, obj, whatUID)
{
	curForm=document.getElementsByTagName('form')[0];
	curObj=document.getElementById(obj);
	if(curObj.value=="")
	{
		alert("Search criteria may not be an empty string");
		return false;
	}
	else if(curObj.value.length<3)
	{
		alert("Search word must have at least 3 characters!");
		return false;
	}
	else if(curObj.value!="" && curObj.value.length>=3)
	{
		if(curObj.value=="Skriv søgeord her...")
		{
			alert("You are not provided to use this text as search criteria \"Skriv søgeord her... \" ");
			return false;
		}
		if(curObj.value!="Skriv søgeord her...")
		{
			whatForm.submit();
		}
	}
}


function loadSearchContentScript(searchTerm, whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList)
{
	var folderpath="fileadmin/template/main/php/";
	
	var date = new Date();
	var timestamp = date.getTime();	
	
	var params = "sword=" + searchTerm + "&whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&whatForm=" + 1 + "&timestamp=" + timestamp;
	
	
	xmlHttp.open("POST", folderpath + "contentSearchAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse50();
	}
	xmlHttp.send(params);
}


function loadSearchContent(searchTerm, whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList)
{
	var folderpath="fileadmin/template/main/php/";
	
	var date = new Date();
	var timestamp = date.getTime();	
	
	var params = "sword=" + searchTerm + "&whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&whatForm=" + 1 + "&timestamp=" + timestamp;
	
	xmlHttp.open("POST", folderpath + "contentSearchAjax_xml.php", true);
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse6(objContainer, whatUID, whatPageInList, whatUIDContent);
	}
	xmlHttp.send(params);
}


function handleServerResponse6(dText, whatUID, whatPageInList, whatUIDContent) 
{
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		whatDivCont = document.getElementById(dText);
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
		var titleArray2 = xmlRoot.getElementsByTagName("obj2");
		var helloMessage2=titleArray2.item(0).firstChild.data;
		
		var titleArray3 = xmlRoot.getElementsByTagName("obj3");
		var helloMessage3=titleArray3.item(0).firstChild.data;
		
		var titleArray5 = xmlRoot.getElementsByTagName("obj5");
		var helloMessage5=titleArray5.item(0).firstChild.data;
		
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
				
		document.getElementById("nPlace" + whatPageInList.substr(6)).innerHTML=helloMessage1;
				
		if(helloMessage2.length>3) eval(helloMessage2);
		
				
		if(whatUID + "" + whatUIDContent == recentHash[1] + "" + recentHash[2])
		{
			if(helloMessage5.length>3) eval(helloMessage5);
		}
		
				
		if(arrAllContent[nextContentToLoad]==0 && nextContentToLoad<arrAllContent.length-1)
		{
			if(typeof(isLoadedContentThis)!="undefined") window.clearInterval(isLoadedContentThis);
			var isLoadedContentThis=window.setTimeout(function (){loadContentNext(nextContentToLoad)}, 10);
		}
		
		
		if(typeof(startMin)!="undefined") delete startMin;
	if(typeof(endMax)!="undefined") delete endMax;
	
	
	
	whatMin=whatDivCont.offsetLeft;
	whatMax=whatPageInList.substr(6)*732*-1;
	
	if(recentHash[1]=="54")
	{
		window.location.hash="!"+helloMessage3; 
		return false;
	}
	
	if(typeof(contentSlideshowTimer)!="undefined")
	{
		window.clearInterval(contentSlideshowTimer);		
	}
	
		if(whatMin!=whatMax)
		{
			if(whatMin>whatMax) whatWay="next";
			if(whatMin<whatMax) whatWay="prev";
			
				if(typeof(animationIsOn)=="undefined")
				{
					
					var contentSlideshowTimer=window.setInterval(function() {moveContentNextSearch(whatDivCont, whatMin, whatMax, contentSlideshowTimer, whatWay, whatPageInList.substr(6))}, 10);
				}
		}
		else
		{
			return false;
		}
	
		
    } 
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}



function moveContentNextSearch(bigObj, whatMin, whatMax, contentSlideshowTimer, whatWay, nPlace)
{
	if(typeof(startMin)=="undefined" && typeof(endMax)=="undefined")
	{
		startMin=whatMin;
		endMax=whatMax;		
	}
	animationIsOn=1;
	switch(whatWay)
	{
		case "next":
		step100=endMax-startMin;
		if(endMax-startMin<200)
		{
			startMin +=step100/5;		
		}
		else
		{
			startMin +=step100/2;	
		}
		
		if(startMin<=endMax+1)
		{
			startMin=endMax;
			window.clearInterval(contentSlideshowTimer);
			
			delete animationIsOn;
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="none";
				if(BrowserDetect.browser=="Explorer")
				{
					document.getElementById(recentHash[3]).innerHTML="&nbsp;";
					arrAllContent[recentHash[3].substr(6)]=0;
				}
			}
			window.location.hash="!"+arrWhatStringHash[nPlace];
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			document.title = recentHash[0].substr(1) + " - " + " HALVORSMINDE";
			
			loadSearchContentScript(recentHash[4], recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
			
		}	
		bigObj.style.left=startMin + "px";
		break;
		
		case "prev":
		step100=startMin-endMax;
		if((startMin-endMax)<200)
		{
			startMin -=step100/5;
		}
		else
		{
			startMin -=step100/2;
		}		
		if(startMin>=endMax-1)
		{
			startMin=endMax;
			window.clearInterval(contentSlideshowTimer);			
			delete animationIsOn;
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			
			if(document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]))
			{
				document.getElementById("myflash" + recentHash[1] + "" + recentHash[2]).style.display="none";
				if(BrowserDetect.browser=="Explorer")
				{
					document.getElementById(recentHash[3]).innerHTML="&nbsp;";
					arrAllContent[recentHash[3].substr(6)]=0;
				}
			}
			
			
			window.location.hash="!"+arrWhatStringHash[nPlace];
			
			recentHash = window.location.hash;
			recentHash = recentHash.split("|");
			document.title = recentHash[0].substr(2) + " - " + " HALVORSMINDE";	
			
			loadSearchContentScript(recentHash[4], recentHash[1], 'mainStagePage', maxListItem, recentHash[2], recentHash[3]);
		}	
		bigObj.style.left=startMin + "px";
		break;
	}	
}


function fPrintCont()
{
	
	recentHash = window.location.hash;
	
	if(typeof(recentHash)=="undefined" || recentHash=="")
	{
		var winW=732;
	if(document.getElementById("mainStagePage"))
	{
		if(document.getElementById("mainStagePage").getElementsByTagName("object").length>0)
		{			
			return false;
		}
		
		var curTxtDiv="<div class='nextLoadedContentClass'>" + document.getElementById("mainStagePage").innerHTML + "</div>";
		contDiv="<div id='middle'>" + curTxtDiv + "</div>";
		winFinal=winW+23;
		if(BrowserDetect.browser=="Explorer")
		{
			winFinal=winW+25;
		}
		var a = window. open('', '', 'scrollbars=yes, width=' + winFinal + ', height=384');
		a.document.open("text/html");
		a.document.write("<html><head><script type='text/javascript'>function initAll(){ document.getElementById('finalDiv').style.display = 'block'; } window.onload=initAll;</script><link rel='stylesheet' href='fileadmin/template/main/css/style_print.css' media='all' /></head><body class='body2'><div id='finalDiv' style='display: none;'>" + contDiv + "</div></body></html>");
		a.document.close();
		//a.print();
	}
	}
	else
	{
	
	recentHash = recentHash.split("|");
	
	
	if(recentHash[1]==12 || recentHash[1]==55)
	{	
		return false;
	}
	
	var winW=732;
	if(document.getElementById(recentHash[3]) && (document.getElementById("mainStagePage").offsetLeft>=((parseInt(recentHash[3].substr(6))*732*-1)-5) && document.getElementById("mainStagePage").offsetLeft<=((parseInt(recentHash[3].substr(6))*732*-1)+5)))
	{
		if(document.getElementById(recentHash[3]).getElementsByTagName("object").length>0)
		{			
			return false;
		}
		
		var curTxtDiv="<div class='nextLoadedContentClass'>" + document.getElementById(recentHash[3]).innerHTML + "</div>";
		contDiv="<div id='middle'>" + curTxtDiv + "</div>";
		winFinal=winW+23;
		if(BrowserDetect.browser=="Explorer")
		{
			winFinal=winW+25;
		}
		var a = window. open('', '', 'scrollbars=yes, width=' + winFinal + ', height=384');
		a.document.open("text/html");
		a.document.write("<html><head><script type='text/javascript'>function initAll(){ document.getElementById('finalDiv').style.display = 'block'; } window.onload=initAll;</script><link rel='stylesheet' href='fileadmin/template/main/css/style_print.css' media='all' /></head><body class='body2'><div id='finalDiv' style='display: none;'>" + contDiv + "</div></body></html>");
		a.document.close();
		//a.print();
	}
	}
																																
}

function revalidateDMSForm(input1, input2, whatUID, whatUIDContent)
{
	var curField1=document.getElementById(input1);
	var curField2=document.getElementById(input2);
	
	var errString="Manglende felter:";
	var counter=0;
	
	var txt=/^\D+$/g;
	var resTxt=curField1.value.match(txt);
	if(resTxt==null)
	{
		errString +="\nNavn";
	}
	else
	{
		counter++;
	}
	
	var txt1 = /^([a-zæøåA-ZÆØÅ0-9_\.\-])+\@(([a-zæøåA-ZÆØÅ0-9\-])+\.)+([a-zæøåA-ZÆØÅ0-9]{2,4})+/;
	var resTxt1=curField2.value.match(txt1);
	if(resTxt1==null)
	{
		errString +="\nEmail";
	}
	else
	{
		counter++;
	}
	if(counter==2)
	{
		var folderpath="fileadmin/template/main/php/";
	
		var date = new Date();
		var timestamp = date.getTime();	
		
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
		
		
		var params = "whatPID=" + 56 + "&whatName=" + curField1.value +"&whatMail=" + curField2.value + "&whatForm=" + 2 + "&timestamp=" + timestamp;
		params +="&whatUID=" + recentHash[1] + "&whatUIDContent=" + recentHash[2] + "&nPlace=" + recentHash[3] + "&stepInNL=2"+ "&whatStep=" + 2;
		
		xmlHttp.open("POST", folderpath + "dmSupscriptionAjax_xml.php", true);
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse22();
		}
		xmlHttp.send(params);
	}
	else
	{
		alert(errString);
	}
	
}


function getStyle(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}
	else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = oElm.currentStyle[strCssRule];
	}
	return strValue;
}



function revalidateDMSForm1(input2, whatUID, whatUIDContent)
{
	var curField2=document.getElementById(input2);
	
	var errString="Manglende felter:";
	var counter=0;
	
	var txt1 = /^([a-zæøåA-ZÆØÅ0-9_\.\-])+\@(([a-zæøåA-ZÆØÅ0-9\-])+\.)+([a-zæøåA-ZÆØÅ0-9]{2,4})+/;
	var resTxt1=curField2.value.match(txt1);
	if(resTxt1==null)
	{
		errString +="\nEmail";
	}
	else
	{
		counter++;
	}
	if(counter==1)
	{
		var folderpath="fileadmin/template/main/php/";
	
		var date = new Date();
		var timestamp = date.getTime();	
		
		recentHash = window.location.hash;
		recentHash = recentHash.split("|");
		
		var params = "whatPID=" + 56 + "&whatMail=" + curField2.value + "&whatForm=" + 3 + "&timestamp=" + timestamp;
		params +="&whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&whatStep=5" + "&nPlace=" + recentHash[3];
		
		xmlHttp.open("POST", folderpath + "dmSupscriptionAjax_xml.php", true);
		if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
		xmlHttp.onreadystatechange =function()
		{
			handleServerResponse22();
		}
		xmlHttp.send(params);
	}
	else
	{
		alert(errString);
	}
	
}


function loadDMSupscriptionContent(whatUID, objContainer, maxListItem, whatUIDContent, whatPageInList, whatStep, whatUIDDMS)
{
	var folderpath="fileadmin/template/main/php/";
	
	var date = new Date();
	var timestamp = date.getTime();	
	
	var params = "whatUID=" + whatUID + "&whatUIDContent=" + whatUIDContent +"&nPlace=" + whatPageInList + "&maxListItem=" + maxListItem + "&whatForm=" + 1 + "&whatStep=" + whatStep +"&whatUIDDMS=" + whatUIDDMS + "&timestamp=" + timestamp;
	
	xmlHttp.open("POST", folderpath + "dmSupscriptionAjax_xml.php", true);
	
	if(BrowserDetect.browser=="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//xmlHttp.setRequestHeader("Content-Length", params.length);
		//xmlHttp.setRequestHeader("Connection", "Keep-Alive");
		}
		
		if(BrowserDetect.browser!="Safari")
		{
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-Length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		}
	
	
	xmlHttp.onreadystatechange =function()
	{
		handleServerResponse55(objContainer, whatUID);
	}
	xmlHttp.send(params);
}



function handleServerResponse22() 
{		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
				
		if(helloMessage1.length>3)
		{
			eval(helloMessage1);		
		}		
	}
  }
}


function handleServerResponse55(dText, whatUID) 
{
		
  if (xmlHttp.readyState == 4) 
  {
	if (xmlHttp.status == 200) 
    {
		whatDivCont = document.getElementById(dText);
		var xmlResponse = xmlHttp.responseXML;
		  
		if(!xmlResponse || !xmlResponse.documentElement)
		{
			throw("Invalid XML structure:\n" + xmlHttp.responseText);
		}
		  
		var rootNodeName=xmlResponse.documentElement.nodeName;
		  
		if(rootNodeName == "parserror")
		{
			throw("Invalid XML structure");
		}
	  	xmlRoot=xmlResponse.documentElement;
		
		var titleArray1 = xmlRoot.getElementsByTagName("obj1");
		var helloMessage1=titleArray1.item(0).firstChild.data;
		
		var titleArray3 = xmlRoot.getElementsByTagName("obj3");
		var helloMessage3=titleArray3.item(0).firstChild.data;
			
			
		whatDivCont.innerHTML=helloMessage1;
		
		window.location.hash="!"+helloMessage3;
		
    } 
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}





function callToActionscript() 
{
     document.getElementById("flashVolume").sendToActionscript();
}

function soundPlusActiveOnClick()
{
	soundActiveOnClick=1;
}

function soundUnActiveOnClick()
{
	soundActiveOnClick=0;
}
