$(document).ready(function() {
	switchTo('level-1');

  $("#projects .level-1 a ").bind("click", function(){ switchTo("level-1"); });
  $("#projects .level-2 a ").bind("click", function(){ switchTo("level-2");});
  $("#projects .level-3 a ").bind("click", function(){ switchTo("level-3"); });
  $("#projects .level-4 a ").bind("click", function(){ switchTo("level-4");});
    		
	var curSect = "";

	function switchTo(which){
		jQuery.easing.def = "easeInOutSine";
		
		h = $(".project").height();  //so we don't have to hardcode the row height;
		if (which == curSect) { return; }  //don't switch if we are on the selected tab
		
		if (which == "level-1"){ $("#scroller-vertical").animate({top: '0'}, { "duration": 300 } ); }
		if (which == "level-2"){ $("#scroller-vertical").animate({top: "-"+(h)+"px"}, { "duration": 300 } ); }
		if (which == "level-3"){ $("#scroller-vertical").animate({top: "-"+(h*2)+"px"}, { "duration": 300 } ); }
		if (which == "level-4"){ $("#scroller-vertical").animate({top: "-"+(h*3)+"px"}, { "duration": 300 } ); }
		
		curSect = which;
	
	}

	$('#slider-one').movingBoxes({
		startPanel   : 1,      // start with this panel
		buildNav     : true,   // if true, navigation links will be added
		panelType    : '> li', // selector to find the immediate ">" children "li" of "#slider-one" in this case
		navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
	});

	$('#slider-two').movingBoxes({
		startPanel   : 1,      // start with this panel
		buildNav     : true,   // if true, navigation links will be added
		panelType    : '> li', // selector to find the immediate ">" children "li" of "#slider-one" in this case
		navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
	});

	$('#slider-three').movingBoxes({
		startPanel   : 1,      // start with this panel
		buildNav     : true,   // if true, navigation links will be added
		panelType    : '> li', // selector to find the immediate ">" children "li" of "#slider-one" in this case
		navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
	});

	$('#slider-four').movingBoxes({
		startPanel   : 1,      // start with this panel
		buildNav     : true,   // if true, navigation links will be added
		panelType    : '> li', // selector to find the immediate ">" children "li" of "#slider-one" in this case
		navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
	});
});

