//definieren variabelen
var isNav4, isNav6, isIE
var isBrand = navigator.appName
var agt = navigator.userAgent.toLowerCase()
var navVer = parseInt(navigator.appVersion)

//browser check
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
	}
}

//koppel de juiste classes bij mouseover uitklapmenu
sfHover = function() {
	if (document.getElementById("nav")) {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



//zet hoogtes van verschilldende divjes goed
function zetScrollHoogte(templateid)
{
	schermhoogte = getInsideWindowHeight();
	var divmaintable = document.getElementById('divMaintable');
	var rodebalkvert = document.getElementById('rodebalkvert');
	var maintable = document.getElementById('maintable');
	var mainsite = document.getElementById('mainsite');


	if (maintable) {
		var hoogtemaintable = maintable.offsetHeight; //hoogte maintable
		var hoogte = hoogtemaintable + 120;  //hoogte header + maintable
		if (hoogte < schermhoogte) { 
			hoogte = schermhoogte;
			divmaintable.style.height = hoogte - 120;
			if (templateid !== 1) { maintable.style.height = hoogte - 120; }
			rodebalkvert.style.height = hoogte;
			mainsite.style.height = hoogte;
		} else {
			rodebalkvert.style.height = hoogtemaintable + 120;
			mainsite.style.height = hoogtemaintable + 120;
		}
	}
}

window.onresize = zetScrollHoogte;

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] : "#F7F7F7";
 
   // 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;
			   
			   mytd.style.borderTop = '1px solid #E8E8E8';
           
           }
         }
       }
       // flip from odd to even, or vice-versa
       even =  ! even;
     }
   }
 }
 
function hasClass(obj) {
   var result = false;
   if (typeof obj.getAttributeNode != 'undefined') {
	   if (obj.getAttributeNode("class") != null) {
	       result = obj.getAttributeNode("class").value;
	   }
	}
  return result;
} 
