var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

var curobj = false;
var curbg = false;
var	curclr = false;

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6){
	/*dropmenuobj.style.left=dropmenuobj.style.top=-500*/
}
if (e.type=="click" && obj.display==hidden || e.type=="mouseover")
	obj.display='';
else if (e.type=="click")
	obj.display='none';
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
	if (typeof dropmenuobj!="undefined") //hide previous menu
	dropmenuobj.style.display="none";
	clearhidemenu();
	if (ie5||ns6){
		if (obj != curobj) {
			obj.onmouseout=delayhidemenu
		}
		dropmenuobj=document.getElementById(dropmenuID)
		if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.display='none'}
		dropmenuobj.onmouseover=clearhidemenu
		
	
		dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
		showhide(dropmenuobj.style, e, '', "none");
		if (dropmenuID == 'sub_publication') dropmenuobj.style.marginLeft="495px";
		else if (dropmenuID == 'sub_igi') dropmenuobj.style.marginLeft="492px";
		else if (dropmenuID == 'sub_about')dropmenuobj.style.marginLeft="165px";
	}
	noChange = ((obj.className != 'menuitemsdis') || (obj.className != 'menumostrightdis'));
	if (obj != curobj){
		if (!noChange){
			curbg = obj.style.backgroundImage;
			curclr = obj.style.color;
			curobj = obj;
		}
	}
	if (!noChange){
		obj.style.backgroundImage='none';
		obj.style.color='#fff';
	}

	return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
	delayhide=setTimeout("dropmenuobj.style.display='none'; if (curobj) { curobj.style.backgroundImage=curbg; curobj.style.color=curclr}",disappeardelay)
}

function clearhidemenu(){
	if (typeof delayhide!="undefined")
	clearTimeout(delayhide)
}

function showsubmenu(submenu,othis){
		submn=mId(submenu);
		submn.style.display='';
		if (othis){
			if (submenu == 'sub_publication') submn.style.marginLeft=(othis.offsetLeft - 375) + "px";
			else submn.style.marginLeft=(othis.offsetLeft - 50) + "px";
		}
		mId('menubottom').style.backgroundImage='none';
}

function hideSubMenu(cthis){
	aSub = new Array('sub_publication', 'sub_igi', 'sub_about');
	for(iSub=0; iSub < aSub.length; iSub++){
		if (cthis != aSub[iSub]){
			submn=mId(aSub[iSub]);
			if (submn){
				submn.style.display='none';
			}
		}
	}
}