$(document).ready(function(){

	$(".gdPrimaryNavigation li:not(.selected)").hover(
		function(){
			var isSelected = !!($(this).parents('.selected').get(0));
			$(this).addClass("hover");
			// console.log($(this).children("ul").get(0) !== undefined || isSelected);
			if( $(this).children("ul").get(0) !== undefined || isSelected){
				$(this).children("ul").show();
			}else{
				// ...else hide current page sub menu;
				$(".gdPrimaryNavigation li.selected ul").hide();		
			};
		},
		function(){
			$(this).removeClass("hover");
			// show current page sub menu, should test if hidden first:-(;
			$(".gdPrimaryNavigation li.selected ul").show();
			$(this).children("ul").fadeOut("normal");		
		}
	);

	$("#pageNumbering li:not(.current)").hover(
		function(){
			$(this).addClass("hover");
		},
		function(){
			$(this).removeClass("hover");	
		}
	);
	
	$("#printA")
		.css("cursor","pointer")
		.attr({title: "Click to Print"})
		.children("img")
			.attr({alt: "Click to Print"})
			.end()
		.click(function(){
			window.print();
		});
	
	$('.relatedImages a').lightBox();
	
	$(".email").addClass("emailBG");
	$(".password").addClass("passwordBG");
	
	$(".LoginContainer input[value!='']").addClass("noBG");
	$(".LoginContainer input").focus( function(){
		if ($(this).val() == "") {
			$(this).addClass("noBG");
		}
	});
	$(".LoginContainer input").blur( function(){
		if ($(this).val() == "") {
			$(this).removeClass("noBG");
		}
	});
	
});
