var page_url = 'http://www.mfru.org/'; // full path leading up to hash;
	var current_url_w_hash = page_url + window.location.hash;
	function TrackHash() {
		if (document.location != page_url + current_url_w_hash) {
			window.location = document.location;
			/*var hashspit=window.location.hash.substr(1);
			hashspit=hashspit.split("_");			
			//document.getElementById("hash").innerHTML=window.location.hash+"   "+hashspit[0]+".xml   "+hashspit[0]+"_"+hashspit[1]+".xsl param:"+hashspit[2];	
			displayResultServer('data/slo/'+hashspit[0],hashspit[1],hashspit[2]); */
			updatePage();
		}
		return false;
	}
	
	if ("onhashchange" in window) { // event supported?
 	   	window.onhashchange = updatePage; /*function () {
  	   	//hashChanged(window.location.hash);
		if (window.location.hash=="") window.location.hash="events_all";
		var hashspit=window.location.hash.substr(1);
		hashspit=hashspit.split("_");			
		//document.getElementById("hash").innerHTML=window.location.hash+" onhashchange  "+hashspit[0]+".xml   "+hashspit[0]+"_"+hashspit[1]+".xsl param:"+hashspit[2];	
		//displayResultServer(hashspit[0],hashspit[1],hashspit[2]);
		displayResultServer('data/slo/'+hashspit[0],hashspit[1],hashspit[2]);
		window.scrollTo(0,0)		
    	}*/
	}
	else var RunTabs = setInterval('TrackHash()', 1000);
	
	function updatePage()
	{
		if (window.location.hash=="") window.location.hash="news_front";
		var hashspit=window.location.hash.substr(1);
		hashspit=hashspit.split("_");			
		//document.getElementById("hash").innerHTML=window.location.hash+" onhashchange  "+hashspit[0]+".xml   "+hashspit[0]+"_"+hashspit[1]+".xsl param:"+hashspit[2];	
		//displayResultServer(hashspit[0],hashspit[1],hashspit[2]);
		displayResultServer(data_path+hashspit[0],hashspit[1],hashspit[2]);
		window.scrollTo(0,0)		
	}
	
	function mfru_search()
	{
		var input = document.getElementById('mfru_search_input');
		window.location.hash="events_search_"+input.value;
	}
	
	function KeyPressed(event){
 		 if(event.keyCode == "13")
   	 	mfru_search();
	}

function loadXMLDoc(dname)
{
	if (window.XMLHttpRequest)
	  {
	  xhttp=new XMLHttpRequest();
	  }
	else
	  {
	  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xhttp.open("GET",dname,false);
	xhttp.send("");
	return xhttp.responseXML;
}

function displayResult()
{
	xml=loadXMLDoc("events.xml");
	xsl=loadXMLDoc("events.xsl");
	// code for IE
	if (window.ActiveXObject)
	  {
	  ex=xml.transformNode(xsl);
	  document.getElementById("news").innerHTML=ex;
	  }
	// code for Mozilla, Firefox, Opera, etc.
	else if (document.implementation && document.implementation.createDocument)
	  {
	  xsltProcessor=new XSLTProcessor();
	  xsltProcessor.importStylesheet(xsl);
	  resultDocument = xsltProcessor.transformToFragment(xml,document);
	  document.getElementById("news").appendChild(resultDocument);
	  }
}

function displayResultServer($p1,$p2,$p3)
{
	var xmlhttp;
	var reqStr;
	reqStr="?xmlfile="+$p1+".xml&xsltfile="+$p1+"_"+$p2+".xsl&param="+$p3;
	/*if (str.length==0)
	  { 
	  document.getElementById("txtHint").innerHTML="";
	  return;
	  }*/
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("news").innerHTML=xmlhttp.responseText;
		}
	  }
	//xmlhttp.open("GET","getServerData.php?xmlfile=events.xml&xsltfile=events_daily.xsl&param=Event 2",true);
	//TRACE(regStr);
	xmlhttp.open("GET","/getServerData.php"+reqStr,true);
	xmlhttp.send();	
}
