var previousSelected = null;

//*************************************************************************************************
function getSrcElement(event){
//*************************************************************************************************
	var src;
	if(UseIE){
		src = window.event.srcElement;
	}else{
		src = event.target;
	}
	return src;
}

//*************************************************************************************************
document.onmouseover = function(mouseEvent){
//*************************************************************************************************
	var eSrc = getSrcElement(mouseEvent);
	if(eSrc != null){
		if(eSrc.tagName.toLowerCase() == "img"){
			eSrc = eSrc.parentNode;
		}
		if(eSrc.className.toLowerCase().indexOf("item") != -1){
			var className = eSrc.className.toLowerCase();
			var previous = false;
			if((className == "item")){
				eSrc = eSrc.parentNode;
				className = eSrc.className.toLowerCase();
			}
			if((className.indexOf("_header") != -1) || (className.indexOf("_footer") != -1) || className == "menu_item"){
				eSrc = eSrc.parentNode;
				className = eSrc.className.toLowerCase();
			}
			if(className.indexOf("previous_selected") != -1){
				className = className.split(" ")[0];
				previous = true;
			}
			if((className.toLowerCase() == "menu_item_top") || (className.toLowerCase() == "menu_item_middle") || (className.toLowerCase() == "menu_item_bottom")){
				eSrc.className = className + "_selected";
				if(previous){
					eSrc.className += " previous_selected";
				}
				if(eSrc.nextSibling){
					eSrc.nextSibling.className += " previous_selected";
					previousSelected = eSrc.nextSibling;
				}
			}
		}
	}
}

//*************************************************************************************************
document.onmouseout = function(mouseEvent){
//*************************************************************************************************
	var eSrc = getSrcElement(mouseEvent);
	if(eSrc != null){
		if(eSrc.tagName.toLowerCase() == "img"){
			eSrc = eSrc.parentNode;
		}
		if(eSrc.className.toLowerCase().indexOf("item") != -1){
			var className = eSrc.className.toLowerCase();
			var previous = false;
			if((className == "item")){
				eSrc = eSrc.parentNode;
				className = eSrc.className.toLowerCase();
			}
			if((className.indexOf("_header") != -1) || (className.indexOf("_footer") != -1) || className == "menu_item"){
				eSrc = eSrc.parentNode;
				className = eSrc.className.toLowerCase();
			}
			if(className.indexOf("previous_selected") != -1){
				className = className.split(" ")[0];
				previous = true;
			}
			if((className.toLowerCase() == "menu_item_top_selected") || (className.toLowerCase() == "menu_item_middle_selected") || (className.toLowerCase() == "menu_item_bottom_selected")){
				eSrc.className = className.substring(0, className.indexOf("_selected"));
				if(previous){
					eSrc.className += " previous_selected";
				}
				if(previousSelected){
					previousSelected.className = previousSelected.className.substring(0, previousSelected.className.indexOf(" previous_selected"));
					previousSelected = null;
				}
			}
		}
	}
}

//*************************************************************************************************
document.onclick = function(mouseEvent){
//*************************************************************************************************
	var eSrc = getSrcElement(mouseEvent);
	if(eSrc != null){
		if(eSrc.className.toLowerCase() == "lu"){
			window.open(eSrc.href);
			return false;
		}
	}
}
