$(document).ready(function() {

	/*
	$("#link-beginwork").click(function () {
		  $("#menu-begin-work").fadeToggle();
		});
	
	$("#more-info").click(function () {
		$('#portfolio-item-info').fadeToggle();
	});
	*/

	
	/*@cc_on
	@if (@_jscript_version <= 5.6)
	  // js code for IE6 or down
	  $('body').pngFix();
	  $('body').append("<style> </style>");
	@else @*/
	// js code for IE7 and non-IE browsers
	
	$(window).resize(function() {
		checkMenuScrollHeight();		
	});
	
	checkMenuScrollHeight();	  
	/*@end @*/
	

	
	$("#viewDirections").click(function(){
		$("#googleMap").slideToggle('slow');
	});
	
});

function checkMenuScrollHeight() {
	
	var viewportHeight = $(window).height();
	var menuHeight = $("#menu-begin-work").height() +314;
	
		if(viewportHeight < menuHeight){
			
			$('#main-nav-outer').css('position','absolute');
			$('#begin').css('position','absolute');
			$('#beginlogo').css('position','absolute');
			$('#menu-begin-work').css('position','absolute');
						
		}else{

			$('#main-nav-outer').css('position','fixed');
			$('#begin').css('position','fixed');
			$('#beginlogo').css('position','fixed');
			$('#menu-begin-work').css('position','fixed');

		}
}

changeBackground = function ($url) {
	$("#ajax-loader").fadeIn();
	//$("#background-img").toggle();
	var src = $url;

    $("#background-img").attr("src", src);
	
	$("#background-img").load(function (){
		$("#ajax-loader").fadeOut();
		$("#background-img").show();
	});
	
}

jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);

}; 
