
/* Recent Work Fade In
------------------------------------------------------*/

$(document).ready(function () {
  
  if($(".newWork .info")){
    $(".newWork .info:last-child").css("margin-right","0");
    $(".newWork .info").css("cursor","pointer");
    
    var workPanel = $(".newWork .info");
    var workLink = $(".newWork .info .thumbnails a");

    $(".newWork .info").click(function(){
        var index = workPanel.index(this);
        window.location=workLink[index].href;
    });

  }
  
  $(".newWork .info").eq(1).fadeTo("slow", 1);
  setTimeout('$(".newWork .info").eq(0).fadeTo("slow", 1);', 500);
  setTimeout('$(".newWork .info").eq(2).fadeTo("slow", 1);', 1000);
  
  $(".newWork .info").mouseover(function(){
    $(this).animate({backgroundColor:"#EFFCFC"},200);
    $(this.childNodes[1].childNodes[1]).fadeTo("fast",1);
    
  });
  $(".newWork .info").mouseleave(function(){
    $(this).animate({backgroundColor:"#ffffff"},150);
    $(this.childNodes[1].childNodes[1]).fadeTo("fast",.8);
  });
  
  /* Main Navigation Hover Effect
  ------------------------------------------------------*/
  
  var navHover = $("#navMark");
  
  $("#mainNav li").mouseover(function(){
   navHover.css("border-left-width","7px");
   navHover.css("border-right-width","7px");
   navHover
      .animate({left:$(this).position().left + "px"}, { queue:false, duration:250 })
      .animate({width:$(this).width()-14 + "px"}, { queue:false, duration:250 });
   navHover.fadeIn("slow");
  });
  $("#header").mouseleave(function(){
   navHover
      .animate({left:navHover.position().left + navHover.width()/2 + 7 + "px"}, { queue:false, duration:150 })
      .animate({width:0 + "px"},{ queue:false, duration:150 })
      .animate({borderLeftWidth:0},{ queue:false, duration:150 })
      .animate({borderRightWidth:0},{ queue:false, duration:150 })
      .fadeOut("def");
  });


  $('#dialog').jqm({modal: true, trigger: 'a.showDialog'});
  $('#dialog').jqmAddClose('.hideDialog');


  /* Projects Listing Layout
  ------------------------------------------------------*/

  if($("#projectListing .info")){
    $("#projectListing .info:nth-child(even)").css("padding-right","0");
  }
  
  $(".flickr img").hover(
    function(){
      $(this).fadeTo("fast",1);
    },
    function(){
      $(this).fadeTo("fast",.8);
    }
    );
});



