/* 
	SPHE JS Clientes 2007
	© 2009 IntelyGenZ - www.intelygenz.com 
    version 0.744 [30.11.2009]
    
    [VER] 	 sphe_js.txt
*/


oIGZ.f_require ("i_marray");

var oSWF = new SWFObject("pix/swf/menu_sup.swf","menusup","814","28","8","#FFFFFF");
var sAlternateFlashText = "<B>No tienes instalada la última versión del player de flash.</B><BR />Para ver el contenido de esta página, te recomendamos que actualices dicha versión en el siguiente sitio:<BR /><A href=https://www.macromedia.com/go/getflash/>Descargar</A>";

g_maMenuSup = new MArray(['Seccion','Nombre','Enlace']
	,[
	 ['home','INICIO',oIGZ.m_sRootPath+'home.html']
	,['bd','BLU-RAY',oIGZ.m_sRootPath+'listado_bd.html']
	,['dvd','DVD',oIGZ.m_sRootPath+'listado_dvd.html']
	,['umd','UMD',oIGZ.m_sRootPath+'listado_umd.html']
	,['busqueda','BUSQUEDA AVANZADA',oIGZ.m_sRootPath+'busqueda_av.asp']
//	,['noticias','NOTICIAS',oIGZ.m_sRootPath+'noticias.asp']
//	,['compania','La Compañía','#.#']
//	,['club','CLUB SPHE',oIGZ.m_sRootPath+'club/index.asp']
	,['contacta','CONTACTENOS',oIGZ.m_sRootPath+'contacta.html']
	]
)

g_maSecciones = new MArray(["idxSeccion","sUrlImagenFondo","sColorActivo","sColorOver"],[
								 [1,oIGZ.m_sRootPath+"pix/swf/menu_sup_caja.jpg","0xFFFFFF","0xFDE449"]
								,[2,oIGZ.m_sRootPath+"pix/swf/menu_sup_caja2.jpg","0xFF0000","0x00E449"]
								,[3,oIGZ.m_sRootPath+"pix/swf/menu_sup_club.jpg","0xFFFFFF","0xFDE449"]
							]);

g_maAudioFormato = new MArray(['Tipo','Valor']
	,[
	 ['Mono','a']
	,['Estereo','b']
	,['Surround','c']
	,['4.0','e']
	,['5.1','d']
	,['5.1 EX','f']
	,['5.1 DTS','g']
	,['5.1 DTS-HD','m']
	,['5.1 PCM','i']
	,['7.1 PCM','j']
	,['Dolby Surround','h']
	,['Dolby Digital','l']
	,['Dolby TrueHD 5.1','k']
	]
)

a_sExtrasDVD    = Array (
	 "Trailers","Trailers promocionales"
	,"Trailerdecine","Trailer de cine"
	,"Comentarios","Comentarios"
	,"Escenasnuncavistas","Escenas nunca vistas"
	,"Bandasonora","Banda sonora"
	,"AudioComentarios","Audio Comentarios"
	,"Comosehizo","Cómo se hizo"
	,"Filmografias","Filmografías"
	,"Fichatecnica","Ficha técnica"
	,"Documentales","Documentales"
	,"Salvapantallas","Salvapantallas"
	,"Animaciondemenus","Animación de menús"
	,"Localizaciones","Localizaciones"
	,"Notasdeproduccion","Notas de Producción"
	,"GaleriaFotografica","Galería Fotográfica"
	,"Entrevistas","Entrevistas"
	,"EnlacesWeb","Enlaces a Contenidos Web"
	,"DVDROM","Contenidos DVD-ROM"
	,"FinalAlternativo","Final Alternativo"
	,"SpotsTV","Spots de Televisión"
	,"VideoClips","Videoclips Musicales"
	,"Discos","Número de Discos"
	,"Observaciones","Observaciones"
	,"BluWizard","Blu-Wizard"
	,"BDLive","BD Live"
)



// ITEMS GENERICOS DEL WEB

