/*---
 
 DYNAMIC MENU 4 CM.CANCOM.DE
 $Revision: 1.03 1.8.2004 $

 (c)2004 Copyright TriSoft Technologies. All rights reserved.
 
 License:
 This menu is not freeware - it is licensed!

---*/

//---( Variables
var timerID = null;
var timerOn = false;
var timecount = 500;

var check = false;
var what = null;
var newbrowser = true;
var arrActiveLayers = new Array();

function onLoad() {
	init();
}

function init() {
	if (document.layers) {
		layerRef="document.layers";
		styleSwitch="";
		visibleVar="show";
		screenSize = window.innerWidth;
		what ="ns4";
	} else if(document.all) {
	  	layerRef="document.all";
	  	styleSwitch=".style";
	  	visibleVar="visible";
	  	screenSize = document.body.clientWidth + 18;
	  	what ="ie4";
	}	else if(document.getElementById) {
		layerRef="document.getElementByID";
		styleSwitch=".style";
		visibleVar="visible";
		what="dom1";
	} else {
		what="none";
		newbrowser = false;
	}
	check = true;
}  

function reDo() {
	window.location.reload(); 
} window.onresize = reDo;

function getWidth(e) { 
	return (e.pixelWidth) ? e.pixelWidth : e.offsetWidth; 
}

function getAbsX(e) { 
	return (e.x) ? e.x : getAbsPos(e,"Left"); 
}

function getAbsY(e) {
	//return (e.y) ? e.y : getAbsPos(e,"Top");
	return (e.y) ? e.y : e["offsetTop"]; 
}

function getAbsPos(e,which) {
 iPos = 0;
 while (e != null) {
  iPos += e["offset" + which];
  e = e.offsetParent;
 }
 return iPos;
}

//---( the layer visibility on
function showLayer(layerName,e) {  
	if(check) {
		arrActiveLayers.push(layerName);
		if ( what=="none" ) { 
			return;
		} else if ( what=="dom1" ) {
			//document.getElementById(layerName).style.position="static";  
			document.getElementById(layerName).style.left=getAbsX(e)+getWidth(e);  
			document.getElementById(layerName).style.top=getAbsY(e); 
			document.getElementById(layerName).style.visibility="visible";  
		} else {
			//eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.position="static"');  
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left='+getWidth(e));  
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top='+getAbsY(e));
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');  		}
	} else {  
		return;  
	}
} 

//---( the layer visibility off
function hideLayer(layerName) {
	if (check) {
		if (what == "none") {
			return;
		} else if (what == "dom1") {
			//document.getElementById(layerName).style.position="absolute";
			document.getElementById(layerName).style.visibility="hidden";
		} else {
			//eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.position="absolute"');
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
		}
	} else {
		return;
	}
}

function hideAll() {
	for(var i=0;i<arrActiveLayers.length;i++) {
		hideLayer(arrActiveLayers[i]);
	}
	arrActiveLayers = new Array();
} 

function startTime() {
	if (timerOn == false) {
		timerID=setTimeout( "hideAll()", timecount);
		timerOn = true;
	}
} 

function stopTime() {
	if (timerOn) {
		clearTimeout(timerID);
		timerID = null;
		timerOn = false;
	}
}
