	/**
	 * @Author		Ashley Finlayson
	 * @Project		ENNAH website
	 * @Title		site.js
	 * @Description	General javascript for the site layout
	 */
	
	var rollOutTimer;

jQuery(document).ready(function(){
	
 /**
  * Get the web browser. If its IE6 the var has the value of true.
  * If isIE6 is true. Use jquery to change the sub menu backgrounds to gifs (this fixes subnav shadow issue).
  */
	var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
	if(isIE6 == true){
		$(".sub_menu_top").css({ background : 'url(assets/site_files/images/layout_assets/navigation/sub_menu_top_ie.gif) top' });
		$(".sub_menu_middle").css({ background : 'url(assets/site_files/images/layout_assets/navigation/sub_menu_middle_ie.gif) top' });
		$(".sub_menu_bottom").css({ background : 'url(assets/site_files/images/layout_assets/navigation/sub_menu_bottom_ie.gif) top' });
	}

  /**
   * Right Ad Functions
   */
	$("#main_right_top p a").mouseover(function(){
		$("#main_right_top").css( "background-position", "bottom" );
	});
	
	$("#main_right_top p a").mouseout(function(){
		$("#main_right_top").css( "background-position", "top" );
	});
	
	$("#main_right_middle p a").mouseover(function(){
		$("#main_right_middle").css( "background-position", "bottom");
	});
	
	$("#main_right_middle p a").mouseout(function(){
		$("#main_right_middle").css( "background-position", "top");
	});
	
 /**
  * Rollovers for Links that are folders.
  * get the buttons x and y.
  * set the buttons background to 'selected'
  * set the buttons inner link to 'selected'
  * set the buttons sub list to display block and its x value to the same as the button (for ie6).
  */
	$(".root_item_folder, .root_item_selected_folder").mouseover(function(){
		$(".root_item_folder").css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_folder.gif) right' });
		$(".root_item_folder, .root_item_selected_folder").find("ul").css({ display: 'none' });
		$(".root_item_folder").find("a").css({ color: '#535353' });
		
		var parentOffset = $(this).offset();
		$(this).css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_selected_folder.gif) right' });
		$(this).find("a").css({ color: '#FFA600' });
		$(this).find("ul").css({ display: 'block', left: parentOffset.left + 15 });
		clearInterval(rollOutTimer);
	});
 /**
  * Rollouts for Links that are folders.
  * do the oposite of the above.
  */
	$(".root_item_folder").mouseout(function(){

		rollOutTimer = setInterval(function(){
			
			$(".root_item_folder").css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_folder.gif) right' });
			$(".root_item_folder").find("a").css({ color: '#535353' });
			//$(".root_item_folder").find("ul").css({ display: 'none' });
			$(".root_item_folder").find("ul").slideUp("fast");
			clearInterval(rollOutTimer);
			
			//alert('!!!!');
		}, 500);
	});
/*
	Rollouts for a selected folder link.
*/
	$(".root_item_selected_folder").mouseout(function(){
	
		rollOutTimer = setInterval(function(){
			$(".root_item_selected_folder").find("ul").slideUp("fast");
			clearInterval(rollOutTimer);
		}, 500);
	});
/*
	Rollovers for first link
*/
	$(".root_item_first").mouseover(function(){
		$(this).css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_home_selected.gif) right' });
		$(this).find("a").css({ color: '#FFA600' });
	});
	$(".root_item_first").mouseout(function(){
		$(this).css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_home.gif) right' });
		$(this).find("a").css({ color: '#535353' });
	});
/*
	Rollovers for the last link
*/
	$(".root_item_last").mouseover(function(){
		$(this).css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_last_selected.gif) right' });
		$(this).find("a").css({ color: '#FFA600' });
	});
	$(".root_item_last").mouseout(function(){
		$(this).css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_last.gif) right' });
		$(this).find("a").css({ color: '#535353' });
	});
/*
	Rollovers for any links that arent, home, last or folers.
*/
	$(".root_item").mouseover(function(){
		$(this).css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav_selected.gif) right' });
		$(this).find("a").css({ color: '#FFA600' });
	});
	$(".root_item").mouseout(function(){
		$(this).css({ background: 'url(assets/site_files/images/layout_assets/navigation/nav.gif) right' });
		$(this).find("a").css({ color: '#535353' });
	});
	
  /**
   * Rollovers / Focus Effects for the search form and submit button
   */
	$("#search_input_wrapper input").focus(function(){
		$(this).parent().css('background-position', 'bottom left');
	});
	
	$("#search_input_wrapper input").blur(function(){
		$(this).parent().css('background-position', 'top left');
	});
	
	$("#search_btn_wrapper").mouseover(function(){
		$(this).css('background-position', 'bottom left');
	});
	
	$("#search_btn_wrapper").mouseout(function(){
		$(this).css('background-position', 'top left');
	});
	
  /**
   * Focus Effects for the username and password fields on the on the partner logins
   * Username
   */
	$("#username").focus(function(){
		$(this).parent().css('background-position', 'bottom left');
	});
	
	$("#username").blur(function(){
		$(this).parent().css('background-position', 'top left');
	});
	
	// password
	$("#password").focus(function(){
		$(this).parent().css('background-position', 'bottom left');
	});
	
	$("#password").blur(function(){
		$(this).parent().css('background-position', 'top left');
	});
	
	// forgot password email input
	$("#forgot_login_email_input").focus(function(){
		$(this).parent().css('background-position', 'bottom');
	});
	
	$("#forgot_login_email_input").blur(function(){
		$(this).parent().css('background-position', 'top');
	});
	
	// forgot password submit btn
	$("#submit, #cancel").mouseover(function(){
		$(this).parent().css('background-position', 'bottom');
	});
	
	$("#submit, #cancel").mouseout(function(){
		$(this).parent().css('background-position', 'top');
	});
	/*
	// forgot password submit btn
	$("#cancel").mouseover(function(){
		$(this).parent().css('background-position', 'bottom');
	});
	
	$("#cancel").mouseout(function(){
		$(this).parent().css('background-position', 'top');
	});
	*/
	/**
	 * RollOvers for the back button - #btn_back
	 */
	$("#btn_back").mouseover(function(){
		$(this).css('background-position', 'bottom');
	});
	
	$("#btn_back").mouseout(function(){
		$(this).css('background-position', 'top');
	});
	
});
/*
function rollOutFunc(){
	
}*/
