jQuery(function(){
	//$('.showpreview').mouseover(function() {
	//	$(this).find('.preview').css('left',$(this).context.offsetLeft).show();
	//});
	
	//$('.showpreview').mouseout(function() {
	//	$(this).find('.preview').hide();
	//});
	
	$('.tip').tooltip({position: 'top center', relative: true, offset: [-20,0]});
	
	$(".mainmenu.single").animate({opacity:'1'},{duration:160}).animate({opacity:'0.0'},{duration:160});
	
	$('#header').hover(function(){
		$(".mainmenu.single", this).stop().animate({opacity:'1'},{queue:false,duration:160});
	}, function() {
		$(".mainmenu.single", this).stop().animate({opacity:'0.0'},{queue:false,duration:160});
	});
	
	$('.singlenavlink').hover(function(){
		$(this).stop().animate({opacity:'1'},{queue:false,duration:160});
	}, function() {
		$(this).stop().animate({opacity:'0.2'},{queue:false,duration:160});
	});

		
	//Full Caption Sliding (Hidden to Visible)
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'110px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'197px'},{queue:false,duration:160});
	});
	
	$("div.work:odd").css("margin-right", "0px");
	
});

function applyBoxGrid() {
		//Full Caption Sliding (Hidden to Visible)
		jQuery('.boxgrid.captionfull').hover(function(){
			jQuery(".cover", this).stop().animate({top:'110px'},{queue:false,duration:160});
		}, function() {
			jQuery(".cover", this).stop().animate({top:'197px'},{queue:false,duration:160});
		});
		
		$('.content .boxgrid a').each(function() {
			var img = new Image();
			$(this).append(img);
			// image onload
			        $(img).load(function () {
						// hide first
			            $(this).css('display','none'); // since .hide() failed in safari
						//
			            $(this).parent().removeClass('loading');
			            $(this).fadeIn();
			        }).error(function () {
						$(this).remove();
			        }).attr('src', $(this).attr('rel'));
		
		
		});
	}

