$(document).ready(function(){
	 

var bgpos =0;

bgpos = $('#nav').css("backgroundPosition");



$(function(){
  $('#nav-home a').hover(function(){
    $('#nav').stop();
    $('#nav').animate({backgroundPosition: '56px 0px'});
  }, function(){
    $('#nav').stop();
    $('#nav').animate({backgroundPosition: bgpos});
  });
});

$(function(){
  $('#nav-shop a').hover(function(){
	  
    $('#nav').stop();
    $('#nav').animate({backgroundPosition: '205px 0px'});
  }, function(){
    $('#nav').stop();
    $('#nav').animate({backgroundPosition: bgpos});
  });
});

$(function(){
  $('#nav-contact a').hover(function(){
    $('#nav').stop();
    $('#nav').animate({backgroundPosition: '345px 0px'});
  }, function(){
    $('#nav').stop();
    $('#nav').animate({backgroundPosition: bgpos});
  });
});



$(function() {

	// if the function argument is given to overlay,
	// it is assumed to be the onBeforeLoad event listener
	$("a[rel]").overlay({

		mask: 'grey',
		effect: 'apple',

		onBeforeLoad: function() {

			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentWrap");

			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href") + ' #single-product');
		}

	});
});

 
});

$(window).load(function() {


$(function() {

	// if the function argument is given to overlay,
	// it is assumed to be the onBeforeLoad event listener
	$("a[rel]").overlay({

		mask: 'grey',
		effect: 'apple',

		onBeforeLoad: function() {

			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentWrap");

			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href") + ' #single-product');
		}

	});
});




    $(function() {  
	$(".product-options").jqDropDown({
		effect:'fade',
		effectSpeed:200	
	});
});



});


$(document).ready(function() {
	
$.validator.addMethod('letters', function(value) {
	return value.match(/^[- a-zA-Z]+$/);
});

$.validator.addMethod('phonenumber', function(value) {
	return value.match(/^[+ 0-9]+$/);
});

$('form').validate({
    rules : {
		Name : {
            required : true,
            letters : true
        },
		Email :  {
            required : true,
            email : true
        },
		Telephone :  {
            required : true,
            phonenumber : true,
            minlength : 11,
            maxlength : 14
        },
		Enquiry : {
            required : true
        }
		
	},
    messages : {
		Name : {
            required : 'The name field cannot be blank',
            letters : 'Please enter letters only'
        },
		Email :  {
            required : 'The email field cannot be blank',
            email : 'Please enter a valid email address'
        },
		Telephone :  {
            required : 'The telephone field cannot be blank',
            phonenumber : 'Please enter numbers only',
            minlength : 'Please enter a UK phone number (11 digits)',
            maxlength : 'Please enter a UK phone number (11 digits)'
        },
		Enquiry : {
            required : 'The message field cannot be blank',
            
        }
    }
});
 
});





