// Ocultamos los precios y mostramos el cargando
document.write('<style> #cabecera_precios {visibility:hidden;} </style>');
document.write('<style> #pestanias {visibility:hidden;} </style>');
document.write('<style> #precios_oc {visibility:hidden;} </style>');

document.write('<script type="text/javascript" src="/on/io/js/grayout/grayout_entop.js"></script>');
document.write('<link rel="stylesheet" type="text/css" href="/on/io/js/grayout/grayout.css">');

var productos_sel = new Array();
var productos_el_sel = new Array();
var selec = getParametro('selec');
var v_procede=getParametro('v_procede',top.window);
if (v_procede==null || v_procede=='undefined') v_procede="";
var pos_ini;
var primer_ajax = true;

if	((selec == null) || (selec == 'undefined'))
{
	productos_sel[0] = '';
	selec = '';
}
else
{
	//Excepción para Oferta Local Catalunya
	/*if	(getParametro('v_procede',top.window) == 'catalunya')
	{
		if	((document.location.href.indexOf('internet_2') != -1) ||
			(document.location.href.indexOf('internet_4') != -1) ||
			(document.location.href.indexOf('television_2') != -1) ||
			(document.location.href.indexOf('television_3') != -1))
		{
			selec_aux = selec;
			selec = 'trioc06-duo06-duo10-triofm06-triof10';
		}
	}*/
	//FIN Excepción para Oferta Local Catalunya

	productos_sel = selec.split('-');
	var j=0;
	for	(var i=0; i<productos_sel.length; i++)
	{
		if	(productos_sel[i].indexOf('el') == 0)
			productos_el_sel[j++] = productos_sel[i];
	}

	//Excepción para Oferta Local Catalunya
	/*if	(getParametro('v_procede',top.window) == 'catalunya')
	{
		if	((document.location.href.indexOf('internet_2') != -1) ||
			(document.location.href.indexOf('internet_4') != -1) ||
			(document.location.href.indexOf('television_2') != -1) ||
			(document.location.href.indexOf('television_3') != -1))
			selec = selec_aux;
	}*/
	//FIN Excepción para Oferta Local Catalunya
}

var pest_sel = new Array();
var pest2 = getParametro('pest2');
if	((pest2 == null) || (pest2 == 'undefined'))
{
	pest2 = '';
}
var pest = getParametro('pest');
if	((pest == null) || (pest == 'undefined'))
{
	pest_sel[0] = '';
	pest = '';
}
else
	pest_sel = pest.split('-');

function esta_producto(id_producto)
{
	esta = false;
	for	(i=0; i<productos_sel.length; i++)
	{
		if	(id_producto==productos_sel[i] || productos_sel[i]=='') //El id tiene que empezar en la posición 0
			esta = true;
	}
	return esta;
}

/*function existe_producto_el(id_producto)
{
	var esta = false;
	if	(document.getElementById('el'+id_producto))
	{
		for	(i=0; i<productos_el_sel.length; i++)
		{
			if	('el'+id_producto == productos_el_sel[i])
				esta = true;
		}
	}
	return esta;
}*/

function existe_producto_el(id_producto)
{
    var esta = false;
    if    (document.getElementById('el'+id_producto))
    {
        for    (i=0; i<productos_el_sel.length; i++)
        {
            if    (productos_el_sel[i].indexOf('el'+id_producto) >= 0)
                esta = true;
        }
    }
    return esta;
}

function existe_producto_el_provincia(id_producto,provincia)
{
    var esta = false;
    if    (document.getElementById(id_producto+'$'+provincia))
    {
        for    (i=0; i<productos_el_sel.length; i++)
        {
            if    (id_producto+'$'+provincia == productos_el_sel[i])
                esta = true;
        }
    }
    return esta;
}

function existen_productos_el_provincia(id_producto,provincias)
{
	var esta = false;
	for    (var i=0; i<provincias.length; i++)
	{
		if (existe_producto_el_provincia(id_producto,provincias[i]))
		{
			esta = true;
			break;
		}
	}
	return esta;
}

function esta_pest(id_pest)
{
	esta = false;
	for	(var i=0; i<pest_sel.length; i++)
	{
		if	(id_pest == 'pestania_' + pest_sel[i])
			esta = true;
	}
	return esta;
}

