<!--
/**
* 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>

			$("#demo3 li").hoverIntent({
				sensitivity: 3, 
				interval: 200, 
				over: makeTall, 
				timeout: 500, 
				out: makeShort
			});
function makeTall(){  $(this).animate({"height":75},200);}

*/
(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(){
    $("#navcontainer, #navbar, #navbar2, #navnext, #navprev, #prevproj, #nextproj").hide();

//for all menus
function menusOpen(){ $("#navcontainer, #navbar, #navbar2").slideDown(120);}
function menusClose(){ $("#navcontainer, #navbar, #navbar2").slideUp(120);}

//menus
//BOTTOM
    $("#hoverbottom, #breadcrumb").hover(
	 function () {  //on hover 
      $("#navcontainer, #navbar, #navbar2").slideDown(120);
	 },
	 function () { //hover out
     } 
	);

//clear menus when hover over overlay. overlay is under menu layers, so is masked.
	 $("#overlay, #overlaymovie, #deck_textonly").hover(
	 function () {  //on hover 
      $("#navcontainer, #navbar, #navbar2").slideUp(120);
	 },
	 function () { //hover out
     } 
	);

//hover out of container closes everything, with delay
$("#container").hoverIntent({
				sensitivity: 3, 
				interval: 0, 
				//over: functionName, 
				timeout: 700, 
				out: menusClose
			    });

//

//PREV/NEXT
	$("#hovernext").hover(
	 function () {  //do this on hover 
	 $("#navcontainer, #navbar, #navbar2").slideUp(120);
	 $("#navnext, #nextproj").show();
	 },
	 function () { //hover out
	 $("#navnext, #nextproj").hide();
     } 
	);
	
	$("#hoverprev").hover(
	 function () {  //do this on hover 
	 $("#navprev, #prevproj").show();
	 },
	 function () { //hover out
	 $("#navprev, #prevproj").hide();
     } 
	);
	
//end menus

//cycle plugin
   $(function() {
    $("#deck").cycle({
     //delay: 500, use this and comment out line below for auto advance
     timeout: 0,
     speed: 200,
	 nowrap: 1,
	 prev: '#navprev', //clicking on these moves back 
     next: '#overlay, #overlaymovie, #navnext, #intro_miranda', //clicking on these moves forward
     before: onBefore
     });
    
    function onBefore() { 
     $('#title').html(this.title);
	 $('#title_black').html(this.title);
     $('.intro_subline').html(this.alt);
     $('.intro_headline').html(this.name);
	 $('#caption').html(this.title);
       //
	   if ((this.id)=='movie')
	    {
	    $("#infobar, #overlay").hide();
		//$("#navbar").css("bottom", 50);
		$("#navcontainer").css("bottom", 50);
		$("#hoverbottom").css("bottom", 50);
	   } else {
		 $("#navcontainer").css("bottom", 0);
		 $("#hoverbottom").css("bottom", 0);
	   }
	   //
     }
   });

});
//end cycle


//end jquery functions


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->