function check_locality(elem){if(elem.parent().children(".locationAjax").val()=="Eg. Bondi, VIC or 6000"||elem.parent().children(".locationAjax").val()==""){elem.parent().children(".locationAjax").val("Australia");elem.parent().children(".hidden_location").val("1")}}function consult_broker_send(type_of_enquiry){var error=0;var field='';if(type_of_enquiry==2){var div_id='enquire';var my_function='reload_enquire_now'}else if(type_of_enquiry==3){var div_id='lightwindow_consult_broker'}else if(type_of_enquiry==4){var div_id='contact_us';var my_function='reload_enquire_now_get_advice_form'}if((name=$('#name'+type_of_enquiry).val())==''){field+='Name, ';error=1}var phone;phone=$('#phone'+type_of_enquiry).val();if(phone==''||(phone.length<10)){field+='Phone (need to be 10 numeric characters), ';error=1}if(((type_of_enquiry==3)&&(company_id=$('#company_id'+type_of_enquiry).val())=='')){field+="an error occured in your broker's selection process, "}if(type_of_enquiry==3||type_of_enquiry==4){var product_id=$('#product_id'+type_of_enquiry).val()}if($('#receive_offer'+type_of_enquiry).is(':checked')==false){var receive_offer='no'}else{var receive_offer='yes'}var email=$('#email'+type_of_enquiry).val();var valid=Validate_Email_Address(email);if(valid==false){field+='Email, ';error=1}var locationId=$('#locationId'+type_of_enquiry).val();if((locationId)==''){field+='you have to fill in properly Location, ';error=1}if(type_of_enquiry==4){var home_loan=$('#home_loan'+type_of_enquiry).attr("checked");var car_loan=$('#car_loan'+type_of_enquiry).attr("checked");var personal_loan=$('#personal_loan'+type_of_enquiry).attr("checked");var insurance=$('#insurance'+type_of_enquiry).attr("checked");var tax_advice=$('#tax_advice'+type_of_enquiry).attr("checked");var financial_planning=$('#financial_planning'+type_of_enquiry).attr("checked");if((home_loan==false)&&(car_loan==false)&&(personal_loan==false)&&(insurance==false)&&(tax_advice==false)&&(financial_planning==false)){field+='Product Type, ';error=1}var product_type="";if(home_loan==true){product_type+="&home_loan="+home_loan}if(car_loan==true){product_type+="&car_loan="+car_loan}if(personal_loan==true){product_type+="&personal_loan="+personal_loan}if(insurance==true){product_type+="&insurance="+insurance}if(tax_advice==true){product_type+="&tax_advice="+tax_advice}if(financial_planning==true){product_type+="&financial_planning="+financial_planning}}if(type_of_enquiry==2){var home_loan=$('#home_loan'+type_of_enquiry).attr("checked");var car_loan=$('#car_loan'+type_of_enquiry).attr("checked");var personal_loan=$('#personal_loan'+type_of_enquiry).attr("checked");var insurance=$('#insurance'+type_of_enquiry).attr("checked");if((home_loan==false)&&(car_loan==false)&&(personal_loan==false)&&(insurance==false)){field+='Product Type, ';error=1}var product_type="";if(home_loan==true){product_type+="&home_loan="+home_loan}if(car_loan==true){product_type+="&car_loan="+car_loan}if(personal_loan==true){product_type+="&personal_loan="+personal_loan}if(insurance==true){product_type+="&insurance="+insurance}}var message=$('comment'+type_of_enquiry).val();if(error==1){alert('Please fill in the following field correctly: '+field.substr(0,(field.length-2)));$('#submit'+type_of_enquiry).val("Send");$('#submit'+type_of_enquiry).attr("disabled",false);$('#submit'+type_of_enquiry).removeClass().addClass("sub")}if(error==0){if(type_of_enquiry==2){var pars="name="+escape(name)+"&phone="+escape(phone)+"&email="+escape(email)+"&locationId="+escape(locationId)+"&message="+escape(message)+product_type+"&receive_offer="+escape(receive_offer)+"&my_function="+escape(my_function)}if(type_of_enquiry==3){var pars="name="+escape(name)+"&phone="+escape(phone)+"&email="+escape(email)+"&locationId="+escape(locationId)+"&message="+escape(message)+"&company_id="+escape(company_id)+"&product_id="+escape(product_id)+"&receive_offer="+escape(receive_offer)}if(type_of_enquiry==4){var pars="name="+escape(name)+"&phone="+escape(phone)+"&email="+escape(email)+"&locationId="+escape(locationId)+"&message="+escape(message)+product_type+"&receive_offer="+escape(receive_offer)+"&product_id="+escape(product_id)+"&my_function="+escape(my_function)}var resp=$.ajax({type:"POST",url:http_host+"/ajax/ajax_send_lead.php",data:pars,async:false}).responseText;$("#"+div_id).html(resp)}}function Validate_String(string,return_invalid_chars){var valid_chars='1234567890-_.^~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';var invalid_chars='';if(string==null||string=='')return(true);for(index=0;index<string.length;index++){char=string.substr(index,1);if(valid_chars.indexOf(char)==-1){if(invalid_chars.indexOf(char)==-1){if(invalid_chars=='')invalid_chars+=char;else invalid_chars+=', '+char}}}if(return_invalid_chars==true&&invalid_chars!=''){var last_comma=invalid_chars.lastIndexOf(',');if(last_comma!=-1){invalid_chars=invalid_chars.substr(0,$last_comma)+' and '+invalid_chars.substr(last_comma+1,invalid_chars.length)}return(invalid_chars)}else return(invalid_chars=='')}function Validate_Email_Address(email_address){var at=email_address.indexOf('@');var dot=email_address.indexOf('.');if(at==-1||dot==-1||dot==0||dot==email_address.length-1)return(false);var user_name=email_address.substr(0,at);var domain_name=email_address.substr(at+1,email_address.length);if(Validate_String(user_name)===false||Validate_String(domain_name)===false)return(false);return(true)}$(document).ready(function(){$('.inst a').click(function(){var tab_id=$(this).attr('href');$('.results_tab li a').removeClass('active');$(this).addClass('active');count=0;$('.check').attr('checked',false);$('.search_results li').removeClass("selected");$('.search_results').css({display:"none"});$('#'+tab_id).css({display:"inline"});return false});$(".institution_compare_but").click(function(){if(count>1){var form_id=$(this).attr('href');$("#search_compare_form_"+form_id).submit()}else{alert('You need to select at least two products to compare')}return false});$(".ajax_ads").each(function(){if($(this).children(".nb_ads").html()!=null)var nb_ads=$(this).children(".nb_ads").html();else var nb_ads=3;var ad_zone=$(this).children(".ad_zone").html();if($(this).children(".ad_start").html()!=null)var ad_start=$(this).children(".ad_start").html();else var ad_start=0;var resp=$.ajax({type:"POST",url:http_host+"/ajax/ajax_load_yahoo_ads.php",data:"action=load&nb_ads="+nb_ads+"&ad_zone="+ad_zone+"&start="+ad_start,async:false}).responseText;if(resp!=''){$(this).html(resp)}});$(".locationAjax").each(function(){$(this).autocomplete(http_host+"/ajax/ajaxGetLocation.php",{delay:500,selectFirst:true,max:20,cacheLength:100,parse:function(data){tmp=$.evalJSON(data);parsed_data=[];for(i=0;i<tmp.length;i++){obj=tmp[i];parsed_data[i]={data:obj,value:obj.id,result:obj.name}}return parsed_data},formatItem:function(row,i,max){return row.name},formatMatch:function(row,i,max){return row.name},formatResult:function(row){return row.name}});$(this).result(function(event,data,formatted){$(this).parent().children(".hidden_location").val(data["id"])})});$(".locationAjaxPostcode ").each(function(){$(this).autocomplete(http_host+"/ajax/ajaxGetLocation.php",{delay:2,selectFirst:true,max:20,minChars:4,cacheLength:100,parse:function(data){tmp=$.evalJSON(data);parsed_data=[];for(i=0;i<tmp.length;i++){obj=tmp[i];parsed_data[i]={data:obj,value:obj.id,result:obj.name}}return parsed_data},formatItem:function(row,i,max){return row.name},formatMatch:function(row,i,max){return row.name},formatResult:function(row){return row.name}});$(this).result(function(event,data,formatted){$(this).parent().children(".hidden_location").val(data["id"])})});$(".home_page_search_more_option").click(function(){if($(this).html()=='more options &gt;'){$(".tool").css('width','940px').hide().fadeIn();$(this).html("&lt; less options");$(this).parent(".search_links").addClass("clicked")}else{$(".tool").css('width','250px').hide().fadeIn();$(this).html("more options &gt;");$(this).parent(".search_links").removeClass("clicked")}return false});$(".search_more_option").click(function(){if($("#search_tool_more_option_"+$(this).attr("id").substr(19,20)).css("display")=="none"){$("#search_tool_more_option_"+$(this).attr("id").substr(19,20)).show();$(".search_more_option").html("&lt; less options")}else{$("#search_tool_more_option_"+$(this).attr("id").substr(19,20)).hide();$(".search_more_option").html("more options &gt;")}return false});$(".close_button").click(function(){$(".tool").css('width','250px').hide().fadeIn();$(".home_page_search_more_option").html("more options &gt;");$(".home_page_search_more_option").parent(".search_links").removeClass("clicked")});$(".slider").each(function(){$(this).slider({max:$(this).parent().children("input").attr("value"),min:parseInt($(this).parent().children(".min").html()),step:parseInt($(this).parent().children(".step").html()),value:parseInt($(this).parent().parent().children().find(".upd").html()),slide:function(e,ui){$(this).parent().parent().children().find(".upd").html(ui.value);if(ui.value==0){$(this).parent().parent().children(".display_1").css({display:"none"});$(this).parent().parent().children(".display_2").css({display:"block"});$(this).parent().parent().children(".display_3").css({display:"none"})}else{$(this).parent().parent().children(".display_1").css({display:"block"});$(this).parent().parent().children(".display_2").css({display:"none"});$(this).parent().parent().children(".display_3").css({display:"none"})}if(ui.value==$(this).slider('option','min')){if($(this).parent().parent().children().hasClass("display_3")){$(this).parent().parent().children(".display_1").css({display:"none"});$(this).parent().parent().children(".display_2").css({display:"none"});$(this).parent().parent().children(".display_3").css({display:"block"})}}}})});$(".tab_most_pop").click(function(){$(this).parent().parent().children().children(".tab_most_pop").each(function(){$(this).removeClass("active");$(".prod_type_"+$(this).attr("id").substr(12,13)).css({display:"none"})});$(this).addClass("active");$(".prod_type_"+$(this).attr("id").substr(12,13)).css({display:"inline"});return false});$(".search_tool_select_type").change(function(){var tmp=$(this);for(i=1;i<=5;i++){$(".pf_form_block_"+i).css({display:"none"});$(".product_type_"+i).each(function(){$(this).css({display:"none"})})}$(".pf_form_block_"+$(this).val()).css({display:"block"});$(".product_type_"+$(this).val()).each(function(){$(this).css({display:"block"})});var save=$(this).attr("id").substr(12,13);var save2=$(this).val();$("#sel_prod_id_"+save).children().each(function(){if(save==$(this).val())$(this).attr("selected",true);else $(this).attr("selected",false)});if($(".search_more_option").length!=0){if($("#search_tool_more_option_"+$(".search_more_option").attr("id").substr(19,20)).css("display")=="none"){$(".search_more_option").html("more options &gt;");$("#search_tool_more_option_"+save2).css({display:"none"})}else{$(".search_more_option").html("&lt; less options");$("#search_tool_more_option_"+save2).css({display:"inline"})}}$(".search_button").attr("id","search_but_id_"+save2);$(".search_more_option").attr("id","search_more_opt_id_"+save2);window.focus()});$(".search_button").click(function(){$(this).html("<span>Searching...</span>");$(this).attr("disabled",true);$(this).addClass("searching");$(this).removeClass("search_button");$(".comparison").each(function(){var tmp1=$(this).text();var tmp2=$(this).parent().parent().children().find(".upd").text();$(this).parent().children("input").val(tmp1+tmp2)});$("#search_form_"+$(this).attr("id").substr(14,15)).submit();return false});$(".product_enquire_now").click(function(){var error=0;var set_focus="";$("#submit_button").attr("disabled",true);var product_id=$("#product_id").val();var name=$("#name").val();if(name==""){error=1;$("#p_name").addClass("error");if(set_focus==""){set_focus='name'}}var email=$("#email").val();var valid=Validate_Email_Address(email);if(valid==false){error=1;$("#p_email").addClass("error");if(set_focus==""){set_focus='email'}}var phone=$("#phone").val();if(phone==""){error=1;$("#p_phone").addClass("error");if(set_focus==""){set_focus='phone'}}var location_id;if((location_id=$("#location_id_contact").val())==""){error=1;$('#p_location').addClass("error");if(set_focus==""){set_focus='location_id_contact'}}var message=$("#message").val();if(message==""){error=1;$("#p_message").addClass("error");if(set_focus==""){set_focus='message'}}var receive_offer=$("#offer_contact").is(':checked');if(receive_offer==false){receive_offer='no'}else{receive_offer='yes'}var url_destination=window.location;if(error==1){$("#submit_button").attr("disabled",false);if(set_focus!=""){$("#"+set_focus).focus()}}else{$(".product_enquire_now").addClass("sending");var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_product_enquire_now.php",data:"name="+escape(name)+"&email="+escape(email)+"&phone="+escape(phone)+"&message="+escape(message)+"&product_id="+escape(product_id)+"&location_id="+escape(location_id)+"&receive_offer="+escape(receive_offer)+"&url_destination="+escape(url_destination),async:false}).responseText;$("#div_send_mail").html(html)}});$(".company_enquire_now").click(function(){var error=0;var set_focus="";$(this).attr("disabled",true);var company_id=$("#form_company_id").val();var name=$("#form_name").val();if(name==""){error=1;$("#p_form_name").addClass("error");if(set_focus==""){set_focus='form_name'}}var email=$("#form_email").val();var valid=Validate_Email_Address(email);if(valid==false){error=1;$("#p_form_email").addClass("error");if(set_focus==""){set_focus='form_email'}}var phone=$("#form_phone").val();if(phone==""){error=1;$("#p_form_phone").addClass("error");if(set_focus==""){set_focus='form_phone'}}var location_id;if((location_id=$("#location_id_contact").val())==""){error=1;$('#p_location').addClass("error");if(set_focus==""){set_focus='location_id_contact'}}var message=$("#form_message").val();if(message==""){error=1;$("#p_form_message").addClass("error");if(set_focus==""){set_focus='form_message'}}var receive_offer=$("#offer_contact").is(':checked');if(receive_offer==false){receive_offer='no'}else{receive_offer='yes'}var url_destination=window.location;if(error==1){$(this).attr("disabled",false);if(set_focus!=""){$("#"+set_focus).focus()}}else{$(".company_enquire_now").addClass("sending");var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_company_enquire_now.php",data:"name="+escape(name)+"&email="+escape(email)+"&phone="+escape(phone)+"&message="+escape(message)+"&company_id="+escape(company_id)+"&location_id="+escape(location_id)+"&receive_offer="+escape(receive_offer)+"&url_destination="+escape(url_destination),async:false}).responseText;$("#div_send_mail").html(html)}});$(".compare_but").click(function(){if(count>1){$("#search_compare_form").submit()}else{count=0;$(".check").each(function(){if($(this).is(':checked')==true){count++;$(this).parent("li").addClass("selected")}});if(count<2){alert('You need to select at least two products to compare')}else{$("#search_compare_form").submit()}}return false});$(".search_compare_order_by").click(function(){$(".loader").show();$(this).parent(".sortable").children(".search_compare_order_by").each(function(){$(this).removeClass("active")});$(this).addClass("active");if($(this).children(".arrow-up").attr("class")==null){$(this).children(".arrow").addClass("arrow-up");$(this).children(".arrow").removeClass("arrow");var asc_desc="asc"}else{$(this).children(".arrow-up").addClass("arrow");$(this).children(".arrow-up").removeClass("arrow-up");var asc_desc="desc"}var product_type=$(this).children(".product_type").html();var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_load_search_compare_results.php",data:"product_type="+product_type+"&asc_desc="+asc_desc+"&order_by="+$(this).attr("id"),success:function(){$(".loader").hide()},error:function(){$(".loader").hide()},async:false}).responseText;$(".search_compare_results").html(html);scroll(0,0);return false});$(".check_captcha").click(function(){var captcha_code=$("#captcha_code").val();var sid=$("#session_id").val();var reload_form=$("#reload_form").val();if(reload_form!="1"){var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_check_captcha.php",data:"captcha_code="+captcha_code+"&SID="+sid,async:false}).responseText;check_captcha_response(html)}else{$(this).attr("disabled",true);send_mail()}});$(".check_captcha_advice").click(function(){var captcha_code=$("#captcha_code").val();var sid=$("#session_id").val();var reload_form=$("#reload_form").val();if(reload_form!="1"){var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_check_captcha.php",data:"captcha_code="+captcha_code+"&SID="+sid,async:false}).responseText;check_captcha_response_advice(html)}else{$(this).attr("disabled",true);send_mail_advice()}});$("#get_advice_contact").click(function(){$(".get_advice_form").fadeIn()});$(".close_form").click(function(){$(".get_advice_form").fadeOut()});$(".extra_nav").children("li").mouseover(function(){$(this).addClass("over")});$(".extra_nav").children("li").mouseout(function(){$(this).removeClass("over")});$(".nav").children("ul").children("li").mouseover(function(){$(this).addClass("sfhover")});$(".nav").children("ul").children("li").mouseout(function(){$(this).removeClass("sfhover")});$(".get_advice_form_step1").click(function(){send_mail_advice()});$(".detail_compare_get_advice_form_step1").click(function(){send_mail_advice_detail_compare()});$(".checkbox_contact").click(function(){if($(".select_pro").hasClass("error")){$(".select_pro").removeClass("error")}});if($('.shortlist').length>0){var resp=$.ajax({type:"POST",url:http_host+"/ajax/ajax_shortlist_product_details.php",data:"action=load",async:false}).responseText;if(resp!=''){$('.shortlist').children(".all_product_types").slideDown(500,function(){$('.shortlist').children(".all_product_types").html(resp);if($('.li_added').length>0){call_back_list();$('.email_shortlist').fadeIn();$('.shortlist_info').css({display:"none"})}})}else{$('.shortlist_info').fadeIn()}}$('.email_shortlist').click(function(){$(this).fadeOut(300,function(){$(this).hide()});$('.email_form').fadeIn();$('#form_tool').fadeIn();return false});$('.email_shortlist_click').click(function(){$(this).parent().hide();$('#form_tool').fadeIn();return false});$('#form_tool').submit(function(){$.error=0;$.set_focus='';$("#submit_tool").attr("disabled",true);var mail=$('#email_tool').val();if(mail==''){$.error=1;$('#email_tool').addClass("error");if($.set_focus==""){$.set_focus='email_tool'}}else{valid=Validate_Email_Address(mail);if(valid==false){$.error=1;$('#email_tool').addClass("error");$.set_focus='email_tool'}}if($.error==1){if($.set_focus!=''){$("#"+$.set_focus).focus()}}else{var resp=$.ajax({type:"POST",url:http_host+"/ajax/ajax_send_shortlist.php",data:"action=send_shortlist&mail="+mail,async:false}).responseText;if(resp=='ok'){$('.shortlist_sent').fadeIn();$('#form_tool').hide();$('#email_tool').val('')}else if(resp=='black_listed'){$(".shortlist_black_list").fadeIn();$('#form_tool').hide();$('#email_tool').val('')}else{}}$("#submit_tool").attr("disabled",false);return false});$(".product_special").css({display:"block"});listen_search_compare_result_check();listen_click_page();listen_change_paging()});var count=0;function listen_search_compare_result_check(){$(".check").click(function(){var id=$(this).attr("value");var tmp_count=0;$(".check").each(function(){if($(this).is(':checked')==true){tmp_count++}});if($("#checkbox_"+id).is(':checked')==true){count++;if(count>3){window.alert('You have selected '+count+' products and the limit is 3.');$("#checkbox_"+id).attr("checked",false);tmp_count--}else{$(this).parent("li").addClass("selected")}}else{$(this).parent("li").removeClass("selected")}if($("#checkbox_"+id).is(':checked')==false){count--;$("#checkbox_"+id).attr("checked",false)}if(count!=tmp_count){count=0;$(".check").each(function(){if($(this).is(':checked')==true){count++;if(count>3){window.alert('You have selected '+count+' products and the limit is 3.');$("#checkbox_"+id).attr("checked",false);count--;$("#checkbox_"+id).parent("li").removeClass("selected")}else{if($(this).parent("li").hasClass("selected")==false){$(this).parent("li").addClass("selected")}}}else{$(this).parent("li").removeClass("selected")}})}})}function listen_click_page(){$(".pagination").click(function(){$(".loader").show();var pageid=$(this).children(".page").html();var nb_products=$(this).children(".limit").html();var product_type=$(this).children(".product_type").html();var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_load_search_compare_results.php",data:"pageid="+pageid+"&nb_products="+nb_products+"&product_type="+product_type,success:function(){$(".loader").hide()},error:function(){$(".loader").hide()},async:false}).responseText;$(".search_compare_results").html(html);scroll(0,0);return false})}function listen_change_paging(){$(".select_pagination").change(function(){$(".loader").show();var pageid=1;var nb_products=$("#select_id option:selected").val();var product_type=$("#select_id option:selected").attr("id");var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_load_search_compare_results.php",data:"pageid="+pageid+"&nb_products="+nb_products+"&product_type="+product_type,success:function(){$(".loader").hide()},error:function(){$(".loader").hide()},async:false}).responseText;$(".search_compare_results").html(html);scroll(0,0);listen_click_page()})}function check_captcha_response(responseText){if(responseText=="true"){$("#submit_btn").attr("disabled",true);send_mail()}else{$("#p_captcha").addClass("error");$("#submit_btn").attr("disabled",false)}}function send_mail(){var error=0;var set_focus="";var div_id="div_send_mail";var name;if((name=$("#name_contact").val())==""){error=1;$('#p_name_contact').addClass("error");if(set_focus==""){set_focus='name_contact'}}var phone;if((phone=$("#phone_contact").val())==""){error=1;$('#p_phone_contact').addClass("error");if(set_focus==""){set_focus='phone_contact'}}var email;email=$("#email_contact").val();valid=Validate_Email_Address(email);if(valid==false){error=1;$('#p_email_contact').addClass("error");if(set_focus==""){set_focus='email_contact'}}if($("#subject_contact").length!=0){var subject=$("#subject_contact").val()}else{var subject=""}var message;message=$("#comment_contact").val();var url_destination=window.location;if(error==1){$("#submit_btn").attr("disabled",false)}else{var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_send_mail.php",data:"name="+escape(name)+"&email="+escape(email)+"&phone="+escape(phone)+"&subject="+escape(subject)+"&message="+escape(message)+"&page=contact&url_destination="+escape(url_destination),async:false}).responseText;$("#div_send_mail").html(html);scroll(0,0)}}function check_captcha_response_advice(responseText){if(responseText=="true"){$("#submit_btn").attr("disabled",true);send_mail_advice()}else{$("#p_captcha").addClass("error");$("#submit_btn").attr("disabled",false)}}function align_section(section_class){var height_section_one=0;$.each($('.'+section_class),function(){var height=parseInt($(this).css('height').replace("px",""));if(height>height_section_one){height_section_one=height}});$('.'+section_class).css('height',height_section_one+'px')}function align_section_ref(section_class,ref_class){var height_section_one=0;$("."+section_class).each(function(){if($(this).hasClass(ref_class)){if($(this).css('height')!="auto"){height_section_one=parseInt($(this).css('height').replace("px",""))}}});if(height_section_one!=0){$('.'+section_class).css('height',height_section_one+'px')}}function send_mail_advice(){var error=0;var set_focus="";var div_id="div_send_mail";var name;if((name=$("#name_contact").val())==""){error=1;$('#p_name_contact').addClass("error");if(set_focus==""){set_focus='name_contact'}}var phone;if((phone=$("#phone_contact").val())==""){error=1;$('#p_phone_contact').addClass("error");if(set_focus==""){set_focus='phone_contact'}}var email;email=$("#email_contact").val();valid=Validate_Email_Address(email);if(valid==false){error=1;$('#p_email_contact').addClass("error");if(set_focus==""){set_focus='email_contact'}}var location_id;if((location_id=$("#location_id_contact").val())==""){error=1;$('#p_location_contact').addClass("error");if(set_focus==""){set_focus='location_id_contact'}}var home_loan;if($("#home_loans_contact").lenght!=0){home_loan=$("#home_loans_contact").is(':checked')}else{home_loan=false}var car_loan;if($("#car_loans_contact").lenght!=0){car_loan=$("#car_loans_contact").is(':checked')}else{car_loan=false}var personal_loan;if($("#personal_loans_contact").lenght!=0){personal_loan=$("#personal_loans_contact").is(':checked')}else{personal_loan=false}var insurance;if($("#insurance_contact").lenght!=0){insurance=$("#insurance_contact").is(':checked')}else{insurance=false}var tax_advice;if($("#tax_and_accounting_contact").lenght!=0){tax_advice=$("#tax_and_accounting_contact").is(':checked')}else{tax_advice=false}var financial_planning;if($("#financial_planning_contact").lenght!=0){financial_planning=$("#financial_planning_contact").is(':checked')}else{financial_planning=false}if((home_loan==false)&&(car_loan==false)&&(personal_loan==false)&&(insurance==false)&&(tax_advice==false)&&(financial_planning==false)){error=1;$('.select_pro').addClass("error");if(set_focus==""){set_focus='home_loan_contact'}}var product_type="";if(home_loan==true){product_type+="&home_loan="+home_loan}if(car_loan==true){product_type+="&car_loan="+car_loan}if(personal_loan==true){product_type+="&personal_loan="+personal_loan}if(insurance==true){product_type+="&insurance="+insurance}if(tax_advice==true){product_type+="&tax_advice="+tax_advice}if(financial_planning==true){product_type+="&financial_planning="+financial_planning}var message;message=$("#comment_contact").val();var receive_offer=$("#offer_contact").is(':checked');if(receive_offer==false){receive_offer='no'}else{receive_offer='yes'}var product_id;if($("#product_id_contact").lenght!=0){product_id=$("#product_id_contact").val()}else{product_id=""}var url_destination=window.location;if(error==1){$("#submit_btn").attr("disabled",false);if(set_focus!=""){$("#"+set_focus).focus()}}else{$(".get_advice_form_step1").addClass("sending");var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_send_mail_advice.php",data:"name="+escape(name)+"&email="+escape(email)+"&phone="+escape(phone)+"&message="+escape(message)+"&location_id="+escape(location_id)+product_type+"&receive_offer="+escape(receive_offer)+"&product_id="+escape(product_id)+"&url_destination="+escape(url_destination),async:false}).responseText;$("#div_send_mail").html(html)}}function send_mail_advice_detail_compare(){var error=0;var set_focus="";var div_id="div_send_mail";var name;if((name=$("#name_contact").val())==""){error=1;$('#p_name_contact').addClass("error");if(set_focus==""){set_focus='name_contact'}}var phone;if((phone=$("#phone_contact").val())==""){error=1;$('#p_phone_contact').addClass("error");if(set_focus==""){set_focus='phone_contact'}}var email;email=$("#email_contact").val();valid=Validate_Email_Address(email);if(valid==false){error=1;$('#p_email_contact').addClass("error");if(set_focus==""){set_focus='email_contact'}}var location_id;if((location_id=$("#location_id_contact").val())==""){error=1;$('#p_location_contact').addClass("error");if(set_focus==""){set_focus='location_id_contact'}}var message;message=$("#comment_contact").val();var receive_offer=$("#offer_contact").is(':checked');if(receive_offer==false){receive_offer='no'}else{receive_offer='yes'}var product_id="";$(".checkbox_contact").each(function(){if($(this).is(":checked")==true){product_id+=$(this).attr("id")+"_"}});if(product_id==""){error=1;$('.select_pro').addClass("error")}else{product_id=product_id.substr(0,(product_id.length-1))}var url_destination=window.location;if(error==1){$("#submit_btn").attr("disabled",false);if(set_focus!=""){$("#"+set_focus).focus()}}else{$(".detail_compare_get_advice_form_step1").addClass("sending");var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_send_mail_advice_detail_compare.php",data:"name="+escape(name)+"&email="+escape(email)+"&phone="+escape(phone)+"&message="+escape(message)+"&location_id="+escape(location_id)+"&receive_offer="+escape(receive_offer)+"&product_id="+escape(product_id)+"&url_destination="+escape(url_destination),async:false}).responseText;$("#div_send_mail").html(html)}}function add_to_shortlist(e){if($('.li_added').length==0){$('.email_shortlist').fadeIn();$('.shortlist_info').hide()}$(e).hide();$(e).next('.added').show();var product_id=$(e).parent().attr('id');var product_type=$(e).parent().attr('class');var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_shortlist_cookie.php",data:"action=shortlist_cookie&product_id="+product_id,async:false}).responseText;if(html=='ok'){var resp=$.ajax({type:"POST",url:http_host+"/ajax/ajax_shortlist_product_details.php",data:"action=new&product_id="+product_id,async:false}).responseText;$('#shortlist_'+product_type).children('.shortlist_first').show();$('#shortlist_'+product_type).find('li:last').after(resp).hide().slideDown()}return false}function deleteProduct(e){var product_type_ul=$(e).parent().parent().parent();var product_div=$(e).parent().parent();var id=product_div.attr('id');$('#shortlist_'+id).find('.added').hide();$('#shortlist_'+id).find('.add_shortlist').show();var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_shortlist_cookie.php",data:"action=shortlist_unset_cookie&product_id="+id,async:false}).responseText;if(html=='ok_unset'){$(product_div).slideUp('',function(){$(this).remove();if($('.li_added').length==0){$('#form_tool').hide();$('.shortlist_sent').hide();$('.email_shortlist').hide();$('.shortlist_info').hide().fadeIn()}if($(product_type_ul).children(".li_added").length==0){$(product_type_ul).children('.shortlist_first').hide()}})}}function call_back_list(){$('.li_added').each(function(){$('#shortlist_'+$(this).attr('id')).find('.add_shortlist').hide();$('#shortlist_'+$(this).attr('id')).find('.added').show()})}