//Add mouse hover class
$(document).ready(function(){
	 $("#navLinks .linkDepth-0 li a").not("#navLinks .linkDepth-1 li a").not('#navLink1 a').click(function(e){
			/*e.returnValue = false;
			if(e.preventDefault()){ e.preventDefault(); }*/
	 });
  $("#navLinks .linkDepth-0 li").not("#navLinks .linkDepth-1 li").mouseenter(function() {
			if($(this).children('ul').length !==0){ 				
				if($(this).children('ul').hasClass("jqNavSel") && $(this).children('ul').is(":visible")){
					$(this).children('ul').stop(true, true);
				} else {
								
					var oldHeight = $(this).children('ul').css('height');
					$(this).children('ul').stop(true, true);
					$("#navLinks .linkDepth-1").not("#navLinks .linkDepth-1 li").hide();	  
					//$(this).children('ul').css({"height":"0px"});
					$(this).children('ul').show();
					$(this).children('ul').addClass("jqNavSel");
				}
				
			} else {
				$("#navLinks .linkDepth-1").not("#navLinks .linkDepth-1 li").hide();	  
			}
	  }).mouseleave(function() {
		$(this).children('ul').hide();
		/*if($(this).children('ul').length !==0 && $(this).children('ul').hasClass("jqNavSel")){ 		
			$(this).children('ul').delay(700).hide(function(){ $(this).children('ul').removeClass("jqNavSel"); });	
		}*/
	 });

	//Fix IE opacity for all selected items
	$(".opacityAnim").css({opacity:1});
	//Animate opacity
	$(".opacityAnim").mouseenter(function() {
		$(this).stop(true, true).animate({opacity:0.9});
	}).mouseleave(function() {
		$(this).stop(true, true).animate({opacity:1});
	});

	$('#shareThisButton').click(function(e){ 			e.returnValue = false;
			if(e.preventDefault()){ e.preventDefault(); } shareThis(); });


	$(document).click(function() {
		$(".formMoreInfoHide").hide();
	});
	
	$(".formMoreInfoQuestion").bind("click",function(e){ 
		var field = $(this).attr("id").substr(4);

		($("#moreInfo"+field).is(":visible")) ? $("#moreInfo"+field).hide() : $("#moreInfo"+field).show();
		$(".formMoreInfoHide").not("#moreInfo"+field).hide();
		return false;
	});
	
});

function shareThis(){
	if($('#shareThis').is(':visible')){
		$('#shareThis').slideUp();
	} else {
		$('#shareThis').slideDown();
	}
}
