var NavState = 0;

function displayNav()
{
if(NavState==0)
{
      $("#nav_container").animate({ 
        height: "480px"
      }, 1000 );
      NavState=1;
}
else
{
      $("#nav_container").animate({ 
        height: "1px"
      }, 1000 );
      NavState=0;
}
}



//Everything we need for slider
var currentindex=2;
var midwidth = 0;
var currentposition = 0;
var totalitems = 0;

$(document).ready(function()
{

//Get dynamic vars
totalitems=$(".galleryitem").size();
slidewidth = totalitems * 140;
midwidth = (totalitems * 70)-140;
midwidth = "-" + midwidth + "px";

$("#slider").fadeIn(500);
$(".galleryitem").animate({opacity: 0.3}, 1);
$("#galitem-2").animate({opacity: 1, 
margin: "0px", 
width: "140px"
}, 10, function(){
//Trigger Slider on complition
TimerMove();
});

});

//Our Timed Slider
function TimerMove()
{

//Do initial resets
currentindex=currentindex+1;
$(".galleryitem").animate({opacity: 0.3, 
margin: "10px", 
width: "120px"
}, 100);

if(currentposition == midwidth){
currentindex=3;
$("#slider").animate({"left": "0px"}, 1);
}

//Animate Slide
$("#slider").animate({"left": "-=140px"}, 1000, function(){
$("#galitem-"+currentindex).animate({opacity: 1, 
margin: "0px", 
width: "140px"
}, 100);
});
currentposition = $('#slider').css("left");

Timer=setTimeout("TimerMove()",4000);
}
