$(document).ready(function(){$(".icon-list li:nth-child(2n)").after('<li class="clear-row"></li>');$(".related li:nth-child(2n)").after('<li class="clear-row"></li>');$(".sf-menu li").each(function(){if($("li",this).length==1){$(this).addClass("single-item");}});searchAL=$("#search input").val();$("#search input").focus(function(){if($(this).val()==searchAL){$(this).val("");$("#search").addClass("focus");}}).blur(function(){if($(this).val()==""){$(this).val(searchAL);$("#search").removeClass("focus");}});searchRes=$("#searchAgain input").val();$("#searchAgain input").focus(function(){if($(this).val()==searchRes){$(this).val("");}}).blur(function(){if($(this).val()==""){$(this).val(searchRes);}});$("ul.sf-menu").superfish({speed:200,delay:0});$.fn.FormViews=function(options){var settings={formSelector:"",formViewBlock:"",formViewsToHide:"",formTitleField:"",formTitleVal:"",formTypeField:"",formTypeVal:1,bindType:"click",callbackFnc:"void"};return this.each(function(){if(options){$.extend(settings,options);}if(settings.bindType!="load"){$(this).bind(settings.bindType,function(e){e.preventDefault();action();});}else{action();}function action(){settings.formSelector.css("display","block");settings.formViewBlock.css("display","block");settings.formViewsToHide.css("display","none");settings.formTitleField.val(settings.formTitleVal);settings.formTypeField.val(settings.formTypeVal);if($.isFunction(settings.callbackFnc)){settings.callbackFnc.call(this);}}});};$("#block-density, #block-size").bind("change blur",function(){var dwellingVal=Math.floor((parseInt($("#block-size").val())/parseInt($("#block-density :selected").val())));if(!isNaN(dwellingVal)){$("#block-dwelling").val(dwellingVal);}else{$("#block-dwelling").val("");}});$("#slide-panel").addClass("panel-close");$(".btn_close").click(function(e){e.preventDefault();$("#slide-panel").slideUp("slow");FormReset(500);});$("#nav-get_started").click(function(){if($(".slide-form").is(":visible")){FormReset(500);}else{GaqPush("/form-get-started");}$("#slide-panel").slideToggle("slow",function(){});return false;});$("#yourBlockInformation, #tellUsYourPlans, #yourQuestionsOrComments").css("display","none");$("#nav-contact-1, .nav-contact-link").click(function(){scroll(0,0);$("#slide-panel").slideDown("slow",function(){});return false;}).FormViews({formSelector:$(".slide-form"),formViewBlock:$("#yourDetails, #yourQuestionsOrComments, .right-col"),formViewsToHide:$(".choices, #tellUsYourPlans, #yourBlockInformation, .slide-form div#response"),formTitleField:$("#formTitle"),formTitleVal:"I'm just looking for advice right now",formTypeField:$("#formType"),formTypeVal:3,callbackFnc:function(){GaqPush("/form-looking-for-advice");}});$("#slide-panel").addClass("panel-close");$("#foot-get-started").click(function(){if($(".slide-form").is(":visible")){FormReset(500);}else{GaqPush("/form-get-started");}$("#slide-panel").slideToggle("slow",function(){});});$(".blockinmind").FormViews({formSelector:$(".slide-form"),formViewBlock:$("#yourDetails, #yourBlockInformation, .right-col"),formViewsToHide:$(".choices, #tellUsYourPlans, #yourQuestionsOrComments,.slide-form div#response"),formTitleField:$("#formTitle"),formTitleVal:"I have a block of land in mind",formTypeField:$("#formType"),formTypeVal:1,callbackFnc:function(){GaqPush("/form-block-of-land");}});$(".arrangemeeting").FormViews({formSelector:$(".slide-form"),formViewBlock:$("#yourDetails, #tellUsYourPlans, .right-col"),formViewsToHide:$(".choices, #yourBlockInformation, #yourQuestionsOrComments, .slide-form div#response"),formTitleField:$("#formTitle"),formTitleVal:"I'd like to arrange a meeting",formTypeField:$("#formType"),formTypeVal:2,callbackFnc:function(){GaqPush("/form-arrange-a-meeting");}});$(".justadvice").FormViews({formSelector:$(".slide-form"),formViewBlock:$("#yourDetails, #yourQuestionsOrComments, .right-col"),formViewsToHide:$(".choices, #tellUsYourPlans, #yourBlockInformation, .slide-form div#response"),formTitleField:$("#formTitle"),formTitleVal:"I'm just looking for advice right now",formTypeField:$("#formType"),formTypeVal:3,callbackFnc:function(){GaqPush("/form-looking-for-advice");}});$("#aspnetForm input,#aspnetForm textarea, #aspnetForm select").focus(function(){$(this).prev("label").removeAttr("style");$("#your-plans, #your-questions").removeAttr("style");});$(".slide-form").bind("keypress",function(e){var code=(e.keyCode?e.keyCode:e.which);if(code==13&&$("*:focus").attr("type")!="textarea"){$("#FormSlideSubmit").trigger("click");e.preventDefault();}});$("#FormSlideSubmit").click(function(e){e.preventDefault();var typeVal=$("#formType").val();var aErrors=new Array(0);var errorColor="red";if($("#firstname").val()==""){aErrors.push("- Please enter your first name\n");$("#firstname").prev("label").css("color",errorColor);}if($("#surname").val()==""){aErrors.push("- Please enter your surname\n");$("#surname").prev("label").css("color",errorColor);}if($("#contactno").val()==""){aErrors.push("- Please enter your contact number\n");$("#contactno").prev("label").css("color",errorColor);}if(!/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/i.test($("#email").val())){aErrors.push("- Please enter a valid email address\n");$("#email").prev("label").css("color",errorColor);}var globalFields="typeVal="+typeVal+"&formTitle="+$("#formTitle").val()+"&firstname="+$("#firstname").val()+"&surname="+$("#surname").val()+"&contactno="+$("#contactno").val()+"&email="+$("#email").val();var fieldsForPost=globalFields;switch(typeVal){case"1":if(isNaN($("#block-size").val())){aErrors.push("- Please enter your block size as a number\n");$("#block-size").prev("label").css("color",errorColor);}if($("#block-angle").val()==""){aErrors.push("- Please enter select if your block has a house\n");$("#block-angle").prev("label").css("color",errorColor);}if(isNaN($("#block-length").val())){aErrors.push("- Please enter your block length as a number\n");$("#block-length").prev("label").css("color",errorColor);}if(isNaN($("#block-width").val())){aErrors.push("- Please enter your block width as a number\n");$("#block-width").prev("label").css("color",errorColor);}if($("#block-density").val()==""){aErrors.push("- Please enter your block density code\n");$("#block-density").prev("label").css("color",errorColor);}if($("#block-dwelling").val()==""){aErrors.push("- Please enter your block size and density code to calculate your allowed dwelling\n");$("#block-dwelling").prev("label").css("color",errorColor);}fieldsForPost=fieldsForPost+"&block-size="+$("#block-size").val()+"&block-angle="+$("#block-angle :selected").val()+"&block-length="+$("#block-length").val()+"&block-width="+$("#block-width").val()+"&block-density="+$("#block-density :selected").text()+"&block-dwelling="+$("#block-dwelling").val();break;case"2":if($("#your-plans").val()==""){aErrors.push("- Please tell us a little about your plans\n");$("#your-plans").css({"border-color":errorColor,"border-style":"solid","border-width":"2px"});}fieldsForPost=fieldsForPost+"&plans-yours="+$("#your-plans").val()+"&plans-meetingtime="+$("#plans-meetingtime").val()+"&plans-prefered-contact="+$("#plans-prefered-contact").val();break;case"3":if($("#your-questions").val()==""){aErrors.push("- Please enter your questions or comments\n");$("#your-questions").css({"border-color":errorColor,"border-style":"solid","border-width":"2px"});}fieldsForPost=fieldsForPost+"&your-questions="+$("#your-questions").val()+"&qa-prefered-contact="+$("#qa-prefered-contact").val();break;}if(aErrors.length){if(aErrors.length>1){var prefix="Some errors occurred:\n";var suffix="\nPlease correct these errors and try again.";}else{var prefix="An error has occurred:\n";var suffix="\nPlease correct this error and try again.";}var errorMessage=prefix;for(var i=0;i<aErrors.length;i++){errorMessage+=aErrors[i];}errorMessage+=suffix;alert(errorMessage);return false;}$.ajax({type:"POST",url:"/UserControls/GetStartedForms/Ajax/GetStartedPost.aspx",data:fieldsForPost,success:function(data){if(data["Status"]=="Success"){$(".slide-form div#response").html('<h2 class="h2-success">Thankyou</h2><p class="success">\n'+data["Data"]+"</p>");switch(typeVal){case"1":GaqPush("/form-block-of-land-thankyou");break;case"2":GaqPush("/form-arrange-a-meeting-thankyou");break;case"3":GaqPush("/form-looking-for-advice-thankyou");break;}}else{$(".slide-form div#response").html('<p class="error">\n'+data["Data"]+"</p>");$("#yourDetails, .right-col").css("display","block");switch(typeVal){case"1":$("#yourBlockInformation").css("display","block");break;case"2":$("#tellUsYourPlans").css("display","block");break;case"3":$("#yourQuestionsOrComments").css("display","block");break;}$(".slide-form div#response").css("display","block");}},dataType:"json",beforeSend:function(XMLHttpRequest){$(".slide-form div#response").html('<img src="/images/generic/loader.gif" width="32" height="32" alt="Form Processing, Please wait" /><br /><p class="success">\nPlease wait...</p>');$("#yourDetails, #yourBlockInformation, #tellUsYourPlans, #yourQuestionsOrComments, .right-col").css("display","none");$(".slide-form div#response").css("display","block");}});});if($(".home #slider div, .img-slider2 div").children().length>1){$(".home #slider div, .img-slider2 div").nivoSlider({effect:"fade",pauseTime:4000,pauseOnHover:false,captionOpacity:1,directionNav:false,controlNav:true,afterLoad:function(){$(".nivo-controlNav a:last-child").addClass("last-child");}});}if($("#gallery").length>0){$("#gallery > ul").tabs({fx:{opacity:"toggle"}}).tabs("rotate",5000,true);}if($("#mycarousel").length>0){$("#mycarousel").jcarousel({start:1,scroll:1});}$("#faq dd").hide();$("#faq dt a").click(function(){if(!($(this).hasClass("faq-open"))){$("#faq dt a").removeClass("faq-open");$(this).addClass("faq-open");$("#faq dd").slideUp();$(this).parent().next("dd").slideDown();$("#faq dt span").removeClass("arrow-close");$("span",this).addClass("arrow-close");}return false;});$("#login-modal-btn").click(function(e){e.preventDefault();$.ajax({type:"POST",url:"/UserControls/Login/Ajax/AuthenticationCheck.aspx",data:"checkAuthentication=true",success:function(data){if(data["Status"]=="Success"){if(data["Data"]=="Redirect"){window.location="/existing-ventura-id-developers.aspx";}else{triggerFancyBox();}}},dataType:"json"});});});function FormReset(milliseconds){setTimeout(function(){$(".choices").css("display","block");$(".slide-form").css("display","none");},milliseconds);}function triggerFancyBox(){$("#login-modal-trigger").fancybox({"width":410,"height":290,"transitionIn":"none","transitionOut":"none","padding":0,"margin":0,"opacity":"true","scrolling":"no","type":"iframe"}).trigger("click");}function GaqPush(gaTrackerTitle){_gaq.push(["_trackPageview",gaTrackerTitle]);}(function($){$.fn.dltoggle=function(options){var opts=$.extend({},$.fn.dltoggle.defaults,options);var shut=(opts["closed-image"]||"closed.gif");var open=(opts["open-image"]||"open.gif");this.data("shut",shut);this.data("open",open);this.parent().find("dt").css({"background-repeat":"no-repeat","background-position":"left center","padding-left":"17px","font-weight":"bold","cursor":"pointer",});this.parent().find("dt").css({"background-image":"url("+open+")",});if(!opts["leave-open"]){this.find("dd:not(:first)").hide();this.parent().find("dt:not(:first)").css({"background-image":"url("+shut+")",});}return this.find("dt").each(function(){$this=$(this);jQuery(this).click(function(){$(this).next().toggle();if($(this).next().is(":visible")){$(this).css({"background-image":"url("+open+")"});}else{$(this).css({"background-image":"url("+shut+")"});}return false;});});};$.fn.dltoggle_show=function(options){var open=$(this).data("open");return $(this).find("dt").each(function(){$this=$(this);$this.next().show().end();$this.css({"background-image":"url("+open+")"});});};$.fn.dltoggle_hide=function(options){var shut=$(this).data("shut");return $(this).find("dt").each(function(){$this=$(this);$this.next().hide().end();$this.css({"background-image":"url("+shut+")"});});};$.fn.dltoggle.defaults={"open-image":"open.gif","closed-image":"closed.gif","leave-open":0};})(jQuery);
