/*
$(function(){
 if ( $.browser.msie ) {
    
 } else {
 $('#top_shadow').hide();
	$('.buffer').waypoint(function(event, direction) {
   		if (direction === 'down') {
   		//alert("down");
   		$('#top_shadow').fadeTo(500, 1);

     		
   		}
   		else {
			//$('#top_shadow').hide('slow');
			$('#top_shadow').fadeTo(500, 0);
      	// do this on the way back up through the waypoint
   		} 
   		}, {
   offset: '0'}); 
 }

});
 
*/

//Small viewports
var height = $(window).height();;
function small_screens() {
	height = $(window).height();

   	if (height <= 1000) { 
   		$('#header').css("position", "relative");
   		$('.buffer').hide();
	} else {
   		$('#header').css("position", "fixed");
   		$('.buffer').show();	
	
	}
}
$(document).ready(function() {
    $(window).bind('resize', small_screens);
	if (height <= 1000) { 
   		$('#header').css("position", "relative");
   		$('.buffer').hide();
	}
});


$(function(){
	$('.top_shadow').hide();
	$('.buffer').waypoint(function(event, direction) {
   		if (direction === 'down') {
   			if (height >= 1000) {
   				$('.top_shadow').fadeTo(500, 1);   		
			}
   		}
   		else {
			$('.top_shadow').fadeTo(500, 0);
   		} 
   		}, {
   offset: '-2'}); 
});
  
$(function(){
//$('#top_shadow').hide();
	$('#subnav_beacon').waypoint(function(event, direction) {
   		if (direction === 'down') {
   		if (height >= 1000) {
			if ($.browser.msie && $.browser.version < 9) {
		   		$('#project_subnav_bottom a').hide(); 
		   	} else {
		   	$('#project_subnav_bottom a').fadeTo("fast", 1); 	
		   	}
		   	
		   	$('#project_subnav_bottom').fadeTo("fast", 0);
		   	}

   		} else {
		   	if ($.browser.msie && $.browser.version < 9) {
		   		$('#project_subnav_bottom a').show(); 
		   	} else {
		   	$('#project_subnav_bottom a').fadeTo("fast", 1); 	
		   	}
		   	$('#project_subnav_bottom').fadeTo("fast", 1);
		   	
   	   	} 
   	}, 
   	{
	offset: '0'}); 
});
 

$("ul#contacts li").hide();
$(function(){
$("ul#contacts li")
	.css( {backgroundPosition: "14px 20px"} )
	.mouseover(function(){
		$(this).stop().animate(
			{backgroundPosition:"(14px 60px)"}, 
			{duration:500})
		})
	.mouseout(function(){
		$(this).stop().animate(
			{backgroundPosition:"(14px 20px)"}, 
			{duration:500})
		})
	});	
		
$( window ).load( function(  ) { 
	var top = $("#about_map").scrollTop();
});

$(function () {
	$('img#contact').hover(function () {
    	this.src = '/wp-content/themes/Starkers/images/contact_down.jpg';
  		}, function () {
    		this.src = '/wp-content/themes/Starkers/images/contact_up.jpg';
 		});
});
$(function () {
        if ($.browser.msie && $.browser.version < 7) return;
        
        $('#navigation li.do')
            .removeClass('highlight')
            .find('a')
            .append('<span class="hover" />').each(function () {
                    var $span = $('> span.hover', this).css('opacity', 0);
                    $(this).hover(function () {
			    // on hover
			    $span.stop().fadeTo(500, 1);
			}, function () {
			    // off hover
			    $span.stop().fadeTo(500, 0);
			});
                });
                
    });

// --------------------- Home page ------------------------//

$(function () {
	$('#hero').hover(
		function () {
			$('#hero_arrow').animate({left: '+=15'}, 100); 
		},
	  	function () {
	  		$('#hero_arrow').animate({left: '-=15'}, 100);
		}
		);
});


$('#clickme').click(function() {
  $('#book').animate({
    opacity: 0.25,
    left: '+=50',
    height: 'toggle'
  }, 5000, function() {
    // Animation complete.
  });
});

//<input type="submit" id="do_it" value="toggle" />   
//
//$(document).ready(function()  
//$('#do_it').toggle(function() { 

    $('#doit').toggle(function() {
    $('.test').css('background', '#ff0').end();
    return false;
  }, function() {
    $('.test').css('background', 'transparent');
    return false;
  });




