$(document).ready(function() {
	
	$("#featured-productss a").click(
		function(){
			$("#featured-productss").toggleClass("active");
			}
		);
			
		$('a.show_retailer').click(function(){
		$('#featured-products').slideDown("slow");
		$('a.show_retailer').hide(); 
		$('a.hide_retailer').show();
	});
	$('a.hide_retailer').click(function(){
				$('#featured-products').slideUp("fast");
				$('a.hide_retailer').hide();
				$('a.show_retailer').show();
   });
/*
	 html > body > div #page > div #container > div #content .product
	*/
	
	$('a#rt').lightBox();
   /*$("input.text, textarea.text").focusFields("#d40000", 1, "#f3e784", );*/              //E-mail Address

   
	$("#search-query").click(function(){
			this.value = '';
	});
	$("#search-query").blur(function(){
		if(this.value == '')       
			this.value = 'Enter Search term';
	});
   
	$("#name").click(function(){
		if(this.value == 'Name') 
			this.value = '';
	});
	$("#name").blur(function(){
		 if(this.value == '')       
			this.value = 'Name';
	});
   
	$("#email").click(function(){
		if(this.value == 'E-mail Address') 
			this.value = '';
	});
	$("#email").blur(function(){
		 if(this.value == '')       
			this.value = 'E-mail Address';
	});
	$("input:text, textarea, input:password").each(function(){
		if(this.value == '')
			this.value = this.title;
	});
	$("input:text, textarea, input:password").click(function(){
		if(this.value == this.title)
			this.value = '';
	});
	$("input:text, textarea, input:password").blur(function(){
		if(this.value == '')
			this.value = this.title;
	});
	$("input:image, input:button, button:submit").click(function(){
		$(this.form.elements).each(function(){
			if(this.type =='text' || this.type =='textarea' || this.type =='password'){
				if(this.value == this.title && this.title != ''){
					this.value='';
				}
			}
		});
	});
 });

jQuery.fn.fadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle'}, speed, easing, callback); 
};
jQuery.fn.blindToggle = function(speed, easing, callback) {
   var h = this.height() + parseInt(this.css('paddingTop')) + parseInt(this.css('paddingBottom'));
   return this.animate({marginTop: parseInt(this.css('marginTop')) < 0 ? 0 : -h}, speed, easing, callback); 
};
 
 function swap_image(newimg,alt, title)
{
	document.getElementById('si').src   = './resize.php?w=300&h=300&img='+newimg;
	document.getElementById('rt').href  = newimg;
	document.getElementById('rt').alt   = alt;
	document.getElementById('rt').title = title;

	// <a href="./upload/photo/{$product->default_image.path}" rel="lightbox" alt="{$product->images[0].alt}" title="{$product->images[0].title}">View larger image</a>
	return true;
}
