window.addEvent("domready",function(){if($("deliveryForm")!=null){$("deliveryForm").addEvent("submit",function(b){b.stop();if(validateDelivery()){var a=new Request({url:"/wp-content/themes/watermark-direct/includes/ajax/check-delivery.php",method:"post",async:"false",onSuccess:function(c){$("feedbackBox").setStyle("display","block");$("feedbackBox").set("html",c)},onFailure:function(){$("feedbackBox").set("html","Ajax call fail please contact admin.")}}).send($("deliveryForm"))}else{$("feedbackBox").setStyle("display","block");$("feedbackBox").set("html","Please ensure you type in all the fields in the correct format.")}})}if(isRecipePage){initRecipesScroll()}});function validateDelivery(){var a=true;var b=/^[0-9-]{4,6}$/;if($("suburbInput").value==""){a=false}if(!b.test($("postcodeInput").value)){a=false}return a}var recipeContainersOffsetX=new Array();var recipesScroll;function scrollToContainer(a){recipesScroll.start(recipeContainersOffsetX[a],0)}function initRecipesScroll(){var c=$$("div#recipesWrapper div.recipeContainer");recipesScroll=new Fx.Scroll($("recipesScroll"),{duration:500,transition:Fx.Transitions.Quad.easeOut});var f=0;for(var b=0;b<c.length;b++){f+=(c[b].getStyle("margin-left")).toInt();f+=(c[b].getStyle("width")).toInt();f+=(c[b].getStyle("margin-right")).toInt();var e=0;for(var a=0;a<b;a++){e+=(c[a].getStyle("margin-left")).toInt();e+=(c[a].getStyle("width")).toInt();e+=(c[a].getStyle("margin-right")).toInt()}recipeContainersOffsetX.push(e)}var d=f+"px";$("recipesWrapper").setStyle("display","block");$("recipesWrapper").setStyle("width",d)};