function prinav () {
	
	$('#nav > li').hover(
		function(){$(this).addClass('hovered'); $('#nav > #' + $(this).attr('id') + ' > ul').css('left','0');}, 
		function(){$(this).removeClass('hovered'); $('#nav > #' + $(this).attr('id') + ' > ul').css('left','-999em');}
	);
	
    $('#nav > li > ul > li.popout').hover(
		function() {$(this).addClass('hover');},
	 	function() {$(this).removeClass('hover');
    });	// This removes the need for HTC fix csshover.htc
	
	$('#nav > li > a').focus(
		function(){$(this).parent().addClass('hovered');}
	);
	$('#nav > li > a').blur(
		function(){$(this).parent().removeClass('hovered');}
	);
		
	$('#nav > li > ul > li > a').focus(
		function(){$(this).parent().parent().parent().addClass('hovered');}
	);
	$('#nav > li > ul > li > a').blur(
		function(){$(this).parent().parent().parent().removeClass('hovered'); $('#nav > #' + $(this).attr('id') + ' > ul').css('left','-999em');}
	);
	$('#nav > li > ul > li.popout > a').blur(
		function (){
			$(this).parent().removeClass('popoutfocus'); // removes the grey line in the li		
			}
			
	);
	$('#nav > li > ul > li.popout > a').focus(
		function(){
			$(this).parent().parent().find('li ul.popoutfocus').removeClass('popoutfocus'); //This is what removes the ul (it bloody works)
			$(this).next().addClass('popoutfocus'); //This adds what is removed above to the current ul
			$(this).parent().css('position','relative'); //This puts the UL next to the parent li
			$(this).parent().addClass('popoutfocus'); // adds the grey line in the li
			}
	);
		
}
function toggleForm(targetId, linkId){
	var link = document.getElementById(linkId);
	var target = document.getElementById(targetId);
	target.className = "show";
	link.onclick = function() {
		toggler(target, link);
		return false;
	}

}
function toggler(target, link) {
	target.className = (target.className == "hide") ? "show" : "hide";
	link.className = (link.className == "tertiary openState") ? "tertiary" : "tertiary openState";
	
}
function openSearch(){
	if ( $("#openSchedule").length > 0 ) {
			toggleForm("ddBreakdown", "openSchedule");
		}
	
}

$(document).ready(function() {
	openSearch();
	prinav();
	$(".lightbox").lightbox();
	$("#promoRotatorContainer").jqGalScroll();

});

 