// JavaScript Document

var z0on = new Image;z0on.src = "img/square_hover.gif";
var z0off = new Image;z0off.src = "img/square_empty.gif";
var z0sel = new Image;z0sel.src = "img/square_marked.gif";
var z1on = new Image;z1on.src = "img/menu/home_on.jpg";
var z1off = new Image;z1off.src = "img/menu/home_off.jpg";
var z2on = new Image;z2on.src = "img/menu/visie_on.jpg";
var z2off = new Image;z2off.src = "img/menu/visie_off.jpg";
var z3on = new Image;z3on.src = "img/menu/producten_on.jpg";
var z3off = new Image;z3off.src = "img/menu/producten_off.jpg";
var z4on = new Image;z4on.src = "img/menu/contact_on.jpg";
var z4off = new Image;z4off.src = "img/menu/contact_off.jpg";
var z14on = new Image;z14on.src = "img/menu/referenties_on.jpg";
var z14off = new Image;z14off.src = "img/menu/referenties_off.jpg";

function img_act(imgName) {
	imgOn = eval(imgName + "on.src");
	document [imgName].src = imgOn;
}

function img_inact(imgName) {
	imgOff = eval(imgName + "off.src");
	document [imgName].src = imgOff;
}

function news_act(imgName, act) {
	img = eval("z0" + act + ".src");
	document [imgName].src = img;
}

var explorer;
var netscape4;
var netscape6;
var theDOM, theSuffix, hiddenKeyword, dhtml;

if (document.all) {explorer = true;}
else if (document.layers) {netscape4 = true;} 
else {netscape6 = true;}

if(explorer){
   theDOM = 'document.all';
   theSuffix = '.style';
   hiddenKeyword = 'hidden';
   dhtml = true;
}

if(netscape4){
   theDOM = 'document';
   theSuffix = '';
   hiddenKeyword = 'hide';
   dhtml = true;
}

if (netscape6) {
  theDOM = "document.getElementsByTagName('*')";
  theSuffix = ".style";
  hiddenKeyword = "hidden";
  dhtml = true;
}

function hideIt(theObject){
   if(dhtml){
		var theObjectReference = eval(theDOM + '.' + theObject + theSuffix);
		theObjectReference.visibility = hiddenKeyword;
		theObjectReference.display = 'none';
	}
}

function showIt(theObject){
   if(dhtml){
		var theObjectReference = eval(theDOM + '.' + theObject + theSuffix);
		theObjectReference.visibility = 'visible';
		theObjectReference.display = 'block';
	}
}

function findPos(obj) {
	var curleft = curtop = curwidth = curheight = 0;
	
	curwidth = obj.offsetWidth;
	curheight = obj.offsetHeight;
	
	if (obj.offsetParent) {
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	
	return {x:curleft,y:curtop,w:curwidth,h:curheight};
}

function showNewsTip(obj, txt) {
	var newsitem = findPos(document.getElementById(obj));
	document.getElementById("newstip_txt").innerHTML = txt;
	document.getElementById("newstip").style.top = (newsitem.y-(4+$("#newstip").height())) + "px";
	document.getElementById("newstip").style.left = (newsitem.x-3) + "px";
	showIt("newstip");
	
}