if ( typeof(oIGZ)!="undefined" && oIGZ.f_checkLib("i_gfx", 0.185) ) {
	oIGZ.m_maItems = [["nType", 	"sTagName"		, "sSrcOrValue"			       , 	"sClassName", "nSizeX", "nSizeY", "sXtraAbs"]
		 ,[
		  	     1, 	"TABLAS_ORDEN"	, "pix/iconos/orden<OBJ>nOrden</OBJ>.gif"  ,           	  "",		 11,	   11, 	   	  ""
		  ,	     1, 	"LOADING_ICO"	, "pix/iconos/xbd_loading.gif"             ,			  "", 	     32, 	   32,		  ""
		  ,	     1, 	"XBD_LOADING"	, "pix/iconos/xbd_loading.gif"             ,			  "", 	     32, 	   32,		  ""
		  ,	     1, 	"XBD_OK"		, "pix/iconos/xbd_save.gif"           	   ,			  "", 	     24, 	   24,		  ""
		  ,	     1, 	"WIN_ICO"		, "pix/iconos/winshield/win_icono.gif"     ,			  "", 	     76, 	   25,		  ""
		  ,	     1, 	"WIN_CLOSE"		, "pix/iconos/winshield/win_cierre.gif"    ,		 	  "", 	     35, 	   25,		  ""
		  ,	     1, 	"FL_CAJAS"		, "pix/2007/flecha_cajas.gif"    			,		 	  "", 	     19, 	   18,		  " align='absmiddle'"

		  ]
	 ];

	oShield.m_sDefaultMSG = oIGZ.f_drawItem("LOADING_ICO");
	if ( oIGZ.f_checkLib("i_exml", 1.216)) {
		oWinShield = new IWIN("oWinShield");
		oWinShield.m_oIEXML.f_setOwnTAG("<ICO />"	   , oIGZ.f_drawItem("WIN_ICO"));
		oWinShield.m_oIEXML.f_setOwnTAG("<BOT_CLOSE />", oIGZ.f_drawItem("WIN_CLOSE"));

		oWinShield.f_defineTopEXML("<TABLE cellpadding=0 cellspacing=0 border=0'><TR>"
							   +"<TD class='WinMSGTit' width='100%' onmousedown='<MOVE_ON />' ><TITLE /></TD>"
							   +"<TD class='WinMSGTools' onclick='<EVENT_CLOSE />'><BOT_CLOSE /></TD>"
							   +"</TR></TABLE>"
						       );
		
		oWinShield.f_defineBodyEXML("<TABLE cellpadding=0 cellspacing=0 border=0 width: <SIZEX />px; height: <SIZEY />px;' >"
								 +"<TR><TD class='WinMSGBody'><CONTENT /></TD></TR>"
								 +"</TABLE>"
							     );

						       
		oWinShield.f_build ("<TABLE cellpadding=0 cellspacing=0 border=0 width=<SIZEX /> class='WinMSG'>"
					 +"<TR><TD><TOP /></TD></TR>"
					 +"<TR><TD class='WinMSGTop'><BODY /></TD></TR>"
					 +"<TR><TD>"
					 +"	<TABLE border='0' cellpadding='0' cellspacing='0' width='100%' style='margin-right: 5px;'>"
					 +"	<TR>"
					 +"		<TD style='background: #FFF; vertical-align: bottom;'><IMG src='"+oIGZ.m_sRootPath+"pix/iconos/winshield/win_inf_iz.gif' width='15' height='25' border='0' /></TD>"
					 +"		<TD style='background: #004D83; width: 100%;'></TD>"
					 +"		<TD style='background: #FFF; vertical-align: bottom; text-align: right;'><IMG src='"+oIGZ.m_sRootPath+"pix/iconos/winshield/win_inf_dc.gif' width='15' height='25' border='0' /></TD>"
					 +"	</TR>"
					 +"	</TABLE>"
					 +"</TD></TR>"
					 +"</TABLE>"
					 );

	}

}


function PintaMenuSup(sSecActiva) { document.write( DrawMenuSup(sSecActiva) )} 
function DrawMenuSup(sSecActiva) {
	var sHTML = ""
	
		sHTML +="<DIV id='menuIZ'></DIV> ";
		sHTML +="<UL id='menu'> ";

		for (var f=0; f<g_maMenuSup.f_length(); f++){
			var sImgAct = 0; 
			var sClass  = "";

			var sSeccion = g_maMenuSup.f_getVal("Seccion", f);
			var sNombre  = g_maMenuSup.f_getVal("Nombre", f);
			var sEnlace  = g_maMenuSup.f_getVal("Enlace", f);

			if (sSeccion==sSecActiva) sClass = " class='menuON'";
			
			sHTML +="<LI><A href='"+ oIGZ.m_sRootPath + sEnlace +"' ";
			if (sSeccion!=sSecActiva) sClass="";
			sHTML += " "+ sClass +" >"+ sNombre +"</A></LI> ";
		}
		
		sHTML +="</UL> ";
		//sHTML += "<DIV id='flashcontent'><IMG src='pix/magic.gif' width='1' height='1' border='0' /></DIV>"	

	return (sHTML)
}

