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:249px;}";
document.write(newStyle+endStyle);

/* carrusel */

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: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){
		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="'+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=10000;
                    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;
	}
}

/* end carrusel */


var init = {
    funciones:function(){
        if (jQuery("#noflash").size()!=0) { noFlash.load(0);}
    }
}
$(document).ready(init.funciones);
