$('*').ajaxError(function (event, request, settings) {  if (request.status == 404) {    $('#dialog').html("A remote endpoint was not found.");  }  else if (request.status == 500) {  $('#dialog').html("An 500 Internal Server error occured when trying to load a remote endpoint.");}else if (request.status == 403) {$('#dialog').html("The Flumpshop Web Service is not available. Please contact the system administrator.");  } else {  $('#dialog').html("An unknown error was encountered loading a remote endpoint.");  }  $('#dialog').append('<p>Requested Page: '+settings.url+'</p>');  $('#dialog').dialog({buttons: {Close: function() {$(this).dialog('destroy');}}, title: 'Load Error', dialogClass: 'ui-state-error'});});function loadMsg(str) { return "<center><img src='http://rjccom.co.uk/images/loading.gif' alt='Loading...' /><br />"+str+"</center>";}$.validator.setDefaults({errorClass: "ui-state-error"});$.validator.addMethod("unique", function(value,element,params) {if (value == "") return true;if ($('.'+params+'[value="'+value+'"]:not("#'+element.id+'")').length == 0) return true; else return false;}, "You've already chosen this value.");$.validator.addMethod("postcode", function(value,element) { return this.optional(element) || (/^([A-PR-UWYZ][A-HK-Y0-9][A-HJKSTUW0-9]?[ABEHMNPRVWXY0-9]?) ?[0-9][ABD-HJLN-UW-Z]{2}$/.test(value) || /^([0-9]{5}-[0-9]{4})|([0-9]{5})$/.test(value)); }, "Please specify a valid postcode (all letters should beuppercase)");$.validator.addMethod("checkOrderQuantity", function(value,element,params) {if (value < 0) return false;return !(value > window.orderItemStock[params]);}, $.validator.format("There is not enough stock for the selected quantity on row {0}."));$.validator.addMethod("positiveInt", function(value,element) {return this.optional(element) || /^[0-9]*(.00)?$/.test(value);}, "Please enter a positive, whole number.");$.validator.addMethod("positive", function(value,element) {return this.optional(element) || value > 0;}, "Please enter a positive number.");
