var get_provincias_URL="/landing/api/provinces";var get_poblaciones_URL="/tiendaonline/poblaciones";var get_direcciones_URL="/landing/api/coverage/horizontals";var get_cobertura_telefono_URL="ws/getCoberturaTlfFijo.aspx";var get_cobertura_calle_URL="/landing/api/coverage/verticals";var get_serviciabilidad_URL="/landing/api/coverage/serviciabilidad/";var get_contactData_URL="/landing/api/coverage/contactData";function get_provincias(){var a={provincia:"void",afiliado:_afiliado};jQuery.get(get_provincias_URL,a,on_provincias,"json")}function on_provincias(d,a){if(false==d.status){tb_show("Visita la tienda On-Line","ws/error_ws.aspx?TB_iframe=true&height=480&width=750",null)}else{jQuery("#provincias").attr("disabled",false);var c=d;for(var b=0;b<c.length;b++){jQuery("#provincias").append('<option value="'+c[b].id+'">'+c[b].name+"</option>")}}}function get_poblaciones(c){provinciaSEL=jQuery(this).attr("value");var b=provinciaSEL.substring(0,1)+provinciaSEL.substring(1,provinciaSEL.length).toLowerCase();var a={provincia:provinciaSEL,afiliado:_afiliado};jQuery.get(get_poblaciones_URL,a,on_poblaciones,"json")}function on_poblaciones(d,a){if(false==d.status){tb_show("Visita la tienda On-Line","ws/error_ws.aspx?TB_iframe=true&height=480&width=750",null)}else{jQuery("#poblaciones").empty();jQuery("#poblaciones").append('<option value="-1"> - Seleccione - </option>');var c=d;for(var b=0;b<c.length;b++){jQuery("#poblaciones").append('<option value="'+c[b].idTown+'">'+c[b].townDescription+"</option>")}jQuery("#poblaciones").attr("disabled",false);jQuery("#poblaciones").focus()}}function set_contact_data(b){var a={nombre:jQuery("#nombre").val(),movil:jQuery("#movil").val(),email:jQuery("#email").val(),tlf_cobertura:jQuery("#tlf_cobertura").val(),prodId:_prodId,afiliado:_afiliado};jQuery.post(get_contactData_URL,a,b)}function get_direccion(){var b=limpiar_numero(jQuery("#numero").val());var a=function(){var c={tipovia:jQuery("#tipovia").val(),provincias:jQuery("#provincias").val(),poblaciones:jQuery("#poblaciones").val(),numero:b,via:encodeURIComponent(jQuery("#via").val()),afiliado:_afiliado};jQuery.get(get_direcciones_URL,c,on_direcciones,"json")};set_contact_data(a)}function on_direcciones(f,a){var d=f;if(d.length==0){show_no_cobertura()}else{if(d.length==1){IdCalle=d[0].id;_poblacion=d[0].city;_provincia=d[0].province;_numero=d[0].number;_calle=d[0].street;_via=d[0].viaType;if(IdCalle==""||IdCalle=="undefined"||IdCalle==null||IdCalle=="null"){var e=new Array();var b=0;for(var c=0;c<d.length;c++){if(d[c].id!=""){e[b++]=d[c]}}jQuery("#direcciones_encontradas").css({display:"block"});show_direcciones(e,_ajax_altura_tabla_direcciones)}else{check_cobertura()}}else{var d=f;var e=new Array();var b=0;for(var c=0;c<d.length;c++){if(d[c].id!=""){e[b++]=d[c]}}if(e!=null&&e.length==0){show_no_cobertura()}else{show_direcciones(e,_ajax_altura_tabla_direcciones)}}}}function get_direccion_by_google(e,d,c,a){var b={tipovia:jQuery("#tipovia").val(),via:encodeURIComponent(e),provincias:jQuery("#provincias").val(),poblaciones:jQuery("#poblaciones").val(),numero:jQuery("#numero").val(),afiliado:_afiliado};jQuery.get(get_direcciones_URL,b,on_direccion_by_google,"json")}function on_direccion_by_google(f,a){var d=f;var e=new Array();var b=0;for(var c=0;c<d.length;c++){if(d[c].id!=""){e[b++]=d[c]}}if(e!=null&&e.length==0){show_no_cobertura()}else{if(d.length==1){IdCalle=d[0].id;_poblacion=d[0].city;_provincia=d[0].province;_numero=d[0].number;_calle=d[0].street;_via=d[0].viaType;check_cobertura()}else{show_direcciones(e,_ajax_altura_tabla_direcciones)}}}function get_cobertura_calle(){var a={provincia:_provincia,poblacion:_poblacion,via:_via,calle:_calle,numero:_numero,IdCalle:IdCalle,horizontalId:IdCalle,afiliado:_afiliado};jQuery.get(get_cobertura_calle_URL,a,on_cobertura_calle,"json")}function on_cobertura_calle(c,a){if(c&&c.length&&c.length>0){var b=c;_verticalId=b[0].id;get_serviciabilidad()}else{show_no_cobertura()}}function get_serviciabilidad(){var a={horizontalId:IdCalle};jQuery.get(get_serviciabilidad_URL,a,on_serviciabilidad,"json")}function on_serviciabilidad(c,a){var b=c;if(b==true){show_cobertura()}else{show_no_cobertura()}}function get_cobertura_telefono(){var a={tlf:jQuery("#tlf_cobertura").val(),afiliado:_afiliado};jQuery.get(get_cobertura_telefono_URL,a,on_cobertura_telefono,"json")}function on_cobertura_telefono(b,a){if(false==b.status){tb_show("Visita la tienda On-Line","ws/error_ws.aspx?TB_iframe=true&height=480&width=750",null)}else{var c=b.Serviciabilidad;_tipoServicio=b.Tipo;if(c=="1"){show_cobertura()}else{show_no_cobertura()}}};