﻿
//INICIALIZAR VARIABLES
var esIE = false;
var scriptIE6 = "";
if (navigator.appVersion.indexOf("MSIE") != -1) { esIE = true; }
swIE60 = (navigator.appVersion.indexOf("6.0") != -1) ? 1 : 0; //funcionalidades exclusivas para IE6
swIE80 = (navigator.appVersion.indexOf("8.0") != -1); 	//Si es explorer 8 esta variable toma valor true, en caso contrario tomara false*
var newStyle = "<style>"; var endStyle = "</style>";
newStyle += ".contentsuperdestacados { background:transparent; height:27.2em;}";
newStyle += ".tpSubMenu .lstRight .txt { filter:progid:dximagetransform.microsoft.alpha(opacity=80); moz-opacity:0.8; opacity:0.8;}";
newStyle += "ul.othersLanguages { display:none; position:absolute; left:0; top:3.6em; width:7em; padding:1em; z-index:20; border:1px solid #48b1c7; border-top:0;}";
newStyle += "ul.othersLanguages li { float:none; margin-bottom:.5em;}";
newStyle += ".headercabecera h1.bold, .headercabecera h1.boldPeque, .headercabecera h1.reg, .headercabecera h1.prodbold, .headercabecera h1.prodreg { font-size:37px;}";
newStyle += ".contentcatalogo .destacados { height:25.3em; overflow:hidden}";
newStyle += ".intapoyo, .intlomasbuscado, .online { display:none;}";
newStyle += ".ocultaTabs { display:none;}";
newStyle += ".txt_entradilla .jsoff { display:none;}";
newStyle += ".cabecera_producto .precioproducto span.titPuntos { display:none;}";
newStyle += "#gmap_coberturaWifi_op { display:none;}";
newStyle += "#gmap_coberturaWifi {height:54.6em}";
newStyle += ".cobertura_finder .ciudad { display:inline;}";
newStyle += ".cobertura_finder .lista_ejemplos {display:none;}";
newStyle += ".oculta_R, #wrapper .oculta_R,.descripVideo { display:none;}";
newStyle += ".cerrar_share { visibility:visible !important;}";
newStyle += ".form_ordenar .goTo, .detalles_producto,.toggle_hide { display:none;}";
newStyle += ".detalles_producto { display:none; position:static }";
newStyle += ".personalizacion .footer_personalizacion span { color:#fff }";
newStyle += ".carrusel_ficha_prod .item-list ul {overflow:hidden}";
newStyle += ".rightcomunidad .plegado .tr {padding-bottom:0;} .rightcomunidad .plegado .archivo_blog ul {display:none} .rightcomunidad .plegado .archivo_blog h2 {background-image:url(/on/img/ico_arrowblue_r.gif);}";
newStyle += "#agrup_help_movil .lis_productos{height:6.8em; overflow:hidden;width:89.5em !important;}"
newStyle += ".navalternativa .navList{ height:15.4em; overflow:hidden}"
if (esIE && swIE60) { newStyle += ".intconfigpuesto .n-ordenadores{height:2em;}"; }
else { newStyle += ".intconfigpuesto .n-ordenadores{height:8em;}"; }
document.write(newStyle + endStyle);

//DENICION DE FUNCIONALIDADES



