//popup voor modules binnen admin
top.window.popupContacts = function () {
	popupModules('contacts');
}
function popupModules(modulenaam) {
	var filename="/admin/modules/"+modulenaam+"/index.php";
	var fileid="Contacts";
	var width="650";
	var height="580";
	var scrollbars="no";
	var resizable="no";
	var menubar="no";
	var toolbar="no";
	var status="no";
	var location="no";
	var popupscherm=0;
	var args = "height=" + height + ", width=" + width + ", scrollbars=" + scrollbars + ", resizable=" + resizable +  ", menubar=" + menubar + ", toolbar=" +toolbar + ", status=" + status + " ,location=" + location;
	popupscherm = top.window.open(filename, fileid, args);
}

//needed for foto overzicht
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var popupscherm=0;

function popup_afbeelding(filename, fileid, width, height, scrollbars, resizable, menubar, toolbar, status, location) {
	if (popupscherm && ! popupscherm.closed)	popupscherm.close();
	if (!filename || filename=="")				filename="http://www.grundel.nl";
	if (!fileid || fileid=="")					fileid="Grundel";
	if (!width || width=="")					width="50";
	if (!height || height=="")					height="50";
	if (!scrollbars || scrollbars=="")			scrollbars="no";
	if (!resizable || resizable=="")			resizable="yes";
	if (!menubar || menubar=="")				menubar="no";
	if (!toolbar || toolbar=="")				toolbar="no";
	if (!status || status=="")					status="no";
	if (!location || location=="")				location="no";
	popupscherm=0;
	var args = "height=" + height + ", width=" + width + ", scrollbars=" + scrollbars + ", resizable=" + resizable +  ", menubar=" + menubar + ", toolbar=" +toolbar + ", status=" + status + " ,location=" + location;
	popupscherm = open(filename, fileid, args);
	if (!InternetExplorer) 						popupscherm.focus();
}

 // this function is needed to work around 
 // a bug in IE related to element attributes
 function hasClass(obj) {
    var result = false;
    if (obj.className != '')
	result = obj.className;

    return result;
 }   

function stripe(id) {

   // the flag we'll use to keep track of 
   // whether the current row is odd or even
   var even = false;
 
   // if arguments are provided to specify the colours
   // of the even & odd rows, then use the them;
   // otherwise use the following defaults:
   var evenColor = arguments[1] ? arguments[1] : "#fff";
   var oddColor = arguments[2] ? arguments[2] : "#F8F6F0";
 
   // obtain a reference to the desired table
   // if no such table exists, abort
   var table = document.getElementById(id);
   if (! table) { return; }
   
   // by definition, tables can have more than one tbody
   // element, so we'll have to get the list of child
   // &lt;tbody&gt;s 
   var tbodies = table.getElementsByTagName("tbody");

   // and iterate through them...
   for (var h = 0; h < tbodies.length; h++) {
   
    // find all the &lt;tr&gt; elements... 
     var trs = tbodies[h].getElementsByTagName("tr");
     
     // ... and iterate through them
     for (var i = 0; i < trs.length; i++) {

       // avoid rows that have a class attribute
       // or backgroundColor style
       if (! hasClass(trs[i]) &&
           ! trs[i].style.backgroundColor) {
		  
         // get all the cells in this row...
         var tds = trs[i].getElementsByTagName("td");
       
         // and iterate through them...
         for (var j = 0; j < tds.length; j++) {
       
           var mytd = tds[j];

           // avoid cells that have a class attribute
           // or backgroundColor style
           if (! hasClass(mytd) &&
               ! mytd.style.backgroundColor) {
       
             mytd.style.backgroundColor =
               even ? evenColor : oddColor;
           
           }
         }
       }
       // flip from odd to even, or vice-versa
       even =  ! even;
     }
   }
 }

  
function zetHoogte(templateid) {
	//Instellen van de hoogte van de div maintable
	var isNav4, isNav6, isIE
	var isBrand = navigator.appName
	var agt = navigator.userAgent.toLowerCase()
	var navVer = parseInt(navigator.appVersion)
	var isNav4 = (isBrand == "Netscape" && navVer < 5) ? true : false
	var isNav6 = (isBrand == "Netscape" && navVer >= 5) ? true : false
	var isNav46 = ((isBrand == "Netscape") && (parseFloat(navigator.appVersion) >= parseFloat(4.6)) && (parseFloat(navigator.appVersion) < parseFloat(4.7))) ? true : false
	var isNav47 = ((isBrand == "Netscape") && (parseFloat(navigator.appVersion) >= parseFloat(4.7))) ? true : false
	var isIE = ((agt.indexOf("msie") != -1) && (parseInt(navVer) >= 4)) ? true : false
	var mac = (agt.indexOf("mac")!= -1);

	//haal hoogte window binnen
	function getInsideWindowHeight() {
		if (isNav4 || isNav6)
			return window.innerHeight
		else 
	 		return document.body.clientHeight
	}
	
	if (templateid == 1) //voorpagina
		var hoogte = getInsideWindowHeight() - 322;
	else if (templateid == 4) //zoekresultaat
		var hoogte = getInsideWindowHeight() - 184;
	else //vervolgpagina
		var hoogte = getInsideWindowHeight() - 58;//was 94
		
	var maintable = document.getElementById('maintable');
	var subnavigatie = document.getElementById('subnavigatie');
	var maintableHoogte = maintable.offsetHeight;

	if (subnavigatie) {
		if (subnavigatie.innerHTML == '')
			subnavigatie.style.display = 'none';
	}
	
	if (maintable) {
		if (maintableHoogte < hoogte) {
			maintable.style.height = hoogte;
		}
	}
}