/*(c) Mindshelf 2010 All Rights Reserved.Web Framework- Core FunctionsNo unauthorised copying or editing without permissionAuthor ~ Matt Hallam*/function submitform(b){err=false;f=new Array;window['f']['case']="B";if($('div.contactform input[type="text"]:eq(0)').val()==''){$('div.contactform input[type="text"]:eq(0)').closest('tr').addClass('err');err=true;}else{$('div.contactform input[type="text"]:eq(0)').closest('tr').removeClass('err');window['f']['first-name']=$('div.contactform input[type="text"]:eq(0)').val();};if($('div.contactform input[type="text"]:eq(1)').val()==''){$('div.contactform input[type="text"]:eq(1)').closest('tr').addClass('err');err=true;}else{$('div.contactform input[type="text"]:eq(1)').closest('tr').removeClass('err');window['f']['surname']=$('div.contactform input[type="text"]:eq(1)').val();};if(!window['emfilt'].test($('div.contactform input[type="text"]:eq(2)').val())){$('div.contactform input[type="text"]:eq(2)').closest('tr').addClass('err');err=true;}else{$('div.contactform input[type="text"]:eq(2)').closest('tr').removeClass('err');window['f']['email-address']=$('div.contactform input[type="text"]:eq(2)').val();};window['f']['mobile-telephone-number']=$('div.contactform input[type="text"]:eq(3)').val();window['f']['receive-alerts-by']='';if(!$('div.contactform input[type="radio"]:eq(0)').is(':checked')&&!$('div.contactform input[type="radio"]:eq(1)').is(':checked')){$('div.contactform input[type="radio"]:eq(0)').closest('tr').addClass('err');err=true;}else{$('div.contactform input[type="radio"]:eq(0)').closest('tr').removeClass('err');};if($('div.contactform input[type="radio"]:eq(0)').is(':checked')){window['f']['receive-alerts-by']+=stripHTML($('div.contactform input[type="radio"]:eq(0)').closest('label').html());};if($('div.contactform input[type="radio"]:eq(1)').is(':checked')){window['f']['receive-alerts-by']+=stripHTML($('div.contactform input[type="radio"]:eq(1)').closest('label').html());};if($('div.contactform select:eq(0)').val()==''){$('div.contactform select:eq(0)').closest('tr').addClass('err');err=true;}else{$('div.contactform select:eq(0)').closest('tr').removeClass('err');window['f']['frequency']=$('div.contactform select:eq(0)').val();};if($('div.contactform input[type="password"]:eq(0)').val()==''){$('div.contactform input[type="password"]:eq(0)').closest('tr').addClass('err');err=true;}else{$('div.contactform input[type="password"]:eq(0)').closest('tr').removeClass('err');window['f']['your-password']=$('div.contactform input[type="password"]:eq(0)').val();};if($('div.contactform input[type="password"]:eq(1)').val()!=$('div.contactform input[type="password"]:eq(0)').val()){$('div.contactform input[type="password"]:eq(1)').closest('tr').addClass('err');err=true;}else{$('div.contactform input[type="password"]:eq(1)').closest('tr').removeClass('err');window['f']['confirm-password']=$('div.contactform input[type="password"]:eq(1)').val();};window['f']['regions']='|';for(i=0;i<$('.holder:eq(0) input[type="checkbox"]').length;i++){if($('.holder:eq(0) input[type="checkbox"]:eq('+i+')').is(':checked')){window['f']['regions']+=$('.holder:eq(0) input[type="checkbox"]:eq('+i+')').val()+'|';};};window['f']['locations']='|';for(i=0;i<$('.holder:eq(1) input[type="checkbox"]').length;i++){if($('.holder:eq(1) input[type="checkbox"]:eq('+i+')').is(':checked')){window['f']['locations']+=$('.holder:eq(1) input[type="checkbox"]:eq('+i+')').val()+'|';};};window['f']['minimum-price']=$('div.contactform select:eq(1)').val();window['f']['maximum-price']=$('div.contactform select:eq(2)').val();window['f']['property-types']='|';for(i=0;i<$('.holder:eq(2) input[type="checkbox"]').length;i++){if($('.holder:eq(2) input[type="checkbox"]:eq('+i+')').is(':checked')){window['f']['property-types']+=$('.holder:eq(2) input[type="checkbox"]:eq('+i+')').val()+'|';};};window['f']['minimum-bedrooms']=$('div.contactform select:eq(3)').val();window['f']['nid']=(($('div.contactform input[type="checkbox"]:eq(0)').is(':checked'))?'1':'0');if(err){alert('Please check the highlighted fields and try again.');}else{_prc();$.post('http://www.hoamz.co.nz/_rsc/validate.mindshelf',{a:$('input.contact').val(),b:$('input[name="subject"]').val()},function(data){if(data=='_tp_pass'){$.post('http://www.hoamz.co.nz/_rsc/form.mindshelf',{c:serialize(window['f']),b:b},function(data){d=data.split('|HOAMZ_DATA|');if(d[0]=='_tp_pass'){_prc(true);if($('#nyroModalContent').length>0){$.nyroModalManual({content:'<strong style="color:#009900;">Your registration was successful and you\'ll shortly receive a confirmation email.<br /><br />You can change your preferences at any time by logging in to your <strong><em>my</em>hoamz</strong> account using the links on our website or clicking the links in your email alerts.</strong>',endShowContent:function(){setTimeout('$.nyroModalRemove();',3000);}});}else{$('.contactform').html('<p><strong style="color:#009900;">Your registration was successful and you\'ll shortly receive a confirmation email.<br /><br />You can change your preferences at any time by logging in to your <strong><em>my</em>hoamz</strong> account using the links on our website or clicking the links in your email alerts.</strong></p>');fixPanel();};$(document).scrollTo('#contact',100);}else if(d[0]=='confirm'){_prc(true);if(window.confirm(d[1]))eval(d[2]);}else{_prc(true);alert(data);_rci();}},'html');}else{_prc(true);alert('Please check the details you\'ve entered and try again.');_rci();}},'html');};return false;};