
	  var headline_count;
	  var headline_interval;
	  var old_headline = 0;
	  var current_headline = 0;

$(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("normal");
	$('a.hide_retailer').hide();
	$('a.show_retailer').show(); 
   });

   /*$("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='';
				}
			}
		});
	});
	
	$('#panels > ul.tabs').tabs({ fxFade: true, fxSpeed: 'fast' });    
	$('#c_pages > ul.tabs').tabs({ fxFade: true, fxSpeed: 'fast' });
	$('#p_pages > ul.tabs').tabs({ fxFade: true, fxSpeed: 'fast' });
	   
		headline_count = $("div.headline").size();
		$("div.headline:eq("+current_headline+")").css('top', '5px');
		headline_interval = setInterval(headline_rotate,5000);
		$('#scrollup').hover(function() {
		  clearInterval(headline_interval);
		}, function() {
		  headline_interval = setInterval(headline_rotate,5000);
		  headline_rotate();
		});
	   
 });
 
	   function headline_rotate() {
		current_headline = (old_headline + 1) % headline_count;
		$("div.headline:eq(" + old_headline + ")")
		  .animate({top: -205},"slow", function() {
			$(this).css('top', '210px');
		  });
		$("div.headline:eq(" + current_headline + ")")
		  .animate({top: 5},"slow"); 
		old_headline = current_headline;
	  }
 
 
 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;
}
  function checkSignup(){
    if (document.getElementById('firstName').value.length<3){
      alert('Please enter your First Name');
      document.getElementById('firstName').focus();
      return false;
    }
    if (document.getElementById('lastName').value.length<3){
      alert('Please enter your Last Name');
      document.getElementById('lastName').focus();
      return false;
    }
    if (document.getElementById('email').value.length<10){
      alert('Please enter your Email Address');
      document.getElementById('email').focus();
      return false;
    }
  }