/* Nuevo Menu Flash */
function PrintMenu(sSecActiva, idxSeccion) { document.write( DrawMenu(sSecActiva, idxSeccion) )} 
function DrawMenu(sSecActiva, idxSeccion) {
	var a_sHTML=[];	


	var a_sCols=g_maMenuSup.m_a_sCOLs;
	var sColY=a_sCols.join(",");
	a_nRegs=g_maMenuSup.f_subRegs();
	a_sRows=g_maMenuSup.f_subVals(a_sCols,a_nRegs);
	var sMaCols=sColY.toString();
	var sMaRows=a_sRows;
	
	if(!idxSeccion) idxSeccion = 1;
	a_datosSeccion = g_maSecciones.f_subRowsIf(["idxSeccion"],[idxSeccion],0,0,0);
//alert(a_datosSeccion);	


	if (oSWF.installedVer.versionIsValid(oSWF.getAttribute("version"))){

		var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '
					+' width="814" height="28" id="menusup" >'
      				+'<param name="movie" value="'+oIGZ.m_sRootPath+'pix/swf/menu_sup.swf?'+new Date()+'">'
      				+'<param name="quality" value="high">'
      				+'<param name="wmode" value="transparent">'
      				+"<param name='FlashVars' value='sMaCols="+sMaCols+"&sMaRows="+sMaRows+"&sSeccion="+sSecActiva+"&sDatosSeccion="+a_datosSeccion.join(",")+"'>"
      				+'<embed src="'+oIGZ.m_sRootPath+'pix/swf/menu_sup.swf?'+new Date()+'" '
      				+' quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" FlashVars="sMaCols='+sMaCols+'&sMaRows='+sMaRows+'&sSeccion='+sSecActiva+'&sDatosSeccion='+a_datosSeccion.join(",")+'"'
      				+' wmode="transparent" width="814" height="28" name="menusup" ></embed>'
    				+'</object>';
    	a_sHTML.push (oeTags);
    	
	} else {  // flash is too old or we can't detect the plugin
		a_sHTML.push (sAlternateFlashText);
	}
	
	return (a_sHTML.join(""));
}


function PrintBusqueda() { document.write(DrawBusqueda()) }
function DrawBusqueda() {
	var sHTML = ""

	sHTML += "<FORM name='FBusqueda' method='POST' action='"+oIGZ.m_sRootPath+"busqueda_av.asp'>";
	sHTML += "<DIV id='bscBusqueda'>";
	sHTML += "	<INPUT type='text' name='a_Titulo' onEnter='Busqueda();return: false;' />";
	sHTML += "	<INPUT type='hidden' name='bListado' value=1 />";
	sHTML += "		<A href='#' onClick='Busqueda()'>"+oIGZ.f_drawItem('FL_CAJAS')+"</A>";
	sHTML += "</DIV>";
	sHTML += "</FORM>";

	return (sHTML)
}

function Busqueda(){
	var oForm = document.forms["FBusqueda"];
	oForm.submit();
}

function PrintLogin() { document.write(DrawLogin()) }
function DrawLogin() {
	var sHTML = ""

		sHTML = "<FORM name='FLogin' action='"+oIGZ.m_sRootPath+"clientes/login/login2bd.asp' method='POST'>"
		sHTML +="<DIV id='bscLoginClientes'>";
		sHTML +="<SPAN>Si no estás registrado, <A href='"+oIGZ.m_sRootPath+"clientes/login/nuevo_usuario.asp'>pulsa aquí</A>.</SPAN>";
		sHTML +="<UL>";
		sHTML +=	"<LI class='sep1'><INPUT type='text' name='A_Login' /></LI>";
		sHTML +=	"<LI>";
		sHTML +=		"<INPUT type='password' name='A_Password' />";
		sHTML +=		"<A href='#' onClick='LoginClientes()'>"+oIGZ.f_drawItem('FL_CAJAS')+"</A>";
		sHTML +=	"</LI>";
		sHTML +="</UL>";
		sHTML +="</DIV>";
		sHTML +="</FORM>";

	
	return (sHTML)
}

