function lib_bwcheck() { 
	this.ver=navigator.appVersion;
	this.agent=navigator.userAgent;
	this.dom=document.getElementById?1:0;
	this.opera5=this.agent.indexOf("Opera 5")>-1;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6;
	this.mac=this.agent.indexOf("Mac")>-1;
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5);
	return this;
}
var bw = new lib_bwcheck();

// util functions

function clipValues(which) {
	if (bw.ns4) {
		if (which=="t") return this.style.clip.top
		if (which=="r") return this.style.clip.right
		if (which=="b") return this.style.clip.bottom
		if (which=="l") return this.style.clip.left
	}
	else if (bw.ie4 || bw.dom) {
		var clipv = this.style.clip.split("rect(")[1].split(")")[0].split("px")
		if (which=="t") return Number(clipv[0])
		if (which=="r") return Number(clipv[1])
		if (which=="b") return Number(clipv[2])
		if (which=="l") return Number(clipv[3])
	}
}

function divClipTo(t,r,b,l) {
	if(bw.ns4){
		this.style.clip.top=t; this.style.clip.right=r; this.style.clip.bottom=b; this.style.clip.left=l;
	} else {
		this.style.clip="rect("+t+"px, "+r+"px, "+b+"px, "+l+"px)";
		//alert(this.style.clip);
	}
}

function getPxInt(strPx) {
	strPx += "";
	return parseInt(strPx.split("px")[0]);
}

var px = bw.ns4||window.opera?"":"px";

function moveDivTo(x,y){this.x=x; this.y=y; this.style.left=this.x+px; this.style.top=this.y+px;}

// caller functions

function requestOpen(objDivId) {
	if(objDivId.indexOf("Open") != -1) objDivId = objDivId.substr(0,objDivId.length-4);
	window.status = '';
	var startRequest = true;
	if(window.event) {
		//alert(objDivId);
		divObj = bw.dom? document.getElementById(objDivId):bw.ie4?document.all[objDivId]:bw.ns4?eval("document.layers." + objDivId):0;
		if(divObj.contains(window.event.fromElement)) {} //startRequest = false;
	}
	if(startRequest) {
		activeItem = objDivId;
		objMB = menuBlockObj[objDivId];
		//alert(objMB.subdiv.style.visibility);
		objMB.subdiv.style.visibility = "visible";
		objMB.state = "open";
	} else if(true) { //!objMB.slideOpenInUse) {
			//window.status = 'request to open';
			//nextRequest = "alert('opening')";
	}
}

function requestClose(objDivId) {
	if(objDivId.indexOf("Open") != -1) objDivId = objDivId.substr(0,objDivId.length-4);
	window.status = '';
	var startRequest = true;
	if(window.event) {
		divObj = bw.dom? document.getElementById(objDivId):bw.ie4?document.all[objDivId]:bw.ns4?eval("document.layers." + objDivId):0;
		if(divObj.contains(window.event.toElement)) {} //startRequest = false;
	}
	if(startRequest) {
		objMB = menuBlockObj[objDivId];
		objMB.subdiv.style.visibility = "hidden";
		objMB.state = "closed";		
	} else {
			//window.status = 'request to close';
			//nextRequest = "alert('opening')";
	}
}


function menuBlock(blockName) {
	this.name = blockName;
	var divId = blockName + "Open";
	this.subdiv = bw.dom? document.getElementById(divId):bw.ie4?document.all[divId]:bw.ns4?eval("document.layers." + divId):0;
	//alert(this.subdiv.style.visibility);
	this.state = "closed";
   	//this.stl = this.obj.style;
	//this.height = document.getElementById(blockName).style;
}

// inits

function initMenu() {
	for(b=0;b<menuBlocks.length;b++)
		{
		menuBlockObj[menuBlocks[b]] = new menuBlock(menuBlocks[b]);
		}
}

//var slideOpenInUse = false;
//var slideCloseInUse = false;
var reqTimer;
var activeItem = "";
var menuBlockObj = new Array();
var menuBlocks = new Array();
menuBlocks = ["divBourgogne","divLecoqdor","divSelectie","divBestellen","divMeerweten"];


