/**********************************************
* Browser definition                          *
**********************************************/
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1 && navigator.userAgent.toLowerCase().indexOf('opera') == -1) {
	var isIE = true;
	//get IE version
	if (navigator.userAgent.toLowerCase().indexOf("msie 5.5") != -1) {
		var isIE55 = true;
	} else if (navigator.userAgent.toLowerCase().indexOf("msie 6") != -1)  {
		var isIE6 = true;
	} else if (navigator.userAgent.toLowerCase().indexOf("msie 7") != -1)  {
		var isIE7 = true;
	}
} else if (navigator.userAgent.toLowerCase().indexOf('opera') != -1) {
	var isOp = true;
} else if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1 || 
		  (navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && (navigator.userAgent.toLowerCase().indexOf('rv:1.7') != -1 || navigator.userAgent.toLowerCase().indexOf('rv:1.8') != -1))) {
	var isMoz = true;
}

if (typeof 'getE' != 'function') {
	function getE(id) {
		if (el = document.getElementById(id)) { 
			return el;
		} else {
			return false;
		}
	}
}
/* Add events on object*/
if (typeof 'addEvent' != 'function') {
	function addEvent(obj, evType, fn)
	{
		if (obj.addEventListener) {
			obj.addEventListener(evType, fn, true);
			return true;
		} else if (obj.attachEvent) {
			var r = obj.attachEvent("on"+evType, fn);
			return r;
		} else {
			return false;
		}
		return true;
	}
}
/*add some events on menu for IE compatibility only*/
function startMenu(menuRootId) {
	if (isIE && !isIE7) {
		var liMenu = document.getElementById(menuRootId).getElementsByTagName("LI");
		for (var i=0; i<liMenu.length; i++) {
		  	li = liMenu[i];
		  	if (li.nodeName=="LI") {
		  		li.onmouseenter=function() {
		  			this.className += " over";
		    	}
		  		li.onmouseleave=function() {
		  			this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}
/** 
  * Add window.onload event
  * launch some functions according to the current page
  */
addEvent(window, 'load', function(){
	startMenu("menu-instit");
	startMenu("menu-right");
	return true;
});
addEvent(window, 'load', function(){
	if(e = getE('print')){
		addEvent(e, 'click', function(){
			window.print();
			return false;
		})
	}
});
