changeMenu = function()
{
    var menuElements = document.getElementById("menu").getElementsByTagName("LI");
    for (var i=0; i<menuElements.length; i++)
    {
        menuElements[i].onmouseover=function()
        {
            this.className+=" hover";
        }
        menuElements[i].onmouseout=function()
        {
            this.className=this.className.replace(new RegExp(" hover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", changeMenu);
function popup(url,width,height)
{
    var winleft=(screen.width - width)/2
    var winUp=(screen.height - height)/2
    winProp='width='+width+',height='+height+',left='+winleft+',top='+winUp+',screenX='+winleft+',screenY='+winUp+',scrollbars=yes,toolbar=no,location=no,menubar=no,resizable'
    Win = window.open("http://"+location.hostname+"/"+url,"",winProp)
    if (parseInt(navigator.appVersion) >= 4)
    {
        Win.window.focus();
    }
}

  // this function is need to work around
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     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] : "#eee";

    // 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 getViewportSize()
{
    var size = [0, 0];
    if (typeof window.innerWidth != 'undefined')
    {
        size = [
        window.innerWidth,
        window.innerHeight
        ];
    }
    else if (typeof document.documentElement != 'undefined'
    && typeof document.documentElement.clientWidth !=
    'undefined' && document.documentElement.clientWidth != 0)
    {
        size = [
        document.documentElement.clientWidth,
        document.documentElement.clientHeight
        ];
    }
    else
    {
        size = [
        document.getElementsByTagName('body')[0].clientWidth,
        document.getElementsByTagName('body')[0].clientHeight
        ];
    }
    return size;
}

function resize()
{
	var size = getViewportSize();
    var header_height = 164;
    var padding_top_van_content = 25;
    var margin_bottom = 25;
    var beschikbaar = size[1] - header_height - padding_top_van_content;
    document.getElementById('content').style.height = beschikbaar +'px';
    
    // auto werkt niet in ie6
    document.getElementById('center_content').style.height = '100%';
    
    // + 50 + 6 omdat net voordat de content echt verdwijnt willen gaan scrollen
    var content_height = document.getElementById('center_content').offsetHeight + 50 + 6;
    
    if (content_height < beschikbaar)
    {
        document.getElementById('center_content').style.height = beschikbaar - 85 +'px';
    }
}
function aanpassen()
{
	setTimeout(resize, 1000);

}

window.onresize = function()
{
    resize();
}
;
window.onload = function()
{
    if (document.getElementById("nav_left") != null && document.getElementById("nav_left").firstChild != null) {
    	uitklapmenu();
    }
    resize();
    
    stripe('zebra', '#7c97cb', '#ffffff');
    
    if(!NiftyCheck())
    return;
	if (document.getElementById("nav_left") != null) {
		//Rounded("div.rond_licht","#7c97cb","#c9c9c9");
		//Rounded("div.rond_donker","#7c97cb","#939393");
	}

	if (document.getElementById("center_column") != null) {
		Rounded("div#center_column","#7c97cb","#ffffff");
	}

	if (document.getElementById("specificaties") != null){
		Rounded("div#specificaties","#ffffff","#7c97cb");
	}
	if (document.getElementById("publicaties") != null){
		Rounded("div#publicaties","#ffffff","#7c97cb");
	}
	

}
;
uitklapmenu = function()
{

    document.getElementById("nav_left").firstChild.style.backgroundImage = 'url(images/menu_top.gif)';
    var klap_items = document.getElementById('nav_left').childNodes;
    
    for (var boot=klap_items.length-1; boot>0; boot--)
    {
        var item = klap_items[boot];
        
        if(item.className == 'serie_donker' || item.className == 'serie_licht')
        {
			klap_items[boot].style.backgroundImage = 'url(images/menu_bottom.gif)';
			klap_items[boot].style.backgroundPosition = 'bottom';
			break;
        }
    }
    
    for (var i=0; i<klap_items.length; i++)
    {
        if (klap_items[i].className == 'boten')
        {
        	klap_items[i].style.display = 'none';
        }
        
        klap_items[i].onclick=function()
        {
            
            if (this.nextSibling != null)
            {
	            if (this.nextSibling.className == 'boten')
	            {
	                var id = this.nextSibling.id;
	                if (this.nextSibling.style.display == "none")
	                {
	                	Effect.toggle(id, 'blind', {duration: 0.3});
	                }
	                else
	                {
	                    Effect.toggle(id, 'blind', {duration: 0.3});
	                }
	            }
            }

        }
    }
    var dus = document.getElementById("nav_left").getElementsByTagName("div");
    for (var i=0; i<dus.length; i++)
    {
        if(dus[i].id == 'active')
        {
            if(dus[i].className == 'serie_donker' || dus[i].className == 'serie_licht')
        	{
        		if (dus[i].nextSibling != null)
        			dus[i].nextSibling.style.display = "block";
        		//alert(dus[i].nextSibling);
        	}
        	dus[i].parentNode.style.display = "block";
        }

    }
    document.getElementById("nav_left").style.display = 'block';
}

function NiftyCheck()
{
if(!document.getElementById || !document.createElement)
    return(false);
var b=navigator.userAgent.toLowerCase();
if(b.indexOf("msie 5")>0 && b.indexOf("opera")==-1)
    return(false);
return(true);
}

function Rounded(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
var l=v.length;
for(i=0;i<l;i++){
    AddTop(v[i],bk,color,size);
    AddBottom(v[i],bk,color,size);
    }
}

function RoundedTop(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
    AddTop(v[i],bk,color,size);
}

function RoundedBottom(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
    AddBottom(v[i],bk,color,size);
}

function AddTop(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn="r";
var lim=4;
if(size && size=="small"){ cn="rs"; lim=2}
d.className="rtop";
d.style.backgroundColor=bk;
for(i=1;i<=lim;i++){
    var x=document.createElement("b");
    x.className=cn + i;
    x.style.backgroundColor=color;
    d.appendChild(x);
    }
el.insertBefore(d,el.firstChild);
}

function AddBottom(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn="r";
var lim=4;
if(size && size=="small"){ cn="rs"; lim=2}
d.className="rbottom";
d.style.backgroundColor=bk;
for(i=lim;i>0;i--){
    var x=document.createElement("b");
    x.className=cn + i;
    x.style.backgroundColor=color;
    d.appendChild(x);
    }
el.appendChild(d,el.firstChild);
}

function getElementsBySelector(selector){
var i;
var s=[];
var selid="";
var selclass="";
var tag=selector;
var objlist=[];
if(selector.indexOf(" ")>0){  //descendant selector like "tag#id tag
    s=selector.split(" ");
    var fs=s[0].split("#");
    if(fs.length==1) return(objlist);
    return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
    }
if(selector.indexOf("#")>0){ //id selector like "tag#id"
    s=selector.split("#");
    tag=s[0];
    selid=s[1];
    }
if(selid!=""){
    objlist.push(document.getElementById(selid));
    return(objlist);
    }
if(selector.indexOf(".")>0){  //class selector like "tag.class"
    s=selector.split(".");
    tag=s[0];
    selclass=s[1];
    }
var v=document.getElementsByTagName(tag);  // tag selector like "tag"
if(selclass=="")
    return(v);
for(i=0;i<v.length;i++){
    if(v[i].className==selclass){
        objlist.push(v[i]);
        }
    }
return(objlist);
}


//window.onload = uitklapmenu;
