$(document).ready(function() {


   $('#slider').nivoSlider({
		effect:'sliceDownLeft',
		slices:8,
		animSpeed:2000,
		pauseTime:4000,
		startSlide:0,
		directionNav:false, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:false, //Use left & right arrows
		pauseOnHover:false, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.5, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});





   // set lightbox looping
   $('a[rel*=lightbox]').slimbox({loop:true});





   // rolling horizontal menu
   $(".rollingMenu li").prepend("<span></span>"); //Throws an empty span tag right before the a tag

	$(".rollingMenu li").each(function() { //For each list item...
		var linkText = $(this).find("a").html(); //Find the text inside of the a tag
		$(this).find("span").show().html(linkText); //Add the text in the span tag
	}); 
	
	$(".rollingMenu li").not(".active").hover(function() {	//On hover...
		$(this).find("span").stop().animate({ 
			marginTop: "-29" //Find the span tag and move it up 53 pixels
		}, 300);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0" //Move the span back to its original state (0px)
		}, 300);
	});


   
   
   // make left sidebar,right sidebars and bodyRightContent full height
   leftSidebar = $('#bodyLeftSidebar').height();
   rightSidebar = $('#bodyRightSidebar').height();
   content = $('#bodyRightContent').height();
   tallest = leftSidebar;
   if(rightSidebar > leftSidebar) tallest = rightSidebar;
   if(content > tallest) tallest = content;
   jQuery('#bodyLeftSidebar').css({'height': tallest});
   jQuery('#bodyRightSidebar').css({'height': tallest});
   jQuery('#bodyRightContent').css({'height': tallest});
      





   // set navbar font to largest fit
   navBarWidth = $('ul.rollingMenu').width();
   newFontSize = jQuery('ul.rollingMenu').css('font-size');
   while(navBarWidth >= 530) {
      newFontSize = (parseInt(newFontSize)-1)+"px";
      jQuery('ul.rollingMenu').css({'font-size': newFontSize});
      navBarWidth = $('ul.rollingMenu').width();
   }




   // center nav bar
   navBarWidth = $('ul.rollingMenu').width();
   marginLeft = Math.round((576-navBarWidth)/2);
   //alert(">"+navBarWidth+" > "+marginLeft+" > "+parseFloat(newFontSize));
   if(navBarWidth <= 576)
      jQuery('ul.rollingMenu').css({'margin-left': marginLeft});

   
});

