$(document).ready(function(){

  	$.validator.addMethod("phone", function(value, element) {
	        return this.optional(element) || /^[0-9\-\+\s]+$/i.test(value);
	    }, "Phone must contain only numbers, + and -.");

  	$.validator.addMethod("humanname", function(value, element) {
        return this.optional(element) || /^[A-Za-z\-\'\s]+$/i.test(value);
    }, "Name entry must contain only letters, hyphens, or apostrophes.");
  	
  	$.validator.addMethod("username", function(value, element) {
        return this.optional(element) || /^(?=.{6,})[a-z0-9]+$/i.test(value);
    }, "Username should be 6 characters or more, consist only of letters and numbers.");
  	
  	$.validator.addMethod("password", function(value, element) {
        return this.optional(element) || /^.*(?=.{7,})(?=.*\d)(?=.*[a-z]).*$/i.test(value);
    }, "Password should be 7 characters or more, consist only of letters and numbers with at least one of each");
  	
	$(".gallerypopup").colorbox({
		iframe: true,
		innerWidth:1000, 
		innerHeight:850
	});
	
	$('.subscribe_email').labelify({ labelledClass : "subscribe_label" });
	
	$('.info-menu li').mouseover(function() {
		$(this).addClass( 'selected' );
	})
	$('.info-menu li').mouseout(function() {
		if( !$(this).hasClass( 'current' ) ) $(this).removeClass( 'selected' );
	})
	
	$('.top-nav li').mouseover( function() {
		var src = $(this).find('img').attr( 'src' );
		src = src.substring(0,src.length-5) + "1.jpg";
		$(this).find('img').attr( 'src', src );
	})
	
	$('.top-nav li').mouseout( function() {
		if( $(this).hasClass( 'current' ) ) return;
		var src = $(this).find('img').attr( 'src' );
		src = src.substring(0,src.length-5) + "0.jpg";
		$(this).find('img').attr( 'src', src );
	})
	
});