var acordeonH = {
	numElems: 0,
	puerta: true,
	espera_puerta: 0, //Tiempo se espera entre un hover y otro
	retardo: null,
	lastBlock: null,
	actualBlock: null,
	num_ciclo: 0,
	intervalo: 10000, //Tiempo que tarda en pasar de un elem a otro 
	speed: 2000,
	obj_retardo: null,
	maxWidth: 698,
	minWidth: 93,
	primer_hover: false,
	load: function(my_class, numElem, maxW) {
		acordeonH.styles(my_class);
		if (swIE80) acordeonH.maxWidth = maxW - 7
		else acordeonH.maxWidth = maxW;
		acordeonH.numElems = numElem;
		if (!acordeonH.primer_hover) {
			$(".intnavalt").css("opacity", 0);
			acordeonH.lastBlock = $("#first_elem");
			$(acordeonH.lastBlock).css("width", acordeonH.maxWidth + "px");
			$(acordeonH.lastBlock).find(".intnavalt").css("opacity", 1);
			acordeonH.ciclo();
			acordeonH.obj_retardo = window.setInterval("acordeonH.ciclo()", acordeonH.intervalo);
		}
		$(my_class + " ul li .agrup_navalt").hover(function() {
			window.clearInterval(acordeonH.obj_retardo);
			acordeonH.primer_hover = true;
			if (acordeonH.puerta) {
				acordeonH.puerta = false;
				acordeonH.actualBlock = this;
				acordeonH.retardo = setTimeout('acordeonH.espera()', acordeonH.espera_puerta);
			}
			else return false;
		})
	},
	styles: function(_myclass) {
		$(_myclass).find("ul.navList").css({
			"overflow": "hidden",
			"height": "15.4em"
		});
		$(_myclass).find("ul.navList .agrup_navalt").css({ "overflow": "hidden", "width": "93px" });
	},
	ciclo: function() {
		var aleatori = Math.floor(Math.random() * acordeonH.numElems);
		while (acordeonH.num_ciclo == aleatori) {
			aleatori = Math.floor(Math.random() * acordeonH.numElems);
		}
		acordeonH.num_ciclo = aleatori;
		$(acordeonH.lastBlock).animate({ width: acordeonH.minWidth + "px" }, { queue: false, duration: acordeonH.speed });
		$(acordeonH.lastBlock).find(".intnavalt").animate({ opacity: 0 }, { queue: false, duration: acordeonH.speed });
		$(acordeonH.lastBlock).removeClass("navAlt_selected");
		$(".navalternativa ul li .agrup_navalt").each(function(e) {
			if (e == acordeonH.num_ciclo) {
				$(this).animate({ width: acordeonH.maxWidth + "px" }, { queue: false, duration: acordeonH.speed });
				$(this).find("div.intnavalt").animate({ opacity: 1 }, { queue: false, duration: acordeonH.speed });
				$(this).addClass("navAlt_selected");
				acordeonH.lastBlock = this;
			}
		})
	},
	espera: function() {
		$(acordeonH.lastBlock).stop().animate({ width: acordeonH.minWidth + "px" }, { queue: false, duration: acordeonH.speed });
		$(acordeonH.lastBlock).find("div.intnavalt").animate({ opacity: 0 }, { queue: false, duration: acordeonH.speed });
		$(acordeonH.actualBlock).stop().animate({ width: acordeonH.maxWidth + "px" }, { queue: false, duration: acordeonH.speed });
		$(acordeonH.actualBlock).find("div.intnavalt").animate({ opacity: 1 }, { queue: false, duration: acordeonH.speed });
		$(acordeonH.lastBlock).removeClass("navAlt_selected");
		$(acordeonH.actualBlock).addClass("navAlt_selected");
		acordeonH.lastBlock = acordeonH.actualBlock;
		acordeonH.puerta = true;
		clearTimeout(acordeonH.retardo);
	}
}

var init = {
	funciones: function() {
		if ($(".panel_4_navalt .navalternativa").size() != 0) acordeonH.load(".navalternativa", 4, 699);
		if ($(".panel_3_navalt .navalternativa").size() != 0) acordeonH.load(".navalternativa", 3, 792);
		if (jQuery("#noflash").size() != 0) { noFlash.load(0); }

		/*NEW*/
		if (jQuery("#noflash2").size() != 0) { noFlash2.load(0); }
		/*NEW*/

	}
}
jQuery(document).ready(init.funciones);






/*CONFIG BANNER HERO*/

