$(document).ready(function(){jQuery.validator.addMethod("password",function(f,e){var c=this.optional(e)||f.length>=6&&/\d/.test(f)&&/[a-z]/i.test(f);if(!c){e.value="";var d=this;setTimeout(function(){d.blockFocusCleanup=true;e.focus();d.blockFocusCleanup=false},1)}return c},"Your password must be at least 6 characters long and contain at least one number and one character.");jQuery.validator.addMethod("defaultInvalid",function(d,c){return d!=c.defaultValue},"");jQuery.validator.addMethod("billingRequired",function(d,c){if($("#bill_to_co").is(":checked")){return $(c).parents(".subTable").length}return !this.optional(c)},"");jQuery.validator.messages.required="";$("form").validate({invalidHandler:function(f,c){var g=c.numberOfInvalids();if(g){var d=g==1?"You missed 1 field. It has been highlighted below":"You missed "+g+" fields.  They have been highlighted below";$("div.error span").html(d);$("div.error").show()}else{$("div.error").hide()}},onkeyup:false,submitHandler:function(){$("div.error").hide()},messages:{password2:{required:" ",equalTo:"Please enter the same password as above"},email:{required:" ",email:"Please enter a valid email address, example: you@yourdomain.com",remote:jQuery.validator.format("{0} is already taken, please enter a different address.")}},debug:true});$(".resize").vjustify();$("div.buttonSubmit").hoverClass("buttonSubmitHover");if($.browser.safari){$("body").addClass("safari")}$("#cc_type").change(function(){switch($(this).val()){case"amex":creditcard.unmask().mask("9999 999999 99999");break;default:creditcard.unmask().mask("9999 9999 9999 9999");break}});var a=$("div.subTableDiv");var b=$("input.toggleCheck");b.is(":checked")?a.hide():a.show();$("input.toggleCheck").click(function(){if(this.checked==true){a.slideUp("medium");$("form").valid()}else{a.slideDown("medium")}})});$.fn.vjustify=function(){var a=0;$(".resize").css("height","auto");this.each(function(){if(this.offsetHeight>a){a=this.offsetHeight}});this.each(function(){$(this).height(a);if(this.offsetHeight>a){$(this).height((a-(this.offsetHeight-a)))}})};$.fn.hoverClass=function(a){return this.hover(function(){$(this).addClass(a)},function(){$(this).removeClass(a)})};
