function swapImages(imgG) { if (jQuery) { var $active = $(imgG+' .active'); var $next = ($active.next().length > 0) ? $active.next() : $(imgG+' img').eq(0); var $tmbnl_a = $active.attr("alt"); var $tmbnl_n = $next.attr("alt"); swapImage($active, $next,3000); $('.'+$tmbnl_a).parent().removeClass('t-active'); $('.'+$tmbnl_n).parent().addClass('t-active'); $active.fadeOut(3000).removeClass('active'); int1=setTimeout('swapImages("'+imgG+'")', 6000); return true; } return false; } function form_validate(lpfname) { lpfid = "#"+lpfname; if ($(lpfid).length>0) { $(lpfid+" input:visible").each(function(){if ($(this).attr('id')=='') $(this).attr('id',$(this).attr('name'));}); $(lpfid+" select").each(function(){if ($(this).attr('id')=='') $(this).attr('id',$(this).attr('name'));}); $(lpfid+" textarea").each(function(){if ($(this).attr('id')=='') $(this).attr('id',$(this).attr('name'));}); $(lpfid).validate({ showErrors: function(errorMap, errorList) { if (this.numberOfInvalids()>0) { $("#errorsummary").html("Please correct the errors ("+this.numberOfInvalids()+") on the form before processing."); $("#errorsummary").addClass("errorsummary"); } else { $("#errorsummary").removeClass("errorsummary").html(''); } this.defaultShowErrors(); }, highlight: function(element, errorClass) { element.style.backgroundColor='#fff0f0'; $("#"+element.name).parent("div").addClass("field-error"); }, unhighlight: function(element, errorClass) { element.style.backgroundColor='#fff'; $("#"+element.name).parent("div").removeClass("field-error"); }, errorPlacement: function(error, element) { element.parent("div").addClass("field-error"); }, success: function(label) { }, submitHandler: function(form) { // Save order form.submit(); } }); jQuery.validator.addClassRules({ postcode: { required: true, digits: true, minlength: 4, maxlength: 5 } }); } } function swapImage($active, $next,$speed) { $next.fadeIn(2000).toggleClass('active'); } function startAnim() { int1=setTimeout('swapImages("#imgGallery")', 3000); } $(document).ready( function(){ $("a").focus(function(){ $(this).blur(); }); $("input:image").focus(function(){ $(this).blur(); }); $("form").each(function(){if($(this).hasClass('validate')) form_validate($(this).attr('id'));}); if ($("#imgGallery img").length>0) { $("#imgGallery img").click( function() { window.location = ('/christmascards/cards/'+$(this).attr('alt')+'/'); } ); if ($("#imgGallery img").length>1) int1=setTimeout('swapImages("#imgGallery")', 3000); } } ); /* jQuery.preloadImages = function() { for(var i = 0; i").attr("src", arguments[i]); } }jQuery.preloadImages = function() { for(var i = 0; i").attr("src", arguments[i]); } } */