// JavaScript Document
document.xmlHttp=createXmlHttpRequestObject();
document.ajaxEnabled=true
document.currentItem=0
document.openW=null

function createXmlHttpRequestObject(){  
  var xmlHttp;  try {    xmlHttp=new XMLHttpRequest();   }
  catch(e) {     var xmlHttpVersions=new Array('MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP');	for (var i=0;i<xmlHttpVersions.length&&!xmlHttp;i++) { 
	   try { 	     xmlHttp=new ActiveXObject(xmlHttpVersions[i]);	   }	   catch (e){}
	 }  }  
     if (!xmlHttp) { document.ajaxEnabled=false; return null; }
	 else return xmlHttp ;
}
function openMediaplayer(){
 document.openW=window.open('http://www.youtube.com/watch?v=XOs7so1fJQc&list=PL0409D5CBA4327775&feature=plpp','mediaplayer','width=900,height=900,resizable,status=0')
  document.openW.focus();	
  return false
}
function changeImage(n){
  try {
  var d=document.getElementById('acme-cd'), a=d.getElementsByTagName('a')
  if (n==0) { a[0].style.display="block"; a[1].style.display="none"}
  else { a[0].style.display="none"; a[1].style.display="block"}
  }
  catch(e){}
}
function menu(section){  
  if (section=='home') changeImage(0)
  else changeImage(1)
  if (!document.ajaxEnabled) window.location="http://www.rebelstar.nl/index.php/"+section
  loadOption(section);
  var as=document.getElementById("top_nav").getElementsByTagName("a")
  for (var i in as) if (as[i].rel==section) {
    as[i].className="active"
	}
  else as[i].className=""
  return false
}
function loadOption(n){
//  try {	document.getElementById("content_in").className="vaag"} catch (e){}  
  document.currentItem=n
  if (document.xmlHttp) {
       try {
		 if (document.xmlHttp.readyState==0||document.xmlHttp.readyState==4){
		   var URL="inc/readContent.php?n="+n
		   document.title="Rebelstar - "+n
		   document.xmlHttp.open("GET",URL,true)
	       document.xmlHttp.onreadystatechange=handleContentLoad
	       document.xmlHttp.send(null);
		   }
		   else {}//setTimeout("loadOption("+n+")",500)
	  }
   catch (e) {}
  }
  else alert('browser does not allow http-request')
}

function handleContentLoad(){ 
if (document.xmlHttp.readyState==4) {
    if (document.xmlHttp.status==200 ) {
	  try { 
		  var txt=document.xmlHttp.responseText.split("||||")
//		  if (!txt[1]) txt[1]=""
		  document.getElementById('content_in').innerHTML=txt[0]
//		  document.getElementById('content_right').innerHTML=txt[1]
//		  window.scrollBy(-10000,-10000)
		  document.getElementById("content_in").className=""
         }
	  catch(e) { }
	 }
   }
}
function audio_file(file){
  window.open(file,"","height=100px, width=500px, resizable, scrollbars")	
}
