/* server */

$(document).ready(function(){
	//Homepage
	$("li#central-home ul.sub-ul-nav").parent().append("<span style='float:left; width:10px; background-image: url(http://175.41.139.102/iv2-css/centralbooks/images/fix-nav.png); background-position: -264px 0;; height:0px; padding-top:29px;'>&nbsp;</span>"); //Only shows drop down trigger when js is enabled and main menu is hovered (Adds empty span tag after ul.sub-ul-nav*)
				$("ul.centralnav li#central-home span").click(function() { //When trigger is clicked...
				//Following events are applied to the sub-ul-nav itself (moving sub-ul-nav up and down)
				$(this).parent().find("ul.sub-ul-nav").slideDown('fast').show(); //Drop down the sub-ul-nav on click
				$(this).parent().hover(function() {
				}, function(){
					$(this).parent().find("ul.sub-ul-nav").slideUp('slow'); //When the mouse hovers out of the sub-ul-nav, move it back up
				});
	});

	$("li#central-home").hover(function() {
					$("ul.centralnav li#central-home span").addClass("subhover");
					
			  },
				function () {
					$("ul.centralnav li#central-home span").removeClass("subhover")
        			});


	
	//Bookstore
	$("li#central-bookstore ul.sub-ul-nav").parent().append("<span style='float:left; width:10px; background-image: url(http://175.41.139.102/iv2-css/centralbooks/images/fix-nav.png); background-position: -264px 0;; height:0px; padding-top:29px;'>&nbsp;</span>"); //Only shows drop down trigger when js is enabled and main menu is hovered (Adds empty span tag after ul.sub-ul-nav*)
				$("ul.centralnav li#central-bookstore span").click(function() { //When trigger is clicked...
				//Following events are applied to the sub-ul-nav itself (moving sub-ul-nav up and down)
				$(this).parent().find("ul.sub-ul-nav").slideDown('fast').show(); //Drop down the sub-ul-nav on click
				$(this).parent().hover(function() {
				}, function(){
					$(this).parent().find("ul.sub-ul-nav").slideUp('slow'); //When the mouse hovers out of the sub-ul-nav, move it back up
				});
	});

	$("li#central-bookstore").hover(function() {
				//	$("ul.centralnav li#central-bookstore span").addClass("subhover");
					
			  },
				function () {
					$("ul.centralnav li#central-bookstore span").removeClass("subhover")
        			});

	//e-Library
	$("li#central-lib ul.sub-ul-nav").parent().append("<span style='float:left; width:10px; background-image: url(http://175.41.139.102/iv2-css/centralbooks/images/fix-nav.png); background-position: -264px 0;; height:0px; padding-top:29px;'>&nbsp;</span>"); //Only shows drop down trigger when js is enabled and main menu is hovered (Adds empty span tag after ul.sub-ul-nav*)
				$("ul.centralnav li#central-lib span").click(function() { //When trigger is clicked...
				//Following events are applied to the sub-ul-nav itself (moving sub-ul-nav up and down)
				$(this).parent().find("ul.sub-ul-nav").slideDown('fast').show(); //Drop down the sub-ul-nav on click
				$(this).parent().hover(function() {
				}, function(){
					$(this).parent().find("ul.sub-ul-nav").slideUp('slow'); //When the mouse hovers out of the sub-ul-nav, move it back up
				});
	});

	$("li#central-lib").hover(function() {
					$("ul.centralnav li#central-lib span").addClass("subhover");
					
			  },
				function () {
					$("ul.centralnav li#central-lib span").removeClass("subhover")
        			});


	//Publish on Demand
			$("li#central-pod ul.sub-ul-nav").parent().append("<span style='float:left; width:10px; background-image: url(http://175.41.139.102/iv2-css/centralbooks/images/fix-nav.png); background-position: -264px 0;; height:0px; padding-top:29px;'>&nbsp;</span>"); //Only shows drop down trigger when js is enabled and main menu is hovered (Adds empty span tag after ul.sub-ul-nav*)
				$("ul.centralnav li#central-pod span").click(function() { //When trigger is clicked...
				//Following events are applied to the sub-ul-nav itself (moving sub-ul-nav up and down)
				$(this).parent().find("ul.sub-ul-nav").slideDown('fast').show(); //Drop down the sub-ul-nav on click
				$(this).parent().hover(function() {
				}, function(){
					$(this).parent().find("ul.sub-ul-nav").slideUp('slow'); //When the mouse hovers out of the sub-ul-nav, move it back up
				});
			});

			$("li#central-pod").hover(function() {
					$("ul.centralnav li#central-pod span").addClass("subhover");
			  },
				function () {
					$("ul.centralnav li#central-pod span").removeClass("subhover")
        			});

	//Print on Demand
			$("li#central-prod ul.sub-ul-nav").parent().append("<span style='float:left; width:10px; background-image: url(http://175.41.139.102/iv2-css/centralbooks/images/fix-nav.png); background-position: -264px 0;; height:0px; padding-top:29px;'>&nbsp;</span>"); //Only shows drop down trigger when js is enabled and main menu is hovered (Adds empty span tag after ul.sub-ul-nav*)
				$("ul.centralnav span").click(function() { //When trigger is clicked...
				//Following events are applied to the sub-ul-nav itself (moving sub-ul-nav up and down)
				$(this).parent().find("ul.sub-ul-nav").slideDown('fast').show(); //Drop down the sub-ul-nav on click
				$(this).parent().hover(function() {
				}, function(){
					$(this).parent().find("ul.sub-ul-nav").slideUp('slow'); //When the mouse hovers out of the sub-ul-nav, move it back up
				});
			});

			$("li#central-prod").hover(function() {
					$("ul.centralnav li#central-prod span").addClass("subhover");
				},
				function () {
					$("ul.centralnav li#central-prod span").removeClass("subhover")
        			});


		//Support
			$("li#central-support ul.sub-ul-nav").parent().append("<span style='float:left; width:10px; background-image: url(http://175.41.139.102/iv2-css/centralbooks/images/fix-nav.png); background-position: -264px 0;; height:0px; padding-top:29px;'>&nbsp;</span>"); //Only shows drop down trigger when js is enabled and main menu is hovered (Adds empty span tag after ul.sub-ul-nav*)
				$("ul.centralnav span").click(function() { //When trigger is clicked...
				//Following events are applied to the sub-ul-nav itself (moving sub-ul-nav up and down)
				$(this).parent().find("ul.sub-ul-nav").slideDown('fast').show(); //Drop down the sub-ul-nav on click
				$(this).parent().hover(function() {
				}, function(){
					$(this).parent().find("ul.sub-ul-nav").slideUp('slow'); //When the mouse hovers out of the sub-ul-nav, move it back up
				});
			});

			$("li#central-support").hover(function() {
					$("ul.centralnav li#central-support span").addClass("subhover");
					
			  },
				function () {
					$("ul.centralnav li#central-support span").removeClass("subhover")
        			});

			
		});


