/* 
// @@@
// @@ Author: Kevin Versteeg
// @@ Date: 2007-06-12
// @@ Last change: 2007-06-18
// @@ Version: 1
// @@ Revision: 0
// @@ Copyright: Ecommany B.V.
// @@ Description: Diverse sitefuncties
// @@$
*/

// bevat id's verkregen van setTimeout()
var aTimeout = new Array();

function setMouseOver(event, sTxt)
{
	jsObj = document.getElementById('main_menu_mouseover');
	if (event.type == 'mouseover')
	{
		jsObj.innerHTML = sTxt;
	} else if (event.type == 'mouseout')
	{
		jsObj.innerHTML = '';
	}
	return;
}
function getHeight(jsObj) {
	h=0;
	if (jsObj.clip) {
		h=jsObj.clip.height;
	}	else {
		if(jsObj.style.pixelHeight) {
			h=jsObj.style.pixelHeight;
		} else {
			h=jsObj.offsetHeight;
		}
	}
	return h;
}
function setHeight(jsObj,h) {
	if (jsObj.clip) {
		jsObj.clip.height=h;
	} else {
		if(jsObj.style.pixelHeight) {
			jsObj.style.pixelHeight=h;
		} else {
			jsObj.style.height=h+'px';
		}
	}
}
function getInnerHeight(win) {
 h=0;
 if (win.innerHeight) 
  h = win.innerHeight;
 else if (win.document.documentElement && win.document.documentElement.clientHeight) 
  h = win.document.documentElement.clientHeight;
 else if (win.document.body) 
  h = win.document.body.clientHeight;
 return h;
}
function resizeNav()
{
	// Zichtbare content hoogte
	iInnerHeight = getInnerHeight(window);
	// Controleer of content obj aanwezig is, anders return	
	contentObj = document.getElementById('content');
	if (!contentObj)
	{
		return;
	}
	// Hoogte content element
	h = getHeight(contentObj);
	// Als content hoger is dan browser, dan navigatie div reizen
	// zodat deze meeloopt met de content (backgrounds enzo)
	if (h >= (iInnerHeight - 215)) // -215 correctie voor content div (headers etc. die er boven zitten)
	{
		// +215 correctie voor margins en headers etc
		iHeight = parseInt(h+215);
		// Ken de hoogte toe aan de 'main_bg' div
		document.getElementById('main_bg').style.height = iHeight+'px';
	}
	return;
}
function showElement(id)
{
	jsObj = document.getElementById(id);
	if (jsObj)
	{
		jsObj.style.display = 'inline';
	}
	return;
}
function hideElement(id)
{
	jsObj = document.getElementById(id);
	if (jsObj)
	{
		jsObj.style.display = 'none';
	}
	return;
}
// Tonen jaar / maand lijst
function positionList(event, id)
{
	// In geval van 'mouseover'
	if (event.type == 'mouseover')
	{
		// Itereer aTimeout, en ruim evt. timeout's op
		// en verberg zelf het element (hetgeen de timeout zou doen)
		// zodat we niet tegelijkertijd 2 dropdown lijstjes in beeld hebben
		for (x in aTimeout)
		{
			clearTimeout(aTimeout[x]);
			hideElement(x);
		}
		// Toon de lijst behorende bij het gemouseoverde element
		try
		{
			showElement(id);
		}
		catch (e)
		{

		}
	// In geval van 'mouseout'
	} else if (event.type == 'mouseout')
	{
		// Verberg element over een seconde
		aTimeout[id] = setTimeout("hideElement('" + id + "')", 1000);
	}
	return;
}
function openPopup(sUrl,h,w,bResize)
{
	winl=(screen.width-w)/2;
	wint=(screen.height-h)/2;	
	// popup altijd resizable
	bResize = 1;
	winprops = 'height='+h+',width='+w+',left='+winl+',top='+wint+',scrollbars=0,resizable='+bResize;
	winprops+= ',toolbar=0,location=0,directories=0,status=1,menubar=0,fullscreen=0';
	popupWin = window.open(sUrl,'popupWin_pc',winprops);
	return;
}
function closePopup()
{
	if (window.popupWin!=undefined && !popupWin.closed) popupWin.close();
	return;
}
function assignPositionList(id)
{
	jsObj = document.getElementById(id);
	if (!jsObj) return;
	id = id.replace('_a', '');
	jsObj.onmouseover = 'positionList(event, \''+ id + '\');';
	jsObj.onmouseout = 'positionList(event, \''+ id + '\');';
	return;
}
function detectBrowser()
{ 
	var BO = new Object(); 
	BO["ie"]        = false /*@cc_on || true @*/; 
	BO["ie4"]       = BO["ie"] && (document.getElementById == null); 
	BO["ie5"]       = BO["ie"] && (document.namespaces == null) && (!BO["ie4"]); 
	BO["ie6"]       = BO["ie"] && (document.implementation != null) && (document.implementation.hasFeature != null); 
	BO["ie55"]      = BO["ie"] && (document.namespaces != null) && (!BO["ie6"]); 
	/*@cc_on
	BO["ie7"]       = @_jscript_version == '5.7';
	@*/ 
	BO["ns4"]       = !BO["ie"] &&  (document.layers != null) &&  (window.confirm != null) && (document.createElement == null); 
	BO["opera"]     = (self.opera != null); 
	BO["gecko"]     = (document.getBoxObjectFor != null); 
	BO["khtml"]     = (navigator.vendor == "KDE"); 
	BO["konq"]      = ((navigator.vendor == 'KDE') || (document.childNodes) && (!document.all) && (!navigator.taintEnabled)); 
	BO["safari"]    = (document.childNodes) && (!document.all) && (!navigator.taintEnabled) && (!navigator.accentColorName); 
	BO["safari1.2"] = (parseInt(0).toFixed == null) && (BO["safari"] && (window.XMLHttpRequest != null)); 
	BO["safari2.0"] = (parseInt(0).toFixed != null) && BO["safari"] && !BO["safari1.2"]; 
	BO["safari1.1"] = BO["safari"] && !BO["safari1.2"] && !BO["safari2.0"]; 
	return BO; 
} 
var BO = new detectBrowser(); 
function onLoad()
{
	resizeNav();
	return;
}