function videoWindow(id){
	var LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
	var TopPosition = 4;
	newWindow = window.open("?item=video_window&id="+id,"MultiMedema","location=no,toolbar=no,status=no,directories=no,scrollbars=no,resizable=no,menubar=no,width=400,height=570,top="+TopPosition+",left="+LeftPosition);
	newWindow.focus();
	newWindow.opener = self;
}

function standaardFlashWindow(id){
	var LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
	var TopPosition = 4;
	newWindow = window.open("?item=video_window&action=flash&id="+id,"MultiMedema","location=no,toolbar=no,status=no,directories=no,scrollbars=yes,resizable=yes,menubar=no,width=400,height=650,top="+TopPosition+",left="+LeftPosition);
	newWindow.focus();
	newWindow.opener = self;
}

function recensieWindow(id,nr){
	var LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
	var TopPosition = 4;
	if(nr!=''){var nummer="&nr="+nr}
	newWindow = window.open("?item=recensie&id="+id+nummer,"MultiMedema","location=no,toolbar=no,status=no,directories=no,scrollbars=yes,resizable=yes,menubar=no,width=400,height=570,top="+TopPosition+",left="+LeftPosition);
	newWindow.focus();
	newWindow.opener = self;
}

function artikelWindow(id){
	var LeftPosition = (screen.width) ? (screen.width-500)/2 : 0;
	var TopPosition = 10;
	newWindow =window.open("?item=artikel&id="+id,"MultiMedema","location=no,toolbar=no,status=no,directories=no,scrollbars=yes,resizable=no,menubar=no,width=500,height=650,top="+TopPosition+",left="+LeftPosition);
	newWindow.focus();
	newWindow.opener = self;
	
}
function enqueteWindow(id){
	var LeftPosition = (screen.width) ? (screen.width-460)/2 : 0;
	if(!LeftPosition) {LeftPosition=0;}
	var TopPosition = 4;
	newWindow = window.open("?item=enquete&id="+id,"MultiMedema","location=no,toolbar=no,status=no,directories=no,scrollbars=no,resizable=yes,menubar=no,width=460,height=730,top="+TopPosition+",left="+LeftPosition);
	newWindow.focus();
	newWindow.opener = self;
}
function eerstehoofdstukWindow(id){
	var LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
	if(!LeftPosition) {LeftPosition=0;}
	var TopPosition = 5;
	newWindow = window.open("?item=hoofdstuk&id="+id,"Eerste hoofdstuk lezen","location=no,toolbar=no,status=no,directories=no,scrollbars=yes,resizable=yes,menubar=no,width=600,height=500,top="+TopPosition+",left="+LeftPosition);
	newWindow.focus();
	newWindow.opener = self;
}


window.name='medema_opener';


function vergroot(divid,control){
	hetobject=findobject(divid);
	if (hetobject.height==""){ hetobject.height = "0px";}
	else{ hetobject.height = "";}
	tekstobject=findobject(control);
	tekstobject.visibility="hidden";
	tekstobject.height = "0px";
}

function checkBrowser(){
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}
bw=new checkBrowser();
//Shows the div
function findobject(div,nest){ 		obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	return obj;  
}

/// for menu

//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=500

function showit(which){
	clear_delayhide()
	thecontent=(which==-1)? "" : submenu[which]
	if (document.getElementById||document.all)
	menuobj.innerHTML=thecontent
	else if (document.layers){
		menuobj.document.write(thecontent)
		menuobj.document.close()
	}
}

function resetit(e){
	if (document.all&&!menuobj.contains(e.toElement))
	delayhide=setTimeout("showit(-1)",delay_hide)
	else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
	delayhide=setTimeout("showit(-1)",delay_hide)
}


function clear_delayhide(){
	if (window.delayhide)
	clearTimeout(delayhide)
}

function contains_ns6(a, b) {
	while (b.parentNode)
	if ((b = b.parentNode) == a)
	return true;
	return false;
}
function GetXmlHttpObject(handler){ 
   var objXMLHttp=null
   if (window.XMLHttpRequest) // non-IE browser
   {
       objXMLHttp=new XMLHttpRequest()
   }
   else if (window.ActiveXObject) // IE browser
   {
      objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
   }
   return objXMLHttp
}


/// Voor stemmen
var score = "0";

function stem()
{
   xmlHttp=GetXmlHttpObject()
   if (xmlHttp==null)
   {
      alert ("Browser does not support HTTP Request")
      return
    } 
    var url="index.php?item=stem";
    var titel= escape(document.form.titel.value);
    var beoordeling = escape(document.form.beoordeling.value);

	// Check the length of the value of the element named text_name
	if ((beoordeling.length < 15) || (titel.length < 3)) {
	mesg = "Uw beoordeling is te kort. Geef een meer uitgebreide beoordeling.";
	alert(mesg);
	return (false);
	}
	else if (score=="0") {
	mesg = "Kies een ster, om te beoordelen.";
	alert(mesg);
	return (false);
    }


    else {

    url=url+"&id=#id#&score="+score+"&titel="+titel+"&text="+beoordeling;

    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    }
}


function stateChanged() 
{ 
   if (xmlHttp.readyState==4)
   {
      if(xmlHttp.status == 200)
      { 
         document.getElementById("beoordeling").innerHTML=xmlHttp.responseText;
      } 
	  else
	  {
	  	alert("Probleem met het request!");
	  }
   }
}    


function go(waarde) {
	var html = "";
	var tekst = "";
	if (waarde == "0") { waarde=score; }

	for (start = 1; start < 6; start++) {
		if ( start<=waarde) { document.getElementById(start).src = "/images/icon_beoordeling_blauw.gif"; }
		else { document.getElementById(start).src = "/images/icon_beoordeling_grijs.gif"; }
	}

	if (waarde==1) {document.getElementById("sterrentekst").innerHTML = "Slecht";}
	if (waarde==2) {document.getElementById("sterrentekst").innerHTML = "Matig";}
	if (waarde==3) {document.getElementById("sterrentekst").innerHTML = "Voldoende";}
	if (waarde==4) {document.getElementById("sterrentekst").innerHTML = "Goed";}
	if (waarde==5) {document.getElementById("sterrentekst").innerHTML = "Zeer goed!";}				
}

function save(waarde) {
	score = waarde;
}

