$(document).ready(function(){
						   	   
/*------------Slideshow configuration----*/
	$('#slideshow').cycle({ 
		fx:     'fade', 
		speed:   3000, 
		timeout: 7000, 
		next:   '#next',
        prev:   '#prev',
		before:  onBefore, 
		after:   onAfter,
		pager:  '#slideshowThumbs',
		pagerAnchorBuilder: function(idx, slide) { 
        	return '<li><a href="#"><img src="' + slide.src + '" width="70" height="70" /></a></li>'; 
    	} 
	 });

	function onBefore() { 
		$('#output').animate({ 
			height: "0",
			opacity: 0.
      	}, 500 );

		$('#output').html(""); 
		
	} 
	function onAfter() { 
		$('#output').animate({ 
			height: "16px",
			opacity: 0.8
      	}, 500 );
		$('#output').append('<h2>' + this.title + '</h2>'); 
	}
	
	$('#pause').click(function() { $('#slideshow').cycle('pause'); return false; });
    $('#play').click(function() { $('#slideshow').cycle('resume'); return false; });
    
    $('#slideshowWrapper').hover(
        function() { $('#controls').show(); },
        function() { $('#controls').slideUp(); }
    );

	/*----Search--------------------------------------*/
	$("input#ajaxSearch_input").focus(function () {
         $(this).css('background','#fde4e5');
    });
	
	/*----Menu--------------------------------------*/
	var subMenuLinksCount = $('#subMenu ul li').size();
	if (subMenuLinksCount==1) {
		$('#subMenu ul li').addClass('firstLast');
	}
	
	
	/*--- Sub Sub Menu --------------------------------------*/
	var subsubMenuHeight = $("#subSubMenu").height();
	var subsubMenuHeight = -subsubMenuHeight-27;
	$("#projectMenu").css('marginTop',subsubMenuHeight);
	//console.log(subsubMenuHeight);
	$("#projectMenuTrigger").toggle( function () {
			$("#subSubMenu").css('visibility','visible');								   	
         	$("#projectMenu").animate({"marginTop": "0"}, "slow", "bounceout");
			$("#projectMenuTrigger").html('<img src="assets/templates/tomobrien/images/projectMenuClose.gif" width="235" height="19" alt="" />');
      }, function () {
		  	$("#projectMenu").animate({"marginTop": subsubMenuHeight}, "slow", "bounceout", function(){ $("#subSubMenu").css('visibility','hidden'); } );	
			$("#projectMenuTrigger").html('<img src="assets/templates/tomobrien/images/projectMenuOpen.gif" width="235" height="19" alt="" />');
	  }); 

	var subMenu = $("#subSubMenu").size();
	if (subMenu==0) {
		$("#content").css('paddingTop','45px');
		$("#content").css('height','500px');
	}
	//console.log(subMenu);
	

}); //Close document.ready
$(window).bind('load', function() {
	
	$("#subMenu").animate({
      "left": "0"
    }, "slow", "easein", function(){ $("#projectMenu").css('visibility','visible'); });

	$('#controls').fadeTo("slow", 0.80);

});





