// JavaScript Document

function flashMovie(name){
	if(navigator.appName.indexOf("Microsoft") != -1){
		return window[name];
	}else{
		return document[name];
	}
}
function callASfunction(rutaXML){					
		rutaXML='http://multimedia.lacaixa.es/lacaixa/ondemand/obrasocial/video/config/home/'+rutaXML+'.xml';
		flashMovie('flashcontent').changeXML(rutaXML);
		flashOn = false;	
}

var flashOn = false;

function resizeDivFlash(ancho, alto){
	if (flashOn ==false){
		flashOn = true;
		leftNuevo = (ancho - 570)/2;
		$('#carrito').addClass('invisible');
		$('#enlaces').addClass('invisible');
		$('#header').append("<div id='fondoHome' class='transparent'></div>");
		$('#fondoBlanco').append("<div id='fondoHome2' class='transparent'></div>");
		alto= alto-1+35;
		$("#titular").animate({"padding-top":"10px"}, 0, "" , "" );
		$("#videosHome").animate({"padding-bottom":"376px"}, 0, "" , "" );
		$("#playerHome").animate({
			"margin-left": "-" + leftNuevo + "px",
			width: ancho+"px",
			height: alto+"px" 
			}, 1000, "" , "" );
		$('#flashcontent').attr("wmode", 'transparent');		
	}else{
		if (flashOn == true){
				flashOn = false;
				var navegador = navigator.appName
				if (navegador == "Microsoft Internet Explorer"){
					anchoDiv= "570px";
				}else{
					anchoDiv= "568px";
				}
				$("#playerHome").animate({
					"margin-left": "0", 
					width: anchoDiv,
					height: "355px" 
				}, 1000, "" , "" );
				$("#titular").animate({"padding-top":"354px"}, 0, "" , "" );
				$("#videosHome").animate({"padding-bottom":"0"}, 0, "" , "" );
				$("#fondoHome").remove();
				$("#fondoHome2").remove();
				//$('#carrito').removeClass('invisible');
				//$('#enlaces').removeClass('invisible');
		}
	}
}
function activar(foto, total){
	
	for (i=1; i<=total; i++){
		if(i==foto){
			document.getElementById("video"+i).className ="activada";
			document.getElementById("titular"+i).style.display ="block";
		}else{
			document.getElementById("video"+i).className ="desactivada";
			document.getElementById("titular"+i).style.display ="none";
		}
	}
	
}
