/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);


$(document).ready(function(){
	//Top Navigation Start 
var t1,t2,t3,t4,t5;
	var in1, in2, in3, in4,in5;
	var fadeInSpeed = 400;
	var fadeOutSpeed = 300;
	//Top Navigation Start 
	$("#nav1b").hover(
		function () {
			$("#nav2c").fadeOut(50);
			$("#nav3c").fadeOut(50);
			$("#nav4c").fadeOut(50);
			$("#nav5c").fadeOut(50);
			clearTimeout(t1);
			clearTimeout(in1);
			in1 = setTimeout('$("#nav1c").fadeIn(100);',fadeInSpeed);
			$("#nav1b").addClass('activeNav');
		},
		function () {
			clearTimeout(t1);
			clearTimeout(in1);
			t1 = setTimeout('$("#nav1c").fadeOut(100);',fadeOutSpeed);
			$("#nav1b").removeClass('activeNav');
		}
	);
	$("#subnav1").hover(
		function () {
			clearTimeout(t1);
			clearTimeout(in1);
			if (document.getElementById("nav1c").style.display == "none") {
				$("#nav1c").fadeIn(100);
			}
		},
		function () {
			t1 = setTimeout('$("#nav1c").fadeOut(100);',fadeOutSpeed);
		}
	);
	
	$("#nav2b").hover(
		function () {
			$("#nav1c").fadeOut(50);
			$("#nav3c").fadeOut(50);
			$("#nav4c").fadeOut(50);
			$("#nav5c").fadeOut(50);
			clearTimeout(t2);
			clearTimeout(in2);
			in2 = setTimeout('$("#nav2c").fadeIn(100);',fadeInSpeed);
			$("#nav2b").addClass('activeNav');
		},
		function () {
			clearTimeout(t2);
			clearTimeout(in2);
			t2 = setTimeout('$("#nav2c").fadeOut(100);',fadeOutSpeed);
			$("#nav2b").removeClass('activeNav');
		}
	);
	$("#subnav2").hover(
		function () {
			clearTimeout(t2);
			clearTimeout(in2);
			if (document.getElementById("nav2c").style.display == "none") {
				$("#nav2c").fadeIn(100);
			}
		},
		function () {
			t2 = setTimeout('$("#nav2c").fadeOut(100);',fadeOutSpeed);
		}
	);
	
	$("#nav3b").hover(
		function () {
			$("#nav1c").fadeOut(50);
			$("#nav2c").fadeOut(50);
			$("#nav4c").fadeOut(50);
			$("#nav5c").fadeOut(50);
			clearTimeout(t3);
			clearTimeout(in3);
			in3 = setTimeout('$("#nav3c").fadeIn(100);',fadeInSpeed);
			$("#nav3b").addClass('activeNav');
		},
		function () {
			clearTimeout(t3);
			clearTimeout(in3);
			t3 = setTimeout('$("#nav3c").fadeOut(100);',fadeOutSpeed);
			$("#nav3b").removeClass('activeNav');
		}
	);
	$("#subnav3").hover(
		function () {
			clearTimeout(t3);
			clearTimeout(in3);
			if (document.getElementById("nav3c").style.display == "none") {
				$("#nav3c").fadeIn(100);
			}
		},
		function () {
			t3 = setTimeout('$("#nav3c").fadeOut(100);',fadeOutSpeed);
		}
	);
	
	$("#nav4b").hover(
		function () {
			$("#nav1c").fadeOut(50);
			$("#nav2c").fadeOut(50);
			$("#nav3c").fadeOut(50);
			$("#nav5c").fadeOut(50);
			clearTimeout(t4);
			clearTimeout(in4);
			in4 = setTimeout('$("#nav4c").fadeIn(100);',fadeInSpeed);
			$("#nav4b").addClass('activeNav');
		},
		function () {
			clearTimeout(t4);
			clearTimeout(in4);
			t4 = setTimeout('$("#nav4c").fadeOut(100);',fadeOutSpeed);
			$("#nav4b").removeClass('activeNav');
		}
	);
	$("#subnav4").hover(
		function () {
			clearTimeout(t4);
			clearTimeout(in4);
			if (document.getElementById("nav4c").style.display == "none") {
				$("#nav4c").fadeIn(100);
			}
		},
		function () {
			t4 = setTimeout('$("#nav4c").fadeOut(100);',fadeOutSpeed);
		}
	);
	

	$("#nav5b").hover(
		function () {
			$("#nav1c").fadeOut(50);
			$("#nav2c").fadeOut(50);
			$("#nav3c").fadeOut(50);
			$("#nav4c").fadeOut(50);
			clearTimeout(t5);
			clearTimeout(in5);
			in5 = setTimeout('$("#nav5c").slideDown(100);',fadeInSpeed);
			$("#nav5b").addClass('activeNav');
		},
		function () {
			clearTimeout(t5);
			clearTimeout(in5);
			t5 = setTimeout('$("#nav5c").slideUp(100);',fadeOutSpeed);
			$("#nav5b").removeClass('activeNav');
		}
	);
	$("#subnav5").hover(
		function () {
			clearTimeout(t5);
			clearTimeout(in5);
			if (document.getElementById("nav5c").style.display == "none") {
				$("#slideDown").fadeIn(100);
			}
		},
		function () {
			t5 = setTimeout('$("#nav5c").slideUp(100);',fadeOutSpeed);
		}
	);
	


$(".submitButton").hover(function(){
		this.style.background="#d7d7d7";
	},function(){
		this.style.background="#fff";
	});
// Top navigation End


	// Top Login Form Inputs
	$("#loginLaunch").click(function(){
		document.getElementById("loginForm").innerHTML = "PWP EMAIL ADDRESS <input type=\"text\" name=\"pwpEmail\" class=\"searchInputSmall\" /> PASSWORD <input type=\"password\" name=\"passwd\" class=\"searchInputSmall\" /><input type=\"hidden\" name=\"action\" value=\"check\" /><input type=\"submit\" value=\"LOG IN\" class=\"submitButton\" />";
  	})

	$(".clickActivate").click(function(){
		$(".headerAdvancedSearch").fadeToggle();
	})

  ss = setTimeout("slideshowKickoff()", 2000);

 });

jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);

}; 


  var whichSlideActive = 0;
  var leftPosition = 0;
  var t;
  function moveActiveSlide(whichSlide) {
     if (whichSlideActive+1 == totalSlides) {
      $("#slider ul").animate({ left: 0}, 300, "easeInOutExpo");
      whichSlideActive = 0;
      leftPosition = 0;
     } else {
      $("#slide"+whichSlide).find("img").trigger("dblclick");	
      whichSlideActive++;
     }
     currentWidth = jQuery("#slide"+whichSlideActive).find("img").width();
     document.getElementById("copyrightInfoList").style.width = (currentWidth-20) + "px";
     //alert(currentWidth + " dude");
     C = setTimeout('$("#caption'+whichSlideActive+'").slideDown("fast");', 1000);
     D = setTimeout('$("#caption'+whichSlideActive+'").slideUp("fast");', 9000);
     t = setTimeout("moveActiveSlide("+whichSlideActive+")", 10000);
  }
  $(window).bind("load", function() { 
    $("div#slider").slideView() 
  }); 

function slideshowKickoff() {
  t = setTimeout("moveActiveSlide("+keepTrack+")", 10000);
  C = setTimeout('$("#caption'+whichSlideActive+'").slideDown("fast");', 1000);
  D = setTimeout('$("#caption'+whichSlideActive+'").slideUp("fast");', 9000);
}

