var postal_lookup = new Object(); postal_lookup['N1C'] = 'guelph@conciergehomeservices.com'; postal_lookup['N1E'] = 'guelph@conciergehomeservices.com'; postal_lookup['N1G'] = 'guelph@conciergehomeservices.com'; postal_lookup['N1H'] = 'guelph@conciergehomeservices.com'; postal_lookup['N1K'] = 'guelph@conciergehomeservices.com'; postal_lookup['N1L'] = 'guelph@conciergehomeservices.com'; postal_lookup['K1H'] = 'info@conciergehomeservices.com'; postal_lookup['K1S'] = 'info@conciergehomeservices.com'; postal_lookup['K1G'] = 'info@conciergehomeservices.com'; postal_lookup['K1K'] = 'info@conciergehomeservices.com'; postal_lookup['K1M'] = 'info@conciergehomeservices.com'; postal_lookup['K1P'] = 'info@conciergehomeservices.com'; postal_lookup['K2P'] = 'info@conciergehomeservices.com'; postal_lookup['K1Z'] = 'info@conciergehomeservices.com'; postal_lookup['K1Y'] = 'info@conciergehomeservices.com'; postal_lookup['K2C'] = 'info@conciergehomeservices.com'; postal_lookup['K1N'] = 'info@conciergehomeservices.com'; postal_lookup['K1V'] = 'huntclub@conciergehomeservices.com'; postal_lookup['K1T'] = 'huntclub@conciergehomeservices.com'; postal_lookup['K0A 1N0'] = 'eorleans@conciergehomeservices.com'; postal_lookup['K1E'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K1C'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K1W'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K1J'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K1B'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K4A'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K4K'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K4C'] = 'westorleans@conciergehomeservices.com'; postal_lookup['K0A 1E0'] = 'westorleans@conciergehomeservices.com'; function match_postal_code(){ if(jQuery('#quote_postal').unmaskedVal().length<7){ show_dialog('Please enter a valid postal code','Form Validation Error'); return false; }else { var postal_code = jQuery('#quote_postal').unmaskedVal().toUpperCase().replace(' ',''); var half = postal_code.substr(0,3); if(postal_lookup[postal_code]){ return postal_lookup[postal_code]; }else if(postal_lookup[half]){ return postal_lookup[half]; }else{ show_dialog('Concierge Home Services does not service your area at this time. We are a growing Canadian success story, so may have a franchise opened in your community soon.','Unsupported Postal Code'); return false; } } } function validateEmail(inputvalue){ var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/; if(pattern.test(inputvalue)){ return true; }else{ return false; } } function validate_textbox(name){ return jQuery.trim(jQuery('#'+name).val()); } function validate_form(){ var to_email = match_postal_code(); if(!to_email){ }else if(!validate_textbox('quote_name')){ show_dialog('Please enter your name','Form Validation Error'); }else if(!validate_textbox('quote_phone')||jQuery('#quote_phone').unmaskedVal().length<12){ show_dialog('Please enter your phone number','Form Validation Error'); }else if(!validate_textbox('quote_address')){ show_dialog('Please enter your address','Form Validation Error'); }else if(!validateEmail(jQuery('#quote_email').val())){ show_dialog('Please enter your email address','Form Validation Error'); }else if(!jQuery('#quote_services').val()){ show_dialog('Please select a service type or \'multiple services\'','Form Validation Error'); }else if(!validate_textbox('quote_date_required')){ show_dialog('Please select the date you will next need our services','Form Validation Error'); }else{ submit_form(to_email); } } function submit_form(to_email){ jQuery.ajax({ type: "get", url: "ajax_quote_submit.php?to_email="+encodeURIComponent(to_email)+'&'+ 'Name='+encodeURIComponent(jQuery('#quote_name').val())+'&'+ 'quote_phone='+encodeURIComponent(jQuery('#quote_phone').val())+'&'+ 'quote_address='+encodeURIComponent(jQuery('#quote_address').val())+'&'+ 'quote_postal='+encodeURIComponent(jQuery('#quote_postal').val())+'&'+ 'quote_email='+encodeURIComponent(jQuery('#quote_email').val())+'&'+ 'quote_referral='+encodeURIComponent(jQuery('#quote_referral').val())+'&'+ 'quote_services='+encodeURIComponent(jQuery('#quote_services').val())+'&'+ 'quote_date_required='+encodeURIComponent(jQuery('#quote_date_required').val())+'&'+ 'quote_describe='+encodeURIComponent(jQuery('#quote_describe').val()) , dataType: "xml", error: function(msg){ alert('error:'+msg.status+' : '+msg.statusText+' : '+msg.responseText,'Communications Error'); }, success: function(xmlDocument){ show_dialog("Thank you for your interest in Concierge Home Services. Expect an email or phone call from us within one business day, and we look forward to helping you with your household management needs.","Message Sent"); } }); /* jQuery.ajax */ } jQuery(document).ready( function(){ jQuery('#quote_postal').setMask(); jQuery('#quote_phone').setMask(); jQuery("#quote_date_required").datepicker({dateFormat: 'DD, d MM, yy'}); } ); /* end document.ready */