$(document).ready(function(){

	$("#Menu li:last-child").addClass("last");
	$('#slideshow').cycle({ 
			fx:			'fade',
			speed:       1000, 
			timeout:     6000
	});
	$('#Buttons .sliderButton0').click(function(e) { e.preventDefault(); $('#slideshow').cycle('next'); });
	$('#Buttons .sliderButton1').click(function(e) { e.preventDefault(); $('#slideshow').cycle('prev'); });
	
	function textReplacement(input) {
		var originalvalue = input.val();
		input.focus(function() {
			if($.trim(input.val()) == originalvalue){ input.val(""); }
		});
		input.blur(function() {
			if($.trim(input.val()) == ""){ input.val(originalvalue); }
		});
	}

	textReplacement($("#search_query"));
	textReplacement($("#nl_first_name"));
	textReplacement($("#nl_email"));
	
	$("#ProductReviews a[onclick*=show_product_review_form]").addClass("button");
	$("#ProductReviews a[onclick*=show_product_review_form] img").replaceWith("Write a Review");	

//	jCarouselLite example -- you will need to add a <div class="ProductListContainer"> around the <ul>
//	in the HomeFeaturedProducts Panel

//	$("#HomeFeaturedProducts .ProductListContainer").jCarouselLite({
//        btnNext: "#featured-next",
//        btnPrev: "#featured-prev",
//	      visible: 5,
//	 	  scroll: 5,
//		  speed: 800
//   });
	
//	$("a.fancybox").fancybox();
	
	var colors = ['#8B7838','#836A75','#1174D6','#FF7A36','#D27CB0','#8B7838','#836A75','#1174D6','#FF7A36','#D27CB0'];
	$('#Menu > ul > li > a').each(function(index,element) {
		$(element).attr('style','color:'+colors[index]);
	});
	
	Cufon.replace('#Menu > ul > li > a');
	

	
	Rugs = 3;
	Lighting = 4;
	Accessories = 7;
	$('#Menu > ul > li:nth-child('+Rugs+') ul').css('width', 150);
	$('#Menu > ul > li:nth-child('+Lighting+') ul').css('width', 150);
	$('#Menu > ul > li:nth-child('+Accessories+') ul').css('width', 200);
	
	//$('.SubCategoryListGrid ul li a:first-child').wrapInner('<div class="ImageWrapper"/>');
	
});

function adToggle() {
if ($("#topad").is(":hidden")) {
$("#topad").slideDown("slow");
//$('body').css("margin-top","40px");
//$(".open").css('display','none');
} else {
$("#topad").slideUp("slow");
//$('body').css("margin-top","0px");
//$(".open").css('display','inline');
}
} 
