//browser object
var browser=new Object();
browser.isIE=(navigator.appName=="Microsoft Internet Explorer" && navigator.userAgent.indexOf("Opera")<0)?true:false;
browser.isOpera=navigator.userAgent.indexOf("Opera")>0?true:false;
browser.isMozilla=navigator.product=="Gecko"?true:false;


//returns element
function getEl(elid){
	return document.getElementById(elid);
}



//returns array of elements with class name clsname inherent in element with id parel
function getElementsByClassName(parel,clsname){
	var outp=new Array();
	var els=getEl(parel).getElementsByTagName("*");
	for(var i=0;i<els.length;i++){
		if(els[i].className==clsname)outp.push(els[i]);
	};
	return outp;
}

//clips an element with id elid (left, top, right, bottom)
function clipEl(elid,l,t,r,b){
	getEl(elid).style.clip="rect("+t+"px,"+(getW(elid)-r)+"px,"+(getH(elid)-b)+"px,"+l+"px)";
}

//sets display none for an element with id elid 
function setDN(elid){
	getEl(elid).style.display="none";
}

//sets display block for an element with id elid
function setDB(elid){
	getEl(elid).style.display="block";
}

//sets display inline for an element with id elid
function setDI(elid){
	getEl(elid).style.display="inline";
}

//sets visibility hidden for an element with id elid
function setVH(elid){
	getEl(elid).style.visibility="hidden";
}

//sets visibility visible for an element with id elid
function setVV(elid){
	getEl(elid).style.visibility="visible";
}

//clips an element given as object 
function clipElObj(el,l,t,r,b){
	el.style.clip="rect("+t+"px,"+(getW(elid)-r)+"px,"+(getH(elid)-b)+"px,"+l+"px)";
}

//sets display none for an element el
function setDNObj(el){
	el.style.display="none";
}

//sets display block for an element el
function setDBObj(el){
	el.style.display="block";
}

//sets display inline for an element el
function setDIObj(el){
	el.style.display="inline";
}

//sets visiblity hidden for an element el
function setVHObj(el){
	el.style.visibility="hidden";
}

//sets visiblity visible for an element el
function setVVObj(el){
	el.style.visibility="visible";
}



window.onload = function() {
	initNav();
}



var timers=new Array();
var menuFall=20;

function initNav() {
	if(browser.isIE) {
		var menuElements=getEl('mnu').getElementsByTagName("ul");
		for(var i=0;i<menuElements.length;i++) {
			menuElements[i].parentNode.onmouseover=function() {
				if(timers[this.lastChild.id]) clearTimeout(timers[this.lastChild.id]);
				setVVObj(this.lastChild);
				this.firstChild.lastChild.style.backgroundPosition="0px -48px";
			}			
			menuElements[i].parentNode.onmouseout=function() {
				timers[this.lastChild.id]=setTimeout('setVH("'+this.lastChild.id+'");var liEl=getEl("'+this.id+'");',menuFall);
			}			
		}
	}
}
