/*Browsercheck object*/

function cm_bwcheck(){

	//In theory we should use object detection, but this script needs work-arounds for almost every browser...

	this.ver=navigator.appVersion

	this.agent=navigator.userAgent.toLowerCase()

	this.dom=document.getElementById?1:0

	this.ns4=(!this.dom && document.layers)?1:0;

	this.op=window.opera

	this.moz=(this.agent.indexOf("gecko")>-1 || window.sidebar)

	this.ie=this.agent.indexOf("msie")>-1 && !this.op

	if(this.op){

		this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1)

		this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1)

		this.op7=this.dom&&!this.op5&&!this.op6 //So all higher opera versions will use it

		this.op9=(this.agent.indexOf("opera 9")>-1 || this.agent.indexOf("opera/9")>-1)

	}else if(this.moz) this.ns6 = 1

	else if(this.ie){

		this.ie4 = !this.dom && document.all

  	   this.ie5 = (this.agent.indexOf("msie 5")>-1)

    	this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)

   	this.ie6 = this.dom && !this.ie4 && !this.ie5 && ! this.ie55

  	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)

	}

	this.mac=(this.agent.indexOf("mac")>-1)

	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6 || this.op7)

  this.usedom= this.ns6||this.op7//Use dom creation

  this.reuse = this.ie||this.op7||this.usedom //Reuse layers

  this.px=this.dom&&!this.op5?"px":""

	return this

}

var bw=new cm_bwcheck()

var disoffset = 19;
if(typeof( window.innerWidth ) == 'number' ) {
    var is_ie = false;
    disoffset = 19;
} else  {
    var is_ie = true;
    disoffset = 19;
    if (navigator.userAgent.indexOf("MSIE 5.5") != -1) {
    	document.write('<link href="css/ie5.css" rel="stylesheet" type="text/css">');
        disoffset = 22;
    }
}

function centerframeOffSet() {
  if (!is_ie) {
    var centerframe 
    if(bw.op5||bw.op6||bw.op7||bw.op9) {
        centerframe = document.getElementById('linkerkolom');
        if (centerframe) {
            return centerframe.offsetLeft -8;
       }
    } else {
          centerframe = document.getElementById('centerframe');
          if (centerframe) {
            return centerframe.offsetLeft -8;
          }
    }
  }
  return  0;

}




var openDiv;
var iDelay = 1000;

function keepOpen(openid) {
    alert('uch');
}

function CloseSubMenu(openid) {
    if (openDiv == openid) {
       setTimeout("CloseSubMenu('" + openid + "')",iDelay);
    } else {
       closeMenu(openid);
    }
}

function mouseover(me,last) {
    var submenu = document.getElementById('sub_' + me.id );
    if (submenu) {
       closemenus();
       if (last) {
         submenu.style.left = (me.offsetLeft + me.width - 148) + 'px';
       } else {
         submenu.style.left = (me.offsetLeft + 1) + 'px';
       }

       submenu.style.display='block';
       openDiv = me.id;
    }
}

function closeMenu(closeid) {
    var submenu = document.getElementById('sub_' + closeid);
    if (submenu) {
       submenu.style.display='none';
    }
}

function mouseuit(me) {
    openDiv = '';
    setTimeout("CloseSubMenu('" + me.id + "')",iDelay);
}

function debug(msg) {
    var debugdiv = document.getElementById('debug');
    if (debugdiv) {
       debugdiv.innerHTML = msg;
    } else {
       alert(msg);
    }
}

function closemenus() {
   var divs = document.getElementById('sub_bovenmenu');
   for (var i=0; i< divs.childNodes.length; i++) {
        if (divs.childNodes[i].className == 'submenu') {
            divs.childNodes[i].style.display='none';
        }
   }
}
function mouseoversub(me) {
    var mesplit = me.id.split('_');
    openDiv = mesplit[1];
}

function mouseuitsub(me) {
    var mesplit = me.id.split('_');
    openDiv = '';
    setTimeout("CloseSubMenu('" + mesplit[1] + "')",iDelay);
}

function fixme() {
    var myWidth = 0, myHeight = 0;
    var mainposition;

    mainposition = document.getElementById('bottomsitewide');

    if(!is_ie) {
        //Non-IE
        myHeight = window.innerHeight;
        myWidth = window.innerWidth;
     } else {
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
        if (myHeight < 700) {
           myHeight = 700;
        }
     }

   if (bw.ie7) {
// For IE browsers (which don't recognize window.innerWidth/Height), we
// have to adjust the height of the content area or the scroll bar will
// extend below the window. We also need to adjust the width to keep
// the scroll bar in the right place.

      if (!window.innerWidth){
         if (document.documentElement) {
            myHeight = document.documentElement.clientHeight;
         }
         else if (document.body){
            myHeight = parseInt(document.body.offsetHeight,10) + document.body.offsetTop;
         }
     }
    }

    // Check voor scroolbar
    if (myHeight < document.body.scrollHeight) {
        myHeight = document.body.scrollHeight;

    }

    if (!is_ie) {
        myHeight = document.documentElement.scrollHeight;
    }

    // Achterground
    if (mainposition) {
       mainposition.name=myHeight;
       mainposition.style.top = (myHeight - disoffset) + 'px';
    }

}

var newwindow = ''
function popitup(url,opt) {
if (newwindow.location && !newwindow.closed) {
    newwindow.location.href = url; 
    newwindow.focus(); } 
else { 
    newwindow=window.open(url,'htmlname',opt);} 
}