$(document).ready(function(){
	$('.boxgrid.bigBox').hover(function(){
		$(".cover", this).stop().animate({bottom:'0px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({bottom:'-63px'},{queue:false,duration:160});
	});
	$('.boxgrid.smallBox').hover(function(){
		$(".cover", this).stop().animate({bottom:'0px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({bottom:'-50px'},{queue:false,duration:160});
	});
	var searchBoxes = $(".text");
	var searchBox = $("#search, #name");
	var searchBoxDefault = "Search";

	searchBoxes.focus(function(e){
	$(this).addClass("active");
	});
	searchBoxes.blur(function(e){
	$(this).removeClass("active");
	});

	searchBox.focus(function(){
		if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
	});
	searchBox.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
	});

	$('.auto-focus:first').focus();

	$('INPUT.auto-hint, TEXTAREA.auto-hint').focus(function(){
		if($(this).val() == $(this).attr('title')){ 
			$(this).val('');
			$(this).removeClass('auto-hint');
		}
	});

	$('INPUT.auto-hint, TEXTAREA.auto-hint').blur(function(){
		if($(this).val() == '' && $(this).attr('title') != ''){ 
			$(this).val($(this).attr('title'));
			$(this).addClass('auto-hint'); 
		}
	});

	$('INPUT.auto-hint, TEXTAREA.auto-hint').each(function(){
		if($(this).attr('title') == ''){ return; }
		if($(this).val() == ''){ $(this).val($(this).attr('title')); }
		else { $(this).removeClass('auto-hint'); } 
	});

	$('ul.sf-menu').superfish();
	$("a.gallerygroup").fancybox();
});
