/* OMX-styled nav bar jquery code for displaying subnav */

var curNav;
var navtime;
var timeDelay = 1000; /* time delay of hiding hovered subnav (1000 = 1 sec) */


/* jquery function to hide current area subnav and show hovered subnav */

jQuery.fn.navHoverOn = function(curId) {
	curNav = $("#omxNav .navOn");
	$("#omxNav .navHover").removeClass("navHover").addClass("navOff");
	if (curNav.attr("id") != curId) {
		$(curNav).addClass("navHighlight");
		$("#omxNav").css("background","url(/omx_styleImages/navBgHover.jpg) repeat-x left top");
		clearTimeout(navtime);
		$(this).removeClass("navOff").addClass("navHover");
	} else {
		$("#omxNav").css("background","url(/omx_styleImages/navBg.jpg) repeat-x left top"); 
		$(curNav).removeClass().addClass("navOn");
	}
};

/* jquery function to hide hovered subnav and restore current area subnav */

jQuery.fn.navHoverOff = function(curId) {
	if (curNav.attr("id") != curId) {
		var doNav = '$("#' + curId + '").removeClass().addClass("navOff"); $("#omxNav").css("background","url(/omx_styleImages/navBg.jpg) repeat-x left top"); $(curNav).removeClass().addClass("navOn");';
		navtime = setTimeout( doNav, timeDelay);
	} else {
		$("#omxNav").css("background","url(/omx_styleImages/navBg.jpg) repeat-x left top"); 
		$(curNav).removeClass().addClass("navOn");
	}
};


$(document).ready(function(){

	$("#omxNav ul li ul").find("li:eq(0)").addClass("noDiv");

	/* public pages nav effects */

	$("#nm-li0").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#nm-li1").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#nm-li2").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#nm-li3").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#nm-li4").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#nm-li5").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});


	/* member pages nav effects */

	$("#liHome").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liMarketData").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liTradingHistory").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liNews").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liAnalyst").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liOwnership").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liGovernance").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liIssuerServices").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});

	$("#liMyAccount").hover(function() {
		$(this).navHoverOn(this.id);
	},
	function() {
		$(this).navHoverOff(this.id);
	});



});