var num_opc = 0;

function cargarPagina()
{
	for (var icapaprinc in document.getElementsByTagName("div"))
	{
		if (document.getElementsByTagName("div")[icapaprinc].className == 'opcion_oc')
		{
			num_opc++;

			var idpuesto = document.getElementsByTagName("div")[icapaprinc].id;
			var num = 0;
			var array_puestos = new Array();
			var indice = 0;

			for (var icapa in document.getElementById(idpuesto).getElementsByTagName("div"))
			{
				if (document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'capas_opciones')
				{
					array_puestos[indice++] = document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id;
				}
			}

			for (var icapa in document.getElementById(idpuesto).getElementsByTagName("div"))
			{	
				if (document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_mostrar') 
				{
					if	((esta_producto(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id)) &&
						(!existe_producto_el(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id)))
					{
						num = num + 1;
						array_puestos[indice++] = document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id;						
					}
					else
					{
						document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className = 'elem_ocultar';
					}
				}
				else
				{
					if ((document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_ocultar') &&
						(productos_sel[0] != ''))
					{
						if	((esta_producto(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id)) &&
						(!existe_producto_el(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id)) &&
						(!existen_productos_el_provincia(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id,['cat','cad','ast'])))
						{
							document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className = 'elem_mostrar';
							num = num + 1;
							array_puestos[indice++] = document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id;
						}
					}
					/*
					if ((document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_ocultar') &&
						(productos_sel[0] != '') &&
						document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id.indexOf('$cad')==-1)
					{
						if	((esta_producto(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id)) &&
						(!existe_producto_el(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id)) &&
						(!existen_productos_el_provincia(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id,['cat'])))
						{
							document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className = 'elem_mostrar';
							num = num + 1;
							array_puestos[indice++] = document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id;
						}
					}
					*/
				}
			}

			// Ajustamos el tamaño de las columnas
			if	(num == 0)
			{
				//document.getElementById(idpuesto).style.visibility = 'hidden';
			}
			else
			{
				if	(num < 4)
				{
					if	(num == 3)
					{
						for (var icapa in document.getElementById(idpuesto).getElementsByTagName("div"))
						{	
							if ((document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_mostrar') ||
								(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_mostrar local'))
								document.getElementById(idpuesto).getElementsByTagName("div")[icapa].style.width = '205px';
						}
					}
					else if	(num == 2)
					{
						for (var icapa in document.getElementById(idpuesto).getElementsByTagName("div"))
						{	
							if ((document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_mostrar') ||
								(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_mostrar local'))
								document.getElementById(idpuesto).getElementsByTagName("div")[icapa].style.width = '310px';
						}
					}
					else
					{
						for (var icapa in document.getElementById(idpuesto).getElementsByTagName("div"))
						{	
							if ((document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_mostrar') ||
								(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'elem_mostrar local'))
								document.getElementById(idpuesto).getElementsByTagName("div")[icapa].style.width = '310px';

							// Se ocultan las indicaciones de oferta recomendada
							if	((document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'oferta_recomendada_si') ||
								(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'oferta_recomendada_local') ||
								(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'oferta_recomendada_si no') ||
								(document.getElementById(idpuesto).getElementsByTagName("div")[icapa].className == 'oferta_recomendada_local no'))
								
								document.getElementById(idpuesto).getElementsByTagName("div")[icapa].style.visibility = 'hidden';
						}
					}
				}
			}

			redimensionar_contenido(array_puestos); 

			// Si no es necesario, ocultamos las barras de scroll
			if	(num < 5)
			{
				for (var icapa in document.getElementById(idpuesto).getElementsByTagName("div"))
				{	
					id_aux = document.getElementById(idpuesto).getElementsByTagName("div")[icapa].id;
					if	((id_aux != null) && (id_aux.indexOf('scrollbar') != -1))
						document.getElementById(idpuesto).getElementsByTagName("div")[icapa].style.display = 'none';
				}
			}
		}		
	}

	if	(num_opc == '2') //Si existen dos tipos de producto
	{
		if	(opc == 'b')
		{
			document.getElementById('opciones_1').style.display = 'none';
			document.getElementById('opciones_2').style.display = 'block';
		}
		else
		{
			document.getElementById('opciones_2').style.display = 'none';
			document.getElementById('opciones_1').style.display = 'block';
		}
	}


	// Ajustamos el tamaño de las capas del scroll
	if	((opc == 'b') && (num_opc == '2'))
	{
		if	(num > 0)
		{
			var h_max = 0;
			for (var icapa in document.getElementById('opciones_2').getElementsByTagName("div"))
			{	
				if ((document.getElementById('opciones_2').getElementsByTagName("div")[icapa].className == 'elem_mostrar') ||
					(document.getElementById('opciones_2').getElementsByTagName("div")[icapa].className == 'elem_mostrar local'))
					h_max = (document.getElementById('opciones_2').getElementsByTagName("div")[icapa].offsetHeight > h_max) ? document.getElementById('opciones_2').getElementsByTagName("div")[icapa].offsetHeight : h_max;
			}

			document.getElementById('contenido5').style.height = (h_max) + 'px';
			document.getElementById('contenido6').style.height = document.getElementById('contenido5').style.height;
			document.getElementById('contenido7').style.height = document.getElementById('contenido5').style.height;
		}
		else
		{
			document.getElementById('opciones_2').innerHTML = '<div style="background:url(/on/images/ico_aviso_atencionAlta.gif) no-repeat 30px 50px; padding:55px 0em 0em 60px; height:8em; margin-left:5em;"><span class="texto1_2"><b>No existe este producto en esta opción.</b></span></div>';
		}
	}
	else
	{
		var h_max = 0;
		for (var icapa in document.getElementById('opciones_1').getElementsByTagName("div"))
		{				
			if ((document.getElementById('opciones_1').getElementsByTagName("div")[icapa].className == 'elem_mostrar') ||
				(document.getElementById('opciones_1').getElementsByTagName("div")[icapa].className == 'elem_mostrar local'))
			{				
				h_max = (document.getElementById('opciones_1').getElementsByTagName("div")[icapa].offsetHeight > h_max) ? document.getElementById('opciones_1').getElementsByTagName("div")[icapa].offsetHeight : h_max;
			}
		}

		document.getElementById('contenido1').style.height = (h_max) + 'px';
		document.getElementById('contenido2').style.height = document.getElementById('contenido1').style.height;
		document.getElementById('contenido3').style.height = document.getElementById('contenido1').style.height;
	}

	// Notas para coberturas
	// Notas para coberturas
	if	((cob != '00') && (cob != 'el'))
	{
		if	((cob == '01') || (cob == '10') || (cob == '12') || (cob == '21'))
		{
			if	(document.getElementById('nota_pie'))
			{
				var cadena =	'<div style="float:left; width:100%;">';
				cadena +=		'	<div style="float:left; width:75%;">';
				cadena +=		'		<p class="texto3_2">La disponibilidad es estimada. Se verificará en el proceso de contratación</p>';
				if	(document.location.href.indexOf('internet') != -1)
				{
					cadena += '<p><a href="/on/io/es/atencion/consultas_y_dudas/contratos/internet/banda_ancha/factores_limitadores_vel/Factores_Limitadores_Velocidad_ADSL.pdf" target="_blank" class="boton_generico"><strong> Factores limitadores de la velocidad de su ADSL </strong><img src="/on/images/icoLink.gif" alt="ampliar información"></a></p>'; 
				}

				if	(document.location.href.indexOf('television') != -1)
				{
					cadena += '<p><a href="/on/io/es/atencion/consultas_y_dudas/contratos/internet/banda_ancha/factores_limitadores_vel/Factores_Limitadores_Velocidad_ADSL.pdf" target="_blank" class="boton_generico"><strong> Factores limitadores de la velocidad de ADSL en su trío </strong><img src="/on/images/icoLink.gif" alt="ampliar información"></a></p>'; 
				}
				cadena +=		'	</div>';
				cadena +=		'	<div style="float:left; width:25%; text-align:right; margin-top:-0.25em; cursor:pointer;>';				

				cadena +=		'	</div>';
				cadena +=		'</div>';
			}
			document.getElementById('nota_pie').innerHTML += cadena;
		}
	}

	//cambiado por Miguel: 12-04-2010 C2C
	var cadena_c2c="";
	if	(document.location.href.indexOf('internet') != -1)
	{		
		cadena_c2c = "<a href=\"https://www.movistar.es/on/es/quest/formularios/callback/llamar-v2.html?motivo_abandono=Callback%20Precios%20ADSL&nombre_producto=ADSL\" target='_blank' onclick=\"javascript:top.bClose_callback_precios=false;GB_showCenter('/on/es/quest/formularios/callback-c2c/frame-previa.html?tipo=coberturaadsl',570,430);return false;\" ><img src='/on/images/es/btn_contratar_telf_v2.jpg' alt='Contratar por teléfono. Le llamamos ahora'></a>"; 
	}
	if	(document.location.href.indexOf('television') != -1)
	{
		cadena_c2c = "<a href=\"https://www.movistar.es/on/es/quest/formularios/callback/llamar-v2.html?motivo_abandono=Callback%20Precios%20Imagenio&nombre_producto=Imagenio\" target='_blank' onclick=\"javascript:top.bClose_callback_precios=false;GB_showCenter('/on/es/quest/formularios/callback-c2c/frame-previa.html?tipo=coberturaimagenio',570,430);return false;\" ><img src='/on/images/es/btn_contratar_telf_v2.jpg' alt='Contratar por teléfono. Le llamamos ahora'></a>"; 
		//cadena_c2c = "";
	}

	if (document.getElementById('contratar-telefono'))	
		document.getElementById('contratar-telefono').innerHTML = cadena_c2c;
	
	//cambiado por Miguel: 12-04-2010 C2C

	/*
	if	((cob != '00') && (cob != 'el'))
	{
		if	((cob == '01') || (cob == '10') || (cob == '12') || (cob == '21'))
		{
			if	(document.getElementById('nota_pie'))
			{
				document.getElementById('nota_pie').innerHTML = document.getElementById('nota_pie').innerHTML + '<p class="texto3_2">La disponibilidad es estimada. Se verificará en el proceso de contratación</p>';

				if	(document.location.href.indexOf('internet') != -1)
				{
					document.getElementById('nota_pie').innerHTML = document.getElementById('nota_pie').innerHTML + '<p><a href="/on/io/es/atencion/consultas_y_dudas/contratos/internet/banda_ancha/factores_limitadores_vel/Factores_Limitadores_Velocidad_ADSL.pdf" target="_blank" class="boton_generico"><strong> Factores limitadores de la velocidad de su ADSL </strong><img src="/on/images/icoLink.gif" alt="ampliar información"></a></p>';

					document.getElementById('nota_pie').innerHTML += "<a href=\"https://www.movistar.es/on/io/recursos/emergente/index.htm?pagina_central=/on/es/quest/formularios/callback/callback_cobertura.html&tipo_cobertura=internet\" target='_blank' style='text-align:right'					onclick=\"javascript:AbreAsistente('https://www.movistar.es/on/io/recursos/emergente/index.htm?pagina_central=/on/es/quest/formularios/callback/callback_cobertura.html&tipo_cobertura=internet','','520','530','yes'); return false;\"><img src='/on/images/btn_llamame_tv.jpg' alt='Tengo dudas, llámenme' width='149px' height='43px'></a>"; 
				}

				if	(document.location.href.indexOf('television') != -1)
				{
					document.getElementById('nota_pie').innerHTML = document.getElementById('nota_pie').innerHTML + '<p><a href="/on/io/es/atencion/consultas_y_dudas/contratos/internet/banda_ancha/factores_limitadores_vel/Factores_Limitadores_Velocidad_ADSL.pdf" target="_blank" class="boton_generico"><strong> Factores limitadores de la velocidad de ADSL en su trío </strong><img src="/on/images/icoLink.gif" alt="ampliar información"></a></p>';

					document.getElementById('nota_pie').innerHTML += "<a href=\"https://www.movistar.es/on/io/recursos/emergente/index.htm?pagina_central=/on/es/quest/formularios/callback/callback_cobertura.html&tipo_cobertura=internet\" target='_blank' style='text-align:right'					onclick=\"javascript:AbreAsistente('https://www.movistar.es/on/io/recursos/emergente/index.htm?pagina_central=/on/es/quest/formularios/callback/callback_cobertura.html&tipo_cobertura=internet','','520','530','yes'); return false;\"><img src='/on/images/btn_llamame_tv.jpg' alt='Tengo dudas, llámenme' width='149px' height='43px'></a>"; 
				}
			}

		}
	}
	*/

	// Si recibimos el parámetro pest, sólo mostramos las pestañas que indique
	if	(pest_sel[0] != '')
	{
		var idpest = 'pestanias';

		for (var ipest in document.getElementById(idpest).getElementsByTagName("div"))
		{	
			if	((document.getElementById(idpest).getElementsByTagName("div")[ipest].className == 'pestania_on') ||
				(document.getElementById(idpest).getElementsByTagName("div")[ipest].className == 'pestania_off'))
			{
				if	(!esta_pest(document.getElementById(idpest).getElementsByTagName("div")[ipest].id))
					document.getElementById(idpest).getElementsByTagName("div")[ipest].style.display = 'none';
			}
		}
	}
	
	// Título Para un único producto
	if	((cob == '00') && (productos_sel.length == 1) && (selec != ''))
	{
		var idselec = productos_sel[0];

		for (var ipest in document.getElementById(idselec).getElementsByTagName("span"))
		{	
			if	(document.getElementById(idselec).getElementsByTagName("span")[ipest].className == 'texto_titulo')
			{
				var tit_selec = document.getElementById(idselec).getElementsByTagName("span")[ipest].innerHTML;

				tit_selec = tit_selec.replace(/<br>/,' ');
				tit_selec = tit_selec.replace(/<br\/>/,' ');
				tit_selec = tit_selec.replace(/<BR>/,' ');
				tit_selec = tit_selec.replace(/<BR\/>/,' ');

				document.getElementById('titulo_y_texto2').getElementsByTagName("h1")[0].innerHTML = tit_selec;

				break;
			}
		}
	}

	try
	{
		if ((top.document.location.href.indexOf("internet_cp") != -1) ||
			(top.document.location.href.indexOf("telefonia_cp") != -1) ||
			(top.document.location.href.indexOf("television_cp") != -1) ||
			(top.document.location.href.indexOf("voz_cp") != -1) ||
			(top.document.location.href.indexOf("adsl_pc_cp") != -1) ||
			(top.document.location.href.indexOf("voz_adsl_pc_cp") != -1) ||
			(top.document.location.href.indexOf("hogar_empresas") != -1))
		{
			document.getElementById('titulo_y_texto2').getElementsByTagName("h1")[0].innerHTML = 'Selección de modalidad';				
			for (var icapaprinc in document.getElementsByTagName("div"))
			{
				// Se ocultan los mas info
				if	((document.getElementsByTagName("div")[icapaprinc].className == 'cab_mas_info') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'mas_info'))
					
					document.getElementsByTagName("div")[icapaprinc].innerHTML = '';

				// Se ocultan las indicaciones de oferta recomendada
				if	((document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_si') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_local') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_si no') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_local no'))
					
					document.getElementsByTagName("div")[icapaprinc].style.visibility = 'hidden';
				
			
				// Se ocultan las posibilidades de ver otras opciones de productos
				if	((document.getElementsByTagName("div")[icapaprinc].id == 'ver_trios') ||
					(document.getElementsByTagName("div")[icapaprinc].id == 'cobertura_imagenio'))

					document.getElementsByTagName("div")[icapaprinc].style.visibility = 'hidden';
			}
		
			// Si es precios seguridad lo mostramos
			if	(top.document.location.href.indexOf("servicios-seguridad") == -1)
				document.getElementById('otros_precios').style.display = 'none';	
			
			document.getElementById('datos_centrales_interior_m3').id = 'datos_centrales_interior_m4';	
			document.getElementById('datos_centrales_interior_m4').style.width = '760px';			

			if	(document.all)
				document.getElementById('datos_centrales_interior_m4').style.marginLeft = '50px';
			else
				document.getElementById('datos_centrales_interior_m4').style.marginLeft = '65px';
			
			inicializar_capas();
			top.gestionIframes.redimension('iframe_principal','datos_centrales_interior_m4','iframe_datos');
		}
		else if ((top.document.location.href.indexOf("clv") != -1))
		{
			for (var icapaprinc in document.getElementsByTagName("div"))
			{
				// Se ocultan los mas info
				if	(((document.getElementsByTagName("div")[icapaprinc].className == 'cab_mas_info') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'mas_info')) &&
					v_procede.indexOf('movistar')==-1)
					
					document.getElementsByTagName("div")[icapaprinc].innerHTML = '';
				
				// Se ocultan las indicaciones de oferta recomendada
				if	((document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_si') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_local') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_si no') ||
					(document.getElementsByTagName("div")[icapaprinc].className == 'oferta_recomendada_local no'))
					
					document.getElementsByTagName("div")[icapaprinc].style.visibility = 'hidden';
				
			}			
			
			//document.getElementById('titulo_y_texto2').style.display = 'none';	
			document.getElementById('titulo_y_texto2').getElementsByTagName("h1")[0].style.display = 'none';
			if (document.getElementById('ayudenos')) document.getElementById('ayudenos').style.display = 'none';	
			if (document.getElementById('otros_precios')) document.getElementById('otros_precios').style.display = 'none';
			if (document.getElementById('ver_duos')) document.getElementById('ver_duos').style.display = 'none';
			inicializar_capas();
			top.gestionIframes.redimension('iframe_principal','datos_centrales_interior_m3','iframe_datos');
		}
		else
		{
			inicializar_capas();		
			top.gestionIframes.redimension('iframe_principal','datos_centrales_interior_m3','iframe_datos');
		}
	}
	catch (ErrorRedimension)
	{
		inicializar_capas();
	}

	// Nota pie
	for (var icapaprinc in document.getElementsByTagName("div"))
	{
		if (document.getElementsByTagName("div")[icapaprinc].className == 'nota_pie')
		{
			document.getElementsByTagName("div")[icapaprinc].innerHTML = '<p class="texto3_2">Ofertas sujetas a la disponibilidad del servicio.</p>' + document.getElementsByTagName("div")[icapaprinc].innerHTML;

			break;
		}
	}
	
	if (top.document.getElementById("ifr-central-cont")!=undefined) {
		try {top.iframe.load();} catch (e) {} 
	}
	
}

function inicializar_capas()
{
	// Ocultamos el cargando y mostramos los precios
	document.getElementById('cargando_datos').style.display = 'none';
	document.getElementById('pestanias').style.visibility = 'visible';
	document.getElementById('cabecera_precios').style.visibility = 'visible';
	document.getElementById('precios_oc').style.visibility = 'visible';
}

function window_onload()
{
	setTimeout('cargarPagina()',1);
}

function crear_objeto_ajax()
{
	if	(window.XMLHttpRequest)
	{
		objeto_ajax = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		objeto_ajax = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (objeto_ajax == null)
	{
		objeto_ajax = null;
	}

	return objeto_ajax;
}

function llamadaWebAjax(objeto_ajax,capa,url)
{					
	if (objeto_ajax != null)
	{
		objeto_ajax.open("GET", url, true);
		objeto_ajax.onreadystatechange =	function ()
											{
												if	(objeto_ajax.readyState == 4)
												{
													if	(objeto_ajax.status == 200)
													{			
														var banner_aux = objeto_ajax.responseText;
														var esta = false;
														if	(productos_sel[0] == '')
														{
															 if (banner_aux.indexOf('elem_mostrar')!=-1) esta = true;
														}
														else
														{
															var productos_sel1 = selec.split('-');
															for	(i=0; i<productos_sel1.length; i++)
															{
																if	((banner_aux.indexOf('id="'+productos_sel1[i]+'"') != -1) ||
																	 (banner_aux.indexOf("id='"+productos_sel1[i]+"'") != -1))
																	esta = true;
															}
														}

														if	(!esta)
															document.getElementById(capa).style.display = 'none';
													}
												}
											}
		objeto_ajax.send(null);
	}
}


function cargar_menu(objeto_ajax,capa,url)
{
	//Creamos los objeto ajax
	var objeto_ajax = crear_objeto_ajax();

	//Lanzamos el primer objeto ajax
	var url_ajax = url;
	llamadaWebAjax(objeto_ajax,capa,url_ajax);
}	

function mover_scroll(capa1, capa2)
{
	document.getElementById(capa2).style.left = document.getElementById(capa1).offsetLeft + 'px';
}