var noFlash = {
	actual: -1, //guarda la posición del listado visible en cada momento, teniedo en cuenta que actual = 0, es la pagina 1
	anterior: -1, //guarda la ultima posición del listado visible
	intervalo: 4000, //intervalo de tiempo que transcurre entre los cambios
	obj_retardo: null, //objeto sobre el que se realiza el intervalo
	objs: null, //objeto que contiene los "li" con cada una de las imágenes a mostrar
	objsPage: null, //objeto que contiene cada uno de los "li" de la paginacion
	objs_size: 0, //numero de elementos del listado
	animacion: true, //variable de control para dar una animacion al cambio de imagenes o no
	transition: 1000, //tiempo del fadeIn y fadeOut
	primer: true,
	load: function(qItem) {
		noFlash.actual = qItem;
		noFlash.anterior = qItem;
		var $noflash = jQuery("#noflash");
		noFlash.objs = jQuery("#noflash li");
		noFlash.objs_size = jQuery(noFlash.objs).size();
		jQuery($noflash).addClass("noflashActive");
		if (noFlash.animacion) jQuery(noFlash.objs).eq(noFlash.actual).css("display", "block")
		else jQuery(noFlash.objs).eq(noFlash.actual).addClass("selected")
		if (noFlash.objs_size > 1) {
			var html_insertar = '<div id="noFlashPaginate"><ul>';
			jQuery(noFlash.objs).each(function(e) {
				//if (e==noFlash.actual)
				//	html_insertar+='<li class="selected"><a href="" title="accede a página '+(e+1)+'"><span class="hidden">'+(e+1)+'</span></a></li>';
				//else html_insertar+='<li><a href="" title="accede a página '+(e+1)+'"><span class="hidden">'+(e+1)+'</span></a></li>'
				if (e == noFlash.actual)
					html_insertar += '<li class="selected"><a href="" title="' + jQuery(this).find("img").attr("alt") + '"><span class="hidden">' + jQuery(this).find("img").attr("alt") + '</span></a></li>';
				else html_insertar += '<li><a href="" title="' + jQuery(this).find("img").attr("alt") + '"><span class="hidden">' + jQuery(this).find("img").attr("alt") + '</span></a></li>';
			})
			html_insertar += '</ul><div id="playerNoflash"><a class="prev" href="#" title="acceda a la página anterior"><span class="hidden">Página anterior</span></a><a class="stop" href="#" title="Pulse para parar"><span class="hidden">Parar</span></a><a class="play" href="#" title="Pulse para reproducir"><span class="hidden">Reproducir</span></a><a class="next" href="#" title="acceda a la página siguiente"><span class="hidden">Página siguiente</span></a></div></div>';
			jQuery($noflash).after(html_insertar);
			noFlash.objsPage = jQuery("#noFlashPaginate ul li");
			noFlash.obj_retardo = window.setInterval("noFlash.ciclo()", noFlash.intervalo);
			jQuery(noFlash.objsPage).find("a").bind("click", function(e) {
				noFlash.anterior = noFlash.actual;
				noFlash.actual = jQuery(noFlash.objsPage).find("a").index(this);
				noFlash.desplaza();
				return false;
			})
			jQuery("#playerNoflash a").bind("click", function() {
				var typebutton = jQuery(this).attr("class");
				switch (typebutton) {
					case 'prev':
						noFlash.anterior = noFlash.actual;
						noFlash.actual = (noFlash.actual + noFlash.objs_size - 1) % noFlash.objs_size;
						noFlash.desplaza();
						break;
					case 'stop':
						clearInterval(noFlash.obj_retardo);
						jQuery(this).css("display", "none");
						jQuery("#playerNoflash a.play").css("display", "block");
						break;
					case 'play':
						jQuery(this).css("display", "none");
						jQuery("#playerNoflash a.stop").css("display", "block");
						noFlash.obj_retardo = window.setInterval("noFlash.ciclo()", noFlash.intervalo);
						break;
					case 'next':
						noFlash.anterior = noFlash.actual;
						noFlash.actual = (noFlash.actual + 1) % noFlash.objs_size;
						noFlash.desplaza();
						break;
				}
				return false;
			})
		}
		jQuery(noFlash.objs).find("a").bind("click", function() {
			if (jQuery(this).hasClass("newwindow")) {
				var _url = jQuery(this).attr("href")
				var tamanios = jQuery(this).attr("id").split("_");
				var w_win = parseInt(tamanios[0].split('w')[1]);
				var h_win = parseInt(tamanios[1].split('h')[1]);
				return noFlash.abrir(_url, 'newwindow', 'width=' + w_win + ',height=' + h_win + ',scrollbars=yes', 1, 2, 2);
			}
		})
	},
	ciclo: function() {
		noFlash.anterior = noFlash.actual;
		noFlash.actual = (noFlash.actual + 1) % noFlash.objs_size;
		noFlash.desplaza();
		if (noFlash.primer) {
			noFlash.primer = false;
			clearInterval(noFlash.obj_retardo);
			noFlash.intervalo = 12000;
			noFlash.obj_retardo = window.setInterval("noFlash.ciclo()", noFlash.intervalo);
		}
	},
	desplaza: function() {
		jQuery(noFlash.objsPage).eq(noFlash.anterior).removeClass("selected");
		jQuery(noFlash.objsPage).eq(noFlash.actual).addClass("selected");
		if (noFlash.animacion) {
			jQuery(noFlash.objs).eq(noFlash.anterior).fadeOut(noFlash.transition);
			jQuery(noFlash.objs).eq(noFlash.actual).fadeIn(noFlash.transition);
		}
		else {
			jQuery(noFlash.objs).eq(noFlash.anterior).removeClass("selected");
			jQuery(noFlash.objs).eq(noFlash.actual).addClass("selected");
		}
	},
	abrir: function() {
		var v1 = arguments, v2 = v1[2].split(","), v3 = (v1.length > 3) ? v1[3] : false, v4 = (v1.length > 4) ? parseInt(v1[4]) : 0, v5 = (v1.length > 5) ? parseInt(v1[5]) : 0, v6, v7 = 0, v8, v9, v10, v11, v12, v13, v14, v15, v16; v11 = new Array("width,left," + v4, "height,top," + v5); for (i = 0; i < v11.length; i++) { v12 = v11[i].split(","); l_iTarget = parseInt(v12[2]); if (l_iTarget > 1 || v1[2].indexOf("%") > -1) { v13 = eval("screen." + v12[0]); for (v6 = 0; v6 < v2.length; v6++) { v10 = v2[v6].split("="); if (v10[0] == v12[0]) { v14 = parseInt(v10[1]); if (v10[1].indexOf("%") > -1) { v14 = (v14 / 100) * v13; v2[v6] = v12[0] + "=" + v14; } } if (v10[0] == v12[1]) { v16 = parseInt(v10[1]); v15 = v6; } } if (l_iTarget == 2) { v7 = (v13 - v14) / 2; v15 = v2.length; } else if (l_iTarget == 3) { v7 = v13 - v14 - v16; } v2[v15] = v12[1] + "=" + v7; } } v8 = v2.join(","); v9 = window.open(v1[0], v1[1], v8); if (v3) { v9.focus(); } document.MM_returnValue = false; return false;
	}
}




