$(document).ready(function(){
//this is jQuery 
//*****************************************************************

//  edit buttons when logged in as administrator
$(".reviewtext").append("<div class=reviewarrow></div>");

//  empty search field on focus

	$('#searchfield').focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = ""; 
	}
}).blur(function() {
	if( !this.value.length ) {
		this.value = this.defaultValue;
	}
});


	$('.mailinglistemailfield').focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = ""; 
	}
}).blur(function() {
	if( !this.value.length ) {
		this.value = this.defaultValue;
	}
});




//  show and hide side menu categories
	$('.menucategories').click(function(){
	$(' ul#menu li ul').slideUp();
		if ($(this).next('ul').css('display') == 'none') {
			$(this).next('ul').slideToggle();
	}
/*	return false;*/
    });
	
	
    // topics accordion
    $(".topics").hide();
    $(".topicheader").click(function() {

        var testa = $(this).next(".topics");
        // dont want it to animate if allready showing
        if ($(testa).css("display") == "none") {
            $(".topics").slideUp("slow");
            $(testa).slideToggle("slow");
        }

        else { return }

    });	
		
	
	
		
    // Forgot Password show/hide
    $(".forgotpassword").hide();
    $(".forgotpasswordlink").click(function() {
  $(".forgotpassword").slideToggle();  return false;

    });	
	
	
// zebrastipe them tables 
$("tr:nth-child(odd)").addClass("odd");


// Product slider
// THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
    var autoscroll = true;
    
   $(".automatedCarousel").automatedCarousel().mouseover(function () {
        autoscroll = false;
    }).mouseout(function () {
        autoscroll = true;
    });
     
    setInterval(function () {
        if (autoscroll) {
            $('.automatedCarousel').trigger('next');
        }
    }, 6000);


// subCategory  banners in category landing page (ProductListingWithThumbsWithSubCategories.ascx)
 $(".categorythumbfeature").hover(function () {
     $(this).find(".categorythumbdetails").animate({top: 190}, 300);	
     },  function () {
    			  $(this).find(".categorythumbdetails").animate({top: 275}, 300);	
     			 }); 	


// gallerysmall widget fade in/out banner using jquery.cycle
 $('.gallerysmallpics').cycle(6800);




// Navigation active styles //
$('#topnav ul li a.active').closest('div > ul > li').children('a').addClass('active');


	
// BASKET (+)/(-) on qty	
$('#basket input.quantity').after("<div class='plus'>+</div>");
$('#basket input.quantity').before("<div class='minus'>-</div>");





	
	
// ****************************************************************
}); // DO NOT DELETE THIS LINE



