/*
	===========================================================
	Custom Wordpress Theme - UI Effects - "Crunch.js"
	Author: Foxtie, www.foxtie.com
	===========================================================
	Description: jQuery function initialization.
	===========================================================
*/

jQuery(function( $ ){	
	
	$(".wpsc_product_search").focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = "";
	}
}).blur(function() {
	if( !this.value.length ) {
		this.value = this.defaultValue;
	}
});
	
	$('a.markgarity').bind('click',function(){
		img = $(this).attr('href');	
		title = $(this).find('img').attr('alt');	
		desc = $(this).find('img').attr('title');	
		
		$('#bigimage').attr('src',img);
		$('#biginfobox h2').empty().append(title);
		$('#biginfobox p').empty().append(desc);
		
		return false;
	});
	
	$('a#changer-wood').click(function(){
		goWood();
		return false;
	});
	$('a#changer-granite').click(function(){
		goGranite();
		return false;
	});
	
	function goGranite(){
		$('div#rotator #fade-one').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/rotator-fade-0-granite.png)");
		$('div#rotator #fade-two').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/rotator-fade-3-granite.png)");
		$('body.home').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/bg-home-granite.jpg) top center no-repeat #1f1b1a");
		if ($('body').hasClass('home')){ }else{
			$('#footer').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/shelf_footer-granite.png) top center no-repeat");
		}
	}
	function goWood(){
		$('div#rotator #fade-one').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/rotator-fade-0.png)");
		$('div#rotator #fade-two').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/rotator-fade-3.png)");
		$('body.home').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/bg-home.jpg) top center no-repeat #1f1b1a");
		if ($('body').hasClass('home')){ }else{
			$('#footer').css("background","url(http://www.steval.us/wp-content/themes/steval/lib/img/shelf_footer.png) top center no-repeat");
		}
	}
		
	$(".fancybox").fancybox({'transitionIn':'elastic', 'transitionOut': 'elastic','easingIn':'swing','easingOut':'swing'}); 
});

