	var jazztelEnabled=false;
	var orangeEnabled=false;
	var yacomEnabled=false;
	var tele2Enabled=true;
	

	function checkCoverageJazztelCoveragePage(tariffID)
	{		 
		if(jazztelEnabled==true)
		{
			Ext.onReady(function()
			{
				Ext.MessageBox.buttonText.yes = "S&iacute;";
				
				Ext.Msg.show({
				   title:'',
				   msg: '<b>&iquest;Tienes l&iacute;nea telef&oacute;nica actualmente?</b>',
				   buttons: Ext.Msg.YESNO,
				   width: 270,
				   fn: showResult,
				   confirm:true
				});
	
				function showResult(btn, text)
				{
					if(btn == 'no')
					{
						var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=3&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
						url = url +"&status=KO";
						window.open(url);
					}
					else
					{
						Ext.MessageBox.buttonText.ok = "Comprobar ahora";
						Ext.Msg.show({
							   title:'',
							   msg: '<b>Introduce el telef&oacute;no donde deseas el ADSL</b>',
							   buttons: Ext.Msg.OK,
							   width: 310,
							   fn: processResult,
							   prompt:true
							});
					}
				};
	
				function processResult(btn, text)
				{
					var telefono = text;
					
					if(btn == 'ok')
					{
						Ext.MessageBox.buttonText.ok = "Aceptar";
						
						if(isNaN(text))
						{
							Ext.MessageBox.show({
					           title: '',
					           msg: '<b>Es necesario que introduzcas s&oacute;lo caracteres num&eacute;ricos</b>',
					           buttons: Ext.MessageBox.OK,
					           width:370
					       });
						}
						else
						{
							Ext.MessageBox.buttonText.ok = "Aceptar";
							
							if((parseInt(text)>999999999)||(parseInt(text)<910000000)||(text.length==0))
							{
								Ext.MessageBox.show({
						           title: '',
						           msg: '<b>Es necesario que introduzcas un telef&oacute;no v&aacute;lido</b>',
						           width:330,
						           buttons: Ext.MessageBox.OK
					      		 });
							}
							else
							{
								 Ext.MessageBox.show({
							       title: '',
							       msg: '<div style="text-align:center;"><b>Comprobando cobertura Jazztel</b><br/><img src="images_base/dsl_landing/coverageLoading.gif"/></div>',
							       width:250,
							       closable:false
								});
							
								var coverageCall = "jazztelcobertura?telefono=" +telefono;
								
								new Ajax.Request(coverageCall,{method:'get',onSuccess: function(helper)
					            {
									var response = helper.responseText;
		
									if(response=='KO')
									{
										Ext.MessageBox.hide();
										Ext.MessageBox.show({
								           title: '',
								           msg: '<div style="text-align:center;"><b>Lo sentimos, el n&uacute;mero que has introducido no tiene cobertura para la tarifa deseada.<br/> Verifica otras ofertas o velocidades de todos los proveedores.</b></div>',
								           buttons: Ext.MessageBox.OK,
								           width:350,
								           fn: redirectToTariff
							      		 });
									}
									else
									{
										if(response=='DOWN')
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>Es necesaria m&aacute;s informaci&oacute;n para comprobar tu cobertura.<br/> Deja tus datos y te llamaremos.</b></div>',
									           buttons: Ext.MessageBox.OK,
									           width:410,
									           fn: submitFormularioDOWN
								      		 });
										}
										else
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>Enhorabuena, tienes cobertura Jazztel.<br/> Deja tus datos para comprar online tu ADSL</b></div>',
									           buttons: Ext.MessageBox.OK,
									           width:310,
									           fn: submitFormularioOK
								      		 });
										}
									}
								},onFailure: function() {}}
								);
								
								function redirectToTariff()
								{
									window.parent.replace="adsl-tarifas";
								}	
	
								function submitFormularioDOWN()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=3&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=DOWN&telefono=" +text;
									window.open(url);
								}
								
								function submitFormularioOK()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=3&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=OK&telefono=" +text;
									window.open(url);
								}
							}
						}
					}
				};
			});
		}
		else
		{
			var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=3&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
			url = url +"&status=DOWN";
			window.parent.replace=url;
		}
   	}

   	
   	function checkCoverageOrangeCoveragePage(tariffID)
	{		 
		if(orangeEnabled==true)
		{
			Ext.onReady(function()
			{
				Ext.MessageBox.buttonText.yes = "S&iacute;";
				
				Ext.Msg.show({
				   title:'',
				   msg: '<b>&iquest;Tienes l&iacute;nea con <img src="images_base/dsl_landing/telefonica.png" style="vertical-align:middle;"/> actualmente?</b>',
				   buttons: Ext.Msg.YESNO,
				   width: 310,
				   fn: showResult,
				   confirm:true
				});
	
				function showResult(btn, text)
				{
					if(btn == 'no')
					{
						var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=2&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
						url = url +"&status=KO";
						window.open(url);
					}
					else
					{
						Ext.MessageBox.buttonText.ok = "Comprobar ahora";
	
						Ext.Msg.show({
							   title:'',
							   msg: '<b>Introduce el tel&eacute;fono donde deseas el ADSL</b>',
							   buttons: Ext.Msg.OK,
							   width: 310,
							   fn: processResult,
							   prompt:true
						});
					}
				};
	
				function processResult(btn, text)
				{
					var telefono = text;
					
					if(btn == 'ok')
					{
						Ext.MessageBox.buttonText.ok = "Aceptar";
						
						if(isNaN(text))
						{
							Ext.MessageBox.show({
					           title: '',
					           msg: '<b>Es necesario que introduzcas s&oacute;lo caracteres num&eacute;ricos</b>',
					           buttons: Ext.MessageBox.OK,
					           width:370
					       });
	
						}
						else
						{
							Ext.MessageBox.buttonText.ok = "Aceptar";
							
							if((parseInt(text)>999999999)||(parseInt(text)<910000000)||(text.length==0))
							{
								Ext.MessageBox.show({
						           title: '',
						           msg: '<b>Es necesario que introduzcas un tel&eacute;fono v&aacute;lido</b>',
						           buttons: Ext.MessageBox.OK,
						           width:330
					      		 });
							}
							else
							{
								 Ext.MessageBox.show({
							       title: '',
							       msg: '<div style="text-align:center;"><b>Comprobando cobertura Orange</b><br/><img src="images_base/dsl_landing/coverageLoading.gif"/></div>',
							       width:250,
							       closable:false
								});
							
								var coverageCall = "orangecobertura?telefono=" +telefono;
								
								new Ajax.Request(coverageCall,{method:'get',onSuccess: function(helper)
					            {
									var response = helper.responseText;
		
									if(response=='KO')
									{
										Ext.MessageBox.hide();
										Ext.MessageBox.show({
								           title: '',
								           msg: '<div style="text-align:center;"><b>Lo sentimos, el n&uacute;mero que has introducido no tiene cobertura para la tarifa deseada. Verifica otras ofertas o velocidades de todos los proveedores.</b></div>',
								           width:350,
								           buttons: Ext.MessageBox.OK,
								           fn: redirectToTariff
							      		 });
									}
									else
									{
										if(response=='DOWN')
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>Es necesaria m&aacute;s informaci&oacute;n para comprobar tu cobertura.<br/> Deja tus datos y te llamaremos.</b></div>',
									           buttons: Ext.MessageBox.OK,
									           width:360,
									           fn: submitFormularioDOWN
								      		 });
										}
										else
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>Enhorabuena, tienes cobertura Orange.<br/> Deja tus datos para comprar online tu ADSL</b></div>',
									           width:310,
									           buttons: Ext.MessageBox.OK,
									           fn: submitFormularioOK
								      		 });
										}
									}
								},onFailure: function() {}}
								);
								
								function redirectToTariff()
								{
									window.parent.replace="adsl-tarifas";
								}	
	
								function submitFormularioDOWN()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=2&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=DOWN&telefono=" +text;
									window.open(url);
								}
								
								function submitFormularioOK()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=2&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=OK&telefono=" +text;
									window.open(url);
								}
							}
						}
					}
				};
			});
		}
		else
		{
			var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=2&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
			url = url +"&status=DOWN";
			window.parent.replace=url;
		}
   	}
   	
   	
	
	function checkCoverageYacomCoveragePage(tariffID)
	{		
		if(yacomEnabled==true)
		{
			Ext.onReady(function()
			{
				Ext.MessageBox.buttonText.yes = "S&iacute;";
				
				Ext.Msg.show({
				   title:'',
				   msg: '<b>&iquest;Tienes l&iacute;nea con <img src="images_base/dsl_landing/telefonica.png" style="vertical-align:middle;"/> actualmente?</b>',
				   buttons: Ext.Msg.YESNO,
				   width: 270,
				   fn: showResult,
				   confirm:true
				});
	
				function showResult(btn, text)
				{
					if(btn == 'no')
					{
						var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=5&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
						url = url +"&status=DOWN";
						window.open(url);
					}
					else
					{
						Ext.MessageBox.buttonText.ok = "Comprobar ahora";
						Ext.Msg.show({
							   title:'',
							   msg: '<b>Introduce el telef&oacute;no donde deseas el ADSL</b>',
							   buttons: Ext.Msg.OK,
							   width: 310,
							   fn: processResult,
							   prompt:true
							});
					}
				};
	
				function processResult(btn, text)
				{
					var telefono = text;
					
					if(btn == 'ok')
					{
						Ext.MessageBox.buttonText.ok = "Aceptar";
						
						if(isNaN(text))
						{
							Ext.MessageBox.show({
					           title: '',
					           msg: '<b>Es necesario que introduzcas s&oacute;lo caracteres num&eacute;ricos</b>',
					           buttons: Ext.MessageBox.OK,
					           width:370
					       });
						}
						else
						{
							Ext.MessageBox.buttonText.ok = "Aceptar";
							
							if((parseInt(text)>999999999)||(parseInt(text)<910000000)||(text.length==0))
							{
								Ext.MessageBox.show({
						           title: '',
						           msg: '<b>Es necesario que introduzcas un telef&oacute;no v&aacute;lido</b>',
						           width:330,
						           buttons: Ext.MessageBox.OK
					      		 });
							}
							else
							{
								 Ext.MessageBox.show({
							       title: '',
							       msg: '<div style="text-align:center;"><b>Comprobando cobertura Yacom</b><br/><img src="images_base/dsl_landing/coverageLoading.gif"/></div>',
							       width:250,
							       closable:false
								});
							
								var coverageCall = "yacomcobertura?telefono=" +telefono;
								
								new Ajax.Request(coverageCall,{method:'get',onSuccess: function(helper)
					            {
									var response = helper.responseText;
		
									if(response=='KO')
									{
										Ext.MessageBox.hide();
										Ext.MessageBox.show({
								           title: '',
								           msg: '<div style="text-align:center;"><b>Lo sentimos, el n&uacute;mero que has introducido no tiene cobertura para la tarifa deseada.<br/> Verifica otras ofertas o velocidades de todos los proveedores.</b></div>',
								           buttons: Ext.MessageBox.OK,
								           width:350,
								           fn: redirectToTariff
							      		 });
									}
									else
									{
										if(response=='DOWN')
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>Es necesaria m&aacute;s informaci&oacute;n para comprobar tu cobertura.<br/> Deja tus datos y te llamaremos.</b></div>',
									           buttons: Ext.MessageBox.OK,
									           width:410,
									           fn: submitFormularioDOWN
								      		 });
										}
										else
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>Enhorabuena, tienes cobertura Yacom.<br/> Deja tus datos para comprar online tu ADSL</b></div>',
									           buttons: Ext.MessageBox.OK,
									           width:310,
									           fn: submitFormularioOK
								      		 });
										}
									}
								},onFailure: function() {}}
								);
								
								function redirectToTariff()
								{
									window.parent.replace="adsl-tarifas";
								}	
	
								function submitFormularioDOWN()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=5&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=DOWN&telefono=" +text;
									window.open(url);
								}
								
								function submitFormularioOK()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=5&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=OK&telefono=" +text;
									window.open(url);
								}
							}
						}
					}
				};
			});
		}
		else
		{
			var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=5&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
			url = url +"&status=DOWN";
			window.open(url);
		}
   	}
	
	
	function checkCoverageTele2CoveragePage(tariffID)
	{		 
		if(tele2Enabled==true)
		{		
			Ext.onReady(function()
			{
				Ext.MessageBox.buttonText.ok = "Comprobar ahora";
				Ext.Msg.show({
					   title:'',
					   msg: '<b>Introduce el c&oacute;digo postal de tu domicilio</b>',
					   buttons: Ext.Msg.OK,
					   fn: processResult,
					   prompt:true
				});
	
				function processResult(btn,text)
				{
					var telefono = text;
					
					if(btn == 'ok')
					{
						Ext.MessageBox.buttonText.ok = "Aceptar";
						
						if(isNaN(text))
						{
							Ext.MessageBox.show({
					           title: '',
					           msg: '<b>Es necesario que introduzcas s&oacute;lo caracteres num&eacute;ricos</b>',
					           width:370,
					           buttons: Ext.MessageBox.OK
					       });
		
						}
						else
						{
							Ext.MessageBox.buttonText.ok = "Aceptar";
	
							if(telefono.length==4)
								telefono = "0" +telefono;
							
							if((parseInt(telefono,10)<1001)||(parseInt(telefono,10)>59000)||(telefono.length==0))
							{
								Ext.MessageBox.show({
						           title: '',
						           msg: '<b>Es necesario que introduzcas un c&oacute;digo postal v&aacute;lido</b>',
						           width:330,
						           buttons: Ext.MessageBox.OK
					      		 });
							}
							else
							{
								 Ext.MessageBox.show({
							       title: '',
							       msg: '<div style="text-align:center;"><b>Comprobando cobertura Tele2</b><br/><img src="images_base/dsl_landing/coverageLoading.gif"/></div>',
							       width:250,
							       closable:false
								});
							
		
								var coverageCall = "tele2cobertura?telefono=" +telefono;
								
								new Ajax.Request(coverageCall,{method:'get',onSuccess: function(helper)
					            {
									var response = helper.responseText;
		
									if(response=='KO')
									{
										Ext.MessageBox.hide();
										Ext.MessageBox.show({
								           title: '',
								           msg: '<div style="text-align:center;"><b>Lo sentimos, el c&oacute;digo postal que has introducido no tiene cobertura para la tarifa deseada.<br/> Verifica otras ofertas o velocidades de todos los proveedores.</b></div>',
								           width:350,
								           buttons: Ext.MessageBox.OK
							      		 });
									}
									else
									{
										if(response=='DOWN')
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>No es posible comprobar la cobertura ahora mismo.<br/> Deja tus datos y te llamaremos</b></div>',
									           width:350,
									           buttons: Ext.MessageBox.OK,
									           fn: submitFormularioDOWN
								      		 });
										}
										else
										{
											Ext.MessageBox.hide();
											
											Ext.MessageBox.show({
									           title: '',
									           msg: '<div style="text-align:center;"><b>Enhorabuena, tienes cobertura Tele2.<br/> Deja tus datos y te llamaremos</b></div>',
									           width:310,
									           buttons: Ext.MessageBox.OK,
									           fn: submitFormularioOK
								      		 });
										}
									}
								},onFailure: function() {}}
								);
	
								function submitFormularioDOWN()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=4&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=DOWN&telefono=" +text;
									window.open(url);
								}
	
																	
								function submitFormularioOK()
								{
									var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=4&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
									url = url +"&status=OK&telefono=" +text;
									window.open(url);
								}	
							}
						}
					}
				}
			});				
		}
		else
		{
			var url = "compraonline-adsl?tariffId=" +tariffID +"&offerId=" +tariffID +"locationId=1&providerId=4&status=&logType=SEARCH_LIST_PROMOTION_BOX_TOP&source=COVERAGEPAGE";
			url = url +"&status=DOWN";
			window.open(url);
		}
   	}
