var list;

function highlight(div){
	div.style.color = '#FF7F24';
	//div.style.fontWeight = 'bold';	
}
function unHighlight(div){
	div.style.color = 'white';	
	div.style.fontWeight = '';
}

function display(div,event){	
	var browser = getBrowser();	   
	var moused = event.toElement?event.toElement.parentNode:event.relatedTarget;		
	//alert('moused = '+moused+'\nid = '+moused.id);
	//getParents(moused,'none');	
	//if(list.indexOf("nav") == -1){initDDLs();alert('closing all DDLs: '+list);}
	try{
		if(moused.id.indexOf("nav") != -1){initDDLs();}	
	}catch(e){}     	

	var id = div.id;	
	var menuId = id+"-dd";
	var menuDiv = document.getElementById(menuId);	

	var bVersion = BrowserDetect.version;
	var browser = BrowserDetect.browser;				

	try{
	menuDiv.style.display = '';			       
	
	var left = getLeft(div);
	var top = getTop(div);		
	
	if(browser == 'Firefox'){
		menuDiv.style.marginTop = '3px';
		menuDiv.style.marginLeft = '-11px';
       }
	else if(browser == 'Explorer' && bVersion == 8 ){
		menuDiv.style.top = (top+25)+"px";
		menuDiv.style.left = (left-1)+'px';
	}
	else if(browser == 'Explorer' && bVersion == 7 ){
		menuDiv.style.top = (top-65)+"px";
		menuDiv.style.left = '-1px';
	}
	else if(browser == 'Explorer' && bVersion <= 6 ){
		menuDiv.style.top = (top-90)+"px";
		menuDiv.style.left = '-1px';
	}



	color = getStyle(menuId,'background-color');	
	color = '#104E8B';
	color = '#003366';
	div.style.backgroundColor = color;			       
	}catch(e){}
}

function getParents(el,l){
	var parent = null;		
	var id = '';
	
try{
		parent = el.parentNode;

		id = parent.id
	}catch(e){id='none';}
	list = l+","+id;
	if(parent && parent.parentNode){		
		getParents(parent,list);
	}else{
		
		return list;
	}
}


function hide(div){
	var id = div.id
	var menuId = id+"-dd";	
	var menuDiv = document.getElementById(menuId);	
	menuDiv.style.display = 'none';
	div.style.backgroundColor = '';	
}

function getStyle(el,styleProp){
	var x = document.getElementById(el);
	var display = x.style.display;	
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}

function getLeft(obj){
    var topValue= 0,leftValue= 0;
    while(obj){
	leftValue+= obj.offsetLeft;
	topValue+= obj.offsetTop;
	obj= obj.offsetParent;
    }
    finalvalue = leftValue + "," + topValue;
    return leftValue;
}
function getTop(obj){
    var topValue= 0,leftValue= 0;
    while(obj){
	leftValue+= obj.offsetLeft;
	topValue+= obj.offsetTop;
	obj= obj.offsetParent;
    }
    finalvalue = leftValue + "," + topValue;
    return topValue;
}

function getBrowser(){
	var browser;
	// Firefox 
	if(window.addEventListener) {			
		browser = "ff";
	}
	// IE //
	else if(window.attachEvent) {
		browser = "ie";
	}
	return browser;
}



