$(document).ready(function() {                




	// Accordion
	
		jQuery('#product-categories').accordion({
	    	header: '.head',
	    	navigation: true,
                navigationFilter: function() {
                                    var currentPage = $("body").attr("class")
                                    
                                    if ( currentPage.length > 0 ) {
                                      return $(this).attr("id") == $("body").attr("class"); 
                                    } else {
                                      return false
                                    }
                                  },
        navigation: true,
	    	event: 'click',
        autoheight: false,
        alwaysOpen: false,
	    	animated: 'easeslide'
	    	});
		
		$('input.signup').css('cursor','pointer').hover(function(){
			$(this).addClass('signuphover');},
			function() {
			$(this).removeClass('signuphover');}
			);	
	
	
	// Search button hover class
	
		$('#product-navigation button#search-button').hover(function(){
			$(this).addClass('hover');},
			function() {
			$(this).removeClass('hover');}
			);
		
		$('.buttons button').css('cursor','pointer');
			
		
	// Listing li rollover

		$('#browse-thumbs li').css('cursor','pointer').hover(function(){
			$(this).addClass('hover');},
			function() {
			$(this).removeClass('hover');}
			);
		
		$('#browse-thumbs li').click(function(){window.location = $(this).find('a').attr("href");});
			
			
	// Members submit button hover class
	
		$('button#submit').hover(function(){
			$(this).addClass('hover');},
			function() {
			$(this).removeClass('hover');}
			);			
			
			
	// Members submit button hover class
	
		$('button#sort').hover(function(){
			$(this).addClass('hover');},
			function() {
			$(this).removeClass('hover');}
			);			
		
		
	// Buttons class hovers
	
		$('.buttons button').hover(function(){
			$(this).addClass('hover');},
			function() {
			$(this).removeClass('hover');}
			);	
		
		
	// Product Comments form button hover
		
		$('form#product-comments button').hover(function(){
			$(this).addClass('hover');},
			function() {
			$(this).removeClass('hover');}
			);			
		
		
	// Send button hover
		
		$('form #send-button').hover(function(){
			$(this).addClass('hover');},
			function() {
			$(this).removeClass('hover');}
			);			
		
		
		
	// Remove text from field when clicked on, then bring it back when you leave the field
		
		$('input#keywords').focus(function(){
			if($(this).val() == "Enter Keywords") {
			$(this).val("");}
			});
		
		$('input#keywords').blur(function(){
			if($(this).val() == "") {
			$(this).val("Enter Keywords");}
			});
			
		//-----------------------------------------	
			
		$('input#user-name, input#user-name-page').focus(function(){
			if($(this).val() == "user name") {
			$(this).val("");}
			});
		
		$('input#user-name, input#user-name-page').blur(function(){
			if($(this).val() == "") {
			$(this).val("user name");}
			});
	
		//-----------------------------------------
	
		$('input#password, input#password-page').focus(function(){
			if($(this).val() == "password") {
			$(this).val("");}
			});
		
		$('input#password, input#password-page').blur(function(){
			if($(this).val() == "") {
			$(this).val("password");}
			});

		//-----------------------------------------
	
		$('input#NameTo').focus(function(){
			if($(this).val() == "Recipients name...") {
			$(this).val("");}
			});
		
		$('input#NameTo').blur(function(){
			if($(this).val() == "") {
			$(this).val("Recipients name...");}
			});

		//-----------------------------------------
	
		$('input#EmailTo').focus(function(){
			if($(this).val() == "Recipients email address...") {
			$(this).val("");}
			});
		
		$('input#EmailTo').blur(function(){
			if($(this).val() == "") {
			$(this).val("Recipients email address...");}
			});

		//-----------------------------------------
	
		$('input#NameFrom').focus(function(){
			if($(this).val() == "Your name...") {
			$(this).val("");}
			});
		
		$('input#NameFrom').blur(function(){
			if($(this).val() == "") {
			$(this).val("Your name...");}
			});

		//-----------------------------------------
	
		$('input#Redeem').focus(function(){
			if($(this).val() == "Enter Voucher Code") {
			$(this).val("");}
			});
		
		$('input#Redeem').blur(function(){
			if($(this).val() == "") {
			$(this).val("Enter Voucher Code");}
			});

		//-----------------------------------------
	
		$('input.email-address').focus(function(){
			if($(this).val() == "email address") {
			$(this).val("");}
			});
		
		$('input.email-address').blur(function(){
			if($(this).val() == "") {
			$(this).val("email address");}
			});

		//-----------------------------------------
	
		$('input.keywords').focus(function(){
			if($(this).val() == "Enter Keywords") {
			$(this).val("");}
			});
		
		$('input.keywords').blur(function(){
			if($(this).val() == "") {
			$(this).val("Enter Keywords");}
			});	
			
			
  		//-----------------------------------------
  		
  		$('#sign-up').validate();
      $('#contact_form').validate();
      $('#product-enquiry').validate()
      $('#gift-voucher-form').validate({
        rules: {
                NameTo: {
                        required: true
                },
                EmailTo: {
                        required: true,
                        email: true
                },
                NameFrom: {
                        required: true
                },
                Message: {
                        required: true
                },
                Price: {
                        required: true,
                        number: true,
                        min: 1
                }
        }
      });
		
		/*on focus for input boxes*/
		$.fn.resetValue = function() {
			return this.focus(function() {if( this.value == this.defaultValue ) {this.value = "";}})
			.blur(function() {if( !this.value.length ) {this.value = this.defaultValue;}});
		};

		$('#mailing-list-form input').resetValue();
});