function LoginClientes(){
	var oForm = document.forms["FLogin"];
	if (oForm["A_Login"].value && oForm["A_Password"].value ){
		oForm.submit();
	}
	else {
		alert ("Debe rellenar Usuario y Contraseña para acceder a la zona de prensa y clientes")	
	}
}


function PrintLogotipo(nCual){ document.write( DrawLogotipo(nCual) ) }
function DrawLogotipo(nCual){
	sHTML = ""
	var sClub = "";
	if (nCual==1) sClub = "_club";
	
		sHTML +="<DIV id='bsLogo'> ";
		sHTML +="	<A href='"+oIGZ.m_sRootPath+"home.html'><IMG src='"+oIGZ.m_sRootPath+"pix/2007/logo_sphe"+sClub+".jpg' title='Sony Pictures Home Entertainment España' /></A> ";
		sHTML +="</DIV>	 ";
	return(sHTML);
}




// Pinta la Carátula Grande de las Fichas  
// -- Referencia(sRef), Array del que lee (maDatos), 
// Si viene de alguna promoción (bPromo)
function PintaCaratula(sRef,maDatos,sFormato,nPromo,bCaratula) { document.write(DrawCaratula(sRef,maDatos,sFormato,nPromo,bCaratula)) }
function DrawCaratula(sRef,maDatos,sFormato,nPromo,bCaratula){
	var sHTML = "", sEXML = ""; sPathCaratPromo = "";

	if (nPromo!="" && bCaratula==1) sPathCaratPromo="promociones/"+nPromocion+"/";

	sHTML += "<IMG src='"+oIGZ.m_sRootPath+"pix/caratulas/"+sPathCaratPromo+sRef+".png' "

	sEXML += " alt=\"<BD>Titulo</BD>\" "

	sHTML += ParseEXMLs (sEXML,"",maDatos,0) + " />"; 

	return (sHTML);
}


// Pinta el Icono del disco del formato en las Fichas (al lado de Carátula)
function PintaIcoFormato(sFormato) { document.write(DrawIcoFormato(sFormato)) }
function DrawIcoFormato(sFormato){  
	var sHTML = "";
		sHTML += "<DIV id='disco"+sFormato+"'></DIV>";
	return (sHTML);
}

// Dibuja el enlace para listar películas Asignadas a un Campo.
function PrintEnlacePelisAsignadas(maDatos,sCampo,sValor) { document.write(DrawEnlacePelisAsignadas(maDatos,sCampo,sValor)) }
function DrawEnlacePelisAsignadas(maDatos,sCampo,sValor){
//	alert(sValor)
	var sHTML = "";
	var sPost = "";
	var sNombre;
	var sDatos	= maDatos.f_maGetVal (sCampo, 0)
	var a_sDato = sDatos.split (",")
	
	for (var f=0;f<a_sDato.length;f++) {
		sNombre = a_sDato[f].f_trim();
		sPost = ", ";
		if (f == a_sDato.length-1) sPost = "";
		sHTML += "<A class='enlace3' href='#' onclick=\'VerListadoAsignadas(\""+sCampo+"\",\""+sNombre+"\")\'>"+ sNombre +"</A>"+sPost;	
		
	}
	return (sHTML);
}

// Envía un Dato al listado de películas (Se usa en ficha.asp para Intérpretes y Director)
function VerListadoAsignadas(sDato,sValor){
	var sCampo = "a_"+sDato;
	sCampo = eval("document.forms.FDatos."+sCampo)
	sCampo.value = sValor
	FDatos.submit();
}


// Devuelve un Dato en Concreto de un Array
function PintaDato(maDatos,sCampo) { document.write(DrawDato(maDatos,sCampo)) }
function DrawDato(maDatos,sCampo){
	var sHTML = "", sEXML = "";
		sEXML += " <BD>"+sCampo+"</BD> "
		sHTML += ParseEXMLs (sEXML,"",maDatos,0);
	return (sHTML);
}


