
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function toggleDiv(divname, visibility) {
	var x=document.getElementById("foto").getElementsByTagName("div");
	for (var i=0;i<x.length;i++){ 
		if (x[i].id.substr(0, 7)=='bericht') {
			MM_changeProp(x[i].id,'','style.visibility','hidden','DIV');
		} else if (x[i].id.substr(0, 5)=='actie') {
			MM_changeProp(x[i].id,'','style.visibility','hidden','DIV');
		}
	}
	MM_changeProp(divname,'','style.visibility',visibility,'DIV');
}

function openWindow(url){
	window.open(url,"WPopup",'location=yes,scrollbars=yes,resizable=yes,status=yes,menubar=yes,toolbar=yes');
}

try {
	if (CmsEditorActive!==true) {}
}
catch (err) {
	var CmsEditorActive=false
}

var newsid;

/* XML HTTP REQUEST */
var xmlhttp = null;
function showNews(url, newid){
	newsid = newid;
	xmlhttp=null;
	if (window.XMLHttpRequest){// code voor Firefox, Opera, IE7, etc.
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject){// code voor IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp!=null){
		xmlhttp.url = url;
		xmlhttp.newsid = newsid;
		xmlhttp.onreadystatechange=state_Change;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(newsid);
	}
	else{
		//alert("Er is een fout opgetreden.");
	}
}

function state_Change(){
	if (xmlhttp.readyState==4){// 4 = "loaded"
		if (xmlhttp.status==200){// 200 = "OK"
			ReplaceContent(xmlhttp.responseText, newsid);
		}
		else{
			//alert("Er is een fout opgetreden: " + xmlhttp.statusText);
		}
	}
}

function ReplaceContent(text, newsid){
    var s_match = "<div class=\"nieuwsbericht\" id=\"nieuwsbericht_"+newsid+"\">";
    var s_match_index = text.indexOf(s_match);
    
    var e_match = "</div>";
    var e_match_index = text.indexOf(e_match, s_match_index);
    if ((s_match_index > -1) && (e_match_index > -1)) {
        var i_text = text.substring(s_match_index + s_match.length, e_match_index-6 + e_match.length);
    }
    document.getElementById('nieuwsdetail').innerHTML = "<img src=\"/sites/85/images/sluiten.gif\" alt=\"Sluiten\" class=\"sluitenknop\" onclick=\"this.parentNode.style.display='none';\"/>";
    document.getElementById('nieuwsdetail').innerHTML += i_text;
    document.getElementById('nieuwsdetail').style.display = 'block';
}

function overflowCms(){
	if (CmsEditorActive==true){
		var div = document.getElementsByTagName('div');
		var table = document.getElementsByTagName('table');
		
		for(var i=0; i<div.length; i++){
			if(div[i].className=="scontainer"){
				div[i].style.height="auto";
			}
			if(div[i].className=="smain2"){
				div[i].style.height="auto";
				div[i].style.overflow="auto";
			}
			if(div[i].className=="overflowdiv"){
				div[i].style.height="auto";
				div[i].style.overflow="auto";
			}
		}
		
		for(var j=0; j<table.length; j++){
			if(table[j].className=="sframe"){
				table[j].style.height="auto";
			}
		}
	}
}
