function action_mobile_phone(){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_phone"){$(this).attr("checked",true);$("."+$(this).attr("name")).removeClass("opacity")}else{$(this).attr("checked",false);$("."+$(this).attr("name")).each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}})}});$(".plan_or_prepaid").each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}});$(".plan_or_prepaid_div").hide().fadeOut();$(".phone_div").hide().fadeIn();$(".brand_div").hide().fadeIn();if($(".container").hasClass("home")){var height=80;$(".more_less_options").hide().fadeOut()}else{var height=2}var tmp=$(".mid_container").offset();var tmp2=$(".search_tool_height").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top)+height;$(".mid_container").css("padding-top",div_height+"px");$("#form_search_tool").attr("action",http_host+"/mobile-phones/search")}function action_mobile_phone_and_plan_more_options(){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_phone"||$(this).attr("name")=="opt_mobile_plan"){$(this).attr("checked",true);$("."+$(this).attr("name")).removeClass("opacity")}else{$(this).attr("checked",false);$("."+$(this).attr("name")).each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}})}});$(".more_less_options").hide().fadeIn();$(".plan_or_prepaid").removeClass("opacity");$(".phone_div").hide().fadeIn();$(".brand_div").hide().fadeOut();$(".prepaid_div").hide().fadeOut();$(".plan_or_prepaid_div").hide().fadeIn();$(".plan_div").hide().fadeIn();if($(".container").hasClass("home")){var height=80}else{var height=2}var tmp=$(".mid_container").offset();var tmp2=$(".search_tool_height").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top)+height;$(".mid_container").css("padding-top",div_height+"px");$("#form_search_tool").attr("action",http_host+"/mobile-plans/search")}function action_mobile_phone_and_plan_less_options(){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_phone"||$(this).attr("name")=="opt_mobile_plan"){$(this).attr("checked",true);$("."+$(this).attr("name")).removeClass("opacity")}else{$(this).attr("checked",false);$("."+$(this).attr("name")).each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}})}});$(".more_less_options").hide().fadeIn();$(".plan_or_prepaid").removeClass("opacity");$(".phone_div").hide().fadeOut();$(".brand_div").hide().fadeOut();$(".prepaid_div").hide().fadeOut();$(".plan_or_prepaid_div").hide().fadeIn();$(".plan_div").hide().fadeIn();if($(".container").hasClass("home")){var height=80}else{var height=2}var tmp=$(".mid_container").offset();var tmp2=$(".search_tool_height").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top)+height;$(".mid_container").css("padding-top",div_height+"px");$("#form_search_tool").attr("action",http_host+"/mobile-plans/search")}function action_mobile_phone_and_prepaid_more_options(){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_phone"||$(this).attr("name")=="opt_prepaid"){$(this).attr("checked",true);$("."+$(this).attr("name")).removeClass("opacity")}else{$(this).attr("checked",false);$("."+$(this).attr("name")).each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}})}});$(".more_less_options").hide().fadeIn();$(".plan_or_prepaid").removeClass("opacity");$(".phone_div").hide().fadeIn();$(".brand_div").hide().fadeOut();$(".plan_div").hide().fadeOut();$(".plan_or_prepaid_div").hide().fadeIn();$(".prepaid_div").hide().fadeIn();if($(".container").hasClass("home")){var height=80}else{var height=2}var tmp=$(".mid_container").offset();var tmp2=$(".search_tool_height").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top)+height;$(".mid_container").css("padding-top",div_height+"px");$("#form_search_tool").attr("action",http_host+"/prepaid-mobile/search")}function action_mobile_phone_and_prepaid_less_options(){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_phone"||$(this).attr("name")=="opt_prepaid"){$(this).attr("checked",true);$("."+$(this).attr("name")).removeClass("opacity")}else{$(this).attr("checked",false);$("."+$(this).attr("name")).each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}})}});$(".more_less_options").hide().fadeIn();$(".plan_or_prepaid").removeClass("opacity");$(".phone_div").hide().fadeOut();$(".brand_div").hide().fadeOut();$(".plan_div").hide().fadeOut();$(".plan_or_prepaid_div").hide().fadeIn();$(".prepaid_div").hide().fadeIn();if($(".container").hasClass("home")){var height=80}else{var height=2}var tmp=$(".mid_container").offset();var tmp2=$(".search_tool_height").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top)+height;$(".mid_container").css("padding-top",div_height+"px");$("#form_search_tool").attr("action",http_host+"/prepaid-mobile/search")}function action_mobile_plan(){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_plan"){$(this).attr("checked",true);$("."+$(this).attr("name")).removeClass("opacity")}else{$(this).attr("checked",false);$("."+$(this).attr("name")).each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}})}});$(".opt_mobile_phone").each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}});$(".plan_or_prepaid").removeClass("opacity");$(".phone_div").hide().fadeOut();$(".brand_div").hide().fadeOut();$(".prepaid_div").hide().fadeOut();$(".plan_or_prepaid_div").hide().fadeIn();$(".plan_div").hide().fadeIn();if($(".container").hasClass("home")){var height=80;$(".more_less_options").hide().fadeOut()}else{var height=2}var tmp=$(".mid_container").offset();var tmp2=$(".search_tool_height").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top)+height;$(".mid_container").css("padding-top",div_height+"px");$("#form_search_tool").attr("action",http_host+"/mobile-plans/search")}function action_prepaid(){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_prepaid"){$(this).attr("checked",true);$("."+$(this).attr("name")).removeClass("opacity")}else{$(this).attr("checked",false);$("."+$(this).attr("name")).each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}})}});$(".opt_mobile_phone").each(function(){if($(this).hasClass("opacity")===false){$(this).addClass("opacity")}});$(".plan_or_prepaid").removeClass("opacity");$(".phone_div").hide().fadeOut();$(".brand_div").hide().fadeOut();$(".plan_div").hide().fadeOut();$(".plan_or_prepaid_div").hide().fadeIn();$(".prepaid_div").hide().fadeIn();if($(".container").hasClass("home")){var height=80;$(".more_less_options").hide().fadeOut()}else{var height=2}var tmp=$(".mid_container").offset();var tmp2=$(".search_tool_height").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top)+height;$(".mid_container").css("padding-top",div_height+"px");$("#form_search_tool").attr("action",http_host+"/prepaid-mobile/search")}function is_one_checkbox_checked(){var missing_provider=true;var missing_brand=true;$(".check_one_is_selected").each(function(){if($(this).is(':checked')===true&&$(this).parent("label").css("display")!="none"&&$(this).parent("label").hasClass("opacity")===false){if($(this).hasClass("checkbox_provider")){missing_provider=false}else{missing_brand=false}}if($(this).parent("label").css("display")!="none"&&$(this).parent("label").hasClass("opacity")===true){if($(this).hasClass("checkbox_provider")){missing_provider=false}else{missing_brand=false}}});if(missing_provider==true&&missing_brand==true){alert("Please select at least one service provider and one phone brand")}else if(missing_provider==true){alert("Please select at least one service provider")}else if(missing_brand==true){alert("Please select at least one phone brand")}else{return true}return false}$(document).ready(function(){if(window.location.hash=="#all-plans"){$(".tab_nav").each(function(){$(this).removeClass("active")});$(".div_nav").each(function(){$(this).css({display:"none"})});$("#plan_opt").addClass("active");$("#div_plan_opt").css({display:"block"})}if(window.location.hash=="#other-phones"){$(".tab_nav").each(function(){$(this).removeClass("active")});$(".div_nav").each(function(){$(this).css({display:"none"})});$("#other_phones").addClass("active");$("#div_other_phones").css({display:"block"})}if(window.location.hash=="#phone-specs"){$(".tab_nav").each(function(){$(this).removeClass("active")});$(".div_nav").each(function(){$(this).css({display:"none"})});$("#phone_specs").addClass("active");$("#div_phone_specs").css({display:"block"})}if(window.location.hash=="#phone-options"){$(".tab_nav").each(function(){$(this).removeClass("active")});$(".div_nav").each(function(){$(this).css({display:"none"})});$("#phone_opt").addClass("active");$("#div_phone_opt").css({display:"block"})}$(".tab_nav").click(function(){$(".tab_nav").each(function(){$(this).removeClass("active")});$(".div_nav").each(function(){$(this).css({display:"none"})});$(this).addClass("active");$("#div_"+$(this).attr("id")).css({display:"block"});return false});$(".toggle_select_all").click(function(){if($(this).hasClass("selected")){$(this).removeClass("selected");$(this).html("select all");$(this).parent().children("label").each(function(){$(this).children("input").attr("checked",false)})}else{$(this).html("unselect all");if($(this).hasClass("selected")===false){$(this).addClass("selected")}$(this).parent().children("label").each(function(){$(this).children("input").attr("checked",true)})}return false});$(".check_one_is_selected").click(function(){if($(this).parent("label").hasClass("opacity")){if($(this).hasClass("checkbox_provider")){var type="";$(this).parent("label").parent().removeClass("opacity");$(this).parent("label").parent().children().children(".check_one_is_selected").each(function(){$(this).parent("label").removeClass("opacity");if($(this).parent("label").css("display")!="none"&&$(this).parent("label").hasClass("prepaid_div")){type="prepaid_div"}});$(".check_opt_search_tool").each(function(){if(type=="prepaid_div"&&$(this).attr("name")=="opt_prepaid"){$(this).attr("checked",true);if($("#tool_check").hasClass("options_tool_is_small")===false){action_mobile_phone_and_prepaid_more_options()}else{action_mobile_phone_and_prepaid_less_options()}}else if(type==""&&$(this).attr("name")=="opt_mobile_plan"){$(this).attr("checked",true);if($("#tool_check").hasClass("options_tool_is_small")===false){action_mobile_phone_and_plan_more_options()}else{action_mobile_phone_and_plan_less_options()}}})}else{$(this).parent("label").parent().removeClass("opacity");$(this).parent("label").parent().children().children(".check_one_is_selected").each(function(){$(this).parent("label").removeClass("opacity")});$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_phone"){$(this).attr("checked",true)}})}}var one_selected=false;var all_selected=true;var checkbox_clicked=$(this);$(this).parent().parent().children().children(".check_one_is_selected").each(function(){if($(this).is(':checked')==true&&$(this).parent("label").css("display")!="none"){one_selected=true}if($(this).is(':checked')==false&&$(this).parent("label").css("display")!="none"){all_selected=false}});if(one_selected==false){$(this).parent().parent().children(".toggle_select_all").removeClass("selected");$(this).parent().parent().children(".toggle_select_all").html("select all")}else if(all_selected==true){$(this).parent().parent().children(".toggle_select_all").html("unselect all");if($(this).parent().parent().children(".toggle_select_all").hasClass("selected")===false){$(this).parent().parent().children(".toggle_select_all").addClass("selected")}}});$(".more_less_options").click(function(){var flag1="";var flag2="";var flag3="";if($("#tool_check").hasClass("options_tool_is_small")){$("#tool_check").toggleClass("options_tool_is_small");$(".more_less_options").html("&lt; less options");$("#options_big").hide().fadeIn();$(".top").css("height","auto");if($(".container").hasClass("home")){$("#main_container").removeClass("home_options");if($("#main_container").hasClass("home_options_big")===false){$("#main_container").addClass("home_options_big")}}else{if($("#main_container").hasClass("home_options_big_normal")===false){$("#main_container").addClass("home_options_big_normal")}}}else{$("#tool_check").toggleClass("options_tool_is_small");$(".more_less_options").html("more options &gt;");$("#options_big").hide().fadeIn();if($(".container").hasClass("home")){$("#main_container").removeClass("home_options_big");if($("#main_container").hasClass("home_options")===false){$("#main_container").addClass("home_options")}$(".top").css("height","auto")}else{if($("#main_container").hasClass("home_options_big_normal")===false){$("#main_container").addClass("home_options_big_normal")}$(".top").css("height","50px")}}$(".check_opt_search_tool").each(function(){if($(this).is(':checked')){switch($(this).attr("name")){case"opt_mobile_phone":flag1="checked";break;case"opt_mobile_plan":flag2="checked";break;case"opt_prepaid":flag3="checked";break}}});if(flag2==""&&flag3==""){action_mobile_phone()}else if(flag1=="checked"&&flag2=="checked"){if($("#tool_check").hasClass("options_tool_is_small")===false){action_mobile_phone_and_plan_more_options()}else{action_mobile_phone_and_plan_less_options()}}else if(flag1=="checked"&&flag3=="checked"){if($("#tool_check").hasClass("options_tool_is_small")===false){action_mobile_phone_and_prepaid_more_options()}else{action_mobile_phone_and_prepaid_less_options()}}else if(flag2=="checked"){action_mobile_plan()}else if(flag3=="checked"){action_prepaid()}call_back_article_auto_ajust_size();if($("#tool_check").hasClass("options_tool_is_small")){return false}});$(".check_opt_search_tool").click(function(){var checkbox_checked=false;var checkbox_clicked=$(this);var flag1="";var flag2="";var flag3="";$(".check_opt_search_tool").each(function(){if($(this).is(':checked')==true){checkbox_checked=true;count++}});if(checkbox_checked==false){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_plan"&&$(checkbox_clicked).attr("name")!="opt_mobile_plan"&&checkbox_checked==false){$(this).attr("checked",true);checkbox_checked=true;checkbox_clicked=$(this)}else if($(this).attr("name")=="opt_prepaid"&&checkbox_checked==false){$(this).attr("checked",true);checkbox_checked=true;checkbox_clicked=$(this)}})}else{if($(checkbox_clicked).attr("name")=="opt_mobile_plan"){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_prepaid"&&$(this).is(':checked')==true){$(this).attr("checked",false)}})}else{if($(checkbox_clicked).attr("name")=="opt_prepaid"){$(".check_opt_search_tool").each(function(){if($(this).attr("name")=="opt_mobile_plan"&&$(this).is(':checked')==true){$(this).attr("checked",false)}})}}}$(".check_opt_search_tool").each(function(){if($(this).attr("name")==$(checkbox_clicked).attr("name")){switch($(this).attr("name")){case"opt_mobile_phone":if($(checkbox_clicked).is(':checked')==true){$(".checkbox_brand").each(function(){$(this).attr("checked",true)})}else{$(".checkbox_brand").each(function(){$(this).attr("checked",false)})}break;case"opt_mobile_plan":if($(checkbox_clicked).is(':checked')==true){$(".checkbox_provider").each(function(){$(this).attr("checked",true)})}else{$(".checkbox_provider").each(function(){$(this).attr("checked",false)})}break;case"opt_prepaid":if($(checkbox_clicked).is(':checked')==true){$(".checkbox_provider").each(function(){$(this).attr("checked",true)})}else{$(".checkbox_provider").each(function(){$(this).attr("checked",false)})}break}}if($(this).is(':checked')){switch($(this).attr("name")){case"opt_mobile_phone":flag1="checked";break;case"opt_mobile_plan":flag2="checked";break;case"opt_prepaid":flag3="checked";break}}});if(flag2==""&&flag3==""){action_mobile_phone()}else if(flag1=="checked"&&flag2=="checked"){if($("#tool_check").hasClass("options_tool_is_small")===false){action_mobile_phone_and_plan_more_options()}else{action_mobile_phone_and_plan_less_options()}}else if(flag1=="checked"&&flag3=="checked"){if($("#tool_check").hasClass("options_tool_is_small")===false){action_mobile_phone_and_prepaid_more_options()}else{action_mobile_phone_and_prepaid_less_options()}}else if(flag2=="checked"){action_mobile_plan()}else if(flag3=="checked"){action_prepaid()}});$(".slider").each(function(){$(this).slider({value:parseInt($(this).parent().children().children(".amount").text()),min:parseInt($(this).parent().children(".min").text()),max:$(this).parent().children(".max").text(),step:parseInt($(this).parent().children(".step").text()),slide:function(event,ui){$(this).parent().children().children(".amount").html(ui.value);if(ui.value==0){$(this).parent().children(".display_1").css({display:"none"});$(this).parent().children(".display_2").css({display:"block"});$(this).parent().children(".display_3").css({display:"none"})}else{$(this).parent().children(".display_1").css({display:"block"});$(this).parent().children(".display_2").css({display:"none"});$(this).parent().children(".display_3").css({display:"none"})}if(ui.value==$(this).slider('option','min')){if($(this).parent().children().hasClass("display_3")){$(this).parent().children(".display_1").css({display:"none"});$(this).parent().children(".display_2").css({display:"none"});$(this).parent().children(".display_3").css({display:"block"})}}}})});$(".search_button").click(function(){var res=is_one_checkbox_checked();if(res==true){$(".search_button").each(function(){$(this).addClass("search_button_active");$(this).attr("disabled",true)});$(".comparison_value").each(function(){var tmp1=$(this).text();var tmp2=$(this).parent().children().find(".amount").text();$(this).parent().children("input").val(tmp1+tmp2)});$("#form_search_tool").submit()}return false});$(".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"])})});$(".enquire_now").click(function(){var error=0;var set_focus="";$("#submit_button").attr("disabled",true);var plan_id=$("#plan_id").val();var id_plan_link_phone=$("#id_plan_link_phone").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").val())==""){error=1;$('#p_location').addClass("error");if(set_focus==""){set_focus='location_id'}}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'}if(error==1){$("#submit_button").attr("disabled",false);if(set_focus!=""){$("#"+set_focus).focus()}}else{$(".enquire_now").addClass("sending");var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_enquire_now.php",data:"name="+escape(name)+"&email="+escape(email)+"&phone="+escape(phone)+"&message="+escape(message)+"&id_plan_link_phone="+escape(id_plan_link_phone)+"&plan_id="+escape(plan_id)+"&location_id="+escape(location_id)+"&receive_offer="+escape(receive_offer),async:false}).responseText;$("#div_send_mail").html(html)}});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_types").slideDown(500,function(){$('.shortlist').children(".all_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('')}}$("#submit_tool").attr("disabled",false);return false});$(".search_compare_order_by").click(function(){var key=$(this).attr("id");var order=$(this).children().next().attr("class");var type_of_page=$("#type_of_page").html();if(order=="arrow"){order="desc";$(this).children().next().addClass("arrow_up");$(this).children().next().removeClass("arrow")}else{order="asc";$(this).children().next().addClass("arrow");$(this).children().next().removeClass("arrow_up")}$(".search_compare_order_by").each(function(){$(this).removeClass("active")});$(this).addClass("active");var results_param="";$("#results_parameters").children("div").each(function(){results_param+="&parameter_"+$(this).children(".param_key").text()+"=";results_param+=$(this).children(".param_value").text()});$(".loader").show();var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_load_search_compare_results.php",data:"order_by="+key+"&asc_desc="+order+"&type_of_page="+type_of_page+results_param,success:function(){$(".loader").hide()},error:function(){$(".loader").hide()},async:false}).responseText;$("#search_compare_results").html(html);call_back_list();count=0;return false});$(".provider_details_order_by").click(function(){var key=$(this).attr("id");var order=$(this).children().next().attr("class");var type_of_page=$("#type_of_page").html();if(order=="arrow"){order="desc";$(this).children().next().addClass("arrow_up");$(this).children().next().removeClass("arrow")}else{order="asc";$(this).children().next().addClass("arrow");$(this).children().next().removeClass("arrow_up")}$(".provider_details_order_by").each(function(){$(this).removeClass("active")});$(this).addClass("active");var results_param="";if($("#tab_57").hasClass("active")){var tab_key=57}else{var tab_key=58}$("#results_parameters_"+tab_key).children("div").each(function(){results_param+="&parameter_"+$(this).children(".param_key").text()+"=";results_param+=$(this).children(".param_value").text()});$(".loader").show();var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_load_search_compare_results.php",data:"order_by="+key+"&asc_desc="+order+"&type_of_page="+type_of_page+results_param,success:function(){$(".loader").hide()},error:function(){$(".loader").hide()},async:false}).responseText;$("#search_compare_results_"+tab_key).html(html);call_back_list();count=0;return false});$(".article_auto_ajust_size").each(function(){call_back_article_auto_ajust_size()});$(".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()}});$(".compare_but").click(function(){if(count>1){$(this).parent().parent().parent("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{$(this).parent().parent().parent("form").submit()}}return false});$(".tab_provider").click(function(){count=0;$(".check").each(function(){$(this).attr("checked",false)});$(".tab_provider").each(function(){$(this).removeClass('active')});$(this).addClass("active");$(".search_results").each(function(){$(this).css({display:"none"})});$("#div_"+$(this).attr("id")).css({display:"block"});return false});listen_hover_box();listen_search_compare_result_check()});function listen_hover_box(){var handle;var status=0;$(".hover_box").hover(function(){if($(this).attr("title").length!=0){$(this).attr("t",$(this).attr("title"));$(this).attr("title","");$(this).attr("alt","");if(status==0){status=1;handle=$('<div style="position:absolute; display:inline;" class="tooltip"></div>').appendTo($(this)).hide()}handle.html($(this).attr("t")).fadeIn('fast')}},function(){if(status==1){handle.hide();status=0;$(this).attr("title",$(this).attr("t"));$(this).attr("t","");$(this).children(".tooltip").remove()}})}function load_search_compare_results(pageid,nb_products){var type_of_page=$("#type_of_page").html();var results_param="";if($("#results_parameters").length!=0){$("#results_parameters").children("div").each(function(){results_param+="&parameter_"+$(this).children(".param_key").text()+"=";results_param+=$(this).children(".param_value").text()})}else{if($("#tab_57").hasClass("active")){var tab_key=57}else{var tab_key=58}$("#results_parameters_"+tab_key).children("div").each(function(){results_param+="&parameter_"+$(this).children(".param_key").text()+"=";results_param+=$(this).children(".param_value").text()})}var key="";var order="";if($("div .sortable").children(".active").length!=0){key="&order_by="+$("div .sortable").children(".active").attr("id");if($("div .sortable").children(".active").children(".arrow_up").length!=0){order="&asc_desc=desc"}else{order="&asc_desc=asc"}}$(".loader").show();var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_load_search_compare_results.php",data:"pageid="+pageid+"&nb_products="+nb_products+"&type_of_page="+type_of_page+key+order+results_param,success:function(){$(".loader").hide()},error:function(){$(".loader").hide()},async:false}).responseText;if($("#results_parameters").length!=0){$("#search_compare_results").html(html)}else{$("#search_compare_results_"+tab_key).html(html)}call_back_list();count=0;return false}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 add_to_shortlist(e){if($('.li_added').length==0){$('.email_shortlist').fadeIn();$('.shortlist_info').hide()}$(e).hide();$(e).next('.added').show();var type=$(e).parent().attr('class');if(type=="phone"){var plan_with_phone_id="";var plan_id="";var phone_id=$(e).parent().attr('id')}else if(type=="plan"||type=="prepaid"){var plan_with_phone_id="";var plan_id=$(e).parent().attr('id');var phone_id=""}else if(type=="planwithphone"){var plan_with_phone_id=$(e).parent().attr('id');var plan_id="";var phone_id="";var type="plan"}else{var plan_with_phone_id=$(e).parent().attr('id');var plan_id="";var phone_id="";var type="prepaid"}var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_shortlist_cookie.php",data:"action=shortlist_cookie&plan_id="+plan_id+"&phone_id="+phone_id+"&plan_with_phone_id="+plan_with_phone_id,async:false}).responseText;if(html=='ok'){var resp=$.ajax({type:"POST",url:http_host+"/ajax/ajax_shortlist_product_details.php",data:"action=new&plan_id="+plan_id+"&phone_id="+phone_id+"&plan_with_phone_id="+plan_with_phone_id,async:false}).responseText;$('#shortlist_'+type).children('.shortlist_first').show();$('#shortlist_'+type).find('li:last').after(resp).hide().slideDown()}return false}function deleteProduct(e){var type_ul=$(e).parent().parent().parent();var product_li=$(e).parent().parent();var id=product_li.attr('id');if($(e).parent().parent().hasClass("plan_with_phone")){var type="planwithphone_";var plan_with_phone_id=id;var plan_id="";var phone_id=""}else if($(e).parent().parent().hasClass("plan")){var type="plan_";var plan_with_phone_id="";var plan_id=id;var phone_id=""}else{var type="phone_";var plan_with_phone_id="";var plan_id="";var phone_id=id}$('#shortlist'+type+id).find('.added').hide();$('#shortlist'+type+id).find('.add_shortlist').show();var html=$.ajax({type:"POST",url:http_host+"/ajax/ajax_shortlist_cookie.php",data:"action=shortlist_unset_cookie&plan_id="+plan_id+"&phone_id="+phone_id+"&plan_with_phone_id="+plan_with_phone_id,async:false}).responseText;if(html=='ok_unset'){$(product_li).slideUp('',function(){$(this).remove();if($('.li_added').length==0){$('#form_tool').hide();$('.shortlist_sent').hide();$('.email_shortlist').hide();$('.shortlist_info').hide().fadeIn()}if($(type_ul).children(".li_added").length==0){$(type_ul).children('.shortlist_first').hide()}})}}function call_back_list(){$('.li_added').each(function(){if($(this).hasClass("plan_with_phone")){var type="planwithphone_"}else if($(this).hasClass("plan")){var type="plan_"}else{var type="phone_"}$('#shortlist'+type+$(this).attr("id")).children('.added').show();$('#shortlist'+type+$(this).attr("id")).children('.add_shortlist').hide()})}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();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",async:false}).responseText;$("#div_send_mail").html(html);scroll(0,0)}}function display_terms(alias){var terms=window.open(http_host+"/terms-and-conditions/"+alias+".pdf","terms","width=600,height=400,top=200,left=200,toolbar=no,menubar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no");if(window.focus){terms.focus()}}function call_back_article_auto_ajust_size(){if($(".article_auto_ajust_size").length!=0){$(".search_results").css({display:"block"});var tmp=$(".article_auto_ajust_size").offset();$(".art").css({top:tmp.top});$(".article_auto_ajust_size").css("height",$(".art").css('height'));var tmp2=$(".art_2").offset();var div_height=parseInt(tmp2.top)-parseInt(tmp.top);$(".article_auto_ajust_size").css({"height":div_height})}}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)}