// Pinta el Título de una Pelicula con Campo Edición Especial y Campo Pack si existe.
function PintaTitulo(maDatosPeli,maDatosProducto,nCual) { document.write(DrawTitulo(maDatosPeli,maDatosProducto,nCual)) }
function DrawTitulo(maDatosPeli,maDatosProducto,nCual){
	var sHTML = "", sEXML = "", sEXML2 = "";
	if(nCual==null) nCual = 0;

	sEXML  += "<BD>Titulo</BD>  "
	sEXML2 += " <IF fun='\"<BD>Edicion</BD>\"!=\"\"'>[<BD>Edicion</BD>]</IF> <IF fun='\"<BD>Coleccion</BD>\"==\"Pack\"'>[<BD>Coleccion</BD>]</IF> "

	sHTML += ParseEXMLs (sEXML,"",maDatosPeli,nCual) + ParseEXMLs (sEXML2,"",maDatosProducto,nCual);

	return (sHTML);
}


//Pinta la linea final con el AvisoLegal y el Copyright
function PrintFooter() { document.write(DrawFooter()) }
function DrawFooter(){
	var sHTML = "";
	var sAnyo = new Date().f_drawFormat("nYYYY");

	sHTML +="<DIV class='footer'>";
	sHTML +=	"<DIV class='footerAviso'>";
	sHTML +=		"<A href='#' onClick='AbrirAvisoLegal()'>Aviso legal</A>";
	sHTML +=	"</DIV>";
	sHTML +=	"<DIV class='footerCopyright'>";
	sHTML +=		"&#169; "+sAnyo+" Sony Pictures Home Entertainment España. Todos los derechos reservados. ";
	sHTML +=	"</DIV>";
	sHTML +="</DIV>";

	return (sHTML);
}

//Cambia el Fondo en la home, dependiendo de la resolución
function ChangeHomeBg(sCual){
	var tamanoX = window.screen.width;
	var tamanoY = window.screen.height;
	var nFondo = 2;
	
	if(tamanoX<=1280) nFondo = 1; 
	if(tamanoX<=1100) nFondo = 0; 
	if(tamanoX>=1680) nFondo = 3; 

	document.write ("<style>body{ background: #000 url(pix/home/fondos/"+sCual+"_bg"+nFondo+".jpg) top center no-repeat;\nbackground-attachment: fixed;\n}</style>")
}

function AbrirAvisoLegal(){
	var sPagina = oIGZ.m_sRootPath+"aviso_legal.html";
	oIWin.f_new("AvisoLegal",sPagina,450,600,20,20,1,1,0,0,0,0,0,0,0)
}


function DescargarMaterial(oHref,nTipo,nIDPeli,nIDRef,nFotoGal,sOtros){
	var sPeli = "";
	var sRef = ""; 
	var sFotoGal = "";
	var sOtrosMateriales = "";
	
	if (nIDPeli!=undefined) sPeli = "&idPeli="+nIDPeli;
	if (nIDRef!=undefined) sRef = "&idRef="+nIDRef;
	if (nFotoGal!=undefined) sRef = "&sFotoGal="+nFotoGal;
	if (sOtros!=undefined) sRef = "&sOtrosMateriales="+sOtros;
	
	var sUrl = oIGZ.m_sRootPath+"clientes/download.asp?nFichero="+nTipo+sPeli+sRef+sFotoGal+sOtrosMateriales;
//	document.location.href=sUrl;

   oHref.href = sUrl;   
//   this.onclick = "";   
//   oHref.click();

}




function AbrirPromo(nIDpeli,nSizeX,nSizeY){
	var sPagina = oIGZ.m_sRootPath+"trailers_promo.asp?idPeli="+nIDpeli;
	oIWin.f_new("Trailers",sPagina,nSizeX,nSizeY,20,20,1,1,0,0,0,0,0,0,0)
}	





/* Funciones para Pintar un Flash (Necesita swfobject.js) */

function PintaFlashCapa(sIDFlash){
	var sHTML = "<DIV id='L"+sIDFlash+"'></DIV>";
	document.write(sHTML);
}

function PintaFlash(sPelicula, sIDFlash, sWidth, sHeight, nFlashVersion, sColor, a_vVariables){
	var sFlashPeli = new FlashObject(sPelicula, sIDFlash, sWidth, sHeight, nFlashVersion, sColor);   
	if (a_vVariables){
		for (var f=0; f<a_vVariables.length-1; f=f+2) {
			sFlashPeli.addVariable(a_vVariables[f],a_vVariables[f+1]);
		}
	}
	
	PintaFlashCapa(sIDFlash);
	sFlashPeli.write("L"+sIDFlash)
}

/* End Funciones Flash */

