$(document).ready(function() {

// FADE IN MENU

	$('#Menu1 a').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});
	
// FADE IN LOGO  
/*
  $('h1 a').hover(
    function () {
      $(this).stop(true).fadeTo('normal',.8);
    }, 
    function () {
      $(this).fadeTo('normal',1);
    }
  );
*/
	 
/*
$(".tab").hide();
	 
	 //when we click one of the tabs
	 $(".tabLink").click(function(){
	 //get the ID of the element we need to show
	 stringref = $(this).attr("href").split('#')[1];
	 //hide the tabs that doesn't match the ID
	 $('.tab:not(#'+stringref+')').hide();
	 //fix
	 if ($.browser.msie && $.browser.version.substr(0,3) == "6.0") {
	 $('.tab#' + stringref).show();
	 }
	 else
	 //display our tab fading it in
	 $('.tab#' + stringref).fadeIn();
	 //stay with me
	 return false;
	 });
	 
  $('.tab .close').click(
    function () {
      $('.tab').stop(true).hide();
    }
  );
*/
  

//SIDEPANEL
//when we click one of the tabs
	 $(".tabLink").click(function(){
	 //get the ID of the element we need to show
	 stringref = $(this).attr("href").split('#')[1];
	 //hide the tabs that doesn't match the ID
	 $('.tab:not(#'+stringref+')').animate({left:'30px'},{queue:'false',duration:'100'});
	 //fix
	 if ($.browser.msie && $.browser.version.substr(0,3) == "6.0") {
	 $('.tab#' + stringref).animate({left:'-500px'},{queue:'false',duration:'100'});
	 }
	 else
	 //display our tab fading it in
	 $('.tab#' + stringref).animate({left:'530px'},{queue:'false',duration:'100'});
	 //stay with me
	 return false;
	});
	 
	$('.tab .close').click(
    function () {
      $('.tab').stop().animate({left:'-500px'},{queue:'false',duration:'100'});
      return false;
	});

	$('.principles').cycle({ 
		fx: 'scrollHorz',
		timeout: 7500 
	});
	
	$('#sillys').cycle({ 
		fx: 'scrollHorz',
		timeout: 2000 
	});

	 
	 
// PROJECT BUTTON SLIDE DOWN
	
	$("#projects ul").hide();
	$("#projects h3").click(function() {
		$("#projects ul").animate({height: "toggle"}, 200);
		$(this).toggleClass("active");
		return false;
	});
	
// HOME PAGE SLIDESHOW	
	
	$('#slider').cycle({ 
		fx: 'scrollHorz',
		timeout: 4000 
	});
	
	$('#ProjectImg').cycle({ 
		next:  '#ProjectImg img', 
		fx: 'cover',
		timeout: 0 
	});

});