/*HERO 222222*/
/*CONFIG BANNER HERO*/

var noFlash2 = {
actual:-1,//guarda la posición del listado visible en cada momento, teniedo en cuenta que actual = 0, es la pagina 1
anterior:-1,//guarda la ultima posición del listado visible
intervalo:20000,//intervalo de tiempo que transcurre entre los cambios
obj_retardo:null,//objeto sobre el que se realiza el intervalo
objs:null,//objeto que contiene los "li" con cada una de las imágenes a mostrar
objsPage:null,//objeto que contiene cada uno de los "li" de la paginacion
objs_size:0,//numero de elementos del listado
animacion:true,//variable de control para dar una animacion al cambio de imagenes o no
transition:1000,//tiempo del fadeIn y fadeOut
primer:true,
load:function(qItem){
noFlash2.actual=qItem;
noFlash2.anterior=qItem;
var $noflash = jQuery("#noflash2");
noFlash2.objs = jQuery("#noflash2 li");
noFlash2.objs_size = jQuery(noFlash2.objs).size();
jQuery($noflash).addClass("noflashActive2");
if(noFlash2.animacion) jQuery(noFlash2.objs).eq(noFlash2.actual).css("display","block")
else jQuery(noFlash2.objs).eq(noFlash2.actual).addClass("selected2")
if(noFlash2.objs_size>1){
var html_insertar = '<div id="noFlashPaginate2"><ul>';
jQuery(noFlash2.objs).each(function(e){
if (e==noFlash2.actual)
html_insertar+='<li class="selected2"><a href="" title="'+jQuery(this).find("img").attr("alt")+'"><span class="hidden">'+jQuery(this).find("img").attr("alt")+'</span></a></li>';
else html_insertar+='<li><a href="" title="'+jQuery(this).find("img").attr("alt")+'"><span class="hidden">'+jQuery(this).find("img").attr("alt")+'</span></a></li>';
})
html_insertar += '</ul><div id="playerNoflash2"><a class="prev2" href="#" title="acceda a la página anterior"><span class="hidden">Página anterior</span></a><a class="stop2" href="#" title="Pulse para parar"><span class="hidden">Parar</span></a><a class="play2" href="#" title="Pulse para reproducir"><span class="hidden">Reproducir</span></a><a class="next2" href="#" title="acceda a la página siguiente"><span class="hidden">Página siguiente</span></a></div></div>';
jQuery($noflash).after(html_insertar);
noFlash2.objsPage=jQuery("#noFlashPaginate2 ul li");
noFlash2.obj_retardo = window.setInterval("noFlash2.ciclo()",noFlash2.intervalo);
jQuery(noFlash2.objsPage).find("a").bind("click",function(e){
noFlash2.anterior = noFlash2.actual;
noFlash2.actual = jQuery(noFlash2.objsPage).find("a").index(this);
noFlash2.desplaza();
return false;
})
jQuery("#playerNoflash2 a").bind("click",function(){
var typebutton = jQuery(this).attr("class");
switch (typebutton){
case 'prev2':
noFlash2.anterior = noFlash2.actual;
noFlash2.actual = (noFlash2.actual+noFlash2.objs_size-1)%noFlash2.objs_size;
noFlash2.desplaza();
break;
case 'stop2':
clearInterval(noFlash2.obj_retardo);
jQuery(this).css("display","none");
jQuery("#playerNoflash2 a.play2").css("display","block");
break;
case 'play2':
jQuery(this).css("display","none");
jQuery("#playerNoflash2 a.stop2").css("display","block");
noFlash2.obj_retardo = window.setInterval("noFlash2.ciclo()",noFlash2.intervalo);
break;
case 'next2':
noFlash2.anterior = noFlash2.actual;
noFlash2.actual = (noFlash2.actual+1)%noFlash2.objs_size;
noFlash2.desplaza();
break;
}
return false;
})
}
jQuery(noFlash2.objs).find("a").bind("click",function(){
if(jQuery(this).hasClass("newwindow")){
var _url = jQuery(this).attr("href")
var tamanios = jQuery(this).attr("id").split("_");
var w_win = parseInt(tamanios[0].split('w')[1]);
var h_win = parseInt(tamanios[1].split('h')[1]);
return noFlash2.abrir(_url,'newwindow','width='+w_win+',height='+h_win+',scrollbars=yes',1,2,2);
}
})
},
ciclo:function(){
noFlash2.anterior = noFlash2.actual;
noFlash2.actual = (noFlash2.actual+1)%noFlash2.objs_size;
noFlash2.desplaza();
if(noFlash2.primer){
noFlash2.primer=false;
clearInterval(noFlash2.obj_retardo);
noFlash2.intervalo=10000;
noFlash2.obj_retardo = window.setInterval("noFlash2.ciclo()",noFlash2.intervalo);
}
},
desplaza:function(){
jQuery(noFlash2.objsPage).eq(noFlash2.anterior).removeClass("selected2");
jQuery(noFlash2.objsPage).eq(noFlash2.actual).addClass("selected2");
if(noFlash2.animacion){
jQuery(noFlash2.objs).eq(noFlash2.anterior).fadeOut(noFlash2.transition);
jQuery(noFlash2.objs).eq(noFlash2.actual).fadeIn(noFlash2.transition);
}
else {
jQuery(noFlash2.objs).eq(noFlash2.anterior).removeClass("selected2");
jQuery(noFlash2.objs).eq(noFlash2.actual).addClass("selected2");
}
},
abrir:function(){
var v1=arguments,v2=v1[2].split(","),v3=(v1.length>3)?v1[3]:false,v4=(v1.length>4)?parseInt(v1[4]):0,v5=(v1.length>5)?parseInt(v1[5]):0,v6,v7=0,v8,v9,v10,v11,v12,v13,v14,v15,v16;v11=new Array("width,left,"+v4,"height,top,"+v5);for (i=0;i<v11.length;i++){v12=v11[i].split(",");l_iTarget=parseInt(v12[2]);if (l_iTarget>1||v1[2].indexOf("%")>-1){v13=eval("screen."+v12[0]);for (v6=0;v6<v2.length;v6++){v10=v2[v6].split("=");if (v10[0]==v12[0]){v14=parseInt(v10[1]);if (v10[1].indexOf("%")>-1){v14=(v14/100)*v13;v2[v6]=v12[0]+"="+v14;}}if (v10[0]==v12[1]){v16=parseInt(v10[1]);v15=v6;}}if (l_iTarget==2){v7=(v13-v14)/2;v15=v2.length;}else if (l_iTarget==3){v7=v13-v14-v16;}v2[v15]=v12[1]+"="+v7;}}v8=v2.join(",");v9=window.open(v1[0],v1[1],v8);if (v3){v9.focus();}document.MM_returnValue=false;return false;
}
}

