
//**************  /app/mngtapas/js/destacados.js ********* //
			var dest_params;
			function destacados_regresar(region,pag,cant,iddest){
				//alert("regresar"+region+","+pag+","+cant);
				if(FWK){
					rnd=Math.random()*new Date().getTime();					
					FWK.loadAppInto("contTapas_"+region,"mngtapas|"+region+"|"+region+"|principal","&"+region+"[vista]=ajax&"+region+"[pag]="+pag+"&"+region+"[cantidad]="+cant+"&"+region+"[accion]=destacados"+"&"+region+"[id_destacado]="+iddest+"&random="+rnd);
				}
			}
			function destacados_avanzar(region,pag,cant,iddest){
				//alert("avanzar"+region+","+pag+","+cant);
				if(FWK){
					rnd=Math.random()*new Date().getTime();					
					FWK.loadAppInto("contTapas_"+region,"mngtapas|"+region+"|"+region+"|principal","&"+region+"[vista]=ajax&"+region+"[pag]="+pag+"&"+region+"[cantidad]="+cant+"&"+region+"[accion]=destacados"+"&"+region+"[id_destacado]="+iddest+"&random="+rnd);//+"&random="+rnd);			
				}			
			}		
			function hola(archivo,titulo){
				//alert("hola"+archivo+","+titulo);
			}
			function parseQuery ( query ) {
			   //alert("query"+query);
			   var Params = new Object ();
			   if ( ! query ) return Params; // return empty object
			   var Pairs = query.split(/[;&]/);
			   for ( var i = 0; i < Pairs.length; i++ ) {
				  var KeyVal = Pairs[i].split('=');
				  if ( ! KeyVal || KeyVal.length != 2 ) continue;
				  var key = unescape( KeyVal[0] );
				  var val = unescape( KeyVal[1] );
				  val = val.replace(/\+/g, ' ');
				  Params[key] = val;
				  //alert("key"+key+":"+val);
			   }
			   return Params;
			}	
			function destacado_preview(vform){
				//alert("Llamo al preview"+vform);
			}
			function destacado_clickUrlGrupo(id,formato){
				//alert("Play id:"+id+",formato:"+formato);
				if(formato=="HTML"){								
					if(ir_playHtml){
						ir_playHtml(id,true);
					}
				}else if(formato=="VIDEO"){
					if(ir_playVideoGrupo){
						ir_playVideoGrupo(id);
					}
				}
			}
			function destacado_clickUrlMasInfoGrupo(id,formato){
				//alert("MasInfo id:"+id+",formato:"+formato);
				if(formato=="VIDEO"){
					if(ir_playFichaVideo){
						ir_playFichaVideo(id);
					}
				}				
			}			
			function destacado_clickUrlContenido(id,formato){
				//alert("Play contenido id:"+id+",formato:"+formato);
				if(formato=="VIDEO"){
					if(ir_playVideoContenido){
						ir_playVideoContenido(id);
					}
				}				
			}			
			function destacado_clickUrlMasInfoContenido(id,formato){
				//alert("MasInfo contenido id:"+id+",formato:"+formato);				
			}
//**************  /js/plays_wmp_refreshbrowser.js ********* //
var mostrarPlayer_previouslyReloadIsNeed;
var mostrarPlayer_volvera;
var mostrarPlayer_encarga=false;
var _anchorSeparador = ".";//"::";
var _skinSeparador= ":";//".";
var _NodoSeparador = "+";

/* ir a la ficha de video por id contenido */
function ir_playFichaVideoByIdCont(id_contenido){
	if(FWK){		
		FWK.loadAppInto("content","fichas|principal|principal|principal","&principal[ficha]=video&principal[id_contenido]="+id_contenido);
		document.getElementById("top").focus();
	}
}


/* ir a la ficha de video */
function ir_playFichaVideo(id_grupo){
	if(FWK){		
		FWK.loadAppInto("content","fichas|principal|principal|principal","&principal[ficha]=video&principal[id_grupo]="+id_grupo);
		document.getElementById("top").focus();
		if (typeof cambiarAnchor != "undefined") {
			//Primero obtengo el titulo
			var sRelleno = FWK.loadApi("fichas|principal|principal|principal","get_titulo","&id_grupo="+id_grupo);
			cambiarAnchor("ficha",id_grupo,sRelleno);
		}		
	}
}


function ir_playHtml(id_grupo,nodo_sesion){
	if(FWK){		
		if(nodo_sesion){
			FWK.loadAppInto("content","conthtml|principal|principal|principal","&principal[nodo_sesion]=true&principal[id_grupo]="+id_grupo);
		}else{
			FWK.loadAppInto("content","conthtml|principal|principal|principal","&principal[id_grupo]="+id_grupo);
		}
		document.getElementById("top").focus();
		if (typeof cambiarAnchor != "undefined") {
			var sRelleno = FWK.loadApi("fichas|principal|principal|principal","get_titulo","&id_grupo="+id_grupo);
			cambiarAnchor("nota",id_grupo,sRelleno);
		}				
	}
}


function ir_playGaleria(id_galeria,site){
	if (typeof site=="undefined"){
			window.open("http://galerias.muchla.com/scripts/general/player_fotos/index_standalone.php?accion=&id_galeria="+ id_galeria,"_blank","menubar=no,toolbar=no,resizable=yes,scrollbars=no,status=no,height=420,width=600");
	}
	else if (site=="PLAYBOY"){
			window.open("http://galerias.playboytvla.com/scripts/general/player_fotos/index_standalone.php?accion=&id_galeria="+ id_galeria,"_blank","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,status=no,height=420,width=600");
	}
	else if (site=="ISAT"){
			window.open("http://galerias.isat.tv/scripts/general/player_fotos/index_standalone.php?accion=&id_galeria="+ id_galeria,"_blank","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,status=no,height=420,width=600");
	}
	else if (site=="FTV"){
			window.open("http://galerias.ftvla.com/scripts/general/player_fotos/index_standalone.php?accion=&id_galeria="+ id_galeria,"_blank","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,status=no,height=420,width=600");
	}
	else{
			window.open("http://galerias.playboytvla.com/scripts/general/player_fotos/index_standalone.php?accion=&id_galeria="+ id_galeria,"_blank","menubar=no,toolbar=no,resizable=yes,scrollbars=no,status=no,height=420,width=600");
	}
}


/*
* Modificado por Marcelo Martinovic
* 4-10-2006
* ir a nota por id_grupo, id_nodo
*/
function ir_playContHtmlNodo(id_grupo,id_nodo){
	if(FWK){		
		FWK.loadAppInto("content","conthtml|principal|principal|principal","&principal[id_grupo]="+id_grupo+"&principal[id_nodo]="+id_nodo);
		document.getElementById("top").focus();		
		if (typeof cambiarAnchor != "undefined") {
			cambiarAnchor("nota",id_grupo,"");
		}						
	}
}

function ir_playVideoGrupo(id_grupo){
	//try{	
		if(wmp_isonlinestore()){
			ir_playFichaVideo(id_grupo);
		}else{
			/*
			mostrarPlayer();
			cargarPlayListGrupo(id_grupo);
			*/
			mostrarPlayer(true,function (){
				cargarPlayListGrupo(id_grupo);
			});
			/*
			if (typeof cambiarAnchor != "undefined") {
				cambiarAnchor("playergrupo",id_grupo,"");
			}										
			*/
		}
	//}catch(e){
	//	window.status="err ir_playVideoGrupo";
	//}
}
function ir_playVideoContenido(id_contenido){
	//try{		
		if(wmp_isonlinestore()){			
			/*
			mostrarPlayer(); //agregado para que cargue el object
			oMaterial = obtenerMaterialDwl(id_contenido,350,1);			
			if(oMaterial){			
				wmp_mostrarPlayDownloadWMP(oMaterial["id_material"],oMaterial);
			}
			*/
			mostrarPlayer(true,function(){
				oMaterial = obtenerMaterialDwl(id_contenido,350,1);			
				if(oMaterial){			
					wmp_mostrarPlayDownloadWMP(oMaterial["id_material"],oMaterial);
				}			
			});
		}else{	
			/*
			mostrarPlayer();
			cargarPlayListContenido(id_contenido);
			*/
			mostrarPlayer(true,function algoalgo(){
				SCRIPT.scriptAlert("REGRESAR","id_contenido:"+id_contenido+",callme:"+algoalgo.caller,1);
				//window.status='reingresar '+window.cargarPlayListContenido;				
				window.cargarPlayListContenido(id_contenido);			
			});
			/*
			if (typeof cambiarAnchor != "undefined") {
				cambiarAnchor("player",id_contenido,"");
			}										
			*/
			
		}
	//}catch(e){
	//	window.status="err ir_playVideoContenido";
	//}
}
function setCabecera(padre,hijos,punteroactual,punterohijo){
	
	var vdiv=document.getElementById("ruta");
	var vdiv_posterior=document.getElementById("ruta_posterior");
	var vonclickactual="";
	var vidactual="";
	var vonclickhijo="";
	var vidhijo="";
	if(punteroactual){
		vonclickactual=punteroactual.reallink;
		vonclickactual=vonclickactual.replace("this","document.getElementById('"+punteroactual.id+"')");
		vidactual=punteroactual.id;
	}
	if(punterohijo){
		vonclickhijo=punterohijo.reallink;
		vonclickhijo=vonclickhijo.replace("this","document.getElementById('"+punterohijo.id+"')");
		vidhijo=punterohijo.id;
	}	
	
	if(vdiv.realid==vidactual){
		vdiv_posterior.innerHTML="";
		vdiv.inicializado=0;
	}
	if(vdiv.inicializado){		
		vdiv_posterior.realid=vidactual;
		vdiv_posterior.innerHTML=" | <a onclick=\""+vonclickactual+"\">"+padre+"</a>";
		if(hijos){
			vdiv_posterior.innerHTML+=" / <span onclick=\""+vonclickhijo+"\">"+hijos+"</span>";
		}		
	}else{
		vdiv.inicializado=1;
		vdiv.realid=vidactual;		
		vdiv.innerHTML=" <a onclick=\""+vonclickactual+"\">"+padre+"</a>";
		if(hijos){
			vdiv.innerHTML+=" / <span onclick=\""+vonclickhijo+"\">"+hijos+"</span> ";
		}
		vdiv.innerHTML+=" <div id='ruta_posterior'></div>";		
	}
	
}

function mostrarPlayer(visible,volvera){
	var regresar=true;
	if(typeof detenerFlash!="undefined"){
		detenerFlash();
	}
	if(typeof visible=="undefined"){
		visible=true;
	}	
	mostrarPlayer_volvera=volvera;
	if(document.getElementById("content_player")&&typeof SCRIPT!="undefined"){
		if(typeof document.getElementById("content_player").nocargado!="undefined"){			
			if(document.getElementById("content_player").nocargado==1){
				if(FWK.debug)
					alert("mostrarPlayer :: Ya estaba cargado");
				if(visible){
					window.playerNoPersonalizado=false;
					FWK.reloadIsNeed=function (newSitepage){window.playerNoPersonalizado=true;mostrarPlayer_previouslyReloadIsNeed(newSitepage);};
					recargarPlayerBannerMetricas("mostrar");				
					FWK.reloadIsNeed=mostrarPlayer_previouslyReloadIsNeed;
				}
			}else if(document.getElementById("content_player").nocargado==2){
				if(FWK.debug)
					alert("mostrarPlayer :: Se esta cargando todavia");			
				if(visible)
					mostrarPlayerCargando();
				regresar=false;
			}else{
				if(mostrarPlayer_volvera){
					if(FWK.debug)
						alert("mostrarPlayer :: Va a cargarse el player por ajax asyncronico");
					mostrarPlayer_previouslyReloadIsNeed=FWK.reloadIsNeed;
					FWK.reloadIsNeed=function(){};
					document.getElementById("content_player").nocargado=2;
					if(visible)
						mostrarPlayerCargando();					
					FWK.loadFrameCallback("mostrarPlayerEnd","player",""); //FWK.loadFrame("player","");
					regresar=false;					
				}else{	
					if(FWK.debug)
						alert("mostrarPlayer :: Va a cargarse el player por ajax sincronico");
					mostrarPlayer_previouslyReloadIsNeed=FWK.reloadIsNeed;
					FWK.reloadIsNeed=function(){};
					var codigo=FWK.loadFrame("player","");
					document.getElementById("content_player").nocargado=1;				
					document.getElementById("content_player").innerHTML=codigo;
					SCRIPT.debug=true;
					SCRIPT.scriptCheckTextOld(codigo);
					window.playerNoPersonalizado=false;
					FWK.reloadIsNeed=function (newSitepage){window.playerNoPersonalizado=true;mostrarPlayer_previouslyReloadIsNeed(newSitepage);};
					recargarPlayerBannerMetricas("mostrar");				
					FWK.reloadIsNeed=mostrarPlayer_previouslyReloadIsNeed;
				}
			}	
		}
	}	
	if(visible){
		if(!wmp_isonlinestore()){
		//if(regresar){
			/***********************************************************************************************************
				Actualizar Browser
				
				refreshBrowser: Función para "pintar" el nodo actual del browser, que debe ser igual al arbol de 
				navegación, si existiera.
				
				Autor: A. Hugo Vélez <avelez@claxson.com>
			***********************************************************************************************************/
			if(regresar){
				if(typeof refreshBrowser!="undefined"){
					if(document.getElementById("content_player").style.display!="block"){
						refreshBrowser();
					}
				}
			}			
			if(document.getElementById("content")){
				document.getElementById("content").style.display="none";
				document.getElementById("content").style.realdisplay="none";
			}	
			if(document.getElementById("content_player")){				
				if(document.getElementById("content_player").style.display!="block"){					
					document.getElementById("content_player").style.display="block";
					document.getElementById("content_player").style.realdisplay="block";
				}				
			}
			
		}
	}
	if(mostrarPlayer_volvera&&regresar){	
		SCRIPT.scriptAlert("mostrarPlayer","Regresar:"+regresar);
		mostrarPlayer_volvera();
	}	
}
function mostrarPlayerEnd(req){
	var codigo=req.responseText;
	document.getElementById("content_player_contenido").innerHTML=codigo;		
	SCRIPT.scriptCheckText(codigo,function (){mostrarPlayerEndScriptCheck(codigo);});	
}
function mostrarPlayerEndScriptCheck(codigo){
	document.getElementById("content_player").nocargado=1;					
	//document.getElementById("content_player_contenido").innerHTML=codigo;		
	window.playerNoPersonalizado=false;
	FWK.reloadIsNeed=function (newSitepage){window.playerNoPersonalizado=true;mostrarPlayer_previouslyReloadIsNeed(newSitepage);};	
	recargarPlayerBannerMetricas("mostrar");
	FWK.reloadIsNeed=mostrarPlayer_previouslyReloadIsNeed;
				
	if(!wmp_isonlinestore()){
		if(document.getElementById("content")){
			document.getElementById("content").style.display="none";
			document.getElementById("content").style.realdisplay="none";
		}	
		if(document.getElementById("content_player")){			
			if(document.getElementById("content_player").style.display!="block"){				
				document.getElementById("content_player").style.display="block";
				document.getElementById("content_player").style.realdisplay="block";
			}			
		}
		ocultarPlayerCargando();
		if(typeof refreshBrowser!="undefined"){
			refreshBrowser();
		}
	}	
	if(mostrarPlayer_volvera)
		mostrarPlayer_volvera();
}
function mostrarPlayerCargando(){
	var oHead=document.getElementsByTagName("HEAD")[0];
	var oDiv;
	if(document.getElementById("content_player_cargando")){
		oDiv=document.getElementById("content_player_cargando");
	}else{
		oDiv=document.createElement("DIV");		
		oDiv.id="content_player_cargando";
		oDiv.style.display="block"; //"block";
		document.getElementById("content_player").appendChild(oDiv);
		oDiv=document.createElement("DIV");		
		oDiv.id="content_player_contenido";
		oDiv.style.display="block"; //"none";
		document.getElementById("content_player").appendChild(oDiv);
	}
	if(wmp_isonlinestore()){
		if(FWK.onStateChange) FWK.onStateChange(FWK.debug,"begin",DIVVTC,"","","noocultarplayer");
		if(!window.corregirTemaWMPInicioConDescarga) //evita que al entrar en WMP despues del autologin cuando tenes descarga quede la pagina con "loading"
			mostrarLogin(true);
		//document.getElementById(DIVVTC).focus();
		window.scrollTo(0,0);
	}else{
		if(FWK.onStateChange) FWK.onStateChange(FWK.debug,"begin","content_player_cargando","","","noocultarplayer");
	}
}
function ocultarPlayerCargando(){
	document.getElementById("content_player_cargando").style.display="none";
	document.getElementById("content_player_contenido").style.display="block";
}
function recargarPlayerBannerMetricas(subsitepage){
	var agregarSkin="";
	if(window.currentSkin){
		agregarSkin="&FWK[skin]="+window.currentSkin;
	}
	if(document.getElementById("refrescaBannersPlayer")){
		////FWK.loadAppInto("refrescaBannersPlayer","html_estatico|principal|principal|principal","&principal[html]=refrescabannerplayer.html&FWK[SITE_PAGE]=player/"+subsitepage); //quieren que solo sea /player
		//FWK.loadAppInto("refrescaBannersPlayer","html_estatico|principal|principal|principal","&principal[html]=refrescabannerplayer.html&FWK[SITE_PAGE]=player","noocultarplayer");
		if( (giVideosRestantes!=undefined&&giVideosRestantes-1==0) && (gbReproduciendoPublicidad!=undefined&&gbReproduciendoPublicidad)){		
			//FWK.loadAppInto("refrescaBannersPlayer","html_estatico|principal|principal|principal","&principal[html]=refrescabannerplayer.html&FWK[SITE_PAGE]=playerconpublicidad","noocultarplayer");
			document.getElementById("refrescaBannersPlayer").innerHTML=FWK.ahah_open_get("/scripts/app/framework.php?FWKINLINE=1&APP=html_estatico|principal|principal|principal&principal[html]=refrescabannerplayer.html&FWK[SITE_PAGE]=playerconpublicidad"+agregarSkin);
		}else{
			//FWK.loadAppInto("refrescaBannersPlayer","html_estatico|principal|principal|principal","&principal[html]=refrescabannerplayer.html&FWK[SITE_PAGE]=player","noocultarplayer");
			document.getElementById("refrescaBannersPlayer").innerHTML=FWK.ahah_open_get("/scripts/app/framework.php?FWKINLINE=1&APP=html_estatico|principal|principal|principal&principal[html]=refrescabannerplayer.html&FWK[SITE_PAGE]=player"+agregarSkin);
		}		
	}
}
function ocultarPlayer(){
	if(wmp_isonlinestore()){
		//return;
	}
	if(document.getElementById("content_player")){		
		player_Stop();
		document.getElementById("content_player").style.display="none";
	}
	if(document.getElementById("content")){
		document.getElementById("content").style.display="block";
	}
	
	//Detengo la publicidad nueva del player
	if (document.getElementById("BannersPlayer_Preroll_AdPositionIFrame")) {
		document.getElementById("BannersPlayer_Preroll_AdPositionIFrame").src = "";
	}
	if (document.getElementById("BannersPlayer_Tanda_AdPositionIFrame")) {
		document.getElementById("BannersPlayer_Tanda_AdPositionIFrame").src = "";
	}	
}

function ir_otroIdioma(idioma){
	//document.location="/scripts/app/framework.php?FRAME=principal&APP=html_estatico&principal[html]=treestart.html&FWK[idioma]="+idioma;
	top.location="/scripts/index.php?telon_FWK[idioma]="+idioma+"&principal_FWK[idioma]="+idioma;
}

function mostrarPrimeroPlayList(){	
	var id_contenido;
	if(wmp_isonlinestore()){
		return;
	}	
	if(document.getElementById("xmlPlaylist")){
		/*
		if(document.getElementById("xmlPlaylist").XMLDocument.documentElement.childNodes[0]){
			if(document.getElementById("xmlPlaylist").XMLDocument.documentElement.childNodes[0].getElementsByTagName("id_contenido")){
				if(document.getElementById("xmlPlaylist").XMLDocument.documentElement.childNodes[0].getElementsByTagName("id_contenido")[0]){
					id_contenido=document.getElementById("xmlPlaylist").XMLDocument.documentElement.childNodes[0].getElementsByTagName("id_contenido")[0].text;
				}
			}						
		}
		*/
		id_contenido=document.getElementById("xmlPlaylist").XMLDocument.documentElement.selectSingleNode("/playlist/item[0]/id_contenido").text;
	}
	if(id_contenido){
		ir_playVideoContenido(id_contenido);
	}
}
function ir_DescargarMiCuenta(id_contenido,id_encodeo,id_reproduccion,boton){
	ocultarLogin();
	ir_playVideoContenido(id_contenido);
	/*
	if(wmp_isonlinestore()){
		wmp_accionControl(id_contenido,id_encodeo,id_reproduccion,boton);
	}else{
		ir_playVideoContenido(id_contenido);
	}		
	*/
}
/**
* Esta función es llamada desde mi cuenta para hacer play por medio del id de grupo
*/
function ir_DescargarMiCuentaXGrupo(id_grupo,id_encodeo,id_reproduccion,boton){
	ocultarLogin();
	ir_playVideoGrupo(id_grupo);	
}
//--------------------------------------------
// Promociones
//--------------------------------------------
/* ira a una promocion en un div determinado */

function ir_playPromocion(codigo,layer,extras){
	if(typeof layer=="undefined"){
		var layer="content"
	}else{
		if(!layer)layer="content";
	}
	if(typeof extras=="undefined"){
		var extras=""
	}	
	if(FWK){		
		FWK.loadAppInto(layer,"promociones|principal|principal|principal","&principal[codigo]="+codigo+"&rand="+Math.random()+extras);		
		document.getElementById("top").focus();
	}
}

/* responder la promocion */
function ir_playRespPromocion(form_name,codigo,layer,extras){
	if(typeof layer=="undefined"){
		var layer="content"
	}else{
		if(!layer)layer="content";
	}
	if(typeof extras=="undefined"){
		var extras=""
	}	
	if(validaPromocion()){
	FWK.postAppInto(layer,"promociones|principal|principal|principal",form_name,"&principal[codigo]="+codigo+extras+"&principal[action]=responder");
	}
}

//--------------------------------------------
// Modificacion URL Browsser
//--------------------------------------------

function cambiarAnchor(modulo,parametros,relleno) {
	var sReplace="";
	if (!relleno) {
		relleno = "";
	}
	if (!parametros) {
		parametros="";
	}
	//Limpio el relleno de caracteres extraños
	if(modulo=="tapa"){
		relleno="";
		if (typeof oArbolPath != "undefined") {
			var sArbolPath = "";
			//Voy desde 1 porque 0 es Home y no recorro todo ya que el ultimo es lo mismo que me vino en parametros
			for(var i = 1; i < oArbolPath.aPila.length -1; i++) {
				var oNodo = oArbolPath.aPila[i];
				var txtNode= oArbolPath.getTextNode(oNodo);
				txtNode = txtNode.replace(/á/g,"a");
				txtNode = txtNode.replace(/é/g,"e");
				txtNode = txtNode.replace(/í/g,"i");
				txtNode = txtNode.replace(/ó/g,"o");
				txtNode = txtNode.replace(/ú/g,"u");
				txtNode = txtNode.replace(/ü/g,"u");
				txtNode = txtNode.replace(/ñ/g,"n");
				txtNode = txtNode.replace(/Á/g,"A");
				txtNode = txtNode.replace(/É/g,"E");
				txtNode = txtNode.replace(/Í/g,"I");
				txtNode = txtNode.replace(/Ó/g,"O");
				txtNode = txtNode.replace(/Ú/g,"U");
				txtNode = txtNode.replace(/Ü/g,"U");
				txtNode = txtNode.replace(/Ñ/g,"N");		
				txtNode = txtNode.toLowerCase();
				sArbolPath += txtNode + _NodoSeparador;
			}
			parametros = sArbolPath+parametros;			
		}
	}
	if(modulo=="buscador"){
		parametros = parametros.replace(/ /g,"-");
		parametros = parametros.replace(/\./g,"-");
	}
		
	relleno = relleno.replace(/,/g,"");	
	relleno = relleno.replace(/#/g,"");		
	relleno = relleno.replace(/ /g,"-");
	relleno = relleno.replace(/á/g,"a");
	relleno = relleno.replace(/é/g,"e");
	relleno = relleno.replace(/í/g,"i");
	relleno = relleno.replace(/ó/g,"o");
	relleno = relleno.replace(/ú/g,"u");
	relleno = relleno.replace(/ü/g,"u");
	relleno = relleno.replace(/ñ/g,"n");
	relleno = relleno.replace(/Á/g,"A");
	relleno = relleno.replace(/É/g,"E");
	relleno = relleno.replace(/Í/g,"I");
	relleno = relleno.replace(/Ó/g,"O");
	relleno = relleno.replace(/Ú/g,"U");
	relleno = relleno.replace(/Ü/g,"U");
	relleno = relleno.replace(/Ñ/g,"N");
	if(modulo!="buscador"){
		relleno = relleno.replace(/\./g,"");
		relleno = relleno.replace(/[^a-zA-Z0-9\-]/g,"-");
	}
	relleno = relleno.replace(/\-\-+/g,"-");
	
	//Cambio el location
	switch(modulo){
			case "buscador":
				if(relleno){
					modulo="buscar-videos-en";
				}else{
					modulo="buscar-videos";				
				}
				break;
			case "playergrupo":
				break;
			case "player":
				modulo="ver-video";
				break;
			case "nota":		
				modulo="nota";
				break;
			case "ficha":
				modulo="video";
				break;
			case "tapa":
				modulo="videos-de";
				break;
	}
	if(window.adaptarAnchorPorInstalacion!=undefined){
		modulo=window.adaptarAnchorPorInstalacion(modulo,"cambiarAnchor");
	}
	sReplace="#"+modulo;
	//antes el skin lo poniamos pegado al modulo
	//if(top.currentSkin){
	//	sReplace+=_skinSeparador+top.currentSkin;
	//}
	if(relleno){
		sReplace+=_anchorSeparador+relleno;
	}
	if(parametros){
		sReplace+=_anchorSeparador+parametros;
	}
	if(top.currentSkin){
		sReplace+=_skinSeparador+top.currentSkin.replace("sk_","");
	}
	top.location.replace(sReplace);
}

function limpiarAnchor() {
	top.location.replace("#"+(new Date().getTime()));
}
function getPrefijoInicial(){
	try{
		var id_nodo="";
		var codigo="";
		var path="";
		var region="";
		try{
			if(document.getElementById("ruta")&&document.getElementById("ruta").getElementsByTagName("SPAN")&&document.getElementById("ruta").getElementsByTagName("SPAN")[0]&&document.getElementById("ruta").getElementsByTagName("SPAN")[0].onclick){
			  if(document.getElementById("ruta").getElementsByTagName("SPAN")[0].onclick.toString().match(/item([0-9]+)/)){
			   id_nodo=document.getElementById("ruta").getElementsByTagName("SPAN")[0].onclick.toString().match(/item([0-9]+)/)[1];
			  }
			}
		}catch(e){
		}

		if(id_nodo&&document.getElementById("item"+id_nodo)){
			codigo=document.getElementById("item"+id_nodo).getElementsByTagName("A")[0].href.toString().replace(/^(.*)\/([^\/]+)$/,"$2");
			path=document.getElementById("item"+id_nodo).getElementsByTagName("A")[0].href.toString().replace(/^http:\/\/[^\/]+\/(.*)\/([^\/]+)$/,"$1");
			region=document.getElementById("item"+id_nodo).getElementsByTagName("A")[0].href.toString().replace(/^http:\/\/[^\/]+\/([^\/]+)\/.*$/,"$1");
			regionyprefijo=document.getElementById("item"+id_nodo).getElementsByTagName("A")[0].href.toString().replace(/^http:\/\/[^\/]+\/([^\/]+)\/([^\/]+)\/.*$/,"$1/$2");
		}

		var result={"id": id_nodo, "codigo_externo": codigo, "prefijo": regionyprefijo, "region": region};
		return "/"+result.prefijo;
	}catch(e){
		return "/";
	}
}
function ejecutarAnchor(prefijo,ret) {
	var info;
	var url="";
	var infoModulo=new Array();
	var sSearch="";
	var sSkin="";
	if(ret==undefined) ret=false;
	if(!prefijo){
		prefijo=top.getPrefijoInicial();		
	}
	if (top.location.hash) {
		//info = top.location.hash.split(_anchorSeparador,3);
		info = top.location.hash.split(_anchorSeparador);
	}
	if (info) {
		//antes se buscaba en la primer parte
		//if(info[0]){			
		//	if(info[0].search(_skinSeparador)!=-1){
		//		infoModulo=info[0].split(_skinSeparador,2);
		//		info[0]=infoModulo[0];
		//		if(infoModulo[1]){
		//			sSkin="&FWK[skin]="+infoModulo[1];
		//		}
		//	}
		//}
		if(info[info.length-1]){			
			if(info[info.length-1].search(_skinSeparador)!=-1){
				infoModulo=info[info.length-1].split(_skinSeparador,2);
				info[info.length-1]=infoModulo[0];
				if(infoModulo[1]){
					sSkin="&FWK[skin]=sk_"+infoModulo[1];
				}
			}
		}		
		if(window.adaptarAnchorPorInstalacion!=undefined){
			info[0]=window.adaptarAnchorPorInstalacion(info[0],"ejecutarAnchor");
		}		
		switch(info[0]) {
			case "#buscar-videos-en":	
				sSearch="search";
				
				if(info[3]){
					info[3]=info[3].replace("-"," ");
					info[3]=escape(info[3]);
				}else{
					info[3]="all";
					sSearch="searchall";
				}	
				
				//if(info[1]){
				url=prefijo+"/"+info[1]+"/"+info[3]+".php?"+sSearch+"&id_nodo="+info[2];
				//}else{
				//	url=prefijo+"/"+info[3]+".php?"+sSearch+"&id_nodo="+info[2];
				//}
			break;		
			case "#buscador":				
			case "#buscar-videos":
				sSearch="search";
				
				if(info[1]){
					info[1]=info[1].replace("-"," ");
					info[1]=escape(info[1]);
				}else{
					info[1]="all";
					sSearch="searchall";
				}			
				
				url=prefijo+"/"+info[1]+".php?"+sSearch;				
				
				/*
				sSearch="search";
				switch(info.length){
					case 4:
					case 2:
					case 1:
					break;
					case 3:												
						info[3]=info[2];
						info[2]=info[1];
						info[1]="";
					break;
				}
				
				
				if(info[1]){
					info[1]=info[1].replace("-"," ");
					info[1]=escape(info[1]);
				}else{
					info[1]="all";
					sSearch="searchall";
				}
				if (info[2]) {
					if(info[3]){
						url=prefijo+"/"+info[3]+"/"+info[1]+".php?"+sSearch+"&id_nodo="+info[2];
					}else{
						url=prefijo+"/"+info[1]+".php?"+sSearch+"&id_nodo="+info[2];
					}
				} else {
					url=prefijo+"/"+info[1]+".php?"+sSearch;
				}			
				*/					
				break;
			case "#playergrupo":				
				url=prefijo+"/"+info[1]+".php?playgroup";
				break;
			case "#player":
			case "#ver-video":
				//url=prefijo+"/"+info[2]+"/"+info[1]+".php?playcontent";
				url=prefijo+"/"+info[1]+"/"+info[2]+".php?playcontent";
				break;
			case "#nota":
				if(info[2]){
					//url=prefijo+"/"+info[2]+"/"+info[1]+".php?viewnote";
					url=prefijo+"/"+info[1]+"/"+info[2]+".php?viewnote";
				}else{
					url=prefijo+"/"+info[1]+".php?viewnote";
				}
				break;				
			case "#ficha":
			case "#video":
				//url=prefijo+"/"+info[2]+"/"+info[1]+".php?viewcard";
				url=prefijo+"/"+info[1]+"/"+info[2]+".php?viewcard";
				break;
			case "#tapa":
			case "#videos-de":
				if(prefijo){
					prefijo=prefijo.replace(/^(\/?[^\/]+\/[^\/]+).*$/,"$1");
				}								
				var listNodes=info[1].split(_NodoSeparador);
				var lastNode=listNodes[listNodes.length-1];
				var fixedText="";
				var fixedParam="";
				if(ret){					
					if(top.ejecutarAnchor_FixedUrlTextByNode!=undefined){						
						fixedText=top.ejecutarAnchor_FixedUrlTextByNode(lastNode,ret);						
						if(fixedText&&top.ejecutarAnchor_FixedUrlTextLabelsByNode!=undefined){
							fixedParam=top.ejecutarAnchor_FixedUrlTextLabelsByNode("fixedParam",ret);
							if(fixedParam){
								fixedParam+=fixedText.replace(/\&/g,"");
							}
						}
					}									
					info[1] = info[1].replace(new RegExp("\\"+_NodoSeparador,"g"),"/");				
					//url=prefijo+"/"+fixedText+"/"+info[1]+"?"+fixedParam;
					return fixedText;
				}else{
					info[1] = info[1].replace(new RegExp("\\"+_NodoSeparador,"g"),"/");				
					url=prefijo+"/"+fixedText+"/"+info[1]+"?";
				}
				break;
			case "#ver-mensaje":
				switch(info[1]){
					case "instalacionActiveX":
						if(!ret){						
							mostrarMensajeDescargaCuandoAceptoYRefresco();
						}
					break;
				}
				break;
		}
		if(url){
			if(ret){				
				return url.replace(/\/\/+/g,"/")+sSkin;
			}else{								
				top.location.replace(url.replace(/\/\/+/g,"/")+sSkin);
			}
		}
	}
}
function mostrarMensajeDescargaCuandoAceptoYRefresco(){
	if(typeof mostrarMDCAYRCantidad=="undefined")
		mostrarMDCAYRCantidad=1;
	else
		mostrarMDCAYRCantidad++;	
	if(typeof FWK!="undefined"&&typeof DIVVTC!="undefined"&&document.getElementById(DIVVTC)){
		mostrarMensajeDescarga("downloader_preguntainstalacionacepto.html",true);
	}else{
		if(mostrarMDCAYRCantidad<20){
			setTimeout("mostrarMensajeDescargaCuandoAceptoYRefresco();",1000);
		}
	}
}

function ir_Promo(id){
	if(FWK){                       
	    FWK.loadAppInto("content","promo|principal|principal|principal","&principal[id]="+id);
	    document.getElementById("top").focus();
	}
}

function ir_playFileUpload(id){
	if(FWK){		
		FWK.loadAppInto("content","fileupload|principal|principal|principal","&principal[id]="+id);
		document.getElementById("top").focus();
	}
}


function  f_irRecomendarAmigo(){
	if(FWK){
		FWK.loadAppInto('content','socialnetworks|principal|principal|principal','&FWK[SITE_PAGE]=socialnetworks&principal[action]=gadgetamigo');
	}
}

function f_irRedSocial(red){
	if(FWK){		
		FWK.loadAppInto("content","socialnetworks|principal|principal|principal","&FWK[SITE_PAGE]=socialnetworks&principal[action]=gadget&principal[red]="+red+"&rand="+Math.random());
		document.getElementById("top").focus();
	}
}

//**************  /js/player.interfaz.js ********* //
/*
** interfaz_publica_generica.js
** Este archivo contiene la implementacion de la interfaz publica entre el player y la plataforma
** Autor: Rodrigo Nicolás Uroz <ruroz@claxson.com>
** Fecha: 17/11/2005
** NOTA: ESTE ARCHIVO NO FUNCIONA POR SI SOLO, SINO QUE ES LEIDO POR EL ARCHIVO INTERFAZ.PHP PARA GENERAR
** LAS FUNCIONES. LEER DOCUMENTACION TECNICA
*/

/*
** VARIABLES GLOBALES
** ------------------
*/

/*
** Referencia al document donde está el player
*/
//02102006-rceles-esto se ve que es viejo
//var goPlayer = top.document.getElementById("player");

/*
** FUNCIONES PRINCIPALES
** ---------------------
*/

/*
** setPosicion
** Esta funcion setea la posicion para referenciar el player por javascript
** Recibe:
**					sPosicion		string		Posicion del player
** Devuelve:
**					Nada
*/
function setPosicion(sPosicion)
{
	//goPlayer = sPosicion;
}
/*
** player_ReproducirAlbum
** Esta funcion se encarga de reproducir un album entero
** Recibe:
**					iIdAlbum		integer		Identificador del album
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_ReproducirAlbum(iIdAlbum,bAgregar)
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.reproducirMaterial(iIdAlbum,true,bAgregar,false);
		return reproducirMaterial(iIdAlbum,true,bAgregar,false);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_PreviewAlbum
** Esta funcion se encarga de hacer preview de un album entero
** Recibe:
**					iIdAlbum		integer		Identificador del album
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_PreviewAlbum(iIdAlbum,bAgregar)
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.reproducirMaterial(iIdAlbum,true,bAgregar,true);
		return reproducirMaterial(iIdAlbum,true,bAgregar,true);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_ReproducirAlbumLocal
** Esta funcion se encarga de reproducir un album entero local
** Recibe:
**					iIdAlbum		integer		Identificador del album
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_ReproducirAlbumLocal(iIdAlbum)
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.reproducirLocal(iIdAlbum,true);
		return reproducirLocal(iIdAlbum,true);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_ReproducirTema
** Esta funcion se encarga de reproducir un material
** Recibe:
**					iIdMaterial		integer		Identificador del material
**					bAgregar			boolean		Indica si se debe agregar al playlist o no
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_ReproducirTema(iIdMaterial,bAgregar)
{
	try
	{		
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.reproducirMaterial(iIdMaterial,false,bAgregar,false);
		return reproducirMaterial(iIdMaterial,false,bAgregar,false);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_PreviewTema
** Esta funcion se encarga de hacer preview de un material
** Recibe:
**					iIdMaterial		integer		Identificador del material
**					bAgregar			boolean		Indica si se debe agregar al playlist o no
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_PreviewTema(iIdMaterial,bAgregar)
{
	try
	{		
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.reproducirMaterial(iIdMaterial,false,bAgregar,true);
		return reproducirMaterial(iIdMaterial,false,bAgregar,true);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_ReproducirTemaLocal
** Esta funcion se encarga de reproducir un material local
** Recibe:
**					iIdMaterial		integer		Identificador del material
**					bGrupo				boolean		Indica si se va a reproducir una tanda
**					bPrimero			boolean		Indica si es el primer tema de la tanda
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_ReproducirTemaLocalDump(iIdMaterial,bGrupo,bPrimero)
{
	try
	{		
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.reproducirLocal(iIdMaterial,false,bGrupo,bPrimero);
		return reproducirLocal(iIdMaterial,false,bGrupo,bPrimero);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_ReproducirTemaLocal
** Esta funcion se encarga de reproducir un material local
** Recibe:
**					iIdMaterial		integer		Identificador del material
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_ReproducirTemaLocal(iIdMaterial)
{
	try
	{		
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.reproducirLocal(iIdMaterial,false,false,false);
		return reproducirLocal(iIdMaterial,false,false,false);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Anterior
** Esta funcion se encarga de llamar al metodo de material anterior del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo cambiar, 0 otherwise
*/
function player_Anterior()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.materialAnterior();
		return materialAnterior();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Siguiente
** Esta funcion se encarga de llamar al metodo de material siguiente del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo cambiar, 0 otherwise
*/
function player_Siguiente()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.materialSiguiente();
		return materialSiguiente();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Stop
** Esta funcion se encarga de llamar al metodo de detener del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo detener, 0 otherwise
*/
function player_Stop()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.detener();
		return detener();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Pause
** Esta funcion se encarga de llamar al metodo de pausar del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo pausar, 0 otherwise
*/
function player_Pause()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.pausar();
		return pausar();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Play
** Esta funcion se encarga de llamar al metodo de reproducir del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo reproducir, 0 otherwise
*/
function player_Play()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.play();
		return play();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Retroceso
** Esta funcion se encarga de llamar al metodo de rebobinar del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo rebobinar, 0 otherwise
*/
function player_Retroceso()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.rebobinar();
		return rebobinar();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_FForward
** Esta funcion se encarga de llamar al metodo de avance rapido del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo avanzar, 0 otherwise
*/
function player_FForward()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.avanzar();
		return avanzar();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_CambiarPosicion
** Esta funcion se encarga de llamar al metodo de cambiar posicion del player
** Recibe:
**					iSegundos		integer		Posicion en segundos en donde se quiere ubicar
** Devuelve:
**					1 si pudo cambiar, 0 otherwise
*/
function player_CambiarPosicion(iSegundos)
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.cambiarPosicion(iSegundos);
		return cambiarPosicion(iSegundos);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Ocultar
** Esta funcion se encarga de llamar al metodo de ocultar del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo ocultar, 0 otherwise
*/
function player_Ocultar()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.ocultarPlayer();
		return ocultarPlayer();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_Mostrar
** Esta funcion se encarga de llamar al metodo de mostrar del player
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo mostrar, 0 otherwise
*/
function player_Mostrar()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.mostrarPlayer();
		return mostrarPlayer();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_AbrirPlaylistManager
** Esta funcion se encarga de llamar al metodo de abrir el playlist manager
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo abrir, 0 otherwise
*/
function player_AbrirPlaylistManager()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.abrirPlaylistManager();
		return abrirPlaylistManager();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_ShufflePlaylist
** Esta funcion se encarga de llamar al metodo de shuffle de la playlist
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo cambiar, 0 otherwise
*/
function player_ShufflePlaylist()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.shuffle();
		return shuffle();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_RepeatPlaylist
** Esta funcion se encarga de llamar al metodo de repeat de la playlist
** Recibe:
**					Nada
** Devuelve:
**					1 si pudo cambiar, 0 otherwise
*/
function player_RepeatPlaylist()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.repeat();
		return repeat();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_ObtenerPlaylist
** Esta funcion se encarga de llamar al metodo de obtener playlist de la playlist
** Recibe:
**					Nada
** Devuelve:
**					string		XML con los datos de la playlist pedida
*/
function player_ObtenerPlaylist()
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.obtenerPlaylist();
		return obtenerPlaylist();
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_CargarPlaylist
** Esta funcion se encarga de llamar al metodo de cargar playlist de la playlist
** Recibe:
**					iIdPlaylist		integer		Identificador de la playlist
** Devuelve:
**					1 si pudo cargar, 0 otherwise
*/
function player_CargarPlaylist(iIdPlaylist)
{
	try
	{
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.cargarPlaylist(iIdPlaylist);
		return cargarPlaylist(iIdPlaylist);
	}
	catch(e)
	{
		return 0;
	}
}
/*
** player_EstaAbierto
** Esta funcion indica si el player esta abierto o no
** Recibe:
**					Nada
** Devuelve:
**					true si esta abierto, false otherwise
*/
function player_EstaAbierto()
{
	try
	{		
		//02102006-rceles-esto se ve que es viejo
//		return goPlayer.gbVisible;
		return gbVisible;
	}
	catch(e)
	{
		return false;
	}
}
/*
** player_CambiarEstado
** Esta funcion cambia el estado del player entre Show o Hidden
** Recibe:
**					Nada
** Devuelve:
**					
*/
function player_CambiarEstado() {
	if (player_EstaAbierto()) {
		player_Ocultar();
	} else {
		player_Mostrar();
	}
}
//**************  /app/login_ajax/js/login_ajax.js ********* //
var USUARIO_NO_EXISTE = "NE";
var USUARIO_NO_HABILITADO = "NH";
var USUARIO_PENAC = "PENAC";

//FWK.loadAppInto("loginMod","login:default","");

/**
*
*/
function login_ajaxGetElement(oXML,sName){
return ((oXML.getElementsByTagName(sName).length!=0 && oXML.getElementsByTagName(sName)[0].childNodes.length!=0)?oXML.getElementsByTagName(sName)[0].childNodes[0].nodeValue:'');
  
}
/**
 * Verifica si el usuario ingresado es valido
 * @param	string	sTemplate	Template que se debe utilizar
 */
function validate(req) {


	var oReturn;
	//--[byGoose!]------------------------------------
	// Esto es para permitir un form con otro nombre
	// si no se pasa nada en req (el parametro ya existia pero
	// no veo que se este usando), entonces dejo el mismo, sino
	// le doy bola a req como nombre de form
	//------------------------------------------------
	if(typeof(req)=="undefined")	formName="frmLoginOver";
	else							formName=req;
	//alert("Usando >>> ["+formName+"]"); // for debugging purposes
	var sXml = FWK.postApi("login_ajax:default","validate",formName,"");

	if(window.ActiveXObject){
		oReturn = new ActiveXObject("Microsoft.XMLDOM");
		oReturn.async = false;	
		oReturn.loadXML(sXml);		
	}else if(document.implementation.createDocument){
		var vParser = new DOMParser();
		oReturn = vParser.parseFromString(sXml, "text/xml");
	}
	/*
alert(oReturn.getElementsByTagName('value')[0].firstChild.nodeValue);

	*/
var xmlValue =login_ajaxGetElement(oReturn,'value');
var xmlFrame =login_ajaxGetElement(oReturn,'frame');
var xmlAPP   =login_ajaxGetElement(oReturn,'app');
var xmlFase   =login_ajaxGetElement(oReturn,'fase');
var xmlAction   =login_ajaxGetElement(oReturn,'action');
var xmlIdUsuario   =login_ajaxGetElement(oReturn,'id_usuario');
var xmlGotoFrame   =login_ajaxGetElement(oReturn,'goto_frame');
var xmlGotoAPP   =login_ajaxGetElement(oReturn,'goto_app');
var xmlGotoParams   =login_ajaxGetElement(oReturn,'goto_params');
var xmlMessage   =login_ajaxGetElement(oReturn,'message');





/*	
	if (window.ActiveXObject){
		vXMLDoc = new ActiveXObject("Microsoft.XMLDOM");
		vXMLDoc.async = false;
		//IE uses the loadXML method when the source document is NOT XML
		vXMLDoc.loadXML(vHttpRequest.responseText);
}else if(document.implementation.createDocument){
	//Firefox requires a parser object to read the text
	var vParser = new DOMParser();
	vXMLDoc = vParser.parseFromString(vHttpRequest.responseText, "text/xml");
	}
*/
	switch (xmlValue) {
		case USUARIO_NO_HABILITADO:
			if(window.loginAjaxHandlerReply){
				if(window.loginAjaxHandlerReply("USUARIO_NO_HABILITADO",{"xmlValue": xmlValue,"xmlFrame": xmlFrame,"xmlAPP": xmlAPP,"xmlFase": xmlFase,"xmlAction": xmlAction,"xmlIdUsuario": xmlIdUsuario,"xmlGotoFrame": xmlGotoFrame,"xmlGotoAPP": xmlGotoAPP,"xmlGotoParams": xmlGotoParams,"xmlMessage": xmlMessage})){
					var sUrl = "/scripts/app/framework.php?FRAME="+xmlFrame+"&APP="+xmlAPP+"&principal[fase]="+xmlFase+"&principal[action]="+xmlAction+"&principal[id_usuario]="+xmlIdUsuario+"&principal[goto_frame]="+xmlGotoFrame+"&principal[goto_app]="+xmlGotoAPP+"&principal[param_app]="+xmlGotoParams;
					document.location.href = sUrl;				
				}
			}else{
				var sUrl = "/scripts/app/framework.php?FRAME="+xmlFrame+"&APP="+xmlAPP+"&principal[fase]="+xmlFase+"&principal[action]="+xmlAction+"&principal[id_usuario]="+xmlIdUsuario+"&principal[goto_frame]="+xmlGotoFrame+"&principal[goto_app]="+xmlGotoAPP+"&principal[param_app]="+xmlGotoParams;
				document.location.href = sUrl;
			}
			break;
		case USUARIO_PENAC:
		case USUARIO_NO_EXISTE:
			if(window.loginAjaxHandlerReply){
				if(window.loginAjaxHandlerReply("USUARIO_NO_EXISTE")){
					var msgErr = document.getElementById("msgErr");
					msgErr.innerText = xmlMessage;				
				}
			}else{			
				var msgErr = document.getElementById("msgErr");
				msgErr.innerText = xmlMessage;
			}
			break;
		default:
			//Andubo bien
			if(window.loginAjaxHandlerReply){			
				if(window.loginAjaxHandlerReply("OK")){
					FWK.loadAppInto("loginMod","login:default","");
					cargarMaterialPlayer(null);			
				}
			}else{
				
				//Andubo bien
				FWK.loadAppInto("loginMod","login:default","");
				cargarMaterialPlayer(null);			
			}
	}
	return false;
}

/**
 * Funcion para validar login en la url de adquisicion
 */
function validateUrlAd(req) {


	var oReturn;
	var sXml = FWK.postApi("login_ajax|principal|principal|principal","validate","frmLoginUrlAd","");

	if(FWK.debug) {
		alert(sXml);		
	}
	
	if(window.ActiveXObject){
		oReturn = new ActiveXObject("Microsoft.XMLDOM");
		oReturn.async = false;	
		oReturn.loadXML(sXml);		
	}else if(document.implementation.createDocument){
		var vParser = new DOMParser();
		oReturn = vParser.parseFromString(sXml, "text/xml");
	}

	var xmlValue =login_ajaxGetElement(oReturn,'value');
	var xmlFrame =login_ajaxGetElement(oReturn,'frame');
	var xmlAPP   =login_ajaxGetElement(oReturn,'app');
	var xmlFase   =login_ajaxGetElement(oReturn,'fase');
	var xmlAction   =login_ajaxGetElement(oReturn,'action');
	var xmlIdUsuario   =login_ajaxGetElement(oReturn,'id_usuario');
	var xmlGotoFrame   =login_ajaxGetElement(oReturn,'goto_frame');
	var xmlGotoAPP   =login_ajaxGetElement(oReturn,'goto_app');
	var xmlGotoParams   =login_ajaxGetElement(oReturn,'goto_params');
	var xmlMessage   =login_ajaxGetElement(oReturn,'message');
	switch (xmlValue) {
		case USUARIO_NO_HABILITADO:
			if(window.loginAjaxHandlerReply){
				if(window.loginAjaxHandlerReply("USUARIO_NO_HABILITADO")){
					var sUrl = "/scripts/app/framework.php?FRAME="+xmlFrame+"&APP="+xmlAPP+"&principal[fase]="+xmlFase+"&principal[action]="+xmlAction+"&principal[id_usuario]="+xmlIdUsuario+"&principal[goto_frame]="+xmlGotoFrame+"&principal[goto_app]="+xmlGotoAPP+"&principal[param_app]="+xmlGotoParams;
					document.location.href = sUrl;				
				}
			}else{
				var sUrl = "/scripts/app/framework.php?FRAME="+xmlFrame+"&APP="+xmlAPP+"&principal[fase]="+xmlFase+"&principal[action]="+xmlAction+"&principal[id_usuario]="+xmlIdUsuario+"&principal[goto_frame]="+xmlGotoFrame+"&principal[goto_app]="+xmlGotoAPP+"&principal[param_app]="+xmlGotoParams;
				document.location.href = sUrl;
			}
			break;
		case USUARIO_PENAC:
		case USUARIO_NO_EXISTE:
			if(window.loginAjaxHandlerReply){
				if(window.loginAjaxHandlerReply("USUARIO_NO_EXISTE")){
					var msgErr = document.getElementById("msgErr");
					msgErr.innerText = xmlMessage;				
				}
			}else{			
				var msgErr = document.getElementById("msgErr");
				msgErr.innerText = xmlMessage;
			}
			break;
		default:
			//Redirecciono a URL ADQUISICION
			if(FWK.debug) {
				alert("Goto APP: " + xmlGotoAPP + "\n Goto Params: " + xmlGotoParams);
			}
			document.location.href = "/scripts/app/framework.php?APP="+xmlGotoAPP+"&"+xmlGotoParams;
			/*
			//Andubo bien
			if(window.loginAjaxHandlerReply){			
				if(window.loginAjaxHandlerReply("OK")){
					FWK.loadAppInto("loginMod","login:default","");
					cargarMaterialPlayer(null);			
				}
			}else{
				
				//Andubo bien
				FWK.loadAppInto("loginMod","login:default","");
				cargarMaterialPlayer(null);			
			}
			*/
	}
	return false;
}

//alert("Porque me plazzzzzzzzze!");
/**
 *FUNCTION loginAjaxHandlerReply
 *PROTOTYPE boolean loginAjaxHandlerReply (string Reply)
 *	    Si la salida es true: ejecuta el flujo normal, sino no ejecuta nada
 */

dummy=1;

//**************  /app/metricas/js/metricas.js ********* //
var METRICAS =
{
	debug			: false,
	frame_object		: null,
	frame_source		: null,
	setFrame:	function(oFrame,sSource)
	{
		this.frame_object=oFrame;
		this.frame_source=sSource;
	},
	reload	:	function()
	{		
		var iRand=new Date().getTime();
		if(this.frame_object){		
			//this.frame_object.location=this.frame_source+"&random="+iRand;	//VERSION QUE ALMACENA EN HISTORY
			this.frame_object.location.replace(this.frame_source+"&random="+iRand);	//VERSION QUE NO ALMACENA EN HISTORY
			
			//alert("refresh metricas");
		}		
	}

};

//alert("JSforMetrics v.0.2");
//**************  /js/onstatechange_mixplay.js ********* //
function onstatechange_mixplay(debug,estado,content,appframe,params,ownparams){
	if(debug) alert(" OnStateChange :: estado:"+estado+", content:"+content+", appframe:"+appframe+",params:"+params);	
	switch(estado){
		case "begin":
			//tema cargando			
			if(document.getElementById("loading_message")){
				if(document.getElementById(content)){
					document.getElementById(content).innerHTML=document.getElementById("loading_message").innerHTML;
				}
			}
			//tema ocultar mostrar
			if(ownparams!="noocultarplayer"){
				ocultarPlayer();
				acomodarDivHomes();
			}else{
				if(content=="refrescaBannersPlayer"){
					//no lo oculto y ni hago stop (refresco banner Player)
				}else{
					player_Stop();			
				}
			}
		break;
		case "end":
		break;
		case "end_aha":			
			switch(content){
				case "registroModOnlyLogin":
					/*
					if(wmp_isonlinestore()){						
						if(document.getElementById("top_userinfoMisDescargas")){							
							document.getElementById("top_userinfoMisDescargas").style.display="inline";
						}
					}else{
						if(document.getElementById("top_userinfoMisDescargas")){					
							document.getElementById("top_userinfoMisDescargas").style.display="none";
						}			
					}	
					*/
				break;
				case "content":
				case "region_playerlogin":
					sendNotifyBack();				
				break;
			}
		break;
	}
}
function acomodarDivHomes(){	
	if(document.getElementById("region_playerlogin")){
		document.getElementById("region_playerlogin").style.display="none";
	}		
	if(document.getElementById("content_player")){
		document.getElementById("content_player").style.display="none";
	}	
	if(document.getElementById("content")){
		document.getElementById("content").style.display="block";
	}
}
function misDescargasEspecial(){
	if(wmp_isonlinestore()){
		wmp_mostrarMisDescargas('top');
	}else{
		/*
		ocultarLogin();
		var oRegionTop = document.getElementById("top");
		var oRegionTop2 = document.getElementById("nav");
		if (oRegionTop)
		{
			var iAltoPxRegionTop = oRegionTop.clientHeight;
			if(oRegionTop2){
				iAltoPxRegionTop += oRegionTop2.clientHeight;
			}
			window.scrollTo(0,iAltoPxRegionTop);
		}		
		mostrarPlayer();
		browseDownloader('downloader');
		*/
		vtc_href2ajax('/scripts/app/framework.php?FRAME=principal&APP=micuenta|principal|principal|principal&principal[accion]=misdescargas');
		mostrarLogin(true);
	}
}
function detenerFlash(){
	if(document.getElementsByTagName("OBJECT").length>0){
		for(var ji=0;ji<document.getElementsByTagName("OBJECT").length;ji++){
			if(document.getElementsByTagName("OBJECT")[ji]&&document.getElementsByTagName("OBJECT")[ji].parentNode&&document.getElementsByTagName("OBJECT")[ji].parentNode.tagName=="DIV"){
				if(document.getElementsByTagName("OBJECT")[ji].parentNode.id.search("destacadoFlash_")!=-1){
					document.getElementsByTagName("OBJECT")[ji].StopPlay();
					document.getElementsByTagName("OBJECT")[ji].SetVariable("parar","1");
				}
			}
		}
	}	
}
function getSkinCurrent(){
	return window.currentSkin?window.currentSkin:document.styleSheets[0].href.match("sk_[^\/]+")[0];
}

function onSkinChange(sNewSkin){
	/*
	//04/06/2009-Se decidio ir por la espera de todo la funcion arbolDo.destacado, no solo el cambio de skin, ya que sino cuando se carga despues quedaban partes en negro sin cambiar
	if(top.location){
		if(top.location.toString().search(/debugjssinskin=/)!=-1){			
			switch(document.readyState){
				case "complete":
					if(onSkinChangeTimeout!=undefined) clearTimeout(onSkinChangeTimeout);
				break;
				default:
					if(onSkinChangeTimeout!=undefined) clearTimeout(onSkinChangeTimeout);
					onSkinChangeTimeout=setTimeout("onSkinChange('"+sNewSkin+"')",500);
					return;
			}									
		}
	}	
	*/
	var bActualizarSkin=false;	
	var sActual="";
	var oParent;
	var oNew;
	//var aRemoves=new Array();
	//var aAdd=new Array();
	var aIter=new Array();
	if(sNewSkin&&document.styleSheets.length>0){
		//alert("Valor:"+window.currentSkin);
		if(typeof window.currentSkin=="undefined"){
			window.currentSkin=document.styleSheets[0].href.match("sk_[^\/]+")[0]; //.replace("sk_","");
		}
		//alert("Current:"+window.currentSkin+","+sNewSkin);		
		if(window.currentSkin!=sNewSkin){
			bActualizarSkin=true;
		}
		if(bActualizarSkin){					
			window.styleLinks=document.getElementsByTagName("LINK");
			//
			for(var i=0;i<window.styleLinks.length;i++){
				if(window.styleLinks[i].href){
					/*
					sActual=window.styleLinks[i].href.toString();
					alert("href: "+sActual.replace("/"+window.currentSkin+"/","/"+sNewSkin+"/") + "\nDisabled: "+ window.styleLinks[i].disabled + "\nReadyState: "+ document.readyState);														
					window.styleLinks[i].href=sActual.replace("/"+window.currentSkin+"/","/"+sNewSkin+"/");					
					alert("cambio ok");
					
					//replace("/sk_"+window.currentSkin+"/","/sk_"+sNewSkin+"/"); //replace("/"+window.currentSkin+"/","/"+sNewSkin+"/")			
					*/
					sActual=window.styleLinks[i].href.toString();
					//alert("href?: "+sActual);														
					if(sActual.search("/"+window.currentSkin+"/")!=-1&&sActual.search("arbol.css")==-1){
						oParent=window.styleLinks[i].parentNode;
						//aRemoves.push(window.styleLinks[i]);
						//oParent.removeChild(window.styleLinks[i]);
						oNew=document.createElement("LINK");
						oNew.type="text/css";
						oNew.rel="stylesheet";
						oNew.href=sActual.replace("/"+window.currentSkin+"/","/"+sNewSkin+"/");
						//alert("href New: "+oNew.href);														
						//oParent.appendChild(oNew);						
						//aAdd.push(oNew);
						aIter.push(new Array(window.styleLinks[i],oNew,window.styleLinks[i].parentNode));
					}
				}
			}
			for(var i=0;i<aIter.length;i++){
				aIter[i][2].removeChild(aIter[i][0]);
				aIter[i][2].appendChild(aIter[i][1]);
				
			}			
			//
			//start-Correccion-actualize el iframe del portabanner de la playlist cuando cambia de skin
			try{
				if(document.frames&&document.frames["portabanner"]){
					var strUrl=document.frames["portabanner"].location.toString();
					//alert("portabanner:" + strUrl.replace("/"+window.currentSkin+"/","/"+sNewSkin+"/"));
					//document.frames["portabanner"].location=strUrl.replace("/"+window.currentSkin+"/","/"+sNewSkin+"/"); //replace("/sk_"+window.currentSkin+"/","/sk_"+sNewSkin+"/"); //replace("/"+window.currentSkin+"/","/"+sNewSkin+"/");
					document.frames["portabanner"].location="/"+sNewSkin+"/app/playlist_contenidos/mixplay/html/publicidad.html";

				}
			}catch(e){
			
			}
			//end			
			window.currentSkin=sNewSkin;
			
		}

		//Parche - para el cambio de skin en mixplay que no saben por que la gente de dis que quedan oculto los elementos de la primer pagina
		if(document.getElementById("cinta")&&document.getElementById("cinta").childNodes[0]){
			//document.getElementById("cinta").childNodes[0].style.display="none";
			//document.getElementById("cinta").childNodes[0].style.display="block";
			document.getElementById("cinta").getElementsByTagName("TR")[0].style.display="none";
			document.getElementById("cinta").getElementsByTagName("TR")[0].style.display="block";
			//alert("cambie el table");
		}	

		
		//llamada sincronica
		FWK.loadApp("html_estatico|principal|principal|principal","&principal[html]=cambio_skin_noexiste.html&FWK[skin]="+sNewSkin);
	}
}

function detectarBrowserNotIE(skin_default, idioma){
	//if(typeof window.ActiveXObject=="undefined") top.location = "/navigatorNotIE.html";
	var url = "/" + skin_default + "/html/" + idioma + "/errorNav.html";
	if(typeof window.ActiveXObject=="undefined") top.location = url;
}

function getUrlRefreshBannerSeoEnabled(nombre,def){
	var url=top.location.pathname.toString()+"";
	var originalparams="";
	if(top.location.hash&&top.ejecutarAnchor!=undefined){		
		url=top.ejecutarAnchor(undefined,true);				
		if(!url) url=top.location.pathname.toString();
	}else{		
		var sNodo=ejecutarAnchor_obtenerNombreNodo();			
		if(URL_principal!=undefined&&URL_principal.search(/&FWK\[nombre_nodo\]=/)!=-1){
			//sNodo=URL_principal.replace(/^.*?&FWK\[nombre_nodo\]=([^&]+).*?$/,"$1").toLowerCase();
			sNodo=window.location.pathname.replace(/^.*?\/([^\/]+)\/?$/,"$1");						
		}
		url=ejecutarAnchor_FixedUrlTextByNode(sNodo); 		
		if(!url) url=top.location.pathname.toString()+"";
	}
	if(url.search(/\?/)!=-1){
		originalparams=url.replace(/^.*\?(.*)$/,"$1");
	}
	url=url.replace(/\?.*$/,"");
	url=url.replace("\.php","");	
	if(top.location.pathname.search("/scripts")==-1&&top.location.pathname!="/"){				
		/*
		alert("nombre:"+nombre);
		bannerTop
		bannerFlyAd
		bannerSky		
		*/
		switch(nombre){		
			case "bannerFlyAd":
			case "bannerTopIzq":
			case "bannerTop":
			case "bannerSky":
			case "Preroll":
			case "Tanda":
				var RUTAPORPOSICION="";
				switch(nombre){
					case "bannerTopIzq":
						RUTAPORPOSICION="/eee/eee.php?eee=";					
					break;
					case "bannerTop":
						RUTAPORPOSICION="/ccc/ccc.php?ccc=";
					break;
					case "bannerFlyAd":
						RUTAPORPOSICION="/ddd/ddd.php?ddd=";
					break;
					case "Preroll":
						RUTAPORPOSICION="/fff/fff.php?fff=";
					break;
					case "Tanda":
						RUTAPORPOSICION="/ggg/ggg.php?ggg=";
					break;
					case "bannerSky":
					default:
						RUTAPORPOSICION="/aaa/aaa.php?aaa=";
				}
				var lUrl=url.replace(/[\/\&]/g," ").replace(/^ +/,"").replace(/ +$/,"");
				lUrl="/"+ejecutarAnchor_FixedUrlTextByAdChannel(lUrl,1).replace(/[\&]/g," ").replace(/^ +/,"").replace(/ +$/,"")+RUTAPORPOSICION+ejecutarAnchor_FixedUrlTextByAdChannel(lUrl,0).replace(/[\/\&]/g," ").replace(/^ +/,"").replace(/ +$/,"");
				lUrl=lUrl.replace(/\/\/+/g,"/");				
				return lUrl;
			break;
			default:
				return "/bbb/bbb.php?banner&position="+nombre+"&bbb="+url.replace(/[\/\&]/g," ").replace(/^ +/,"").replace(/ +$/,"");
				//return url+"/aa.php?banner&position="+nombre+"&"+originalparams;
		}		
	}
	return def;
}
function ejecutarAnchor_FixedUrlTextStart(){
	try{
		if(window.FWK!=undefined){					
			if(window.ejecutarAnchor_jsonData==undefined){				
				window.ejecutarAnchor_jsonString=FWK.ahah_open_get("/pregeneracion/banners/fixedurltextbynode.json.js?rnd="+(new Date().getTime()),null);						
				window.ejecutarAnchor_jsonDataGeneral=eval("("+window.ejecutarAnchor_jsonString+")");				
				window.ejecutarAnchor_jsonData=window.ejecutarAnchor_jsonDataGeneral.data;
				window.ejecutarAnchor_jsonLabels=window.ejecutarAnchor_jsonDataGeneral.labels;
				window.ejecutarAnchor_jsonAdChannels=window.ejecutarAnchor_jsonDataGeneral.ad_channels;
			}			
		}
	}catch(e){
		return "";
	}
}
function ejecutarAnchor_FixedUrlTextByAdChannel(adchannel,pos){
	try{
		if(adchannel!=undefined) adchannel=adchannel.toLowerCase();
		if(adchannel&&window.ejecutarAnchor_jsonAdChannels!=undefined&&window.ejecutarAnchor_jsonAdChannels[adchannel]){
			if(typeof(window.ejecutarAnchor_jsonAdChannels[adchannel])=="string"){
				if(pos==0) 
					return window.ejecutarAnchor_jsonAdChannels[adchannel];
				else
					return adchannel;
			}else{
				if(window.ejecutarAnchor_jsonAdChannels[adchannel][pos]){
					if(pos==1){
					return adchannel+"/"+window.ejecutarAnchor_jsonAdChannels[adchannel][pos];
					}else{					
					return window.ejecutarAnchor_jsonAdChannels[adchannel][pos];
					}
				}else{
					if(pos==0){
						return adchannel;
					}else{
						return adchannel;
					}				
				}
			}
		}else{
			if(pos==1){
				return "";
			}else{
				return adchannel;
			}
		}
	}catch(e){
		return "";
	}
}
function ejecutarAnchor_FixedUrlTextByNode(codigoExterno,ret){
	try{				
		if(codigoExterno!=undefined) codigoExterno=codigoExterno.toLowerCase();
		if(window.FWK!=undefined){					
			window.ejecutarAnchor_FixedUrlTextStart();
			if(window.ejecutarAnchor_jsonData!=undefined&&!window.ejecutarAnchor_jsonData[codigoExterno]){
				codigoExterno="default";
			}						
			if(window.ejecutarAnchor_jsonData!=undefined&&window.ejecutarAnchor_jsonData[codigoExterno]){				
				if(typeof(window.ejecutarAnchor_jsonData[codigoExterno])=="string"){
					return window.ejecutarAnchor_jsonData[codigoExterno];
				}else if(window.ejecutarAnchor_jsonData[codigoExterno].constructor.toString().indexOf("Array")!=-1){
					return window.ejecutarAnchor_jsonData[codigoExterno][Math.round(Math.random()*(window.ejecutarAnchor_jsonData[codigoExterno].length-1))];
				}
			}		
		}
		return "";
	}catch(e){
		return "";	
	}
}
function ejecutarAnchor_FixedUrlTextLabelsByNode(label){
	try{				
		if(label!=undefined) label=label.toLowerCase();
		if(window.FWK!=undefined){					
			window.ejecutarAnchor_FixedUrlTextStart();		
			if(window.ejecutarAnchor_jsonLabels!=undefined&&window.ejecutarAnchor_jsonLabels[label]){				
				if(typeof(window.ejecutarAnchor_jsonLabels[label])=="string"){
					return window.ejecutarAnchor_jsonLabels[label];
				}else if(window.ejecutarAnchor_jsonLabels[label].constructor.toString().indexOf("Array")!=-1){
					return window.ejecutarAnchor_jsonLabels[label][Math.round(Math.random()*(window.ejecutarAnchor_jsonLabels[label].length-1))];
				}
			}		
		}
		return "";
	}catch(e){
		return "";	
	}
}
function ejecutarAnchor_obtenerNombreNodo(){
	var id_nodo="";
	var nombre_nodo="";
	try{
		if(document.getElementById("ruta")&&document.getElementById("ruta").getElementsByTagName("SPAN")&&document.getElementById("ruta").getElementsByTagName("SPAN")[0]&&document.getElementById("ruta").getElementsByTagName("SPAN")[0].onclick){
		  if(document.getElementById("ruta").getElementsByTagName("SPAN")[0].onclick.toString().match(/item([0-9]+)/)){
		   id_nodo=document.getElementById("ruta").getElementsByTagName("SPAN")[0].onclick.toString().match(/item([0-9]+)/)[1];
		   nombre_nodo=document.getElementById("item"+id_nodo).getElementsByTagName("A")[0].href.replace(/^.*?\/([^\/]+)$/,"$1");
		   return nombre_nodo;
		  }
		}
	}catch(e){
	}
	return nombre_nodo;
}
/**
 *BANNERS FACEBOOK
 */
function clickShare(idContenido,url){		
	if(top.parent.document.getElementById('BaseApp')){
		idContenido=top.document.getElementById('BaseApp').content.App.CurrentMaterialItem.ContentId;
	}else if(window.goCMaterial){
		idContenido= goCMaterial.id_contenido;
	}
	if(idContenido){
		url='http://www.mixplay.tv/videosonline/'+idContenido+'.php?playcontent&sharemeta=true';
		window.open('http://www.facebook.com/sharer.php?u='+escape(url),'sharer','toolbar=0,status=0,width=626,height=436');
	}else if(url){
		window.open('http://www.facebook.com/sharer.php?u='+escape(url),'sharer','toolbar=0,status=0,width=626,height=436');	
	}	
	var nuevaImagen=new Image(); 
	nuevaImagen.src="http://ds.clickexperts.net/iserver/site=CL_MIXPLAY/camp_id=100/aamsz=PIX/acc_random?"+(new Date()).getTime(); 

	return void('');
}

//**************  /js/interfaz_loginajax_mixplay.js ********* //
var LOGIN_volvera;

function mostrarLogin(noLoadLogin,volvera,HidePlayer)
{	
	//alert("mostrarLogin");
	LOGIN_volvera=volvera;
	/*
	if(document.getElementById("player")){		
		document.getElementById("player").style.display='none';
	}
	if(document.getElementById("playlist")){		
		document.getElementById("playlist").style.display='none';
	}
	if(document.getElementById("buscadorcontenidos_cinta")){		
		document.getElementById("buscadorcontenidos_cinta").style.display='none';
	}	
	if(document.getElementById("region_player")){
		document.getElementById("region_player").style.display = 'none';
	}
	*/
	if(document.getElementById("content")){
		document.getElementById("content").style.realdisplay=document.getElementById("content").style.display;
		document.getElementById("content").style.display="none";		
	}
	if(typeof HidePlayer=="undefined"){		
		HidePlayer=noLoadLogin;
	}	
	/*ESTO SE SACA PARA VOLVER A HACER A MIXPLAY OCULTAR EL PLAYER COMO FTV, MUCH, ETC.*/
	//if(HidePlayer){
		if(document.getElementById("content_player")){
			document.getElementById("content_player").style.realdisplay=document.getElementById("content_player").style.display;
			document.getElementById("content_player").style.display="none";
		}	
	//}
	if(document.getElementById("region_playerlogin")){
		if(!noLoadLogin){
			FWK.loadAppInto("region_playerlogin","login_ajax|principal|principal|principal","&principal[accion]=login&principal[type]=over&principal[goto_frame]=player","noocultarplayer");			
		}
		document.getElementById("region_playerlogin").style.padding = '0px';
		document.getElementById("region_playerlogin").style.display = 'block';			
	}	
}

function ocultarLogin()
{	
	/*
	if(document.getElementById("player")){
		document.getElementById("player").style.display='block';		
	}
	if(document.getElementById("playlist")){
		document.getElementById("playlist").style.display='block';
	}
	if(document.getElementById("buscadorcontenidos_cinta")){		
		document.getElementById("buscadorcontenidos_cinta").style.display='block';
	}		
	if(document.getElementById("region_player")){
		document.getElementById("region_player").style.display = 'block';	
	}
	if(document.getElementById("region_playerlogin")){
		document.getElementById("region_playerlogin").style.display = 'none';
	}	
	*/	
	/*
	if(typeof goCMaterial!="undefined"){
		//alert("ACA");
		//if(document.getElementById("region_playerlogin")){
		//	document.getElementById("region_playerlogin").style.display = 'none';
		//}		
		//ocultarPlayer();
		//return;
	}
	*/
		if(document.getElementById("content")){
			if(document.getElementById("content").style.realdisplay){
				//*DEBUG*//alert("Valor 1"+document.getElementById("content").style.realdisplay);
				document.getElementById("content").style.display=document.getElementById("content").style.realdisplay;
			}else{
				//*DEBUG*//alert("Valor 2");
				document.getElementById("content").style.display="none";		
			}
		}
	/*ESTO ESTABA COMENTADO PARA 4C*/
		if(document.getElementById("content_player")){
			if(document.getElementById("content_player").style.realdisplay){
				//*DEBUG//alert("Valor 3"+document.getElementById("content_player").style.realdisplay);
				document.getElementById("content_player").style.display=document.getElementById("content_player").style.realdisplay;
			}else{
				//*DEBUG//alert("Valor 4");
				document.getElementById("content_player").style.display="block";		
			}
		}		
	/**/		
		if(document.getElementById("region_playerlogin")){
			document.getElementById("region_playerlogin").style.display = 'none';
		}	
	
}

var LOGIN_reply;
function loginAjaxHandlerReply(reply,otherParams){
	if(reply){
		LOGIN_reply=reply;
	}else{
		reply=LOGIN_reply;
	}
	switch(reply){
		case "OK":
			//alert("LOGIN OK");
			FWK.loadAppInto("registroModOnlyLogin","login|principal|principal|principal","","noocultarplayer");	//Primero refresco
			//SIN ACTIVEX por ahora
			//versionActiveX=0;
			/*PARA PONERLO SACAR LA LINEA ANTERIOR QUE FIJA QUE NO ES ACTIVEX (=0) y DESCOMENTAR EL IF SIGUIENTE*/
			if(!flujoDescargaActiveX(loginAjaxHandlerReply)){
				return;
			} 
			/***/
			//alert("SIGO ACA");			
			ocultarLogin();
			//try{
				if(LOGIN_volvera){
					if(FWK.debug){
						alert("Llamo a login_Volvera");
					}
					LOGIN_volvera();
				}else{
					if(FWK.debug){
						alert("Llamo a Play:"+currentMaterial);
					}					
					if(typeof currentMaterial!="undefined"&&currentMaterial!=null){	
						mostrarPlayer();
						cargarMaterialPlayer(null); //hacer que vuelva a intentar reproducir el Material
					}else{
						if(wmp_isonlinestore()){
							ocultarPlayer();							
						}else{
							ocultarPlayer();
							//mostrarPrimeroPlayList();
						}
					}
				}
			//}catch(e){
			//	alert("Error en login"+e.description);
			//	window.status="Er loginajaxHandler";
			//}
			return false;	//no haga lo que haria por default
		break;
		case "USUARIO_NO_HABILITADO":
			if(typeof otherParams!="undefined")
				FWK.loadAppInto("content","html_estatico|principal|principal|principal","&principal[html]=cargadorregistrofase2.html&principal[replace_escape][src]="+escape("/scripts/app/framework.php?APP=mp|principal|principal|principal&principal[fase]="+otherParams.xmlFase+"&principal[action]="+otherParams.xmlAction+"&principal[id_usuario]="+otherParams.xmlIdUsuario)+"");			
			return false; //no haga lo quer haria por default
		break;
		default:
			return true;	//haga lo que haria por default ej: mostrar el mensaje de error
	}
}
var DESCARGA_volvera;
var DESCARGA_mostrandomensaje;
var bYaRefresque=0;
function refresh_setCookie(sCookieName,sValue,bSession){
	var today = new Date();
	var zero_date = new Date(0,0,0);
	today.setTime(today.getTime() - zero_date.getTime());
	if(!bSession){
		var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000));	
		var cookieString = sCookieName + "=" + escape(sValue) + ";expires=" + cookie_expire_date.toGMTString() + ";domain=" + document.location.hostname;
	}else{
		var cookieString = sCookieName + "=" + escape(sValue) + ";domain=" + document.location.hostname;
	}
	document.cookie = cookieString;	
}
function refresh_getCookie(sCookieName){
	var start = document.cookie.indexOf(sCookieName+"=");
	var len = start + sCookieName.length + 1;
	if ((!start) && (sCookieName != document.cookie.substring(0,sCookieName.length))) return null;
	if (start == -1) return null;
	var end = document.cookie.indexOf(";",len);
	if (end == -1) end = document.cookie.length;
	//Valido si el ultimo caracter es una \
	var sReturn = unescape(document.cookie.substring(len,end));
	return sReturn;
}
function saveCookieMaterial(id_material){
	var idMaterialTmp=id_material?id_material:(goCMaterial["id_material"]?goCMaterial["id_material"]:currentMaterial["id_material"]);	
	refresh_setCookie("esdcsavedmaterial",""+idMaterialTmp,true);
}
function loadFromCookieMaterial(){
	var oMaterialTmp;
	var idMaterialTmp;
	idMaterialTmp=refresh_getCookie("esdcsavedmaterial");
	if(idMaterialTmp){
		mostrarPlayer();
		oMaterialTmp=obtenerMaterialDwl("","","",idMaterialTmp);
		goCMaterial=oMaterialTmp;
		currentMaterial=oMaterialTmp;
		//cargarMaterialPlayer(oMaterialTmp);
		cargarPlayListContenido(oMaterialTmp["id_contenido"],false);		
		boton_downloaddirecto();
		return true;
	}
	return false;
}
function flujoDescargaActiveX(volvera){		
	//var oDownloader = getDownloader("downloader");
	var ret=1;
	DESCARGA_volvera=volvera;
	if(wmp_isonlinestore()){
		versionActiveX=0;
		ret=1;
	}else{
			switch(top.downloader.oDownloader.estaActivado()){
				case "si":			
					if(top.downloader.oDownloader&&top.downloader.oDownloader.estaInstalado()){
						if(!top.downloader.oDownloader.yaRefresque()){	
							versionActiveX=0;
							top.downloader.oDownloader.yaRefresque(1);
							refrescarFrameDescarga();					
							ret=0;
						}else{
							versionActiveX=1;
							ret=1;				
						}								
					}else{
						versionActiveX=0;
						//Mostrar HTML ayuda instalacion
						mostrarMensajeDescarga("downloader_preguntainstalacion.html");
						ret=0;
					}
				break;
				case "no":
					versionActiveX=0;
					ret=1;
				break;
				case "nunca":
				default:
					versionActiveX=0;
					//Mostrar HTML pregunta Uso
					mostrarMensajeDescarga("downloader_preguntainstalacion.html");
					ret=0;
				break;
			}
	} 
	return ret;
}

function mostrarMensajeDescarga(mensaje){	
	if (typeof limpiarAnchor != "undefined") {
		limpiarAnchor();
	}
	FWK.loadAppInto(DIVVTC,"html_estatico|principal|principal|principal","&principal[html]="+mensaje,"noocultarplayer");
	mostrarLogin(true,LOGIN_volvera);
}
function ocultarMensajeDescarga(noPrepare){
	//var oDownloader;
	if(!noPrepare){
		top.downloader.oDownloader.prepareDownloader();
		//oDownloader = getDownloader("downloader");	
		//oDownloader.prepareDownloader();	
	}
	//ocultarLogin(true);
	if(DESCARGA_volvera){
		DESCARGA_volvera();
	}else{
		if(loadFromCookieMaterial()){
			if(typeof IRCOMPRAR_volvera=="undefined"){
				ocultarLogin();
			}
		}else{
			treeOnStart();
		}				
	}
}
function refrescarFrameDescarga(){
	top.downloader.document.location.href = "/scripts/app/framework.php?FRAME=downloader&rnd="+(new Date().getTime());
}
function setearActivado(valor){
	//var oDownloader = getDownloader("downloader");
	//oDownloader.setActivado(valor);
	top.downloader.oDownloader.setActivado(valor);
}
function mostrarOlvideMiContrasena(){
            //FWK.loadAppInto("region_playerlogin","mp|principal|principal|principal","&principal[fase]=recpwd&principal[action]=input","noocultarplayer");
            FWK.loadAppInto("region_playerlogin","mp|principal|principal|principal","&principal[fase]=recpwd&principal[action]=input");
            //mostrarLogin(true,undefined,false);
            mostrarLogin(true); 
}
function mostrarOlvideMiContrasenaRespuesta(pform){
	if(pform){
		if(pform.elements){
			if(pform.elements["principal[email]"]){
				if(pform.elements["principal[email]"].value){
					//FWK.loadAppInto("region_playerlogin","mp|principal|principal|principal","&principal[fase]=recpwd&principal[action]=checkmail&enviar=ok&principal[email]="+pform.elements["principal[email]"].value,"noocultarplayer");
					FWK.loadAppInto("region_playerlogin","mp|principal|principal|principal","&principal[fase]=recpwd&principal[action]=checkmail&enviar=ok&principal[email]="+pform.elements["principal[email]"].value);
					//mostrarLogin(true,undefined,false);
					mostrarLogin(true);
				}
			}
		}
	}
}
function ocultarOlvideMiContrasena(){
            ocultarLogin();
}

//**************  /js/vtc_ajax_mixplay.js ********* //
/**
 *vtc_irComprarPlayer(vtc_packinfo(p_idabono,p_idgrupo,p_idcontenido,p_vtcprecio,p_vtcmonedasimbolo,p_vtccomprado,p_vtcadicionales,p_idencodeo,p_idreproduccion,p_idmediopago,p_idmoneda));
 */
var DIVVTC="region_playerlogin";
var ACTIVARPINCODE_volvera="";
var ACTIVARPINCODE_volvera_inner="";
var IRCOMPRAR_volvera="";
var IRCOMPRAR_volvera_call="";
var MICUENTA_volvera="";
function vtc_href2ajax(url){
	var fullparams,frame,app,params;
	if(url){
		fullparams=url.replace(/^.*\?(.*)$/,"$1");
		frame=fullparams.replace(/^.*FRAME=([^&]*).*$/,"$1");
		app=fullparams.replace(/^.*APP=([^&]*).*$/,"$1");
		params=fullparams.replace(/^[^&]*FRAME=[^&]*/,"").replace(/^[^&]*APP=[^&]*/,"");
		if(app){
			if(app.search(/\|/)==-1){			
				app=app+"|principal|principal|principal";
			}
		}else{
			app="vtc|principal|principal|principal";
		}
		FWK.loadAppInto(DIVVTC,app,params,"noocultarplayer");
	}
}
function vtc_packinfo(p_idabono,p_idgrupo,p_idcontenido,p_vtcprecio,p_vtcmonedasimbolo,p_vtccomprado,p_vtcadicionales,p_idencodeo,p_idreproduccion,p_idmediopago,p_idmoneda){
	var aTmp=new Array();	
	aTmp["id_abono"]=p_idabono;
	aTmp["id_grupo"]=p_idgrupo;
	aTmp["id_contenido"]=p_idcontenido;
	aTmp["vtc_precio"]=p_vtcprecio;	
	aTmp["vtc_monedasimbolo"]=p_vtcmonedasimbolo;	
	aTmp["vtc_comprado"]=p_vtccomprado;
	aTmp["vtc_adicionales"]=p_vtcadicionales;	
	aTmp["id_encodeo"]=p_idencodeo;
	aTmp["id_reproduccion"]=p_idreproduccion;
	aTmp["id_medio_pago"]=p_idmediopago;
	aTmp["id_moneda"]=p_idmoneda;
	return aTmp;      
}
function vtc_irComprarPlayer(p_info,volvera){
	player_Stop();
	/*
	if(document.getElementById("player")){		
		document.getElementById("player").style.display='none';
	}
	if(document.getElementById("playlist")){		
		document.getElementById("playlist").style.display='none';
	}
	if(document.getElementById("region_player")){
		document.getElementById("region_player").style.display = 'none';
	}
	if(document.getElementById("buscadorcontenidos_cinta")){		
		document.getElementById("buscadorcontenidos_cinta").style.display='none';
	}	 
	*/
	vtc_irComprar(p_info,volvera);
	/*
	if(document.getElementById(DIVVTC)){
		document.getElementById(DIVVTC).style.display = 'block';
	}
	*/
	mostrarLogin(true);
}
function vtc_irComprar(p_info,volvera){
     //*DEBUG*//alert("VTC - Ir Comprar ["+p_info["id_contenido"]+"]");
     var res, vparams;
     if(volvera){
     	IRCOMPRAR_volvera=volvera;
     }
     if(typeof p_info=="undefined"){
     	//*DEBUG*//alert("de IR a p_info");
     	p_info=IRCOMPRAR_volvera_call;
     }else{
     	//*DEBUG*//alert("de p_info a IR");
     	IRCOMPRAR_volvera_call=p_info;
     }
     //*DEBUG*//alert("p_info:"+p_info);
     //*DEBUG*//alert("p_info:"+p_info["vtc_adicionales"]);
     //*DEBUG*//alert("IRCOMPRAR_volvera_call:"+IRCOMPRAR_volvera_call);
     if(p_info["vtc_adicionales"]){
     	//alert(p_info["vtc_adicionales"]);
     	res=p_info["vtc_adicionales"].split("|");
	vparams=""+
		"&principal[vtc][accion]=payway&"+
		"&principal[vtc][ajaxmode]=ajah&"+
     		"&principal[vtc][call]=to"+
     		"&principal[vtc][gateway]="+res[7]+
     		"&principal[vtc][idmediopago]="+res[6]+
     		"&principal[vtc][moneda]="+res[8]+
     		"&principal[vtc][idcombinacion]="+res[0]+
     		"&principal[vtc][idcombinacionprecio]="+res[1]+
     		"&principal[vtc][idcontenido]="+res[2]+
     		"&principal[vtc][idabono]="+res[4]+
     		"&principal[vtc][idgrupo]="+res[3]+
     		"&principal[vtc][precio]="+p_info["vtc_precio"];   
	FWK.loadAppInto(DIVVTC,"vtc|principal|principal|principal",vparams,"noocultarplayer");
     }else{
     	top.status="Error in link to buy"; 
     }
}
function vtc_irComprarCerrar(){
	/*
	if(document.getElementById("player")){		
		document.getElementById("player").style.display='block';
	}
	if(document.getElementById("playlist")){		
		document.getElementById("playlist").style.display='block';
	}
	if(document.getElementById("region_player")){
		document.getElementById("region_player").style.display = 'block';
	}
	if(document.getElementById("buscadorcontenidos_cinta")){		
		document.getElementById("buscadorcontenidos_cinta").style.display='block';
	}	 	
	if(document.getElementById(DIVVTC)){
		document.getElementById(DIVVTC).style.display = 'none';
	} 
	*/
	ocultarLogin();

}
function vtc_irComprarVolverA(id_abono,id_grupo,id_contenido){     
     	if(IRCOMPRAR_volvera){
		IRCOMPRAR_volvera();
     	}
     	/*
	if(document.getElementById("player")){		
		document.getElementById("player").style.display='block';
	}
	if(document.getElementById("playlist")){		
		document.getElementById("playlist").style.display='block';
	}
	if(document.getElementById("region_player")){
		document.getElementById("region_player").style.display = 'block';
	}
	if(document.getElementById("buscadorcontenidos_cinta")){		
		document.getElementById("buscadorcontenidos_cinta").style.display='block';
	}	 	
	if(document.getElementById(DIVVTC)){
		document.getElementById(DIVVTC).style.display = 'none';
	}     
	*/
	if(wmp_isonlinestore()){
	}else{
		ocultarLogin();
	}
}

function vtc_mostrarActivarPincode(volvera){
	if(volvera){
		ACTIVARPINCODE_volvera=volvera;	
	}
	if(ACTIVARPINCODE_volvera=="top"){
		player_Stop();
	}else if(ACTIVARPINCODE_volvera=="descontar"){
		player_Stop();
		//ACTIVARPINCODE_volvera_inner="";
		//if(document.getElementById(DIVVTC)){
		//	ACTIVARPINCODE_volvera_inner=document.getElementById(DIVVTC).innerHTML;
		//}				
	}else{
		player_Stop();
	}
	/*
	if(document.getElementById("player")){		
		document.getElementById("player").style.display='none';
	}
	if(document.getElementById("playlist")){		
		document.getElementById("playlist").style.display='none';
	}
	if(document.getElementById("region_player")){
		document.getElementById("region_player").style.display = 'none';
	}
	if(document.getElementById("buscadorcontenidos_cinta")){		
		document.getElementById("buscadorcontenidos_cinta").style.display='none';
	}	
	*/
	if(FWK.debug){
		FWK.loadAppInto(DIVVTC,"vtc|principal|principal|principal","&principal[vtc][accion]=payway&principal[vtc][call]=to&principal[vtc][gateway]=promo&principal[vtc][ajaxmode]=ajah&setverbose=1","noocultarplayer");
	}else{
		FWK.loadAppInto(DIVVTC,"vtc|principal|principal|principal","&principal[vtc][accion]=payway&principal[vtc][call]=to&principal[vtc][gateway]=promo&principal[vtc][ajaxmode]=ajah","noocultarplayer");
	}
	/*
	mostrarPlayer();
	if(document.getElementById(DIVVTC)){
		document.getElementById(DIVVTC).style.display = 'block';
	}	
	*/
	mostrarLogin(true);
	
}
function vtc_ocultarActivarPincode(donde){	
	if(ACTIVARPINCODE_volvera=="top"){
		//*DEBUG*//alert("por aca"+ACTIVARPINCODE_volvera);
		/*
		ocultarPlayer();
		*/
		ocultarLogin();
	}else if(ACTIVARPINCODE_volvera=="descontar"){
		//*DEBUG*//alert("por aca descontar "+ACTIVARPINCODE_volvera);
		vtc_irComprarPlayer();
		//if(ACTIVARPINCODE_volvera_inner){
		//	if(document.getElementById(DIVVTC)){
		//			document.getElementById(DIVVTC).innerHTML=ACTIVARPINCODE_volvera_inner;
		//	}			
		//}else{
		//	ocultarPlayer();
		//}
	}else if(ACTIVARPINCODE_volvera=="micuenta"){
		vtc_mostrarMiCuenta();
	}else{
		/*
		if(document.getElementById("player")){		
			document.getElementById("player").style.display='block';
		}
		if(document.getElementById("playlist")){		
			document.getElementById("playlist").style.display='block';
		}
		if(document.getElementById("region_player")){
			document.getElementById("region_player").style.display = 'block';
		}
		if(document.getElementById("buscadorcontenidos_cinta")){		
			document.getElementById("buscadorcontenidos_cinta").style.display='block';
		}	
		if(document.getElementById(DIVVTC)){
				document.getElementById(DIVVTC).style.display = 'none';
		}	
		*/
		ocultarLogin();
	}
}

function micuenta_dardebaja(id, idObjectError){
	var obj = document.getElementById(id);
	
	if(obj.value){
		document.getElementById(idObjectError).style.display="none";
		vtc_href2ajax("/scripts/app/framework.php?APP=micuenta|principal|principal|principal&principal[accion]=dardebaja&principal["+id+"]="+obj.value);
		
	}else{
		document.getElementById(idObjectError).style.display="block";
		obj.focus();
	}
	
}

function vtc_promo_submitearForm(sNameForm,sParams,sErrorMsg){
            //*DEBUG*//alert("sNameForm"+sNameForm);
            //*DEBUG*//alert("sParams"+sParams);
            //*DEBUG*//alert("sErrorMsg"+sErrorMsg);            
            if(document.forms[sNameForm].elements["principal[vtc][codigopromo]"].value){
			//setverbose=1&showsoapdialog=2
			var url;
			if(FWK.debug){
				url=sParams+"&setverbose=1&showsoapdialog=2&principal[vtc][codigopromo]="+document.forms[sNameForm].elements["principal[vtc][codigopromo]"].value;
			}else{
				url=sParams+"&principal[vtc][codigopromo]="+document.forms[sNameForm].elements["principal[vtc][codigopromo]"].value;
			}
                        //FWK.loadAppInto(DIVVTC,"vtc|principal|principal|principal",url);
                        //*DEBUG*//alert(url);
                        vtc_href2ajax(url);
            }else{
                        alert(sErrorMsg);
            }
 }


function vtc_mostrarMiCuenta(volvera){
	if(volvera){
		MICUENTA_volvera=volvera;	
	}	
	player_Stop();	
	/*
	if(document.getElementById("player")){		
		document.getElementById("player").style.display='none';
	}
	if(document.getElementById("playlist")){		
		document.getElementById("playlist").style.display='none';
	}
	if(document.getElementById("region_player")){
		document.getElementById("region_player").style.display = 'none';
	}
	if(document.getElementById("buscadorcontenidos_cinta")){		
		document.getElementById("buscadorcontenidos_cinta").style.display='none';
	}
	*/
	FWK.loadAppInto(DIVVTC,"micuenta|principal|principal|principal","&principal[accion]=micuenta");
	/*
	if(document.getElementById(DIVVTC)){
		document.getElementById(DIVVTC).style.display = 'block';
	}
	mostrarPlayer();
	*/
	mostrarLogin(true);
}
function vtc_ocultarMiCuenta(){
	if(MICUENTA_volvera=="top"){
		//*DEBUG*//alert("MICUENTA por aca"+MICUENTA_volvera);
		//ocultarPlayer();		
		ocultarLogin();
	}else{
		player_Stop();
		/*
		if(document.getElementById("player")){		
			document.getElementById("player").style.display='block';
		}
		if(document.getElementById("playlist")){		
			document.getElementById("playlist").style.display='block';
		}
		if(document.getElementById("region_player")){
			document.getElementById("region_player").style.display = 'block';
		}
		if(document.getElementById("buscadorcontenidos_cinta")){		
			document.getElementById("buscadorcontenidos_cinta").style.display='block';
		}		
		if(document.getElementById(DIVVTC)){
			document.getElementById(DIVVTC).style.display = 'none';
		}	
		*/
		ocultarLogin();
	}
}
//**************  /js/wmp_utils.js ********* //
	var wmpDownloadCollection;
	var wmpDownloadItems=new Array();
	var wmpDownloadItemsIdx=new Array();
	var wmpDownloadItemsOld=new Array();
	var wmpDownloadItemsOldInfo=new Array();
	var wmpDownloadTypes="background";
	var wmpDownloadTimeOut=2000;
	var wmpDownloadTimeOutMax=-1;
	var wmpDownloadTimeStop=0;
	var wmp_misDescargas_body;
	var wmpCookieName="WMP_IDCLL";
	var wmpReutilizoCollection=0;
	var wmpCallBackDefault;	
	var NOPUEDEREGENERAR_OMATERIAL;
	
	function wmp_misDescargas_Manager(mode,platInfo,wmpItem,wmpOwnItem){
		/*CLERT*/wmp_aalert("wmp_misDescargas_Manager :: mode="+mode+",platInfo="+platInfo+",wmpItem"+wmpItem+",wmpOwnItem="+wmpOwnItem);
		if(wmp_estaMostrandoMisDescargas()){
			switch(mode){
				case "restart":
				case "start":
				case "resume":
				case "progress":
					if(platInfo['id_material']){
						if(document.getElementById("misdescargasmat_"+platInfo['id_material'])){
							/*CLERT*/wmp_aalert("wmp_misDescargas_Manager :: actualizando id_material="+platInfo['id_material']+",sourceURL="+wmpItem.sourceURL);
							if(document.getElementById("misdescargasmat_"+platInfo['id_material']+"_status")){
								document.getElementById("misdescargasmat_"+platInfo['id_material']+"_status").innerHTML=wmp_constant_downloadState(wmpItem.downloadState);
							}
							if(document.getElementById("misdescargasmat_"+platInfo['id_material']+"_progress")){
								document.getElementById("misdescargasmat_"+platInfo['id_material']+"_progress").innerHTML=wmp_constant_sizeprogress(wmpItem.size,wmpItem.progress);
							}
						}else{
							/*CLERT*/wmp_aalert("wmp_misDescargas_Manager :: agregando id_material="+platInfo['id_material']);
							wmp_misDescargas_body=wmp_html_replaceItem(platInfo['id_material'],"wmp_misdescargas_item",wmpOwnItem);
							wmp_html_replaceBody(wmp_misDescargas_body,"wmp_misdescargas_body",DIVVTC);
						}
					}
				break;
				case "end":

				break;
			}
		}
	}
	function wmp_misDescargas_OldManager(item,iditem,oInfo){
		/*CLERT*/wmp_aalert("wmp_misDescargas_OldManager :: item="+item+",iditem="+iditem);
		if(wmp_estaMostrandoMisDescargas()){
			if(item){
					if(document.getElementById("misdescargasitem_"+iditem)){
						/*CLERT*/wmp_aalert("wmp_misDescargas_OldManager :: actualizando id_item="+iditem);
						if(document.getElementById("misdescargasitem_"+iditem+"_status")){
							document.getElementById("misdescargasitem_"+iditem+"_status").innerHTML=wmp_constant_downloadState(item.downloadState);
						}
						if(document.getElementById("misdescargasitem_"+iditem+"_progress")){
							document.getElementById("misdescargasitem_"+iditem+"_progress").innerHTML=wmp_constant_sizeprogress(item.size,item.progress);
						}
					}else{
						/*CLERT*/wmp_aalert("wmp_misDescargas_OldManager :: agregando id_item="+iditem);
						wmp_misDescargas_body=wmp_html_replaceItemOld("wmp_misdescargas_itemold",item,iditem,oInfo);
						wmp_html_replaceBodyOld(wmp_misDescargas_body,"wmp_misdescargas_bodyold",DIVVTC);
					}
			}
		}
	}
	function wmp_estaMostrandoMisDescargas(){
		if(document.getElementById(DIVVTC)){
			if(document.getElementById(DIVVTC).style.display=="block"){
				if(document.getElementById(DIVVTC).childNodes[0]){
					if(document.getElementById(DIVVTC).childNodes[0].ownMisdescargas){
						/*CLERT*/wmp_aalert("wmp_estaMostrandoMisdescaras:: true");
						return true;
					}
				}
			}
		}
		/*CLERT*/wmp_aalert("wmp_estaMostrandoMisdescaras:: false");
		return false;
	}
	function wmp_mostrarMisDescargas(){
		/*CLERT*/wmp_aalert("wmp_mostrarMisDescargas:: call");
		if(wmpDownloadTimeOut){
			wmpDownloadTimeStop=0;
			wmp_download_controlevents();
		}
		mostrarLogin(true);
		wmp_html_checkCreate("wmp_misdescargas_body");
		wmp_html_checkCreate("wmp_misdescargas_item");
		wmp_html_checkCreate("wmp_misdescargas_itemold");
		/*
		wmp_html_checkCreate("wmp_misdescargas_bodyold");
		wmp_html_checkCreate("wmp_misdescargas_bodynohay");
		wmp_html_checkCreate("wmp_misdescargas_bodyoldnohay");
		*/
		if(document.getElementById("wmp_misdescargas_item")){
			if(wmp_download_count()){
				if(document.getElementById("wmp_body_container_hay")){
					document.getElementById("wmp_body_container_nohay").style.display="none";
					document.getElementById("wmp_body_container_hay").style.display="block";
				}
				wmp_download_controleventsfire(undefined,"restart",wmp_misDescargas_Manager);
			}else{
				if(document.getElementById("wmp_body_container_nohay")){
					document.getElementById("wmp_body_container_hay").style.display="none";
					document.getElementById("wmp_body_container_nohay").style.display="block";
				}
			}
			if(wmp_download_countOld()){
				if(document.getElementById("wmp_bodyold_container_hay")){
					document.getElementById("wmp_bodyold_container_nohay").style.display="none";
					document.getElementById("wmp_bodyold_container_hay").style.display="block";
				}
			}else{
				if(document.getElementById("wmp_bodyold_container_nohay")){
					document.getElementById("wmp_bodyold_container_hay").style.display="none";
					document.getElementById("wmp_bodyold_container_nohay").style.display="block";
				}
			}
			sendNotifyBack();	//Para que se integre con el VOLVER
		}else{
			/*CLERT*/wmp_aalert("wmp_mostrarMisDescargas:: Not found wmp_misdescargas_body or wmp_misdescargas_item");
		}
	}
	function wmp_ocultarMisDescargas(){
		/*CLERT*/wmp_aalert("wmp_ocultarMisDescargas:: call");
		wmpDownloadTimeStop=1;
		ocultarLogin();

	}
	function wmp_html_replaceBodyOld(body,id_div_base,id_div_destino,reemplazar){
		/*CLERT*/wmp_aalert("wmp_html_replaceBodyOld:: id_div_base="+id_div_base+",id_div_destino="+id_div_destino+",reemplazar="+reemplazar);
		/*
		var html_base;
		if(!reemplazar&&document.getElementById(id_div_destino)&&wmp_estaMostrandoMisDescargas()){
			html_base=document.getElementById(id_div_destino).innerHTML;
		}else if(document.getElementById(id_div_base)){
			html_base=document.getElementById(id_div_base).innerHTML.toString();
		}
		if(html_base){
			html_base=html_base.replace("<!-- {@BODY_OLD} -->",body+"<!-- {@BODY_OLD} -->");
		}
		if(document.getElementById(id_div_destino)){
			document.getElementById(id_div_destino).innerHTML=html_base;
		}
		*/
		if(document.getElementById("wmp_bodyold_container_hay")){
			document.getElementById("wmp_bodyold_container_nohay").style.display="none";
			document.getElementById("wmp_bodyold_container_hay").style.display="block";
		}
		if(document.getElementById("wmp_bodyold_container_items")){
			document.getElementById("wmp_bodyold_container_items").innerHTML+=body;
		}
	}
	function wmp_html_replaceBody(body,id_div_base,id_div_destino,reemplazar){
		/*CLERT*/wmp_aalert("wmp_html_replaceBody:: id_div_base="+id_div_base+",id_div_destino="+id_div_destino+",reemplazar="+reemplazar);
		/*
		var html_base;
		if(document.getElementById("wmp_body")){
			if(document.getElementById("wmp_body").ownState=="nohay"){
				reemplazar=1;
			}
		}
		if(!reemplazar&&document.getElementById(id_div_destino)&&wmp_estaMostrandoMisDescargas()){
			html_base=document.getElementById(id_div_destino).innerHTML;
		}else if(document.getElementById(id_div_base)){
			html_base=document.getElementById(id_div_base).innerHTML.toString();
		}
		if(html_base){
			html_base=html_base.replace("<!-- {@BODY} -->",body+"<!-- {@BODY} -->");
		}
		if(document.getElementById(id_div_destino)){
			document.getElementById(id_div_destino).innerHTML=html_base;
		}
		*/
		if(document.getElementById("wmp_body_container_hay")){
			document.getElementById("wmp_body_container_nohay").style.display="none";
			document.getElementById("wmp_body_container_hay").style.display="block";
		}
		if(document.getElementById("wmp_body_container_items")){
			document.getElementById("wmp_body_container_items").innerHTML+=body;
		}
	}
	function wmp_html_replaceItemOld(id_div_base,item,iditem,oInfo){
		/*CLERT*/wmp_aalert("wmp_html_replaceItemOld:: id_div_base="+id_div_base+",item="+item+",iditem="+iditem);
		var html_base=document.getElementById(id_div_base).innerHTML.toString();
		html_base=html_base.replace(new RegExp("\{\@ID_ITEM\}","g"),iditem);
		html_base=html_base.replace(new RegExp(escape("\{\@ID_ITEM\}"),"g"),iditem);
		if(oInfo){
			var k,v;
			for(var i in oInfo){
					k=i;
					v=oInfo[i];
					html_base=html_base.replace(new RegExp("\{\@"+k.toUpperCase()+"\}","g"),v);
					html_base=html_base.replace(new RegExp(escape("\{\@"+k.toUpperCase()+"\}"),"g"),v);
			}		
		}else{
			html_base=html_base.replace(new RegExp("\{\@TITULO\}","g"),item.getItemInfo("Title"));
			html_base=html_base.replace(new RegExp(escape("\{\@TITULO\}"),"g"),item.getItemInfo("Title"));		
			html_base=html_base.replace(new RegExp("\{\@DURACION\}","g"),item.getItemInfo("Duration"));
			html_base=html_base.replace(new RegExp(escape("\{\@DURACION\}"),"g"),item.getItemInfo("Duration"));
		}
		html_base=html_base.replace(new RegExp("\{\@ESTADO\}","g"),wmp_constant_downloadState(item.downloadState));
		html_base=html_base.replace(new RegExp(escape("\{\@ESTADO\}"),"g"),wmp_constant_downloadState(item.downloadState));
		html_base=html_base.replace(new RegExp("\{\@PROGRESO\}","g"),wmp_constant_sizeprogress(item.size,item.progress));
		html_base=html_base.replace(new RegExp(escape("\{\@PROGRESO\}"),"g"),wmp_constant_sizeprogress(item.size,item.progress));
		return html_base;
	}
	function wmp_html_replaceItem(id_material,id_div_base,ownInfo){
		/*CLERT*/wmp_aalert("wmp_html_replaceItem:: id_material="+id_material+", id_div_base="+id_div_base+",ownInfo="+ownInfo);
		var oXml=document.getElementById("xmlPlaylist");
		var html_base=document.getElementById(id_div_base).innerHTML.toString();
		html_base=html_base.replace(new RegExp("\{\@ID_MATERIAL\}","g"),id_material);
		html_base=html_base.replace(new RegExp(escape("\{\@ID_MATERIAL\}"),"g"),id_material);
		html_base=html_base.replace(new RegExp("\{\@SID\}","g"),ownInfo["sid"]);
		html_base=html_base.replace(new RegExp(escape("\{\@SID\}"),"g"),ownInfo["sid"]);
		if(ownInfo["item"]){
			html_base=html_base.replace(new RegExp("\{\@ESTADO\}","g"),wmp_constant_downloadState(ownInfo["item"].downloadState));
			html_base=html_base.replace(new RegExp(escape("\{\@ESTADO\}"),"g"),wmp_constant_downloadState(ownInfo["item"].downloadState));
			html_base=html_base.replace(new RegExp("\{\@PROGRESO\}","g"),wmp_constant_sizeprogress(ownInfo["item"].size,ownInfo["item"].progress));
			html_base=html_base.replace(new RegExp(escape("\{\@PROGRESO\}"),"g"),wmp_constant_sizeprogress(ownInfo["item"].size,ownInfo["item"].progress));
		}
		if(ownInfo["additional"]&&ownInfo["additional"]["oMaterial"]){
			var k,v;
			for(var i in ownInfo["additional"]["oMaterial"]){
					k=i;
					v=ownInfo["additional"]["oMaterial"][i];
					html_base=html_base.replace(new RegExp("\{\@"+k.toUpperCase()+"\}","g"),v);
					html_base=html_base.replace(new RegExp(escape("\{\@"+k.toUpperCase()+"\}"),"g"),v);
			}
		}else if(oXml){
			var oXmlItem=oXml.XMLDocument.selectSingleNode("playlist/item[@id_material=\"" + id_material + "\"]");
			var k,v;
			if(oXmlItem){
				for(var i=0;i<oXmlItem.childNodes.length;i++){
						k=oXmlItem.childNodes[i].nodeName;
						v=oXmlItem.childNodes[i].text;
						html_base=html_base.replace(new RegExp("\{\@"+k.toUpperCase()+"\}","g"),v);
						html_base=html_base.replace(new RegExp(escape("\{\@"+k.toUpperCase()+"\}"),"g"),v);
				}
			}
		}
		return html_base;
	}
	function wmp_html_replaceItemPlay(id_material,id_div_base,oMaterial){
		/*CLERT*/wmp_aalert("wmp_html_replaceItemPlay:: id_material="+id_material+", id_div_base="+id_div_base);
		var oXml=document.getElementById("xmlPlaylist");
		var html_base=document.getElementById(id_div_base).innerHTML.toString();
		html_base=html_base.replace(new RegExp("\{\@ID_MATERIAL\}","g"),id_material);
		html_base=html_base.replace(new RegExp(escape("\{\@ID_MATERIAL\}"),"g"),id_material);
		if(oMaterial){
			var k,v;
			for(var i in oMaterial){
					k=i;
					v=oMaterial[i];
					html_base=html_base.replace(new RegExp("\{\@"+k.toUpperCase()+"\}","g"),v);
					html_base=html_base.replace(new RegExp(escape("\{\@"+k.toUpperCase()+"\}"),"g"),v);
			}
		}else if(oXml){
			var oXmlItem=oXml.XMLDocument.selectSingleNode("playlist/item[@id_material=\"" + id_material + "\"]");
			var k,v;
			if(oXmlItem){
				for(var i=0;i<oXmlItem.childNodes.length;i++){
						k=oXmlItem.childNodes[i].nodeName;
						v=oXmlItem.childNodes[i].text;
						html_base=html_base.replace(new RegExp("\{\@"+k.toUpperCase()+"\}","g"),v);
						html_base=html_base.replace(new RegExp(escape("\{\@"+k.toUpperCase()+"\}"),"g"),v);
				}
			}
		}
		return html_base;
	}
	function wmp_html_checkCreate(id_div){
		var oTmpDiv;
		if(!document.getElementById(id_div)){
			if(id_div!="wmp_misdescargas_body"){
				oTmpDiv=document.createElement("DIV");
				oTmpDiv.id=id_div;
				oTmpDiv.name=id_div;
				oTmpDiv.style.display="none";
				document.body.appendChild(oTmpDiv);
				if(document.getElementById(id_div)){
					document.getElementById(id_div).innerHTML=FWK.loadApp("html_estatico|principal|principal|principal","&principal[html]="+id_div+".html");
				}
				//@DEBUG@//wmp_aalert("APENDIO"+id_div+"<br>"+document.getElementById(id_div).innerHTML+"<br>"	);
			}else{
				document.getElementById(DIVVTC).innerHTML=FWK.loadApp("html_estatico|principal|principal|principal","&principal[html]="+id_div+".html");
			}
		}
	}
	function wmp_mostrarPlayDownloadWMP(id_material,oMaterial){
		var html_base;
		wmp_html_checkCreate("wmp_playdescarga");
		var oMaterial128, oMaterial1024;
		var existe1024=false;
		if(oMaterial&&oMaterial["id_contenido"]){						
			/*Evito llamar 2 veces*/
			//oMaterial128=obtenerMaterialDwl(oMaterial["id_contenido"],128,1);
			//oMaterial1024=obtenerMaterialDwl(oMaterial["id_contenido"],1024,2);			
			/*Esta logica es similar a lo que tenia el If donde ahora usa existe1024*/
			//existe1024=oMaterial1024&&parseInt(oMaterial1024["id_encodeo"])==1024;
			/*Asi calculo ahora en funcion de los encodeos download*/
			if(oMaterial['encodeos_download']){			
				if(oMaterial['encodeos_download'].search("1024")!=-1){							
					existe1024=true;
				}
			}
			
		}
		/*CLERT*/wmp_aalert("wmp_mostrarPlayDownloadWMP:: id_material:"+id_material);
		if(document.getElementById("wmp_playdescarga")){
			html_base=wmp_html_replaceItemPlay(id_material,"wmp_playdescarga",oMaterial);
			if(document.getElementById(DIVVTC)){
				document.getElementById(DIVVTC).innerHTML=html_base;
			}						
			/*version prende modalidad Con Download (350 como Preview, 1mb) o Sin Download (128,350 como DEMO)*/
			if(!wmp_FixFAlvarezWmp12(oMaterial["id_contenido"])){
				if(document.getElementById("modalidad_CONDOWNLOAD1")){					
					document.getElementById("modalidad_CONDOWNLOAD1").style.display="block";
				}
				if(document.getElementById("modalidad_CONDOWNLOAD2")){					
					document.getElementById("modalidad_CONDOWNLOAD2").style.display="block";
				}				
				if(document.getElementById("modalidad_SINDOWNLOAD1")){					
					document.getElementById("modalidad_SINDOWNLOAD1").style.display="none";
				}
				if(document.getElementById("modalidad_SINDOWNLOAD2")){					
					document.getElementById("modalidad_SINDOWNLOAD2").style.display="none";
				}						
			}else{
				if(document.getElementById("modalidad_SINDOWNLOAD1")){					
					document.getElementById("modalidad_SINDOWNLOAD1").style.display="block";
				}
				if(document.getElementById("modalidad_SINDOWNLOAD2")){					
					document.getElementById("modalidad_SINDOWNLOAD2").style.display="block";
				}				
				if(document.getElementById("modalidad_CONDOWNLOAD1")){					
					document.getElementById("modalidad_CONDOWNLOAD1").style.display="none";
				}
				if(document.getElementById("modalidad_CONDOWNLOAD2")){					
					document.getElementById("modalidad_CONDOWNLOAD2").style.display="none";
				}								
			}							
			if(document.getElementById(DIVVTC).style.display!="block")
				mostrarLogin(true);
			sendNotifyBack();	//Para integrarse con el VOLVER
		}else{
			/*CLERT*/wmp_aalert("Not found wmp_playdescarga");
		}
	}
	function wmp_ocultarPlayDownloadWMP(){
		/*CLERT*/wmp_aalert("wmp_ocultarPlayDownloadWMP:: call");
		goCMaterial=null;
		ocultarLogin();
	}

	function wmp_salert(valor){		
		//if(!FWK.debug) return;
		//if(document.getElementById('salida'))
		//	document.getElementById('salida').value=valor;
	}
	function wmp_aalert(valor){
		//if(!FWK.debug) return;
		if(document.cookie.toString().search("somosnosotros")!=-1){
			if(document.getElementById('salida')){
				document.getElementById('salida').value+=valor+"\n";
				document.getElementById('salida').style.display="block";
			}
			if(document.getElementById('wmp_debug')){
				document.getElementById('wmp_debug').style.display="block";			
			}
		}
	}
	function wmp_download_reset(){
		wmpDownloadItems=new Array();
		wmpDownloadCollection="";
	}
	function wmp_download_clear(){
		wmpDownloadItems=new Array();
	}
	function wmp_download_count(){
		var total=0;
		for(var i in wmpDownloadItems){
			if(wmpDownloadItems[i]['status']){
				total++;
			}
		}
		/*CLERT*/wmp_aalert("wmp_download_count:: total="+total);
		return total;
	}
	function wmp_download_countOld(){
		var total=0;
		if(wmpDownloadCollection){
			for(var i=0;i<wmpDownloadCollection.count;i++){
				if(!wmpDownloadItemsIdx["item_"+i]){
					switch(wmpDownloadCollection.item(i).downloadState){
						case 0:
						case 1:
						case 2:
							total++;
						break;
					}

				}
			}
		}
		/*CLERT*/wmp_aalert("wmp_download_countOld:: total="+total);
		return total;
	}
	function wmp_download_controleventsfire(item,mode,callbackend){
		var tmpid;
		var tmpi;
		var oInfo;
		//wmp_aalert("wmp_download_controleventsfire:: Item="+item+",mode="+mode+",callbackend="+callbackend);
		if(typeof mode=="undefined"){
			mode="progress";
		}
		switch(wmpDownloadTypes){
			case "background":
				if(item){
						if(wmpDownloadItems[item]){
							if(wmpDownloadItems[item]['callback']){
								wmpDownloadItems[item]['callback'](mode,wmpDownloadItems[item]['additional'],wmpDownloadItems[item]['item'],wmpDownloadItems[item]);
							}
						}
				}else{
					for(var i in wmpDownloadItems){
						if(wmpDownloadItems[i]){
							if(wmpDownloadItems[i]['callback']){
								wmpDownloadItems[i]['callback'](mode,wmpDownloadItems[i]['additional'],wmpDownloadItems[i]['item'],wmpDownloadItems[i]);
							}
						}
					}
					if(wmpCallBackDefault&&wmpDownloadCollection){
						for(var j=0; j<wmpDownloadItemsOld.length;j++){
								tmpi=wmpDownloadItemsOld[j];								
								if(wmpDownloadItemsOldInfo[j]){
									oInfo=wmpDownloadItemsOldInfo[j];
								}
								if(wmpDownloadCollection.item(tmpi)){
									if(!wmpDownloadItemsIdx["item_"+tmpi]){
										wmpCallBackDefault(wmpDownloadCollection.item(tmpi),tmpi,oInfo);
									}
								}
						}
					}
					if(callbackend){
						callbackend("end");
					}
				}
			break;
			default:
				if(item){
						if(wmpDownloadItems[item]){
							if(wmpDownloadItems[item]['callback']){
								wmpDownloadItems[item]['callback'](mode,wmpDownloadItems[item]['additional'],wmpDownloadItems[item]['item'],wmpDownloadItems[item]);
							}
						}
				}else{
					for(var i in wmpDownloadItems){
						if(wmpDownloadItems[i]){
							if(wmpDownloadItems[i]['callback']){
								wmpDownloadItems[i]['callback'](mode,wmpDownloadItems[i]['additional'],wmpDownloadItems[i]['item'],wmpDownloadItems[i]);
							}
						}
					}
					if(wmpCallBackDefault&&wmpDownloadCollection){
						for(var j=0; j<wmpDownloadItemsOld.length;j++){
								tmpi=wmpDownloadItemsOld[j];
								if(wmpDownloadCollection.item(tmpi)){
									if(!wmpDownloadItemsIdx["item_"+tmpi]){
										wmpCallBackDefault(wmpDownloadCollection.item(tmpi),tmpi);
									}
								}
						}
					}
					if(callbackend){
						callbackend("end");
					}
				}
		}
	}
	function wmp_download_controlevents(counter){
		try{
			//wmp_aalert("wmp_download_controleventes:: Contador="+counter);
			if(!counter){
				counter=0;
			}
			switch(wmpDownloadTypes){
				case "background":
					wmp_download_controleventsfire();
					if(wmpDownloadTimeOutMax==-1||counter<=wmpDownloadTimeOutMax){
						if(!wmpDownloadTimeStop){
							window.setTimeout("wmp_download_controlevents("+(counter+1)+")",wmpDownloadTimeOut);
						}
					}
				break;
				default:
			}
		}catch(e){
			//Aca paso otra cosa
		}
	}
	function wmp_download_pausarold(iditem){
		/*CLERT*/wmp_aalert("wmp_download_pausar:: Cancel para  :"+iditem);
		if(wmpDownloadCollection&&iditem){
			if(wmpDownloadCollection.item(iditem)){
					switch(wmpDownloadCollection.item(iditem).downloadState){
						case 0:
						case 1:
						case 2:
							wmpDownloadCollection.item(iditem).pause();
					}
			}
		}
	}
	function wmp_download_pausar(sid){
		/*CLERT*/wmp_aalert("wmp_download_pausar:: Cancel para  :"+sid);
		if(wmpDownloadItems[sid]){
			if(wmpDownloadItems[sid]['item']){
				switch(wmpDownloadItems[sid]['item'].downloadState){
					case 0:
					case 1:
					case 2:
						wmpDownloadItems[sid]['item'].pause();
				}
			}
		}
	}
	function wmp_download_reanudarold(iditem){
		/*CLERT*/wmp_aalert("wmp_download_reaunudar:: Cancel para  :"+iditem);
		if(wmpDownloadCollection&&iditem){
			if(wmpDownloadCollection.item(iditem)){
					switch(wmpDownloadCollection.item(iditem).downloadState){
						case 0:
						case 1:
						case 2:
							wmpDownloadCollection.item(iditem).resume();
					}
			}
		}
	}
	function wmp_download_reanudar(sid){
		/*CLERT*/wmp_aalert("wmp_download_reaunudar:: Cancel para  :"+sid);
		if(wmpDownloadItems[sid]){
			if(wmpDownloadItems[sid]['item']){
				switch(wmpDownloadItems[sid]['item'].downloadState){
					case 0:
					case 1:
					case 2:
						wmpDownloadItems[sid]['item'].resume();
				}
			}
		}
	}
	function wmp_download_cancelarold(iditem){
		/*CLERT*/wmp_aalert("wmp_download_cancelarold:: Cancel para  :"+iditem);
		if(wmpDownloadCollection&&iditem){
			if(wmpDownloadCollection.item(iditem)){
					switch(wmpDownloadCollection.item(iditem).downloadState){
						case 0:
						case 1:
						case 2:
							wmpDownloadCollection.item(iditem).cancel();
					}
			}
		}
	}
	function wmp_download_cancelar(sid){
		/*CLERT*/wmp_aalert("wmp_download_cancelar:: Cancel para  :"+sid);
		if(wmpDownloadItems[sid]){
			if(wmpDownloadItems[sid]['item']){
				switch(wmpDownloadItems[sid]['item'].downloadState){
					case 0:
					case 1:
					case 2:
						wmpDownloadItems[sid]['item'].cancel();
				}
			}
		}
	}
	function wmp_DownloadCollection_Manage_Run(){
		setTimeout("wmp_DownloadCollection_Manage();",500);
	}
	function wmp_DownloadCollection_Manage(){
		var id_collection;
		var oMaterialOld;
		var sFileUrl;
		var aFileUrl;
		var tmp_idmaterial;
		var tmp_ididioma;
		var tmp_idencodeo;
		if(!wmp_isonlinestore()){
			return;
		}
		if(!window.external||!window.external.DownloadManager){
			return;
		}
		if(id_collection=wmp_getCookie(wmpCookieName)){
			wmpReutilizoCollection=1;
			wmpDownloadCollection=window.external.DownloadManager.getDownloadCollection(id_collection);
			if(wmpDownloadCollection){
				/*CLERT*/wmp_aalert("wmp_DownloadCollection_Manage:: Reutilizo la collection :"+id_collection);
				if(wmpDownloadCollection.count){					
					if(typeof obtenerMaterialDwl=="undefined"){
						window.corregirTemaWMPInicioConDescarga=true;
						document.getElementById("salida").value+="llamo al player";
						mostrarPlayer(undefined,wmp_DownloadCollection_Manage_Run); //No estaba cargado el .Js de la playlist donde se define esa funcion, llamo a mostrarPlayer que lo que va a hacer es cargar todo el player.
						/*CLERT*/wmp_aalert("wmp_DownloadCollection_Manage:: Salgo pendiente player obtenerMaterialDwl");
						return;
					}else{
						window.corregirTemaWMPInicioConDescarga=false;
						if(document.getElementById("content_player")){									
							document.getElementById("content_player").style.display="none";
						}
						if(document.getElementById("content")){
							document.getElementById("content").style.display="block";
						}											
					}
				}
				for(var j=0; j<wmpDownloadCollection.count;j++){
						tmpid=j;
						if(!wmpDownloadItemsIdx["item_"+tmpid]){
							switch(wmpDownloadCollection.item(j).downloadState){
								case 0:
								case 1:
								case 2:
									if(wmpDownloadCollection.item(j).sourceURL){
										sFileUrl=wmpDownloadCollection.item(j).sourceURL;
										sFileUrl=sFileUrl.replace(/^.*[\/\\]([^\/\\]*)$/,"$1");
										aFileUrl=sFileUrl.split("_",4);
										if(aFileUrl){
											if(aFileUrl[0]){
												tmp_ididioma=aFileUrl[0];
											}										
											if(aFileUrl[1]){
												tmp_idmaterial=aFileUrl[1];
											}
											if(aFileUrl[2]){
												tmp_idencodeo=aFileUrl[2];
											}											
										}
										if(tmp_idmaterial){
											oMaterialOld=obtenerMaterialDwl("","","",tmp_idmaterial);
										}
									}
									wmpDownloadItemsOld.push(tmpid);
									wmpDownloadItemsOldInfo.push(oMaterialOld);
									/*CLERT*/wmp_aalert("wmp_DownloadCollection_Manage:: Reconociendo como Old a:"+tmpid);
							}

						}
				}
			}
		}
		if(!wmpDownloadCollection){
				/*CLERT*/wmp_aalert("wmp_DownloadCollection_Manage:: No reutilizo la collection");
				wmpReutilizoCollection=0;
				wmpDownloadCollection=window.external.DownloadManager.createDownloadCollection();
				//wmp_setCookie(wmpCookieName,wmpDownloadCollection.id,true);
				wmp_setCookie(wmpCookieName,wmpDownloadCollection.id,false);
		}
	}
	function wmp_acomodar_old(tmpi,sid,surl){
		/*CLERT*/wmp_aalert("wmp_acomodar_old:: tmpi="+tmpi+",sid="+sid+",surl="+surl);
		if(!wmpDownloadItemsIdx["item_"+i]){
			wmpDownloadItemsIdx["item_"+i]=sid;
		}
		for(var i=wmpDownloadItemsOld.length-1;i>=0;i--){
			/*CLERT*/wmp_aalert("wmp_acomodar_old:: preguntando i="+i+",valor="+wmpDownloadItemsOld[i]+",tmpi="+tmpi);
			if(wmpDownloadItemsOld[i]==tmpi){
				/*CLERT*/wmp_aalert("wmp_acomodar_old:: removiendo array i="+i);
				wmpDownloadItemsOld.splice(i,1);
				if(document.getElementById("wmp_item_"+tmpi)){
					/*CLERT*/wmp_aalert("wmp_acomodar_old:: borrando tmpi="+tmpi);
					document.getElementById("wmp_item_"+tmpi).parentNode.removeChild(document.getElementById("wmp_item_"+tmpi));
				}
			}
		}
	}
	function wmp_download_reutilizar(surl,sid){
		if(wmpDownloadCollection){
			for(var i=0;i<wmpDownloadCollection.count;i++){
				if(wmpDownloadCollection.item(i).sourceURL==surl){
					switch(wmpDownloadCollection.item(i).downloadState){
						case 0:
						case 1:
						case 2:						
							/*CLERT*/wmp_aalert("wmp_download_reutilizar:: reusando "+i+" para "+surl);
							wmp_acomodar_old(i,sid,surl);
							return wmpDownloadCollection.item(i);
						case 3:	//Los completos no tiene que reutilizar
					}

				}
			}
		}
		/*CLERT*/wmp_aalert("wmp_download_reutilizar:: No pudo reusar para "+surl);
		return false;
	}
	function wmp_downloadactivo(item){
		if(item){
			switch(item.downloadState){
				case 0:
				case 1:
				case 2:				
					return true;
				case 3:	//Si esta completo no lo consideramos activo (vuelve a iniciar la descarga)
			}
		}
		return false;
	}
	function wmp_download(sid,surl,additional,callback){
		/*CLERT*/wmp_aalert("wmp_download:: sid:"+sid+",url="+surl+", typeof="+typeof wmpDownloadCollection+",id="+wmpDownloadCollection.id+",count="+wmpDownloadCollection.count);
		switch(wmpDownloadTypes){
			case "background":
				if(wmpDownloadItems[sid]&&wmp_downloadactivo(wmpDownloadItems[sid]["item"])){
					/*CLERT*/wmp_aalert("wmp_download:: ya existe sid:"+sid);
					wmpDownloadItems[sid]['item'].resume();
					wmpDownloadItems[sid]['status']=1;
					wmp_download_controleventsfire(sid,"resume");
				}else{
					/*CLERT*/wmp_aalert("wmp_download:: no existe sid:"+sid);
					wmpDownloadItems[sid]=new Array();
					if(!(wmpDownloadItems[sid]['item']=wmp_download_reutilizar(surl,sid))){
						wmpDownloadItems[sid]['item']=window.external.DownloadManager.getDownloadCollection(wmpDownloadCollection.id).startDownload(surl.toString(),'background');
					}else{
						wmpDownloadItems[sid]['item'].resume();
					}
					/*CLERT*/wmp_aalert("wmp_download:: pasa");
					wmpDownloadItems[sid]['additional']=additional;
					wmpDownloadItems[sid]['callback']=callback;
					wmpDownloadItems[sid]['idx']=wmpDownloadItemsIdx.length-1;
					wmpDownloadItems[sid]['status']=1;
					wmpDownloadItems[sid]['url']=surl;
					wmpDownloadItems[sid]['sid']=sid;
					wmpDownloadItemsIdx["item_"+(wmpDownloadCollection.count-1)]=sid;
					wmp_download_controleventsfire(sid,"start");
				}
			break;
			case "real time":
			default:
				if(wmpDownloadItems[sid]){
					/*CLERT*/wmp_aalert("wmp_download:: ya existe sid:"+sid);
					//si lo quiere bajar dos veces? lo baja dos veces
					wmpDownloadItems[sid]["item"]=wmpDownloadCollection.startDownload(surl,"real time");
					wmpDownloadItems[sid]['status']=1;
					wmp_download_controleventsfire(sid,"start");
				}else{
					/*CLERT*/wmp_aalert("wmp_download:: no existe sid:"+sid);
					wmpDownloadItems[sid]=new Array();
					if(!(wmpDownloadItems[sid]['item']=wmp_download_reutilizar(surl,sid))){
						wmpDownloadItems[sid]["item"]=wmpDownloadCollection.startDownload(surl,"real time");
					}
					wmpDownloadItems[sid]['additional']=additional;
					wmpDownloadItems[sid]['callback']=callback;
					wmpDownloadItems[sid]['idx']=wmpDownloadItemsIdx.length-1;
					wmpDownloadItems[sid]['status']=1;
					wmpDownloadItems[sid]['url']=surl;
					wmpDownloadItems[sid]['sid']=sid;
					wmpDownloadItemsIdx["item_"+(wmpDownloadCollection.count-1)]=sid;
					wmp_download_controleventsfire(sid,"start");
				}
		}
	}
	function wmp_isonlinestore(){
		if(window.external){
			try{
				if(window.external.DownloadManager){
					return true;
				}
			}catch(e){
			
			}
		}
		//return true; //FUERZO
		return false;
	}
	function wmp_version(){
		var nro="";
		if(window.external){
			if(window.external.version){
				nro=window.external.version.split(/\./,1);
				if(nro){
					try{
						nro=parseInt(nro);
					}catch(e){
					}
				}
				return nro;
			}
		}
		return -1;
	}
	function wmp_constant_downloadState(valor){
		var msg="";
		switch(valor){
			case 0: msg="downloading"; 	break;
			case 1: msg="paused";	   	break;
			case 2: msg="processing";	break;
			case 3: msg="completed";	break;
			case 4: msg="canceled";		break;
		}
		if(msg){
			if(document.getElementById("wmp_estados_"+msg)){
				msg=document.getElementById("wmp_estados_"+msg).innerHTML;
			}
		}
		return msg;
	}
	function wmp_constant_sizeprogress(msize,progress){
		try{
			if(msize){
				//round, floor, ceil
				return Math.floor(parseInt(progress)*100/parseInt(msize))+" %";
			}else{
				return "0 %";
			}
		}catch(e){
			return "0 %";
		}
	}
	function wmp_setCookie(sCookieName,sValue,bSession){
		var today = new Date();
		var zero_date = new Date(0,0,0);
		today.setTime(today.getTime() - zero_date.getTime());
		if(!bSession){
			var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000));
			var cookieString = sCookieName + "=" + escape(sValue) + ";expires=" + cookie_expire_date.toGMTString() + ";domain=" + document.location.hostname;
		}else{
			var cookieString = sCookieName + "=" + escape(sValue) + ";domain=" + document.location.hostname;
		}
		document.cookie = cookieString;
	}
	function wmp_getCookie(sCookieName){
		var start = document.cookie.indexOf(sCookieName+"=");
		var len = start + sCookieName.length + 1;
		if ((!start) && (sCookieName != document.cookie.substring(0,sCookieName.length))) return null;
		if (start == -1) return null;
		var end = document.cookie.indexOf(";",len);
		if (end == -1) end = document.cookie.length;
		var sReturn = unescape(document.cookie.substring(len,end));
		return sReturn;
	}


	var goWMPCAL=new Array();
	function wmp_accionControl(idContenido,idEncodeo,idReproduccion,oLink){ //ALIAS para wmp de cargarMaterialPlayer y boton_downloaddirecto
		try{
			if(oLink){					
				if(oLink.wasclicked){
					if((new Date().getTime()-oLink.wasclicked)<10000){
						/*CLERT*/alert("ClickControl - Ignorado");
						return true;
					}else{
						/*CLERT*/alert("ClickControl - Ya supero el tiempo lo considero nuevamente");
						oLink.wasclicked=new Date().getTime();
					}
				}else{
					/*CLERT*/alert("ClickControl - La primera vez que hace click");
					oLink.wasclicked=new Date().getTime();
				}
			}else{
				/*CLERT*/alert("ClickControl - No vino referenca al Link");
			}
			var oMaterial;
			var sUrl;
			var sUrlLic;
			/*CLERT*/alert("wmp_accionControl :: idContenido:"+idContenido+",idEncodeo"+idEncodeo+",idReproduccion:"+idReproduccion);
			if(idContenido){
				/*CLERT*/alert("wmp_accionControl :: Nuevos params");
				goWMPCAL["id_contenido"]=idContenido;
				goWMPCAL["id_encodeo"]=idEncodeo;
				goWMPCAL["id_reproduccion"]=idReproduccion;
			}else{
				/*CLERT*/alert("wmp_accionControl :: Reutiliza los params");
				idContenido=goWMPCAL["id_contenido"];
				idEncodeo=goWMPCAL["id_encodeo"];
				idReproduccion=goWMPCAL["id_reproduccion"];
			}
			/*CLERT*/alert("wmp_accionControl :: 2da Lectura idContenido:"+idContenido+",idEncodeo"+idEncodeo+",idReproduccion:"+idReproduccion);
			switch(idReproduccion){
				case 2:
				case "2":					
					oMaterial = obtenerMaterialDwl(idContenido,idEncodeo,idReproduccion);					
					if(wmp_controlarNoDisponibilidad(oMaterial)){
						return;
					}
					/*CLERT*/alert("wmp_accionControl :: Download");
					if (getStatusUsuario() != "logueado"){	
							/*CLERT*/alert("wmp_accionControl :: Enviandolo a Login");
							mostrarLogin(false,wmp_accionControl);
							return;
					}
					if(oMaterial){
						if(oMaterial["comprado"]!="S"){
							/*CLERT*/alert("wmp_accionControl :: Enviandolo a Comprar precio:"+oMaterial["precio"]+",moneda:"+oMaterial["moneda"]+",comprado:"+oMaterial["comprado"]+",adicionales:"+oMaterial["adicionales"]);
							vtc_irComprarPlayer(vtc_packinfo(null,null,idContenido,oMaterial["precio"],oMaterial["moneda"],oMaterial["comprado"],oMaterial["adicionales"],idEncodeo,2,null,null),wmp_accionControl);
							return;
						}else{
							if(oMaterial["puederegenerar"]=="N"){
								wmp_mostrarMensaje_noPuedeRegenerar(oMaterial);
								return;
							}
						}
					}
					sUrlLic="?id_material="+oMaterial["id_material"]+"&id_contenido="+oMaterial["id_contenido"]+"&id_encodeo="+idEncodeo;
					/*CLERT*/alert("wmp_accionControl :: Por bajar la licencia "+sUrlLic);
					wmp_cargarLicenciado(sUrlLic);
					try{
						/*CLERT*/alert("wmp_accionControl :: Por iniciar la descarga");
						wmp_download("mat_"+oMaterial["id_material"],oMaterial["url_material_hostayvdwl"]+oMaterial["url_material"],{'id_material':oMaterial["id_material"],'id_contenido':oMaterial["id_contenido"],'id_encodeo':idEncodeo,'filename':oMaterial["url_material"],'oMaterial':oMaterial},wmp_misDescargas_Manager);
						/*CLERT*/alert("wmp_accionControl :: Por mostrar MISDESCARGAS");
						wmp_mostrarMisDescargas();
					}catch(e){
						/*CLERT*/alert("wmp_accionControl :: ERROR al intentar descargar");
					}
				break;
				case 1:
				case "1":
				default:
					/*CLERT*/alert("wmp_accionControl :: Streaming");
					oMaterial = obtenerMaterialDwl(idContenido,idEncodeo,idReproduccion);
					if(wmp_controlarNoDisponibilidad(oMaterial)){
						return;
					}						
					if(oMaterial){
						if(oMaterial["comprado"]=="S"){
							sUrlLic = "?id_material="+oMaterial["id_material"]+"&id_contenido="+oMaterial["id_contenido"]+"&id_encodeo="+oMaterial["id_encodeo"];
						}else{
							sUrlLic = "?id_material="+oMaterial["id_material"]+"&preview=1"+"&id_contenido="+oMaterial["id_contenido"]+"&id_encodeo="+oMaterial["id_encodeo"];
						}
					}
					if(oMaterial["url_material_hostayv"]&&oMaterial["url_material"]){
						window.setTimeout(function () {wmp_cargarLicenciado(sUrlLic,oMaterial)},400);
					}else{
						/*CLERT*/alert("Play - No tiene la url de host: "+oMaterial["url_material_hostayv"]+", o material:"+oMaterial["url_material"]);
					}
				break;
			}
		}catch(e){
			//Aca algo paso
		}
	}
	function wmp_cargarLicenciado(sUrlLic,oMaterial){ //ALIAS para WMP de cargarLicenciado
		try{
			/*CLERT*/alert("URL LIC:"+sUrlLic);
			var oPlayer = obtenerReferenciaPlayer("player");
			try
			{
				getLicensePlayer(sUrlLic);
			}
			catch(e)
			{
				//
			}
			//setUrl(oPlayer,"/scripts/app/framework.php?APP="+APP_llamador+"&API=cargador&trackeable="+goCMaterial["trackeable"]+"&id_contenido="+goCMaterial["id_contenido"]+"&spot="+sPublicidad+"&id_encodeo="+goCMaterial["id_encodeo"]);
			if(oMaterial){
				/*CLERT*/alert(oMaterial["url_material_hostayv"]+"/"+oMaterial["url_material"]);
				//setUrl(oPlayer,oMaterial["url_material_hostayv"]+"/"+oMaterial["url_material"]);
				wmp_cargarPostLicencia(oMaterial["url_material_hostayv"]+"/"+oMaterial["url_material"]);
			}
		}catch(e){
			//Aca paso algo
		}
	}
	function wmp_cargarPostLicencia(sUrl)	//ALIAS para WMP de cargarPostLicencia
	{
		try{
			var oPlayer = obtenerReferenciaPlayer("player");
			// Esto es impresionante!!!
			var pStatus = VB_StubGetAsyncCallStatus();		
			/*CLERT*/alert("wmp_cargarPostLicencia :: Status:"+pStatus+",playState:"+oPlayer.playState+",url:"+sUrl);
			if (pStatus == 2){
				//Puedo reproducir si el player esta listo
				document.location=sUrl;
				/*
				if (oPlayer.playState == 10){
					oPlayer.controls.play();				
					gbPredeliveryFinalizado = false;
				}else{
					gbPredeliveryFinalizado = true;
				}
				*/
			}else{
				window.setTimeout(function () {wmp_cargarPostLicencia(sUrl);},1000);
			}
		}catch(e){
			//Aca paso algo
		}
	}
	function wmp_controlarNoDisponibilidad(oMaterial){
		if(oMaterial){
			if(oMaterial["url_material_hostayv"]&&oMaterial["url_material"]){
				wmp_controlarNoDisponibilidad_ocultarMensaje();
				return false;				
			}
		}
		wmp_controlarNoDisponibilidad_mostrarMensaje();
		return true;
	}
	function wmp_controlarNoDisponibilidad_mostrarMensaje(){
		if(document.getElementById("wmp_playdescarga_mensajeerror")){
			//document.getElementById("wmp_playdescarga_mensajeerror").style.display="block";
		}
	}
	function wmp_controlarNoDisponibilidad_ocultarMensaje(){
		if(document.getElementById("wmp_playdescarga_mensajeerror")){
			document.getElementById("wmp_playdescarga_mensajeerror").style.display="none";
		}	
	}
	function wmp_mostrarMensaje_noPuedeRegenerar(oMaterial){		
		NOPUEDEREGENERAR_OMATERIAL=oMaterial;
		if(document.getElementById(DIVVTC)){
			document.getElementById(DIVVTC).innerHTML=FWK.loadApp("html_estatico|principal|principal|principal","&principal[html]=wmp_nopuederegenerar.html");
		}					
		mostrarLogin(true);
		sendNotifyBack();	//Para integrarse con el VOLVER
	}
	function wmp_ocultarMensaje_noPuedeRegenerar(){
		ocultarLogin();
	}
	function wmp_noPuedeRegenerar_irComprar(){
		if(NOPUEDEREGENERAR_OMATERIAL){
			var oMaterial=NOPUEDEREGENERAR_OMATERIAL;		
			vtc_irComprarPlayer(vtc_packinfo(null,null,oMaterial["id_contenido"],oMaterial["precio"],oMaterial["moneda"],oMaterial["comprado"],oMaterial["adicionales"],oMaterial["id_encodeo"],2,null,null),wmp_accionControl);
		}
	}
	function wmp_FixFAlvarezWmp12(id_contenido){
		switch(""+id_contenido){
				case "281180":
				case "281343":
				case "289381":
				case "290154":
				case "290177":
				case "292470":
				case "292474":
				case "292485":
				case "292486":
				case "292493":
				case "292491":
				case "292495":
				case "292496":
				case "306003":
				case "306005":
				case "306006":
				case "306031":
				case "306030":
				case "306032":
				case "306033":
				case "306037":
				case "306059":
				case "319630":
				case "337167":
				case "349083":
				case "349084":
				case "349081":
				case "349085":
				case "349092":
				case "349090":
				case "349091":
				case "349093":
				return false;
		}
		return true;
	}
	
	
	
//**************  /js/scriptondemand.js ********* //
SCRIPT ={
	debug: false, 
	sdebug: "",
	COUNTREF: 0,
	EVALERROR: new Array(),
	SCRIPTCALLBACK: undefined,
	SCRIPTNUEVOS: new Array(),
	SCRIPTCURRENT: 0,
	addScript: function (src,id,language){
		var str;
		if(typeof language=="undefined"){
			language="javascript";
		}
		if(typeof id=="undefined"){
			str="<script language='"+language+"' src='"+src+"'></"+"script>";
		}else{
			str="<script language='"+language+"' id='"+id+"' src='"+src+"'></"+"script>";
		}
		this.scriptCheckText(str);	
	},
	scriptCheckText: function (texto,callback){
		this.scriptAlert("scriptCheckText","call",1);	
		var regresar=true;
		if(texto){
			this.scriptAlert("scriptCheckText","Texto: "+texto,2);
			texto=texto.replace(/\n/g,"#@NL@#");
			var oScriptsNuevos=texto.match(/<[ \t]*script[^>]*?>.*?<\/[ \t]*script[ \t]*>/gim);
			this.scriptAlert("scriptCheckText","Nuevos: "+oScriptsNuevos,2);			
			if(oScriptsNuevos&&oScriptsNuevos.length){
				this.SCRIPTCALLBACK=callback;
				this.SCRIPTNUEVOS=oScriptsNuevos;
				this.SCRIPTCURRENT=0;
				regresar=false;								
			}else{				
				this.scriptAlert("scriptCheckText","NoScripts",1);
			}
		}else{
			this.scriptAlert("scriptCheckText","NoTexto",1);
			
		}
		this.scriptAlert("scriptCheckText","End",1);			
		if(regresar){
			callback();
		}else{
			this.scriptAsyncCheckText();
		}
	},
	scriptAsyncCheckText: function(){
		this.scriptAlert("scriptAsyncCheckText","call",1);
		var terminarejecucion=false;
		if(this.SCRIPTNUEVOS){
			this.scriptAlert("scriptAsyncCheckText","ScriptCurrent:"+this.SCRIPTCURRENT,1);
			this.scriptAlert("scriptAsyncCheckText","ScriptNuevos:"+this.SCRIPTNUEVOS.length,1);			
			if(this.SCRIPTCURRENT<this.SCRIPTNUEVOS.length){
				if(this.SCRIPTNUEVOS[this.SCRIPTCURRENT]){
					this.SCRIPTCURRENT++;
					this.scriptAsyncCheckTextProcess(this.SCRIPTNUEVOS[this.SCRIPTCURRENT-1]);						
				}
			}else{				
				terminarejecucion=true;
				
			}
		}else{
			terminarejecucion=true;
		}
		this.scriptAlert("scriptAsyncCheckText","Terminar ejecucion : "+terminarejecucion,1);
		if(terminarejecucion){
			this.scriptAsyncCheckTextEnd();			
		}
	},
	scriptAsyncCheckTextProcess: function(oScriptsNuevos){
		this.scriptAlert("scriptAsyncCheckTextProcess","Call",1);
		var oHead=document.getElementsByTagName("HEAD")[0];
		var oScriptNuevo;
		var bAgregar=true;				
		oScriptsNuevos_info=this.scriptParseTag(oScriptsNuevos);
		if(!oScriptsNuevos_info.defer){
			this.scriptAlert("scriptAsyncCheckTextProcess","Src:"+oScriptsNuevos_info.src,1);
			if(oScriptsNuevos_info.src){ //&&PASO==0
				if(!this.scriptIsLoaded(oScriptsNuevos_info.src,oScriptsNuevos_info.id)){
					try{
						if(oScriptsNuevos_info.id){
							this.scriptAlert("scriptAsyncCheckTextProcess","DO Try Change",1);
							if(document.getElementById(oScriptsNuevos_info.id)){
								this.scriptAlert("scriptAsyncCheckTextProcess","DO  Changed",1);
								document.getElementById(oScriptsNuevos_info.id).src=oScriptsNuevos_info.src;
								bAgregar=false;
							}
						}
						if(bAgregar){
							this.scriptAlert("scriptAsyncCheckTextProcess","DO  Adding",1);
							oScriptNuevo=document.createElement("SCRIPT");
							oScriptNuevo.src=oScriptsNuevos_info.src;
							if(oScriptsNuevos_info.language)
								oScriptNuevo.language=oScriptsNuevos_info.language;
							if(oScriptsNuevos_info.type)
								oScriptNuevo.type=oScriptsNuevos_info.type;
							if(oScriptsNuevos_info.eventfor)
								oScriptNuevo.setAttribute("for",oScriptsNuevos_info.eventfor);
							if(oScriptsNuevos_info.eventevent)
								oScriptNuevo.setAttribute("event",oScriptsNuevos_info.eventevent);
							/*Atachar un manager de count reference*/
							//oScriptNuevo.onreadystatechange=function (){SCRIPT.attachRef(oScriptNuevo);};
							//this.COUNTREF++;
							//oHead.appendChild(oScriptNuevo);
							//this.appendChildAjax(oHead,oScriptNuevo);
							/**/
							var sScriptContenido;
							var oScript=oScriptNuevo;
							if(oScript.language=="vbscript"){
								this.scriptAlert("scriptAsyncCheckTextProcess","DO  Adding in Head",1);
								oHead.appendChild(oScript);
							}else{
								if(oScript.src){				
									this.scriptAlert("scriptAsyncCheckTextProcess","DO  request async of js",1);
									FWK.ahah_open_getcallback(oScript.src,"SCRIPT.scriptAsyncCheckTextProcessEval");
									return;
									/*
									sScriptContenido=FWK.ahah_open_get(oScript.src,null);
									if(sScriptContenido){
										this.scriptAlert("appendChildAjax","DO  Eval",1);
										//prompt("","SCRIPT SRC:"+oScript.src+"\n"+sScriptContenido,"");
										eval(sScriptContenido);
										if(typeof cargarPlayListDefault!="undefined"){
											//alert("FUNCION LOCAL: "+cargarPlayListDefault);
										}
										//alert("FUNCION GLOBAL: "+window.cargarPlayListDefault);
									}
									*/
								}		
							}										
						}
					}catch(e){
						this.scriptAlert("scriptCheck","Exception "+e.name+","+e.message,1);
					}
				}else{
					this.scriptAlert("scriptCheck","DO  Ign Already Loading",1);
				}
			}else if(oScriptsNuevos_info.text&&!oScriptsNuevos_info.src){ //&&PASO==1
				this.scriptAlert("scriptCheck","DO  Interpret",1);
				if(oScriptsNuevos_info.eventevent||oScriptsNuevos_info.eventfor){
					if(oScriptsNuevos_info.eventevent&&oScriptsNuevos_info.eventfor&&oScriptsNuevos_info.text){
						if(document.getElementById(oScriptsNuevos_info.eventfor)){
							this.scriptAlert("scriptCheck","DO  Attach for:"+oScriptsNuevos_info.eventfor+",event:"+oScriptsNuevos_info.eventevent,1);
							document.getElementById(oScriptsNuevos_info.eventfor).attachEvent(oScriptsNuevos_info.eventevent,function () { eval(oScriptsNuevos_info.text);});
						}
					}
				}else{
					try{
						this.scriptAlert("scriptCheck","DO  Eval ing",1);
						self.eval(oScriptsNuevos_info.text);
					}catch(e){
						this.scriptAlert("scriptCheck","DO  Add to error on eval",1);
						this.EVALERROR.push(oScriptsNuevos_info);
					}
				}
			}else{
				this.scriptAlert("scriptCheck ","DO  Nada PASO:"+PASO,1);
			}
		}else{
			this.scriptAlert("scriptCheck","DO  IgnDefer",1);
		}
		this.scriptAsyncCheckText();
	},
	scriptAsyncCheckTextProcessEval: function(req){
		this.scriptAlert("scriptAsyncCheckTextProcessEval","Request async OK eval",1);		
		eval(req.responseText);
		this.scriptAlert("checkPLAYLIST","cargarPlayListContenido:"+window.cargarPlayListContenido);
		this.scriptAlert("checkPLAYLIST","cargarPlayListContenido:"+typeof cargarPlayListContenido);
		setTimeout("SCRIPT.scriptAsyncCheckText();",100);
	},
	scriptAsyncCheckTextEnd: function(){
		this.scriptAlert("scriptAsyncCheckTextEnd","Finalizacion, reingresar al flujo",1);		
		if(this.SCRIPTCALLBACK){
			this.SCRIPTCALLBACK();
		}
	},
	scriptCheckTextOld: function (texto){
		this.scriptAlert("scriptCheckTEXT","call",1);
		var oHead=document.getElementsByTagName("HEAD")[0];
		var oScriptNuevo;
		var bAgregar;
		if(texto){
			this.scriptAlert("scriptCheckTEXT","Texto: "+texto,2);
			texto=texto.replace(/\n/g,"#@NL@#");
			var oScriptsNuevos=texto.match(/<[ \t]*script[^>]*?>.*?<\/[ \t]*script[ \t]*>/gim);
			this.scriptAlert("scriptCheckTEXT","Nuevos: "+oScriptsNuevos,2);
			var oScriptsNuevos_info;
			if(oScriptsNuevos&&oScriptsNuevos.length){
				this.scriptAlert("scriptCheckTEXT","Cantidad n "+oScriptsNuevos.length,1);
				for(var PASO=0;PASO<2;PASO++){
				for(var j=0;j<oScriptsNuevos.length;j++){
					this.scriptAlert("scriptCheckTEXT","Iteration j "+j,1);
					bAgregar=true;
					oScriptsNuevos_info=this.scriptParseTag(oScriptsNuevos[j]);
					if(!oScriptsNuevos_info.defer){
						this.scriptAlert("scriptCheckTEXT","Src:"+oScriptsNuevos_info.src,1);
						if(oScriptsNuevos_info.src&&PASO==0){
							if(!this.scriptIsLoaded(oScriptsNuevos_info.src,oScriptsNuevos_info.id)){
								try{
									if(oScriptsNuevos_info.id){
										this.scriptAlert("scriptCheckTEXT","DO Try Change",1);
										if(document.getElementById(oScriptsNuevos_info.id)){
											this.scriptAlert("scriptCheckTEXT","DO  Changed",1);
											document.getElementById(oScriptsNuevos_info.id).src=oScriptsNuevos_info.src;
											bAgregar=false;
										}
									}
									if(bAgregar){
										this.scriptAlert("scriptCheckTEXT","DO  Adding",1);
										oScriptNuevo=document.createElement("SCRIPT");
										oScriptNuevo.src=oScriptsNuevos_info.src;
										if(oScriptsNuevos_info.language)
											oScriptNuevo.language=oScriptsNuevos_info.language;
										if(oScriptsNuevos_info.type)
											oScriptNuevo.type=oScriptsNuevos_info.type;
										if(oScriptsNuevos_info.eventfor)
											oScriptNuevo.setAttribute("for",oScriptsNuevos_info.eventfor);
										if(oScriptsNuevos_info.eventevent)
											oScriptNuevo.setAttribute("event",oScriptsNuevos_info.eventevent);
										/*Atachar un manager de count reference*/
										oScriptNuevo.onreadystatechange=function (){SCRIPT.attachRef(oScriptNuevo);};
										this.COUNTREF++;
										//oHead.appendChild(oScriptNuevo);
										//this.appendChildAjax(oHead,oScriptNuevo);
										/**/
										var sScriptContenido;
										var oScript=oScriptNuevo;
										if(oScript.language=="vbscript"){
											this.scriptAlert("appendChildAjax","DO  Adding in Head",1);
											oHead.appendChild(oScript);
										}else{
											if(oScript.src){				
												sScriptContenido=FWK.ahah_open_get(oScript.src,null);
												if(sScriptContenido){
													this.scriptAlert("appendChildAjax","DO  Eval",1);
													//prompt("","SCRIPT SRC:"+oScript.src+"\n"+sScriptContenido,"");
													eval(sScriptContenido);
													if(typeof cargarPlayListDefault!="undefined"){
														//alert("FUNCION LOCAL: "+cargarPlayListDefault);
													}
													//alert("FUNCION GLOBAL: "+window.cargarPlayListDefault);
												}
											}		
										}										
										/**/
										/*Esperar hasta 5 segundos que cargue el JS*/
										/*
										var waitTimeStart=new Date().getTime();
										var waitTimeEnd=waitTimeStart;
										while(oScriptNuevo.readyState!="complete"&&oScriptNuevo.readyState!="loaded"&&(waitTimeEnd-waitTimeStart)<5000){
											waitTimeEnd=new Date().getTime();
										}
										this.scriptAlert("scriptCheckTEXT","Salio del Add con readyState:"+oScriptNuevo.readyState,1);
										//window.status=oScriptNuevo.readyState+" "+oScriptNuevo.src;
										/**/
										/**/
										
									}
								}catch(e){
									this.scriptAlert("scriptCheck","Exception "+e.name+","+e.message,1);
								}
							}else{
								this.scriptAlert("scriptCheck","DO  Ign Already Loading",1);
							}
						}else if(oScriptsNuevos_info.text&&!oScriptsNuevos_info.src&&PASO==1){
							this.scriptAlert("scriptCheck","DO  Interpret",1);
							if(oScriptsNuevos_info.eventevent||oScriptsNuevos_info.eventfor){
								if(oScriptsNuevos_info.eventevent&&oScriptsNuevos_info.eventfor&&oScriptsNuevos_info.text){
									if(document.getElementById(oScriptsNuevos_info.eventfor)){
										this.scriptAlert("scriptCheck","DO  Attach for:"+oScriptsNuevos_info.eventfor+",event:"+oScriptsNuevos_info.eventevent,1);
										document.getElementById(oScriptsNuevos_info.eventfor).attachEvent(oScriptsNuevos_info.eventevent,function () { eval(oScriptsNuevos_info.text);});
									}
								}
							}else{
								try{
									this.scriptAlert("scriptCheck","DO  Eval ing",1);
									self.eval(oScriptsNuevos_info.text);
								}catch(e){
									this.scriptAlert("scriptCheck","DO  Add to error on eval",1);
									this.EVALERROR.push(oScriptsNuevos_info);
								}
							}
						}else{
							this.scriptAlert("scriptCheck ","DO  Nada PASO:"+PASO,1);
						}
					}else{
						this.scriptAlert("scriptCheck","DO  IgnDefer",1);
					}
				}
				}
			}else{
				this.scriptAlert("scriptCheck","NoScripts",1);
			}
		}
		this.scriptAlert("scriptCheck","End",1);
	},
	scriptParseTag: function (texto){
		var res=new Array();
		var tmp;
		if(texto){
			tmp=texto.match(/id='([^']*?)'|id="([^"]*?)"/i);
			if(tmp){
				if(tmp[1]){
					res.id=tmp[1];
				}else{
					res.id=tmp[2];
				}
			}
			tmp=texto.match(/src='([^']*?)'|src="([^"]*?)"/i);
			if(tmp){
				if(tmp[1]){
					res.src=tmp[1];
				}else{
					res.src=tmp[2];
				}
			}
			tmp=texto.match(/defer='([^']*?)'|defer="([^"]*?)"/i);
			if(tmp){
				if(tmp[1]){
					res.defer=tmp[1];
				}else{
					res.defer=tmp[2];
				}
			}			
			if(!res.defer){
				tmp=texto.match(/[^a-z]+defer[^a-z]?/i);				
				if(tmp){
					res.defer="yes";
				}
			}
			res.defer=undefined;
			tmp=texto.match(/language='([^']*?)'|language="([^"]*?)"/i);
			if(tmp){
				if(tmp[1]){
					res.language=tmp[1];
				}else{
					res.language=tmp[2];
				}
			}
			tmp=texto.match(/for='([^']*?)'|for="([^"]*?)"/i);
			if(tmp){
				if(tmp[1]){
					res.eventfor=tmp[1];
				}else{
					res.eventfor=tmp[2];
				}
			}			
			tmp=texto.match(/event='([^']*?)'|event="([^"]*?)"/i);
			if(tmp){
				if(tmp[1]){
					res.eventevent=tmp[1];
				}else{
					res.eventevent=tmp[2];
				}
			}	
			tmp=texto.match(/type='([^']*?)'|type="([^"]*?)"/i);
			if(tmp){
				if(tmp[1]){
					res.language=tmp[1];
				}else{
					res.language=tmp[2];
				}
			}			
			tmp=texto.match(/<[ \t]*script[^>]*?>(.*?)<\/[ \t]*script[ \t]*>/i);
			if(tmp){
				res.text=tmp[1];
				res.text=res.text.replace(/#@NL@#/g,"\n");
			}
		}
		this.scriptAlert("scriptParseTag","Results \n"+
			  "id:"+res.id+"\n"+
			  "src:"+res.src+"\n"+
			  "language:"+res.language+"\n"+
			  "text:"+res.text+"\n"+
			  "defer:"+res.defer+"\n"+
			  "type:"+res.type+"\n"+
			  "eventevent:"+res.eventevent+"\n"+
			  "eventfor:"+res.eventfor+"\n"+
			  "WITH:\n\n"+texto+
			  "",1);
		return res;
	},
	scriptIsLoaded: function (src,name){
		var oHead=document; //document.getElementsByTagName("HEAD")[0]; //chekea en toda la pagina
		var oScriptsActuales=oHead.getElementsByTagName("SCRIPT");
		var sinDominio;
		this.scriptAlert("scriptIsLoaded","call",1);
		if(oScriptsActuales){
			this.scriptAlert("scriptIsLoaded","length: "+oScriptsActuales.length,2);
			if(typeof name=="undefined"){
				for(var j=0;j<oScriptsActuales.length;j++){
					this.scriptAlert("scriptIsLoaded","src: "+oScriptsActuales[j].src,2);
					sinDominio=oScriptsActuales[j].src+"";
					sinDominio=sinDominio.replace("http://"+window.location.hostname,"");
					if(oScriptsActuales[j].src==src||src==sinDominio){
						return true;
					}
				}
			}else{
				for(var j=0;j<oScriptsActuales.length;j++){
					this.scriptAlert("scriptIsLoaded","id: "+oScriptsActuales[j].id,2);
					if((oScriptsActuales[j].id==name||oScriptsActuales[j].name==name)&&(oScriptsActuales[j].src==src||!src)){
						return true;
					}
				}
			}
		}
		return false;
	},
	scriptAlert: function (funcion,cadena,nivel){
		this.debug=FWK.debug;
		this.sdebug+=funcion+" :: "+cadena+"\n";
		if(this.debug){						
				if(this.debug=="all"){
					alert(funcion+" :: "+cadena);
				}else{
					if(this.debug==nivel){
						alert(funcion+" :: "+cadena);
					}
				}
		}
	},
	attachRef: function (oScript){	
		//alert(oScript.src+" "+oScript.readyState+" "+SCRIPT.COUNTREF);
		//window.status=oScript.src+" "+oScript.readyState+" "+SCRIPT.COUNTREF;
		if(oScript.readyState=="complete"||oScript.readyState=="loaded"){
			SCRIPT.COUNTREF--;
		}
		if(SCRIPT.COUNTREF==0){
			SCRIPT.processEvalError();
		}
		if(oScript.readyState=="complete"||oScript.readyState=="loaded"){
			oScript.onreadystatechange=null;
		}
	},
	processEvalError: function (){
		this.scriptAlert("processEvalError","Call",1);
		//alert("processEvalError call "+this.EVALERROR.length);
		//window.status="processEvalError call "+this.EVALERROR.length;
		if(this.EVALERROR.length){
			for(var i=0;i<this.EVALERROR.length;i++){
				//try{
					this.scriptAlert("processEvalError","DO  Eval script with Error previously",1);
					//alert("processEvalError DO EVAL "+this.EVALERROR[i].text);
					self.eval(this.EVALERROR[i].text);
				//}catch(e){
				//}
			}
		}
	},
	appendChildAjax: function (oHead,oScript){
		var sScriptContenido;
		if(oScript.language=="vbscript"){
			this.scriptAlert("appendChildAjax","DO  Adding in Head",1);
			oHead.appendChild(oScript);
		}else{
			if(oScript.src){				
				sScriptContenido=FWK.ahah_open_get(oScript.src,null);
				if(sScriptContenido){
					this.scriptAlert("appendChildAjax","DO  Eval",1);
					//prompt("","SCRIPT SRC:"+oScript.src+"\n"+sScriptContenido,"");
					eval(sScriptContenido);
					if(typeof cargarPlayListDefault!="undefined"){
						//alert("FUNCION LOCAL: "+cargarPlayListDefault);
					}
					//alert("FUNCION GLOBAL: "+window.cargarPlayListDefault);
				}
			}		
		}
	}
}
//**************  /js/backforward_mixplay.js ********* //
var GL_PREVG=0;
var GL_PREVMSG;
var GL_STEP=0;

/*
var GL_CACHE_TAM=8;
var GL_CACHE_MAX=7;
var GL_CACHE_MIN=0;
*/
var GL_CACHE_TAM=16;
var GL_CACHE_MAX=15;
var GL_CACHE_MIN=0;

var GL_CACHE_POS=-1;
var GL_CACHE=new Array();

var GL_CACHE_HOME;
var GL_PREV_ONLOAD;	//Por ahora no modificamos el onload

function saveHome(){
	GL_CACHE_HOME=getSnapshoot();
}
function malert(cadena){
	//document.getElementById("TxTDebug").value=document.getElementById("TxTDebug").value+"\n"+cadena;
}
function getSnapshoot(reloadIsNeed){
	malert("getSnapshoot :: ");
	var aTmp=new Array();
	aTmp["content"]=new Array();
	aTmp["content_player"]=new Array();
	aTmp["region_playerlogin"]=new Array();
	aTmp["reloadIsNeed"]=reloadIsNeed;	
	aTmp["nav"]=new Array();
	aTmp["ruta"]=new Array();
	if(typeof getSkinCurrent!="undefined")
		aTmp["currentSkin"]=getSkinCurrent();
	else
		aTmp["currentSkin"]="";
	if(document.getElementById("content")){
		aTmp["content"]["innerHTML"]=document.getElementById("content").innerHTML;
		aTmp["content"]["display"]=document.getElementById("content").style.display;	
	}
	if(document.getElementById("content_player")){
		aTmp["content_player"]["display"]=document.getElementById("content_player").style.display;	
	}
	if(document.getElementById("region_playerlogin")){
		aTmp["region_playerlogin"]["innerHTML"]=document.getElementById("region_playerlogin").innerHTML;
		aTmp["region_playerlogin"]["display"]=document.getElementById("region_playerlogin").style.display;
	}
	if(document.getElementById("nav")){
		aTmp["nav"]["innerHTML"]=document.getElementById("nav").innerHTML;
		aTmp["nav"]["display"]=document.getElementById("nav").style.display;
	}
	if(document.getElementById("ruta")){
		aTmp["ruta"]["innerHTML"]=document.getElementById("ruta").innerHTML;
		aTmp["ruta"]["display"]=document.getElementById("ruta").style.display;
	}	
	return aTmp;
}
function loadSnapshoot(aTmp){
	malert("loadSnapshoot :: aTmp:"+(typeof aTmp));
	if(aTmp){		
		if(aTmp["currentSkin"]){
			if(typeof onSkinChange!="undefined"){
				onSkinChange(aTmp["currentSkin"]);
			}
		}
		if(aTmp["content"]){
			malert("loadSnapshoot contentDisplay "+aTmp["content"]["display"]);
			if(document.getElementById("content")){
				document.getElementById("content").innerHTML=aTmp["content"]["innerHTML"];
				document.getElementById("content").style.display=aTmp["content"]["display"];	
			}
		}
		if(aTmp["content_player"]){
			malert("loadSnapshoot contentplayerDisplay "+aTmp["content_player"]["display"]);
			if(document.getElementById("content_player")){
				document.getElementById("content_player").style.display=aTmp["content_player"]["display"];	
			}
		}
		if(aTmp["region_playerlogin"]){
			malert("loadSnapshoot regionplayerloginDisplay "+aTmp["region_playerlogin"]["display"]);
			if(document.getElementById("region_playerlogin")){
				document.getElementById("region_playerlogin").innerHTML=aTmp["region_playerlogin"]["innerHTML"];
				document.getElementById("region_playerlogin").style.display=aTmp["region_playerlogin"]["display"];
			}	
		}
		if(aTmp["nav"]){
			malert("loadSnapshoot navDisplay "+aTmp["nav"]["display"]);
			if(document.getElementById("nav")){
				document.getElementById("nav").innerHTML=aTmp["nav"]["innerHTML"];
				document.getElementById("nav").style.display=aTmp["nav"]["display"];
			}	
		}
		if(aTmp["ruta"]){
			malert("loadSnapshoot rutaDisplay "+aTmp["ruta"]["display"]);
			if(document.getElementById("ruta")){
				document.getElementById("ruta").innerHTML=aTmp["ruta"]["innerHTML"];
				document.getElementById("ruta").style.display=aTmp["ruta"]["display"];
			}	
		}			
	}
}
function saveSnapshoot(reloadIsNeed){		
	GL_CACHE_POS++;
	if(GL_CACHE_POS<=GL_CACHE_MAX&&GL_CACHE_POS>=GL_CACHE_MIN){
		GL_CACHE[GL_CACHE_POS-GL_CACHE_MIN]=getSnapshoot();
		malert("saveSnapshootMode :: Usa: "+(GL_CACHE_POS-GL_CACHE_MIN));
	}else{
		malert("saveSnapshootMode :: Push");
		GL_CACHE.push(getSnapshoot());
	}
	if(GL_CACHE.length>GL_CACHE_TAM){
		GL_CACHE_MIN=GL_CACHE_POS-(GL_CACHE_TAM-1);
		GL_CACHE_MAX=GL_CACHE_POS;
		GL_CACHE.shift();
	}
	malert("saveSnapshootEnd :: "+", GL_CACHE_MIN:"+GL_CACHE_MIN+",GL_CACHE_POS:"+GL_CACHE_POS+",GL_CACHE_MAX:"+GL_CACHE_MAX);		
	/*
	//GL_CACHE.push(getSnapshoot());
	GL_CACHE[GL_CACHE_POS-GL_CACHE_MIN]=getSnapshoot(reloadIsNeed);
	if(GL_CACHE_POS-GL_CACHE_MIN>GL_CACHE_MAX){
		GL_CACHE_MIN=GL_CACHE_POS-GL_CACHE_MAX;
		//GL_CACHE.shift(); //elimino el primer elemento
	}
	malert("saveSnapshoot "+", GL_CACHE_MIN:"+GL_CACHE_MIN+",GL_CACHE_POS:"+GL_CACHE_POS);	
	*/
}
function restoreSnapshoot(vpos){
	malert("restoreSnapshoot :: vpos:"+vpos+", GL_CACHE_MIN:"+GL_CACHE_MIN+",GL_CACHE_POS:"+GL_CACHE_POS+",GL_CACHE_MAX:"+GL_CACHE_MAX);
	if(vpos<=GL_CACHE_MAX&&vpos>=GL_CACHE_MIN){
		loadSnapshoot(GL_CACHE[vpos-GL_CACHE_MIN]);
		GL_CACHE_POS=vpos;
	}else{
		manageHome();
	}
}
function manageStep(i,test){
	if(i<GL_CACHE_MIN){
		manageHome();
	}else{
		GL_STEP=i;
		//document.getElementById("paso_actual").value=GL_STEP;
		restoreSnapshoot(parseInt(i));
		GL_STEP=i+1;
	}
	
}
function manageHome(){
	//alert("VOY A HOME");
	if(GL_CACHE_HOME){
		loadSnapshoot(GL_CACHE_HOME);
	}else{
		treeOnStart();
	}
}

function getNotifyBack(mensaje,i){
	malert("getNotifyBack :: mensaje:"+mensaje+" i:"+i);
	var vstep;
	if(i){
		GL_PREVMSG=mensaje;
	}else{
		if(GL_PREVMSG){
		vstep=mensaje.replace(/[^_]+_/,"");
		if(parseInt(vstep)){
			malert("restoreSnapshoot :: vstep:"+parseInt(vstep)+"-gl_prevmsg:"+GL_PREVMSG+",mensaje:"+mensaje);
			manageStep(parseInt(vstep)-1,"backbrowser");
		}else{
			malert("restoreSnapshoot :: NaN");	
			manageStep(-1,"backbrowser");
		}
		}
		GL_PREVMSG="";
	}
	/*
	if(i){
		vstep=mensaje.replace(/[^_]+_/,"");
		if(parseInt(vstep)){
			manageStep(parseInt(vstep)-1,1);
		}
	}
	*/
	/*
	var vstep;
	if(GL_PREVG){
		if(mensaje){
			if(mensaje=="firstload"){
				manageStep(0);
				if(window.frames["frm_all_back"]){
					window.frames["frm_all_back"].nobubble=false;
				}				
			}else{
			vstep=mensaje.replace(/[^_]+_/,"");
			if(vstep){
				if(parseInt(vstep)){
					manageStep(parseInt(vstep));
					if(window.frames["frm_all_back"]){
						window.frames["frm_all_back"].nobubble=false;
					}
				}
			}
			}
		}
		GL_PREVG=0;
	}else{
		if(i){
			GL_PREVG=1;
		}
	}
	*/
}
function sendNotifyBack(mensaje){
	if(typeof mensaje=="undefined"){
		GL_STEP++
		mensaje=GL_STEP;
	}
	malert("sendNotifyBack :: mensaje:"+mensaje);
	saveSnapshoot();
	//document.getElementById("paso_actual").value=mensaje;
	var rand=new Date().getTime();
	if(mensaje!="firstload"){
		if(window.frames["frm_all_back"]){
			window.frames["frm_all_back"].nobubble=true;
			window.frames["frm_all_back"].document.location="/backload.html?random="+rand+"&stepactual="+mensaje;
		}
	}
}

/*
function treeOnStart(){
	malert("VOLVI A LA HOME");
}
function mostrarLogin(nro){
	if(document.getElementById("region_playerlogin")){
		document.getElementById("region_playerlogin").innerHTML=document.getElementById("region_playerlogin").innerHTML.replace(/X[0-9]*X/,"X"+nro+"X");
		document.getElementById("region_playerlogin").style.display="block";
	}
	document.getElementById("content").style.display="none";
	document.getElementById("content_player").style.display="none";
}
function mostrarHome(nro){
	if(document.getElementById("content")){
		document.getElementById("content").innerHTML=document.getElementById("content").innerHTML.replace(/X[0-9]*X/,"X"+nro+"X");
		document.getElementById("content").style.display="block";
	}
	document.getElementById("region_playerlogin").style.display="none";
	document.getElementById("content_player").style.display="none";
}
function mostrarPlayer(nro){
	if(document.getElementById("content_player")){
		document.getElementById("content_player").innerHTML=document.getElementById("content_player").innerHTML.replace(/X[0-9]*X/,"X"+nro+"X");
		document.getElementById("content_player").style.display="block";
	}
	document.getElementById("region_playerlogin").style.display="none";
	document.getElementById("content").style.display="none";
}
function malert(cadena){
	document.getElementById("TxTDebug").value=document.getElementById("TxTDebug").value+"\n"+cadena;
	alert(cadena);
}

function refrescarMolesto(nro){
	window.frames["molesto"+nro].location="blank.html?rnd="+(new Date().getTime());
}
*/
//**************  /js/swfobjects.js ********* //
// JavaScript Document
/**
 * SWFObject v1.4.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed wmode='transparent' type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
_19+="<param name=\"WMode\" value=\"transparent\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){
var _25=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);_25=new deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_23&&_25.major>_23.major){return _25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}
catch(e){}}}return _25;};
deconcept.PlayerVersion=function(_29){
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;
this.minor=parseInt(_29[1])||0;
this.rev=parseInt(_29[2])||0;};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}return true;};
deconcept.util={getRequestParameter:function(_2b){
var q=document.location.search||document.location.hash;
if(q){var _2d=q.indexOf(_2b+"=");
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;
if(q.length>1&&_2d>-1){return q.substring(q.indexOf("=",_2d)+1,_2e);}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
var _2f=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2f.length;i++){
for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=null;}}}};
if(typeof window.onunload=="function"){
var oldunload=window.onunload;
window.onunload=function(){deconcept.SWFObjectUtil.cleanupSWFs();oldunload();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}
if(Array.prototype.push==null){
Array.prototype.push=function(_32){
this[this.length]=_32;
return this.length;};}

var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for backwards compatibility
var SWFObject = deconcept.SWFObject;
//**************  /js/fest.js ********* //
/****************************************************************************************************/
/*
clase integrante
*/
	function validar_integrante_form(){
	var bvalido = true;
        if(this.nombre == ""){
			bvalido = false;
            this.error_nombre = true;
		}

		if(!(/^[0-9]{2}.?[0-9]{3}.?[0-9]{3}$/.test(this.dni))){
			bvalido = false
            this.error_dni = true;
		}
		
        if(!valDatoDate(this.fecha_nacimiento)){
			bvalido = false;
			this.error_fecha = true;
		}
		
        if(this.funcion_en_banda == ""){
			bvalido = false;
            this.error_funcion_en_banda = true;
		}
		return bvalido;
	}

    function validar_integrante(){
        if((this.nombre == "") && (this.dni == "") && (this.fecha_nacimiento == "") && (this.funcion_en_banda == ""))
            return false;

        return true;
    }

    function integrante(nombre, dni, fecha_nacimiento, funcion_en_banda){
    var nombre, dni, fecha_nacimiento, funcion_en_banda;
	var error_nombre, error_dni, error_fecha_nacimiento, error_funcion_en_banda;

        this.nombre = nombre;
        this.dni = dni;
        this.fecha_nacimiento = fecha_nacimiento;
        this.funcion_en_banda = funcion_en_banda;
        
		this.error_nombre = false;
        this.error_dni = false;
        this.error_fecha_nacimiento = false;
        this.error_funcion_en_banda = false;
		
        this.validar = validar_integrante;
		this.validar_form = validar_integrante_form;
    }
/*fin de clase integrante*/


//calcular la edad de una persona 
//recibe la fecha como un string en formato español 
//devuelve un entero con la edad. Devuelve false en caso de que la fecha sea incorrecta o mayor que el dia actual 
function calcular_edad(fecha){

	//calculo la fecha de hoy 
	hoy=new Date() 
	//alert(hoy) 

	//calculo la fecha que recibo 
	//La descompongo en un array 
	var array_fecha = fecha.replace(/\//g, "-").split("-")
	//si el array no tiene tres partes, la fecha es incorrecta 
	if (array_fecha.length!=3) 
	   return false 

	//compruebo que los ano, mes, dia son correctos 
	var ano 
	ano = parseInt(array_fecha[2]); 
	if (isNaN(ano)) 
	   return false 

	var mes 
	mes = parseInt(array_fecha[1]); 
	if (isNaN(mes)) 
	   return false 

	var dia 
	dia = parseInt(array_fecha[0]); 
	if (isNaN(dia)) 
	   return false 


	//si el año de la fecha que recibo solo tiene 2 cifras hay que cambiarlo a 4 
	if (ano<=99) 
	   ano +=1900;

	//resto los años de las dos fechas 
	edad = hoy.getYear()- ano - 1; //-1 porque no se si ha cumplido años ya este año 

	//si resto los meses y me da menor que 0 entonces no ha cumplido años. Si da mayor si ha cumplido 
	if (hoy.getMonth() + 1 - mes < 0) //+ 1 porque los meses empiezan en 0 
	   return edad 
	if (hoy.getMonth() + 1 - mes > 0) 
	   return edad+1 

	//entonces es que eran iguales. miro los dias 
	//si resto los dias y me da menor que 0 entonces no ha cumplido años. Si da mayor o igual si ha cumplido 
	if (hoy.getUTCDate() - dia >= 0) 
	   return edad + 1 

	return edad;
}/*fin de calcular_edad*/


function promedioEdadIntegrantes(a_integrantes){
var sumar_edad = 0;
	if(a_integrantes.length>0){
		for(i=0;i<a_integrantes.length;i++){
			sumar_edad += calcular_edad(a_integrantes[i].fecha_nacimiento);
		}
		return (sumar_edad / a_integrantes.length);
	}else{
		return 0;
	}
}



/****************************************************************************************************/
/****************************************************************************************************/
/****************************************************************************************************/

function display_div(nombre, valor){
	div_html = document.getElementById(nombre);
	div_html.style.display = valor;
}

function valDatoDate(value){
	if(/^[0-9]{1,2}(-|\/)[0-9]{1,2}(-|\/)([0-9]{2}|[0-9]{4})$/.test(value)){
		return true;
	}
	return false;
}

function valDatoInt(value){
	if (value != "" && !isNaN(value)){
		return true;
	}
	return false;
}
/****************************************************************************************************/
function valDatoMail(value){
	if(/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(value)){
		return (true)
	}
	return (false);
}

function error_control_save(frmcontrol, control_error_activo){
	if(control_error_activo == null){
		control_error_activo = frmcontrol;
	}
	return control_error_activo;
}

function array_buscar(lista, valor){
	var ind, pos;
	for(ind=0; ind<lista.length; ind++)
	   {
	    if (lista[ind] == valor)
	      break;
	    }
	pos = (ind < lista.length)? ind : -1;
	return (pos);
}
/****************************************************************************************************/
/****************************************************************************************************/
/****************************************************************************************************/
function validarFormularioFest(){
var frm = document.fest_registro;
var mensaje_error = "";

var i;
var integrantes_banda = Array();
var integrantes_banda_datos_completos = Array();
var integrantes_banda_validos = Array();
var n_promedioEdadIntegrantes;
var bvalido = true;
var control_error_activo = null;
var v_errores = Array();

var cnnombre = 0;
var cndni = 1;
var cnfecha = 2;
var cnfuncion = 3;

	integrantes_banda[0] = new integrante(frm.nombreIntegrante1.value, frm.dniIntegrante1.value, frm.fechaIntegrante1.value, frm.funcionIntegrante1.value);
	integrantes_banda[1] = new integrante(frm.nombreIntegrante2.value, frm.dniIntegrante2.value, frm.fechaIntegrante2.value, frm.funcionIntegrante2.value);
	integrantes_banda[2] = new integrante(frm.nombreIntegrante3.value, frm.dniIntegrante3.value, frm.fechaIntegrante3.value, frm.funcionIntegrante3.value);
	integrantes_banda[3] = new integrante(frm.nombreIntegrante4.value, frm.dniIntegrante4.value, frm.fechaIntegrante4.value, frm.funcionIntegrante4.value);
	integrantes_banda[4] = new integrante(frm.nombreIntegrante5.value, frm.dniIntegrante5.value, frm.fechaIntegrante5.value, frm.funcionIntegrante5.value);
	integrantes_banda[5] = new integrante(frm.nombreIntegrante6.value, frm.dniIntegrante6.value, frm.fechaIntegrante6.value, frm.funcionIntegrante6.value);
	integrantes_banda[6] = new integrante(frm.nombreIntegrante7.value, frm.dniIntegrante7.value, frm.fechaIntegrante7.value, frm.funcionIntegrante7.value);
	integrantes_banda[7] = new integrante(frm.nombreIntegrante8.value, frm.dniIntegrante8.value, frm.fechaIntegrante8.value, frm.funcionIntegrante8.value);
	integrantes_banda[8] = new integrante(frm.nombreIntegrante9.value, frm.dniIntegrante9.value, frm.fechaIntegrante9.value, frm.funcionIntegrante9.value);
	integrantes_banda[9] = new integrante(frm.nombreIntegrante10.value, frm.dniIntegrante10.value, frm.fechaIntegrante10.value, frm.funcionIntegrante10.value);

	
	for(i=0;i<integrantes_banda.length;i++){
		if(integrantes_banda[i].validar())
			integrantes_banda_datos_completos[integrantes_banda_datos_completos.length] = integrantes_banda[i];
	}

	for(i=0;i<integrantes_banda_datos_completos.length;i++){
		if(integrantes_banda_datos_completos[i].validar_form())
			integrantes_banda_validos[integrantes_banda_validos.length] = integrantes_banda_datos_completos[i];
	}

	
	//verificando DNI únicos
	var arrDNI = new Array(frm.dniIntegrante1.value, frm.dniIntegrante2.value, frm.dniIntegrante3.value, frm.dniIntegrante4.value, frm.dniIntegrante5.value, frm.dniIntegrante6.value, frm.dniIntegrante7.value, frm.dniIntegrante8.value, frm.dniIntegrante9.value, frm.dniIntegrante10.value);
	for(i=0; i<arrDNI.length; i++){
		if(arrDNI[i]){
			pos = array_buscar(arrDNI, arrDNI[i]);
			if(pos>=0 && pos!=i){
				control_error_activo = error_control_save(frm.nombreIntegrante1, control_error_activo);
				display_div("errorDniIntegrantes_repetido", "block");
				bvalido = false;
			}else{
				display_div("errorDniIntegrantes_repetido", "none");
			}
		}
	}
	
	
	//n_promedioEdadIntegrantes = promedioEdadIntegrantes(integrantes_banda_validos);

	v_errores[cnnombre] = false;
	v_errores[cndni] = false;
	v_errores[cnfecha] = false;
	v_errores[cnfuncion] = false;
	
	for(i=0; i<integrantes_banda_datos_completos.length; i++){
		v_errores[cnnombre] = (v_errores[cnnombre] || integrantes_banda_datos_completos[i].error_nombre);
		v_errores[cndni] = (v_errores[cndni] || integrantes_banda_datos_completos[i].error_dni);
		v_errores[cnfecha] = (v_errores[cnfecha] || integrantes_banda_datos_completos[i].error_fecha);
		v_errores[cnfuncion] = (v_errores[cnfuncion] || integrantes_banda_datos_completos[i].error_funcion_en_banda);
	}
	
	if(!(/^[_a-zA-Z0-9][_a-zA-Z0-9]*$/.test(frm.nombreUsuario.value))){
		control_error_activo = error_control_save(frm.nombreUsuario, control_error_activo);
		display_div("errorUsuarioNombre", "block");
		display_div("errorUsuario", "none");
		bvalido = false;
	}else{
		display_div("errorUsuarioNombre", "none");
		var usuario_existe=FWK.loadApi("fest_registro|principal|principal|principal", "validarusuario", "&usuario="+frm.nombreUsuario.value);

		if(usuario_existe=="OK"){
			control_error_activo = error_control_save(frm.nombreUsuario, control_error_activo);
			display_div("errorUsuario", "block");
			bvalido = false;
		}else{
			display_div("errorUsuario", "none");
		}
	}
	
	if(!(/^[_a-zA-Z0-9][_a-zA-Z0-9]*$/.test(frm.Contrasena.value))){
		control_error_activo = error_control_save(frm.Contrasena, control_error_activo);
		display_div("errorContrasena", "block");
		bvalido = false;
	}else{
		if(frm.Contrasena.value != frm.Contrasena1.value){
			control_error_activo = error_control_save(frm.Contrasena, control_error_activo);
			display_div("errorContrasena", "block");
			bvalido = false;
		}else{
			display_div("errorContrasena", "none");
		}
	}

	if(frm.nombreGrupo.value == ""){
		control_error_activo = error_control_save(frm.nombreGrupo, control_error_activo);
		display_div("errorGrupoNombre", "block");
		display_div("errorGrupo", "none");
		bvalido = false;
	}else{
		display_div("errorGrupoNombre", "none");
		var banda_existe=FWK.loadApi("fest_registro|principal|principal|principal", "validarbanda","&banda="+frm.nombreGrupo.value);
		if(banda_existe=="OK"){
			control_error_activo = error_control_save(frm.nombreGrupo, control_error_activo);
			display_div("errorGrupo", "block");
			bvalido = false;
		}else{
			display_div("errorGrupo", "none");
		}
	}

	
/*validacion de integrantes*/
	if(integrantes_banda_validos.length < 3){
		control_error_activo = error_control_save(frm.nombreIntegrante1, control_error_activo);
		display_div("errorIntegrantes", "block");
		bvalido = false;
	}else{
		display_div("errorIntegrantes", "none");
	}
	/*
	if(n_promedioEdadIntegrantes > 23){
		control_error_activo = error_control_save(frm.nombreIntegrante1, control_error_activo);
		display_div("errorIntegrantesEdad", "block");
		bvalido = false;
	}else{
		display_div("errorIntegrantesEdad", "none");
	}
	*/
	if(v_errores[cnnombre]){
		control_error_activo = error_control_save(frm.nombreIntegrante1, control_error_activo);
		display_div("errorNombreIntegrantes", "block");
		bvalido = false;
	}else{
		display_div("errorNombreIntegrantes", "none");
	}
	
	if(v_errores[cndni]){
		control_error_activo = error_control_save(frm.nombreIntegrante1, control_error_activo);
		display_div("errorDniIntegrantes", "block");
		bvalido = false;
	}else{
		display_div("errorDniIntegrantes", "none");
	}
	
	if(v_errores[cnfecha]){
		control_error_activo = error_control_save(frm.nombreIntegrante1, control_error_activo);
		display_div("errorFechaNacimiento", "block");
		bvalido = false;
	}else{
		display_div("errorFechaNacimiento", "none");
	}
	
	if(v_errores[cnfuncion]){
		control_error_activo = error_control_save(frm.nombreIntegrante1, control_error_activo);
		display_div("errorInstrumentoIntegrantes", "block");
		bvalido = false;
	}else{
		display_div("errorInstrumentoIntegrantes", "none");
	}
/*fin - validacion de integrantes*/
	if(frm.tema.value == ""){
		control_error_activo = error_control_save(frm.tema, control_error_activo);
		display_div("errorNombreTema", "block");
		bvalido = false;
	}else{
		display_div("errorNombreTema", "none");
	}
	
	if(!(/^[0-9]*:[0-9]*$/.test(frm.duracionVideo.value))){
		control_error_activo = error_control_save(frm.duracionVideo, control_error_activo);
		display_div("errorDuracionVideo", "block");
		bvalido = false;
	}else{
		display_div("errorDuracionVideo", "none");
	}
	
	if(frm.autores.value == ""){
		control_error_activo = error_control_save(frm.autores, control_error_activo);
		display_div("errorAutores", "block");
		bvalido = false;
	}else{
		display_div("errorAutores", "none");
	}
		
	if(frm.genero.value == ""){
		control_error_activo = error_control_save(frm.genero, control_error_activo);
		display_div("errorGenero", "block");
		bvalido = false;
	}else{
		display_div("errorGenero", "none");
	}
/*no son mas obligatorios, no se valida mas
	if((frm.gruposInfluencia1.value == "") || (frm.gruposInfluencia2.value == "") || (frm.gruposInfluencia3.value == "")){
		control_error_activo = error_control_save(frm.gruposInfluencia1, control_error_activo);
		display_div("errorInfluencia", "block");
		bvalido = false;
	}else{
		display_div("errorInfluencia", "none");
	}
*/
	
	if(frm.procedencia.value == ""){
		control_error_activo = error_control_save(frm.procedencia, control_error_activo);
		display_div("errorProcedencia", "block");
		bvalido = false;
	}else{
		display_div("errorProcedencia", "none");
	}
	
	if(frm.biografia.value == ""){
		control_error_activo = error_control_save(frm.biografia, control_error_activo);
		display_div("errorBiografia", "block");
		bvalido = false;
	}else{
		display_div("errorBiografia", "none");
		if(frm.biografia.value.length > 1000){
			control_error_activo = error_control_save(frm.biografia, control_error_activo);
			display_div("errorLimiteBiografia", "block");
			bvalido = false;
		}else{
			display_div("errorLimiteBiografia", "none");
		}
	}
/*no son mas obligatorios, no se valida mas
	if((frm.show1.value == "") || (frm.show2.value == "") || (frm.show3.value == "")){
		control_error_activo = error_control_save(frm.show1, control_error_activo);
		display_div("errorShows", "block");
		bvalido = false;
	}else{
		display_div("errorShows", "none");
	}
*/
/*
	if(frm.sitio.value == ""){
		error_control_save(frm.sitio, control_error_activo);
		display_div("errorSitio", "block");
		bvalido = false;
	}else{
		display_div("errorSitio", "none");
	}
*/
	if(frm.manager.value == ""){
		control_error_activo = error_control_save(frm.manager, control_error_activo);
		display_div("errorManager", "block");
		bvalido = false;
	}else{
		display_div("errorManager", "none");
	}

	if(!(/^([0-9]|-|\(|\)| )([0-9]|-|\(|\)| )*$/.test(frm.telefono.value))){
		control_error_activo = error_control_save(frm.telefono, control_error_activo);
		display_div("errorTelefono", "block");
		bvalido = false;
	}else{
		display_div("errorTelefono", "none");
	}
	
	if(!(/^([0-9]|-|\(|\)| )([0-9]|-|\(|\)| )*$/.test(frm.celular.value))){
		control_error_activo = error_control_save(frm.celular, control_error_activo);
		display_div("errorCelular", "block");
		bvalido = false;
	}else{
		display_div("errorCelular", "none");
	}
	
	if(!valDatoMail(frm.email.value)){
		control_error_activo = error_control_save(frm.email, control_error_activo);
		display_div("errorEmail", "block");
		bvalido = false;
	}else{
		display_div("errorEmail", "none");
	}
	
	if(!valDatoInt(frm.staff.value)){
		control_error_activo = error_control_save(frm.staff, control_error_activo);
		display_div("errorStaff", "block");
		bvalido = false;
	}else{
		display_div("errorStaff", "none");
	}
	
	if(control_error_activo!=null)
		control_error_activo.focus();

	if(bvalido)
		FWK.postAppInto("content", "fest_registro|principal|principal|principal", "fest_registro", "&");
}


function check_length(control, cantidad_caracteres){
	if(control.value.length > cantidad_caracteres)
		control.value = control.value.substring(0, cantidad_caracteres);
}
//**************  /app/fest_concurso/js/funciones.js ********* //
var error_archivo	= "El tipo de archivo no es válido.";
var error_null		= "Debe seleccionar un archivo.";

function verificar_video(){
	//var archivo		= document.forms[0].video;
	var archivo		= top.principal.document.getElementById("video");
	if(!archivo.value){
		alert(error_null);
		archivo.focus();
		return false;
	}
	if(!esVideo(archivo.value)){
		alert(error_archivo);
		archivo.focus();
		return false;
	}
	return true;
}

function verificar_audio(){
	var archivo		= top.principal.document.getElementById("audio");
	if(!archivo.value){
		alert(error_null);
		archivo.focus();
		return false;
	}
	if(!esAudio(archivo.value)){
		alert(error_archivo);
		archivo.focus();
		return false;
	}
	return true;
}

function verificar_foto(){
	var archivo		= top.principal.document.getElementById("foto");
	if(!archivo.value){
		alert(error_null);
		archivo.focus();
		return false;
	}
	if(!esFoto(archivo.value)){
		alert(error_archivo);
		archivo.focus();
		return false;
	}
	return true;
}

function verificar_clip(){
	var archivo		= top.principal.document.getElementById("clip");
	if(!archivo.value){
		alert(error_null);
		archivo.focus();
		return false;
	}
	if(!esClip(archivo.value)){
		alert(error_archivo);
		archivo.focus();
		return false;
	}
	return true;
}

//funciones
function esFoto(archivo){
	extencion = archivo.toLowerCase();
	extencion = extencion.split(".");
	extencion = extencion[1];
	switch (extencion){
		case "jpg":
		case "jpe":
		case "jpeg":
		case "jif":
		case "jfif":
			return true;
			break;
		default:
			return false;
			break;
	}
}
function esVideo(archivo){
	extencion = archivo.toLowerCase();
	extencion = extencion.split(".");
	extencion = extencion[1];
	switch (extencion){
		//archivos microsoft office
		case "wmv":
		//case "asf":
		//case "mpg":
		//case "mpeg":
			return true;
			break;
		default:
			return false;
			break;
	}
}
function esAudio(archivo){
	extencion = archivo.toLowerCase();
	extencion = extencion.split(".");
	extencion = extencion[1];
	switch (extencion){
		//archivos permitidos
		case "mp3":
		case "wma":
			return true;
			break;
		default:
			return false;
			break;
	}
}
function esClip(archivo){
	extencion = archivo.toLowerCase();
	extencion = extencion.split(".");
	extencion = extencion[1];
	switch (extencion){
		//archivos microsoft office
		case "wmv":
		//case "asf":
		//case "mpg":
		//case "mpeg":
			return true;
			break;
		default:
			return false;
			break;
	}
}
function  validarEntrada(nivel)
{
	var valida;
	switch(nivel.toLowerCase())
	{	
		case "audio":
			valida = verificar_audio();
			break;
		
		case "video":
			valida = verificar_video();
			break;
		case "clip":
			valida = verificar_clip();
			break;
			
		case "foto":
			valida = verificar_foto();
			break;
	}
	if (valida)
	{
		top.principal.document.getElementById("loading_bar").style.display='block';
		top.principal.document.getElementById("div_mensaje").style.display='none';
		document.getElementById("form_action").submit();
	}else
	{
		top.principal.document.getElementById("div_mensaje").innerHTML = nivel + "no valida";
	}
}

function personal_ver_especificaciones(){
window.open("/sk_mixplay/app/html_estatico/mixplay/html/esp/personal_tecnicas_popup.html","PersonalMania", 
"width=770,height=646,menubar=no,location=no,resizable=no,scrollbars=no,status=no");

}
//**************  /framework/js/framework.js ********* //
//==============================================================================
// FRAMEWORK - Javascript 
// Crafted by Goose!2006
//==============================================================================
// javascript:alert(principal.FWK.loadFrameInto('enlacesMod','principal'));

//==============================================================================
// INCLUSIONES 
//==============================================================================

/**
* Incluye archivos js
*/
	function fwk_requires()
	{
		sPath="/scripts/framework/js/";
		aRequires=Array(	"prototype.js",
											"scriptaculous.js"
											);
		for(a=0;a<aRequires.length;a++) document.write('<script type="text/javascript" src="'+sPath+aRequires[a]+'"></script>');
	} 

//==============================================================================
// FRIEND FUNCTIONS
//==============================================================================

//==============================================================================
// OBJETO FWK
//==============================================================================
if(typeof(FWK)=="undefined")
var FWK =	
{
	debug: false, 
	browser : navigator.appName, //find the browser name
	//==============================================================================
	// AHAH 
	//==============================================================================
		//==============================================================================
		// LOAD
		//==============================================================================
			ahah_open_return	:	function (url)
													{
														try
														{
															var req;
															if(this.browser == "Microsoft Internet Explorer")	req = new ActiveXObject("Microsoft.XMLHTTP");
															else req = new XMLHttpRequest();
															if(req)
															{
																req.open("POST",url,false);
																req.send(null)
																if(req.status<400)	return(req.responseText);
																else								return("FWK:Error: "+req.statusText);
															}
														}
														catch(e) { window.status="ahah_open_return	["+e.message+"]"; }
													},
			ahah_open_get	:	function (url)
													{
														try
														{
															var req;
															if(this.browser == "Microsoft Internet Explorer")	req = new ActiveXObject("Microsoft.XMLHTTP");
															else req = new XMLHttpRequest();
															if(req)
															{
																req.open("GET",url,false);
																req.send(null)
																if(req.status<400)	return(req.responseText);
																else								return("FWK:Error: "+req.statusText);
															}
														}
														catch(e) { window.status="ahah_open_return	["+e.message+"]"; }
													},													
			ahah_open_set	:	function(url,target)
											{
												try
												{
													var req;
													var onStateChangeLocal=this.onStateChangeLocal;
													if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
													else req = new XMLHttpRequest();
													if(req)
													{
														req.onreadystatechange=function()
															{
																if(req.readyState==4)
																	if(req.status<400)
																	{
																		results=req.responseText;																		
																		// no funcionaba ni en IE ni en otros navegadores
																		// el this.debug da undefiniend en IE y que siempre es un objeto (true) en  otros nav.
																		//if(this.debug) alert(results);																		
																		//onStateChangeDebug=this.debug
																		document.getElementById(target).innerHTML=results;																		
																		
																		
																		if(FWK) if(FWK.onStateChange) FWK.onStateChange(FWK.debug,"end_aha",target); //puesto con FWK por que el this parece que dentro no funciona ya que el alert nunca se ve
																	}
																	else	document.getElementById(target).innerHTML="<font color='red'>FWK:Error: "+req.statusText+"<br/></font>"+document.getElementById(target).innerHTML;
															};
														req.open("POST",url,true);
														req.send(null)
													}
												}
												catch(e) { window.status="ahah_open_set	["+e.message+"]"; }
											},
			ahah_open_getcallback	:	function(url,callback,callwhile)
														{
															try
															{
																var req;
																if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
																else req = new XMLHttpRequest();
																if(req)
																{
																	if(!callwhile) callwhile="fwk_doNothing";
																	eval("callbackFunc=function () { if (req.readyState == 4) "+callback+"(req); else "+callwhile+"(req.readyState); };");
																	req.onreadystatechange=callbackFunc;
																	req.open("GET",url,true);
																	req.send(null)
																}
															}
															catch(e) { window.status="ahah_open_callback2 ["+e.message+"]"; }
														},											
			ahah_open_callback	:	function(url,callback,callwhile)
														{
															try
															{
																var req;
																if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
																else req = new XMLHttpRequest();
																if(req)
																{
																	if(!callwhile) callwhile="fwk_doNothing";
																	eval("callbackFunc=function () { if (req.readyState == 4) "+callback+"(req); else "+callwhile+"(req.readyState); };");
																	req.onreadystatechange=callbackFunc;
																	req.open("POST",url,true);
																	req.send(null)
																}
															}
															catch(e) { window.status="ahah_open_callback2 ["+e.message+"]"; }
														},
		//==============================================================================
		// POST
		//==============================================================================
			ahah_post_return	:	function (url,form)
													{
														try
														{
															var req;
															if(this.browser == "Microsoft Internet Explorer")	req = new ActiveXObject("Microsoft.XMLHTTP");
															else req = new XMLHttpRequest();
															if(req)
															{
																req.open("POST",url,false);
																req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
																req.send(form)
																if(req.status<400)	return(req.responseText);
																else								return("FWK:Error: "+req.statusText);
															}
														}
														catch(e) { window.status="ahah_post_return	["+e.message+"]"; }
													},
			ahah_post_set	:	function(url,form,target)
											{
												try
												{
													var req;
													if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
													else req = new XMLHttpRequest();
													if(req)
													{
														req.onreadystatechange=function()
															{
																if(req.readyState==4)
																	if(req.status<400)
																	{
																		results=req.responseText;																		
																		// no funcionaba ni en IE ni en otros navegadores
																		// el this.debug da undefiniend en IE y que siempre es un objeto (true) en  otros nav.
																		//if(this.debug) alert(results);
																		document.getElementById(target).innerHTML=results;
																		
																		if(FWK) if(FWK.onStateChange) FWK.onStateChange(FWK.debug,"end_aha",target); //puesto con FWK por que el this parece que dentro no funciona ya que el alert nunca se ve
																	}
																	else	document.getElementById(target).innerHTML="<font color='red'>FWK:Error: "+req.statusText+"<br/></font>"+document.getElementById(target).innerHTML;
															};
														req.open("POST",url,true);
														req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
														req.send(form)
													}
												}
												catch(e) { window.status="ahah_post_set	["+e.message+"]"; }
											},
			ahah_post_callback	:	function(url,form,callback,callwhile)
														{
															try
															{
																var req;
																if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
																else req = new XMLHttpRequest();
																if(req)
																{
																	if(!callwhile) callwhile="fwk_doNothing";
																	eval("callbackFunc=function () { if (req.readyState == 4) "+callback+"(req); else "+callwhile+"(req.readyState); };");
																	req.onreadystatechange=callbackFunc;
																	req.open("POST",url,true);
																	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
																	req.send(form)
																}
															}
															catch(e) { window.status="ahah_post_callback	["+e.message+"]"; }
														},
	//==============================================================================
	// LOAD
	//==============================================================================
		//==============================================================================
		// FRAME
		//==============================================================================
		loadFrameInto	: function(destino,frame,parametros,onstateParams)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&FRAME="+frame+parametros;										
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\nparam:["+parametros+"]");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,frame,parametros,onstateParams);
										this.ahah_open_set(url,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,frame,parametros,onstateParams);
									},
		loadFrame			: function(frame,parametros)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&FRAME="+frame+parametros;
										if(this.debug) alert("url:["+url+"]\nparam:["+parametros+"]");
										return(this.ahah_open_return(url,null));
									},
		loadFrameCallback	: function(callback,frame,parametros,callwhile)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&FRAME="+frame+parametros;
										if(this.debug) alert("url:["+url+"]\nparam:["+parametros+"]");
										this.ahah_open_callback(url,callback,callwhile);
									},
		//==============================================================================
		// APP 
		//==============================================================================
		loadAppInto	: function(destino,app,parametros,onstateParams)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&APP="+app+parametros;
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,app,parametros,onstateParams);
										this.ahah_open_set(url,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,app,parametros,onstateParams);
									},
		reloadIsNeed	: function (new_sitepage)
									{										
										//Esta funcion se implemento para evitar tener que propagar el Reload de Banners y de conteo de metricas por todas las aplicaciones
										//Esta vinculada con loadAppInto y loadFrameInto que al ser usadas por las aplicaciones de forma transparente realizan el refresco										
										if(FWK.debug) alert(" FWK :: reloadIsNeed Sitepage:"+new_sitepage);
										try{
											top.pageNum=undefined; //para evitar cache en accipiter se limpia el random
											if(typeof BANNERS!= "undefined"){if(BANNERS.reload){BANNERS.reload();}}
											if(typeof METRICAS!= "undefined"){if(METRICAS.reload){METRICAS.reload();}}	
										}catch(er){
											window.status="Er";
										}
									},
		loadApp			: function(app,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+parametros;
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]");
										return(this.ahah_open_return(url,null));
									},
		loadAppCallback	: function(callback,app,parametros,callwhile)
									{
										url="/scripts/app/framework.php?APP="+app+parametros;
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]");
										this.ahah_open_callback(url,callback,callwhile);
									},
		//==============================================================================
		// API
		//==============================================================================
		loadApiInto	: function(destino,app,token,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]");
										this.ahah_open_set(url,destino);
									},
		loadApi			: function(app,token,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										var newDate=new Date();
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"] :: start "+newDate.getTime());
										var ret=this.ahah_open_return(url,null);
										var endDate=new Date();
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"] :: end "+endDate.getTime()+" - "+((newDate.getTime()-endDate.getTime())/1000));
										return(ret);
									},
		loadApiCallback	: function(callback,app,token,parametros,callwhile)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										if(this.debug) alert("url:["+url+"]\ntoken:["+token+"]\napp:["+app+"]\nparam:["+parametros+"]");
										this.ahah_open_callback(url,callback,callwhile);
									},

	//==============================================================================
	// LOAD
	//==============================================================================
		//==============================================================================
		// FRAME
		//==============================================================================
		postFrameInto	: function(destino,frame,pform,parametros,onstateParams)
									{
										url="/scripts/app/framework.php";
										sform="FWKINLINE=1&FRAME="+frame+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,app,parametros,onstateParams);
										this.ahah_post_set(url,sform,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,app,parametros,onstateParams);
										this.reloadIsNeed();
									},
		postFrame			: function(frame,pform,parametros)
									{
										url="/scripts/app/framework.php";
										sform="FWKINLINE=1&FRAME="+frame+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										return(this.ahah_open_return(url,sform));
									},
		postFrameCallback	: function(callback,frame,pform,parametros,callwhile)
									{
										url="/scripts/app/framework.php?";
										sform="FWKINLINE=1&FRAME="+frame+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_callback(url,sform,callback,callwhile);
									},
		//==============================================================================
		// APP 
		//==============================================================================
		postAppInto	: function(destino,app,pform,parametros,onstateParams)
									{
										url="/scripts/app/framework.php";
										sform="FWKINLINE=1&APP="+app+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,app,parametros,onstateParams);
										this.ahah_post_set(url,sform,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,app,parametros,onstateParams);
									},
		postApp			: function(app,pform,parametros)
									{
										url="/scripts/app/framework.php?";
										sform="APP="+app+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										return(this.ahah_post_return(url,sform));
									},
		postAppCallback	: function(callback,app,pform,parametros,callwhile)
									{
										url="/scripts/app/framework.php?";
										sform="APP="+app+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_callback(url,sform,callback,callwhile);
									},
		//==============================================================================
		// API
		//==============================================================================
		postApiInto	: function(destino,app,token,pform,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										sform="APP="+app+"&API="+token+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_set(url,sform,destino);
									},
		postApi			: function(app,token,pform,parametros)
									{
										url="/scripts/app/framework.php";
										sform="APP="+app+"&API="+token+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										return(this.ahah_post_return(url,sform));
									},
		postApiCallback	: function(callback,app,token,pform,parametros,callwhile)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										sform="APP="+app+"&API="+token+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ntoken:["+token+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_callback(url,sform,callback,callwhile);
									},
									
	//==============================================================================
	// UTILIDADES
	//==============================================================================
		getFormValues	:	function(fobj)
										{
											var str = "";
											for(var i = 0;i < fobj.elements.length;i++)
											{
												switch(fobj.elements[i].type)
												{
													case "password":
													case "textarea":
													case "hidden":
													case "text": str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&"; break;
													case "select-one": str += fobj.elements[i].name + "=" + escape(fobj.elements[i].options[fobj.elements[i].selectedIndex].value) + "&"; break;
													case "checkbox": if(fobj.elements[i].checked) str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&"; break;
													case "radio": if(fobj.elements[i].checked) str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&"; break;
												}
											}
											str = str.substr(0,(str.length - 1));
											if(this.debug) alert(str);
											return str;
										}

};

function	fwk_doNothing(estado) {  } //Esta funcion es el default de los "callwhile"
function	ltrim(s)	//trimeo de enters en respuestas de ajax
{
	i=0; while(s.charAt(i)=='\n'||s.charAt(i)=='\r'||s.charAt(i)==' ') i++;
	return(s.substr(i));
}

//==============================================================================
// OBJETO CSS
//==============================================================================

CSS=
{
	addCss: function(archivo,titulo,alternate)
			{
				if(this.debug) alert("::CSS>> addCss archivo=["+archivo+"] titulo=["+titulo+"]");
				if(!this.existCss(archivo))
				{
					var oHead = document.getElementsByTagName("HEAD")[0];
					var oLink = document.createElement("link");
					oLink.attributes.setNamedItem(this.crearAtributo("href",archivo));
					if(alternate)	oLink.attributes.setNamedItem(this.crearAtributo("rel","alternate stylesheet"));
					else					oLink.attributes.setNamedItem(this.crearAtributo("rel","stylesheet"));
					oLink.attributes.setNamedItem(this.crearAtributo("type","text/css"));
					oLink.attributes.setNamedItem(this.crearAtributo("title",titulo));
					oLink.attributes.setNamedItem(this.crearAtributo("id",titulo));
					if(this.debug) alert(oLink.outerHTML);
					oHead.appendChild(oLink);
					if(this.debug) alert(oHead.innerHTML);
					if(alternate) { this.turnCss(titulo,true); this.turnCss(titulo,false); } //bugfix para que no se prenda
				}
				else if(this.debug) alert("::CSS>> addCss archivo=["+archivo+"] titulo=["+titulo+"] --- YA EXISTIA !!!");
			},
	crearAtributo: function(nombre,valor)
			{
				var nItem = document.createAttribute(nombre);
				nItem.value = valor;
				return(nItem);
			},
	removeCss: function(archivo,titulo)
			{
				if(this.debug) alert("::CSS>> removeCss archivo=["+archivo+"] titulo=["+titulo+"]");
				var aLinks = document.getElementsByTagName("LINK");
				if(titulo==null)	
					for (i=0;i<aLinks.length;i++) 
					{ 
						if(aLinks[i].href==archivo) 
						{ 
								//this.turnCss(aLinks[i].title,false); 
								aLinks[i].removeNode(true); 
						} 
					}
				else							
					for (i=0;i<aLinks.length;i++) 
					{ 
						if(aLinks[i].title==titulo) 
						{ 
							//this.turnCss(aLinks[i].title,false); 
							aLinks[i].removeNode(true); 
						} 
					}
			},
	existCss: function(archivo)
			{
				if(this.debug) alert("::CSS>> existCss archivo=["+archivo+"]");
				for (i=0;i<document.styleSheets.length;i++) if(document.styleSheets(i).href==archivo) return(true);
				return(false);
			},
	turnCss: function(nom,estado)
			{
				if(this.debug) alert("::CSS>> TurnCss nom=["+nom+"] estado=["+estado+"]");
				estado=!estado;
				for (i=0;i<document.styleSheets.length;i++)
				{
					nombre=document.styleSheets(i).title;
					nombre=nombre.substr(0,nom.length);
					if(nom==nombre) { 
						//alert('OOOOO la encontre-----'+nom); 
						document.styleSheets(i).disabled=estado; return; }
				}
			},
	setCss: function(nom)
			{
				for (i=0;i<document.styleSheets.length;i++)
				{
					if(document.styleSheets(i).title==nom)	document.styleSheets(i).disabled=false;
					else																		document.styleSheets(i).disabled=true;
				}
			},
	getCssActivos: function()
			{
				aEstilos=new Array;
				if(this.debug) alert("::CSS>> Total de styles: "+document.styleSheets.length);
				for (i=0;i<document.styleSheets.length;i++) 
				{
					if(!(document.styleSheets(i).disabled))
					{
						if(this.debug) alert("::CSS>> Nro: "+i+" ACTIVO >> "+document.styleSheets(i).title);
						aEstilos.push(document.styleSheets(i).title);
					}
				}
				return(aEstilos);
			}
}

//==============================================================================
// LOAD 
//==============================================================================

//fwk_requires();
//alert("jsFramework\n\nLOAD r6.1.008\nPOST r1.0.000\nCSS r1.0.027");

//**************  /app/banners_ajax/js/accipiter_linkexternrun.js ********* //
//=================================================================
// JAVASCRIPT IMPLEMENTATION FOR AJAX BANNERS (GDRipoll) 
//  ACCIPITER VERSION
//=================================================================
var      BANNER_timeout;
function BANNER_ocultarflyAd(nombre,mensaje){
	if(this.debug)	alert("onclick");
	if(document.getElementById(nombre+"_diviframe")) document.getElementById(nombre+"_diviframe").style.display="none"
	if(document.getElementById(nombre+"_iframe")) document.getElementById(nombre+"_iframe").style.display="none"
	if(typeof mensaje=="undefined"){
		mensaje="ocultarflyAd";
	}
	window.status=mensaje;
	return true;
}
function BANNER_mostrarflyAd(nombre){
	window.status="";
	if(window.wmp_isonlinestore&&window.wmp_isonlinestore()){
		return;
	}	
	if(document.getElementById(nombre+"_diviframe")){
		if(this.debug)	alert("BANNERS :: fix FlyAd DivIframe positioning h:"+window.screen.height+" w:"+window.screen.width);
		document.getElementById(nombre+"_diviframe").style.position="absolute";
		document.getElementById(nombre+"_diviframe").style.zIndex=10000;
		document.getElementById(nombre+"_diviframe").style.left="0px";
		document.getElementById(nombre+"_diviframe").style.top="0px";					
		document.getElementById(nombre+"_diviframe").style.height=window.screen.height+"px";
		document.getElementById(nombre+"_diviframe").style.width=window.screen.width+"px";										
		document.getElementById(nombre+"_diviframe").onclick=function () { return BANNER_ocultarflyAd(nombre);};
		if(document.getElementById(nombre+"_iframe")){
			if(this.debug)	alert("BANNERS :: fix FlyAd Iframe");						
			document.getElementById(nombre+"_iframe").style.position="absolute";
			document.getElementById(nombre+"_iframe").style.zIndex=10000;
			document.getElementById(nombre+"_iframe").style.left="0px";
			document.getElementById(nombre+"_iframe").style.top="0px";					
			document.getElementById(nombre+"_iframe").style.height=window.screen.height+"px";
			document.getElementById(nombre+"_iframe").style.width=window.screen.width+"px";												
			if(window.frames[nombre+"_iframe"]){
				if(window.frames[nombre+"_iframe"].document){
					if(window.frames[nombre+"_iframe"].document.body){
						if(this.debug)	alert("BANNERS :: fix FlyAd IframeBody");
						window.frames[nombre+"_iframe"].document.body.style.backgroundColor="transparent";
						window.frames[nombre+"_iframe"].document.body.onclick=document.getElementById(nombre+"_diviframe").onclick;
					}
				}
			}
			document.getElementById(nombre+"_iframe").style.display="block";
		}
		document.getElementById(nombre+"_diviframe").style.display="block";
		if(BANNER_timeout){
			window.clearTimeout(BANNER_timeout);
		}
		BANNER_timeout=setTimeout("BANNER_ocultarflyAd('"+nombre+"');",120000);
	}	
}
BANNERS =
{
	debug			: false,
	aBanners	: Array(),

	add	:	function(nombre,noCargarDefault)
	{
		var armado=Array(	nombre,
											document.getElementById(nombre+"_iframe"),
											document.getElementById(nombre+"_div"),
											window.frames[nombre+"_iframe"]
											);
		this.aBanners.push(armado);
		if(this.debug)	alert(":: BANNERS >> add "+this.aBanners.join("|"));
		//if(!noCargarDefault)
		//	this.getOneBanner(nombre);
		if(typeof(IRENDER)!="undefined"||document.getElementById("content").innerHTML.indexOf("<")!=-1){
			this.getOneBanner(nombre);
		}
	},

	setearBanner	:	function(nombre,contenido)
	{		
		if(this.debug)	alert("BANNERS :: setear "+nombre);
		if(nombre){
			if(nombre.toLowerCase()=="bannerflyad"){
				if(contenido){
					if(contenido.search(/<object/i)!=-1){
						if(this.debug)	alert(contenido);
						if(this.debug)	alert("BANNERS :: fix FlyAd");
						BANNER_mostrarflyAd(nombre,contenido);				
					}else{
						BANNER_ocultarflyAd(nombre,"flyAd NoObject");
					}				
				}else{
					BANNER_ocultarflyAd(nombre,"flyAd NoObject");
				}
				return;
			}
		}
		if(document.getElementById(nombre+"_div"))
			document.getElementById(nombre+"_div").innerHTML=contenido;
	},

	getOneBanner	:	function(nombre)
	{
		if(this.debug)	alert(":: BANNERS >> add "+nombre);
		if(this.debug)	alert("/scripts/app/framework.php?APP=banners_ajax|"+nombre+"|"+nombre+"|principal&API=banner");
		//for(var a in this.aBanners) if(this.aBanners[a][0]==nombre) this.aBanners[a][1].src="/scripts/app/framework.php?APP=banners_ajax|"+nombre+"|"+nombre+"|principal&API=banner";
		//07042009//for(var a in this.aBanners) if(this.aBanners[a][0]==nombre) this.aBanners[a][3].document.location.replace("/scripts/app/framework.php?APP=banners_ajax|"+nombre+"|"+nombre+"|principal&API=banner");
		for(var a in this.aBanners) if(this.aBanners[a][0]==nombre) this.aBanners[a][3].document.location.replace(this.getUrlRefreshBanner(nombre));		
	},

	reload	:	function()
	{
		//for(var a in this.aBanners) this.aBanners[a][1].src="/scripts/app/framework.php?APP=banners_ajax|"+this.aBanners[a][0]+"|"+this.aBanners[a][0]+"|principal&API=banner";
		//07042009//for(var a in this.aBanners) this.aBanners[a][3].document.location.replace("/scripts/app/framework.php?APP=banners_ajax|"+this.aBanners[a][0]+"|"+this.aBanners[a][0]+"|principal&API=banner");
		for(var a in this.aBanners) this.aBanners[a][3].document.location.replace(this.getUrlRefreshBanner(this.aBanners[a][0]));
	},
	reloadEx	:	function(sParams,sPosition)
	{
		for(var a in this.aBanners){
			if(sPosition==undefined||this.aBanners[a][0]==sPosition){
				this.aBanners[a][3].document.location.replace(this.getUrlRefreshBanner(this.aBanners[a][0],sParams));
			}
		}
	},	
	getUrlRefreshBanner : function(nombre,sParams){
		if(sParams==undefined){
			sParams="";
		}else{
			sParams=sParams.replace("{@name}",nombre);
		}
		var def="/scripts/app/framework.php?APP=banners_ajax|"+nombre+"|"+nombre+"|principal&API=banner&";
		if(top.getUrlRefreshBannerSeoEnabled!=undefined){
			return top.getUrlRefreshBannerSeoEnabled(nombre,def)+"&"+sParams;
		}else{
			return def+sParams;
		}
	}

}

//alert("JSforBanners v.0.15");
//**************  /app/buscadorcontenidos/js/buscador.js ********* //
/*
* BUSCADOR
*
* Manejo de Javascript para los resultados
*
*/

//=========================================================================================
//	LLAMADO DE BUSQUEDA
//=========================================================================================


function buscadorContenidos()
{
	//FWK.debug=true;
	FWK.postAppInto('content','buscadorcontenidos|principal|principal|principal','buscador_form','&principal[pag]=1&');
	if(typeof cambiarAnchor != "undefined") {
		var oObject = document.getElementById("principal[id_nodo]");
		if (oObject && oObject.value) {
			//var sRelleno = oObject.value + _anchorSeparador + oObject.options[oObject.selectedIndex].text;						
			var sRelleno =  oObject.options[oObject.selectedIndex].text + _anchorSeparador + oObject.value;
		}
		cambiarAnchor("buscador",document.getElementById("buscar").value,sRelleno);
	}
}


function buscadorContenidosCinta()
{
//FWK.debug=true;
//id_tipo = 2 siempre llama a videos
var id_nodo=document.buscadorcinta_form.id_nodo.options[top.principal.document.buscadorcinta_form.id_nodo.selectedIndex].value;
var nombre_nodo=document.buscadorcinta_form.id_nodo.options[top.principal.document.buscadorcinta_form.id_nodo.selectedIndex].text;
eval(FWK.loadApi('buscadorcontenidos',document.buscadorcinta_form.buscar.value,'&tipovista=cinta&id_tipo=2&'+ ((id_nodo)?'id_nodo='+id_nodo:'')));
 pathLinkCarpetaBusqueda(document.buscadorcinta_form.buscar.value + ((nombre_nodo)?" ("+ nombre_nodo + ")":""));
}

function pagGoto(event,modulo,pag,request)
{
	//alert("modulo="+modulo+"\npagina="+pag+"\nrequest="+request);
	FWK.loadAppInto('content',modulo,'&principal[pag]='+pag+'&'+request);
	//--cancelacion de evento---------
	if(!document.all) {	event.stopPropagation(); event.preventDefault(); }
	event.cancelBubble=true; event.returnValue=false; //cierre, deshabilito el A ------
	return false;
}


//**************  /app/arbol/js/arbolDo.js ********* //
/**
 * ARCHIVO DE ACCIONES PARA EL ARBOL
 * GDRipoll
 */
arbolDoPreventiveOAIEInteractiveCounter=0;
arbolDoPreventiveOAIECallback=undefined;
arbolDoPreventiveOAIETimeout=undefined;
function arbolDoPreventiveOAIETimeoutHandler(){
	if(arbolDoPreventiveOAIECallback!=undefined){
		arbolDoPreventiveOAIECallback();
	}
}
function arbolDoPreventiveOAIE(sNewSkin,callback){	
	var currentSkin=getSkinCurrent();
	if((currentSkin!=undefined&&currentSkin!=sNewSkin)||(currentSkin==undefined&&sNewSkin!="sk_mixplay")){
		var windowReadyState=window.document.readyState;
		arbolDoPreventiveOAIECallback=callback;		
		if(windowReadyState=="interactive"){
			arbolDoPreventiveOAIEInteractiveCounter++;
			if(arbolDoPreventiveOAIEInteractiveCounter>8){
				arbolDoPreventiveOAIEInteractiveCounter=0;
				windowReadyState="complete";
			}
		}
		switch(windowReadyState){
			case "complete":
				//alert("aca1"+window.document.readyState+","+windowReadyState);
				if(arbolDoPreventiveOAIETimeout!=undefined) clearTimeout(arbolDoPreventiveOAIETimeout);
				return false;
			break;			
			default:
				//alert("aca2:"+window.document.readyState+","+windowReadyState);
				if(arbolDoPreventiveOAIETimeout!=undefined) clearTimeout(arbolDoPreventiveOAIETimeout);
				arbolDoPreventiveOAIETimeout=setTimeout("arbolDoPreventiveOAIETimeoutHandler();",500);
				return true;
		}
	}
	//alert("aca3: current:"+window.currentSkin+", currentGet: "+currentSkin+", new:"+sNewSkin);
	return false;
}
arbolDo =
{
	destacado : function(event,frame,id,nombre,pregenerado,titulo,codigo,ob) //-------------------------------
	{
		//04/06/2009 Esto se agrega para permitir llamarla desde el timer, sino daba error de que event no tenia los miembros, etc. 
		var modeFromTimer=(ob!=undefined)?true:false;
		if(!modeFromTimer)		
			ob=this.getOpcionMenu(event); //crossbrowser event		
		//if(top.location.toString().search(/debugjssinnodo=/)!=-1){ //Para todo el mundo ahora 04/06/2009
			if(arbolDoPreventiveOAIE(ob.parentElement.arbol_skin,function(){arbolDo.destacado(undefined,frame,id,nombre,pregenerado,titulo,codigo,ob);})){
				if(!modeFromTimer)
					return(this.stopPropagation(event));
				else
					return false;
			}
		//}
		//alert("arbolDo.Destacado (12)");		
		eval("if(typeof(MENU_"+ob.parentElement.parentElement.level+")!='undefined') MENU_"+ob.parentElement.parentElement.level+".select("+ob.parentElement.id.substr(4)+")"); //prendo la opcion en el menu
		onSkinChange(ob.parentElement.arbol_skin); //llamado al cambio de skin
		this.llamarSubMenu(ob.parentElement);

		if(pregenerado!="s")
			FWK.loadFrameInto("content",frame,"&FWK[id_nodo]="+id+"&FWK[nombre_nodo]="+nombre);
		else
			FWK.loadAppInto("content","mngtapas|principal|principal|principal","&principal[accion]=html_pregen&principal[html]=mngtapas_pregen_"+id+".html&FWK[id_nodo]="+id+"&FWK[nombre_nodo]="+nombre);

		this.setTopTitle(unescape(titulo));
		if(typeof cambiarAnchor!="undefined")
			cambiarAnchor("tapa",codigo,nombre);
		if(!modeFromTimer)
			return(this.stopPropagation(event));
		else
			return false;
	},
	link : function(event,href,features) //--------------------------------------
	{
		//alert("arbolDo.Link");
		ob=this.getOpcionMenu(event); //crossbrowser event
		eval("if(typeof(MENU_"+ob.parentElement.parentElement.level+")!='undefined') MENU_"+ob.parentElement.parentElement.level+".select("+ob.parentElement.id.substr(4)+")"); //prendo la opcion en el menu
		onSkinChange(ob.parentElement.arbol_skin); //llamado al cambio de skin
		this.llamarSubMenu(ob.parentElement);
		window.open(href,null,features);
		return(this.stopPropagation(event));
	},
	html : function(event,nota,id,nombre,titulo)
	{
		//alert("arbolDo.Html");
		ob=this.getOpcionMenu(event); //crossbrowser event
		eval("if(typeof(MENU_"+ob.parentElement.parentElement.level+")!='undefined') MENU_"+ob.parentElement.parentElement.level+".select("+ob.parentElement.id.substr(4)+")"); //prendo la opcion en el menu
		onSkinChange(ob.parentElement.arbol_skin); //llamado al cambio de skin
		this.llamarSubMenu(ob.parentElement);
		FWK.loadAppInto('content','conthtml|principal|principal|principal','&principal[nodo_sesion]=true&principal[id_grupo]='+nota+"&FWK[id_nodo]="+id+"&FWK[nombre_nodo]="+nombre);
		this.setTopTitle(unescape(titulo));
		return(this.stopPropagation(event));
	},
	list : function(event,id,nombre,titulo,codigo,ob)
	{
		//04/06/2009 Esto se agrega para permitir llamarla desde el timer, sino daba error de que event no tenia los miembros, etc. 
		var modeFromTimer=(ob!=undefined)?true:false;
		if(!modeFromTimer)		
			ob=this.getOpcionMenu(event); //crossbrowser event		
		//if(top.location.toString().search(/debugjssinnodo=/)!=-1){										
			if(arbolDoPreventiveOAIE(ob.parentElement.arbol_skin,function(){arbolDo.list(undefined,id,nombre,titulo,codigo,ob);})){
				if(!modeFromTimer)
					return(this.stopPropagation(event));
				else
					return false;
			}
		//}		
		//alert("arbolDo.List");
		//ob=this.getOpcionMenu(event); //crossbrowser event
		eval("if(typeof(MENU_"+ob.parentElement.parentElement.level+")!='undefined') MENU_"+ob.parentElement.parentElement.level+".select("+ob.parentElement.id.substr(4)+")"); //prendo la opcion en el menu
		onSkinChange(ob.parentElement.arbol_skin); //llamado al cambio de skin
		this.llamarSubMenu(ob.parentElement);
		FWK.loadAppInto('content','listador|principal|principal|principal','&principal[pag]=1&principal[id_nodo]='+id+'&principal[nodo_sesion]=true&FWK[id_nodo]='+id+'&FWK[nombre_nodo]='+nombre);
		this.setTopTitle(unescape(titulo));
		if(typeof cambiarAnchor!="undefined")
			cambiarAnchor("tapa",codigo,nombre);
		if(!modeFromTimer)
			return(this.stopPropagation(event));
		else
			return false;
	},
	generico : function(event,onclick)
	{
		//alert("arbolDo.Generico");
		ob=this.getOpcionMenu(event); //crossbrowser event
		eval("if(typeof(MENU_"+ob.parentElement.parentElement.level+")!='undefined') MENU_"+ob.parentElement.parentElement.level+".select("+ob.parentElement.id.substr(4)+")"); //prendo la opcion en el menu
		onSkinChange(ob.parentElement.arbol_skin); //llamado al cambio de skin
		this.llamarSubMenu(ob.parentElement);
		eval(unescape(onclick));
		//return(this.stopPropagation(event)); en este no stopeo nada
	},
	llamarSubMenu : function(ob,seleccionado,bAsync)
	{
		//alert(ob);
		if(typeof bAsync=="undefined"){
			bAsync=true;
		}
		var id=ob.id.substr(4);
		var reg=ob.parentElement.region;
		var sub=ob.parentElement.subregion;
		var level=ob.parentElement.level;
		//eval("MENU_"+level+".select("+id+")"); //prendo la opcion en el menu
		//alert("Poniendo en  arbChilds"+level+" el ["+reg+"."+sub+"."+id+"]");
		if(bAsync){
			FWK.loadApiInto('arbChilds'+level,"arbol|arbol|arbol|principal","sub","&idReg="+reg+"&idSub="+sub+"&idItem="+id+"&idSel="+seleccionado);
		}else{
			if(document.getElementById('arbChilds'+level)){
				document.getElementById('arbChilds'+level).innerHTML=FWK.loadApi("arbol|arbol|arbol|principal","sub","&idReg="+reg+"&idSub="+sub+"&idItem="+id+"&idSel="+seleccionado);
			}
		}
	},
	//--[UTILIDADES]-----------------------------------------
	getOpcionMenu : function(event)
	{
		ob=(document.all)?event.srcElement:event.target; //crossbrowser event
		while(ob.tagName!="A") ob=(document.all)?ob.parentElement:ob.parentNode; //bubble hasta el A
		return(ob);
	},
	stopPropagation : function(event)
	{
		if(!document.all) {	event.stopPropagation(); event.preventDefault(); }
		event.cancelBubble=true; event.returnValue=false; //cierre, deshabilito el A ------
		return false;
	},
	setTopTitle : function(titulo)
	{
		top.document.title=titulo;
	},
	
	irA : function(sPath) {
		if (sPath) {
			var aPath = sPath.split("/");
			var ob = document.getElementById("item"+aPath[0]);
			if (ob) {
				ob = ob.getElementsByTagName("A")[0];
				if(aPath.length==1){
					if (ob) {
						ob.click();
					}
				} else {
					eval("if(typeof(MENU_"+ob.parentElement.parentElement.level+")!='undefined') MENU_"+ob.parentElement.parentElement.level+".select("+ob.parentElement.id.substr(4)+")"); //prendo la opcion en el menu
					if (ob) {
						onSkinChange(ob.parentElement.arbol_skin)
						this.llamarSubMenu(ob.parentElement,true,false);				
						this.irA(aPath.slice(1,aPath.length).join("/"));
					}
				}				
			}
		}
	}
}

//**************  /app/arbol/js/TextHRibbon.js ********* //
// ============================================================================
// CLASE PARA MANEJO DE CINTAS DE IMAGEN HORIZONTAL EN MC
// ============================================================================

function TextHRibbon(id,nivel)
{
	// ==============================================
	// = CONSTANTES
	// ==============================================
		this.HRDerecha=1;
		this.HRIzquierda=-1;
	// ==============================================
	// = PROPIEDADES
	// ==============================================
		this.nombre="arbNivel" + id;
		this.nCurItem=0;
		this.nItemWidth=1;
		this.nScrollDefault = 0;
		this.nRealWidth = 0;
		this.nNivel = nivel;
		// punteros a objetos -----------
		this.oBefore = document.getElementById(("arbAntes" + id));
		this.oMatRibbon=document.getElementById("arbMarco" + id);
		this.oMatRow=document.getElementById("arbListado" + id);
		this.oAfter = document.getElementById(("arbDespues" + id));
	// ==============================================
	// = METODOS
	// ==============================================
		this.initRibbon = function()
			{
				if(this.oMatRow.children.length>0)
				{
					//Por default oculto las flechas
					this.oBefore.style.display = "none";
					this.oAfter.style.display = "none";
					//Obtengo el scroll por default
					this.nScrollDefault = this.getScrollDefault();
					this.nRealWidth = this.getRealWidth();

					//Si es nivel 1 por default seteo el primer item del arbol como fijo
					if (this.nNivel == 1) {
						oArbolPath.setFijo(this.getObjectLink(0));
					}

					//alert("Nivel: " + this.nNivel + "\nSeleccionado: " + this.oMatRow.seleccionado);

					//Verifico cual es el id seleccionado por default
					if (typeof this.oMatRow.seleccionado != "undefined") {
						var aIds = this.oMatRow.seleccionado.split("|");
						//Selecciono el primero solamente
						if (aIds.length > 1) {
							this.select(aIds[0]);
							//Remuevo el primero
							aIds.shift();
							//Llamo al submenu correspondiente
							arbolDo.llamarSubMenu(this.oMatRow.children[this.nCurItem],aIds.join("|"));
						} else if (aIds.length == 1) {
							if (typeof this.oMatRibbon.nuevaInstancia == "undefined") {
								this.click(aIds[0]);
							}
							/*
							//Si existe algo seleccionado y es distinto de lo que hay en el array entonces
							//le doy importancia a lo que ya estaba seleccionado
							var nIdSelected = this.getIdFromSelected(true);
							alert("IdFromSelected: " + nIdSelected + "\nSeleccionado: " + aIds[0]);
							if (nIdSelected == null || nIdSelected == aIds[0]) {
								this.click(aIds[0]);
							} else {
								alert("Me voy al: " + this.getSelected());
								this.click(this.getSelected());
							}
							*/
						} else {
							//nCurItem
							this.nCurItem=0;
							this.click(this.indexToId(this.nCurItem));
						}
					} else {
						//nCurItem
						this.nCurItem=0;
						this.click(this.indexToId(this.nCurItem));
					}
				}

				cintaAncho= this.getWidth(this.oMatRibbon);
				inicioWin = this.oMatRibbon.scrollLeft;
				finWin = inicioWin + cintaAncho;

				if (inicioWin > 0 ) {
					this.oBefore.style.display = "";
				}
				if (finWin < this.nRealWidth) {
					this.oAfter.style.display = "";
				}

				//Busco si existe este atributo, sino lo agrego. Este atributo me permite identificar si el objeto ya esta siendo usado
				//o es la primera vez que se instancia
				if (typeof this.oMatRibbon.nuevaInstancia == "undefined") {
					this.oMatRibbon.setAttribute("nuevaInstancia","false");
					//this.oMatRibbon.nuevaInstancia = "false";
				} else {
					//marco como current el seleccionado
					this.nCurItem = this.oMatRibbon.getAttribute("lastSelected");
					if (this.nCurItem == null) {
						this.nCurItem = 0;
					}
					this.checkVisibilidad()
					//Actualizo el path del arbol
					if (this.nNivel == 1 && !oArbolPath.isSetFijo()) {
						oArbolPath.setFijo(this.getObjectLink(this.nCurItem));
					} else {
						oArbolPath.setPath(this.nNivel,this.getObjectLink(this.nCurItem));
					}
				}
			};
		this.getCurrentName = function()
			{
				return(this.oMatRow.cells[this.nCurItem].firstChild.innerHTML);
			};
		this.cambiar = function(direccion)
			{
				if(this.oMatRow.children.length>0)
				{
					var nJumpTo = 0;
					if(direccion>0) //va hacia la derecha --------
					{
						nJumpTo = this.oMatRibbon.scrollLeft - this.nScrollDefault;
						if (nJumpTo <= 0) {
							nJumpTo = 0;
							//Oculto la flecha
							this.oBefore.style.display = "none";
						} else {
							this.oBefore.style.display = "";
						}
						this.oAfter.style.display = "";
					}
					else //va hacia la izquierda -----------------
					{
						nJumpTo = this.oMatRibbon.scrollLeft + this.nScrollDefault;
						if (parseInt(this.getWidth(this.oMatRibbon)) + nJumpTo > this.nRealWidth) {
							nJumpTo -= ((parseInt(this.getWidth(this.oMatRibbon)) + nJumpTo) - this.nRealWidth);
							//Oculto la flecha
							this.oAfter.style.display = "none";
						} else {
							this.oAfter.style.display = "";
							//Por las dudas muestro la flecha del inicio
						}
						/*
						alert(
							"ScrollLeft: " + this.oMatRibbon.scrollLeft + "\n" +
							"ScrollDefault: " + this.nScrollDefault + "\n" +
							"JumpTo: " + nJumpTo + "\n" +
							"Width: " + parseInt(this.getWidth(this.oMatRibbon)) + "\n" +
							"RealWidth: " + this.nRealWidth
						);
						*/
						this.oBefore.style.display = "";
					}
					this.jumpToPixel(nJumpTo);
				}
			};
		this.turnto = function(item)
			{
				if(this.oMatRow.children.length>0)
				{
					this.checkVisibilidad();
				}
			};
		this.select = function(id)
			{
				var bReturn = false;
				if(this.oMatRow.children.length>0)
				{
					var nItem = this.idToIndex(id);
					//alert("id: " + id + "\nnItem: " + nItem);
					if (nItem >= 0) {
						//Quito el "selected" al actual
						var sClassName = this.oMatRow.children[this.nCurItem].className;
						this.oMatRow.children[this.nCurItem].className = sClassName.replace(/_selected/g,"");
						//Cambio el current al recibido por parametro
						this.nCurItem=nItem;
						this.oMatRow.children[this.nCurItem].className += "_selected";
						this.turnto(nItem);
						bReturn = true;
						//Actualizo el path del arbol
						if (this.nNivel == 1 && !oArbolPath.isSetFijo()) {
							oArbolPath.setFijo(this.getObjectLink(nItem));
						} else {
							oArbolPath.setPath(this.nNivel,this.getObjectLink(nItem));
						}
						//Guardo el ultimo seleccionado
						this.oMatRibbon.setAttribute("lastSelected",nItem);
						//this.oMatRibbon.lastSelected = nItem;
					}
				}
				return bReturn;
			};
		this.click = function(id)
			{
				if(this.select(id))
				{
					//OJO AL PIOJO
					//Si ya existe una APP cargada en el content entonces NO SE DISPARA EL CLICK
					var oContent = document.getElementById("content");
					//alert("Click del id: " + id);
					if(oContent)
					{
					//alert("oContent: " + oContent.innerHTML);
						if (oContent.innerHTML.indexOf("<") == -1)
						{
							var oLink = this.oMatRow.children[this.nCurItem].getElementsByTagName("A"); //GDR
							if (oLink[0])
							{
								//alert("muestro submenu y ejecuto");
								oLink[0].click();
							}
						}
						else
						{
							//alert("no ejecuto pero muestro submenu [["+id);
							arbolDo.llamarSubMenu(this.oMatRow.children[this.idToIndex(id)]);
						}
					}
				}
			};
		this.focus = function()
			{
				if(this.oMatRow.children.length>0) this.oMatRow.children[this.nCurItem].className="actual";
			};
		this.blur = function()
			{
				if(this.oMatRow.children.length>0) this.oMatRow.children[this.nCurItem].className=(this.nCurItem==this.nSelItem)?"selected":"item";
			};
		this.reinicializar = function()
			{
				this.oMatRibbon.scrollLeft = 0;
				this.initRibbon();
			};
		this.derecha = function()
			{
				if(this.oMatRow.children.length>0)
				{
					this.cambiar(this.HRDerecha);
					//MCNAV.focus(this.nombre);
				}
			};
		this.izquierda = function()
			{
				if(this.oMatRow.children.length>0)
				{
					this.cambiar(this.HRIzquierda);
					//MCNAV.focus(this.nombre);
				}
			};
		this.getObjectLink = function(nIndex)  {
			var oLink = this.oMatRow.children[nIndex].getElementsByTagName("A"); //GDR
			return oLink[0];
		}

		this.getSelected = function () {
			var nReturn = null;
			for(var i=0; i < this.oMatRow.children.length; i++) {
				var sClassName = this.oMatRow.children[i].className;
				if (sClassName.indexOf("_selected")) {
					nReturn = i;
					break;
				}
			}
			return nReturn;
		}
		this.getIdFromSelected = function (bLast) {
			var nReturn = null;
			for(var i=0; i < this.oMatRow.children.length; i++) {
				var sClassName = this.oMatRow.children[i].className;
				if (sClassName.indexOf("_selected")) {
					nReturn = this.oMatRow.children[i].id.replace(/item/g,"");
					if (typeof bLast != "undefined" && !bLast) {
						break;
					}
				}
			}
			return nReturn;
		}
	// ==============================================
	// = MANEJO INTERNO
	// ==============================================
		this.checkVisibilidad = function()
			{
				if (this.oMatRow.children[this.nCurItem]) {
					inicioItem = this.oMatRow.children[this.nCurItem].offsetLeft;
					finItem = inicioItem + this.getWidth(this.oMatRow.children[this.nCurItem]);

					cintaAncho= this.getWidth(this.oMatRibbon);

					inicioWin = parseInt(this.oMatRibbon.scrollLeft);
					finWin = inicioWin + cintaAncho;

					//alert("inicioItem: " + inicioItem + "\nfinItem: " + finItem + "\ncintaAncho: " + cintaAncho + "\ninicioWin: " + inicioWin + "\nfinWin: " + finWin);

					if (inicioItem < inicioWin) {
						this.oMatRibbon.scrollLeft = inicioItem;
					} else {
						if (finItem >= finWin) {
							this.oMatRibbon.scrollLeft = finItem - cintaAncho;
						}
					}

					//porque quizas se cambiaron arriba
					inicioWin = parseInt(this.oMatRibbon.scrollLeft);
					finWin = inicioWin + cintaAncho;

					//alert("inicioItem: " + inicioItem + "\nfinItem: " + finItem + "\ncintaAncho: " + cintaAncho + "\ninicioWin: " + inicioWin + "\nfinWin: " + finWin + "\nRealWidth: " + this.getRealWidth());

					if (inicioWin > 0 ) {
						this.oBefore.style.display = "";
					} else {
						this.oBefore.style.display = "none";
					}
					if (finWin < this.getRealWidth()) {
					//if (finWin < this.nRealWidth) {
						this.oAfter.style.display = "";
					} else {
						this.oAfter.style.display = "none";
					}
				}
			};
			this.jumpToPixel = function(pixel)
				{
					var p1 = parseInt(this.oMatRibbon.scrollLeft);
					var p2 = parseInt(pixel);
					var paso = 0.5/(100); //delta PI
					for(t=1.5; t<=2; t+=paso) //subo por cuarto cuadrante
						this.oMatRibbon.scrollLeft=p1+(p2-p1)*Math.cos(t*Math.PI);
				};
			this.idToIndex = function(id)
				{
					var nReturn = -1;
					for(var i=0; i < this.oMatRow.children.length; i++) {
						if (id == parseInt(this.oMatRow.children[i].id.replace(/item/g,""))) {
							nReturn = i;
							break;
						}
					}
					return nReturn;
				}
			this.indexToId = function(index) {
				var nReturn = -1;
				if (this.oMatRow.children.length > 0) {
					nReturn = parseInt(this.oMatRow.children[index].id.replace(/item/g,""));
				}
				return nReturn;
			}
	// ==============================================
	// = CALCULO DE TAMANIO
	// ==============================================
		this.getWidth = function(obj)
			{
				//if(obj.nWidth=undefined || refresh) this.setProperties(obj);
				this.setProperties(obj);
				return(obj.nWidth);
			};
		this.getHeight = function(obj)
			{
				if(obj.nHeight==undefined) this.setProperties(obj);
				return(obj.nHeight);
			};
		this.setProperties = function(obj)
			{
				objPosition=obj.getBoundingClientRect()
				obj.nLeftPos = objPosition.left -2
				obj.nRightPos = objPosition.right -2
				obj.nTopPos = objPosition.top - 2
				obj.nBottomPos = objPosition.bottom -2
				obj.nWidth = (obj.nRightPos - obj.nLeftPos)
				obj.nHeight = (obj.nBottomPos - obj.nTopPos)
			};
		this.getScrollDefault = function()
			{
				var nReturn = 0;
				for(var i = 0; i < this.oMatRow.children.length; i++) {
					if (this.getWidth(this.oMatRow.children[i]) > nReturn) {
						nReturn = this.getWidth(this.oMatRow.children[i]);
					}
				}
				return nReturn;
			}
		this.getRealWidth = function()
			{
				/*
				var nReturn = 0;
				for(var i = 0; i < this.oMatRow.children.length; i++) {
					nReturn += parseInt(this.getWidth(this.oMatRow.children[i]));
				}
				//alert("RealWidth: " + nReturn + "MatRow.Width: " + this.getWidth(this.oMatRow));
				*/
				return this.getWidth(this.oMatRow);
			}

	// ==============================================
	// = INICIALIZACION
	// ==============================================
		this.initRibbon();
}

//alert("TextHRibbon 1.0.001");
//**************  /app/arbol/js/arbolPath.js ********* //
/**
 * @class
 * Esta clase se utiliza para manejar el path del arbol
 */

/**
 * @constructor
 * @param {objecto}	oNodo	Objeto nodo con la info para mostrar como texto y tambien con el onclick para ejecutar
 */
function arbolPath(oNodo) {
	// ==========================================
	// Propiedades
	// ==========================================
	if (typeof oNodo != "undefined") {
		this.aPila = new Array(oNodo);		
	} else {
		this.aPila = new Array();
	} 
	this.oArbolPath = document.getElementById("ruta");

	/**
	 * Esta funcion es la encargada de dibujar el path recorriendo aPila
	 */
	this.draw = function () 
		{
			//Vacio el div
			this.oArbolPath.innerHTML = "";
			//Lo Armo Nuevamente
			for(var i = 0; i < this.aPila.length; i++) {
				var oNodo = this.aPila[i];
				if (oNodo.parentNode) {
					if (i < this.aPila.length-1) {
						if (i > 0) {
							this.oArbolPath.innerHTML += " | ";
						}					
						this.oArbolPath.innerHTML += "<a onclick=\"oArbolPath.click(" + i + ",'" + oNodo.parentNode.id +"');\">" + this.getTextNode(oNodo) + "</a>";
					} else {
						if (i > 0) {
							this.oArbolPath.innerHTML += " / ";
						}
						//alert("Nodo: " + oNodo + "\nParent: " + oNodo.parentNode);					
						this.oArbolPath.innerHTML += "<span onclick=\"oArbolPath.click(" + i + ",'" + oNodo.parentNode.id +"');\">" + this.getTextNode(oNodo) + "</span>";						
					}					
				}
			}
		}

	/**
	 * Pone como fijo un item
	 */
	this.setFijo = function(oNodo) {
		if (this.aPila.length > 0) {
			this.aPila[0] = oNodo;
		} else {
			this.aPila.push(oNodo);
		}
		this.draw();
	}
	
	/**
	 * Devuelve verdadero si existe como fijo un item
	 * @return	bool
	 */
	this.isSetFijo = function () 
		{
			return (this.aPila.length > 0); 
		}
	/**
	 * Setea el path correspondiente en la barra
	 * @param {numeric}	nNivel	Nivel correspondiente en el nodo
	 * @param {object}	oNodo	Objeto con la informacion
	 */
	this.setPath = function(nNivel,oNodo) 
		{
			if (this.getTextNode(this.aPila[0]) == this.getTextNode(oNodo)) {
				//Hizo click en el home
				this.aPila = this.aPila.slice(0,1);
			} else {
				//Primero borro la informacion en el array desde ese nivel para abajo
				this.aPila = this.aPila.slice(0,nNivel);
				//Agrego la info
				this.aPila.push(oNodo);
			}
			//dibujo nuevamente la info
			this.draw();				
		}
		
	/**
	 * Esta funcion devuelve el texto que esta dentro del <span>
	 * @param {object}	oNode	Objeto para buscar el texto
	 * @return string
	 */
	this.getTextNode = function(oNodo) 
		{
			var re = /<span>(.+)<\/span>/i;
			var aResult = oNodo.innerHTML.match(re);
			var sReturn = "";
			if (aResult != null && aResult.length >= 2) {
				sReturn = aResult[1];
			}
			return sReturn;
		}
	/**
	 * Dispara el onclick del menu
	 */
	this.click = function(nIndex,sId) 
		{			
			var oParent = document.getElementById(sId);
			if (oParent) {
				var oLinks = oParent.getElementsByTagName("A");
				oLinks[0].click();
			}
			//this.aPila[nIndex].click();
		}
}

/**
 * Esta funcion se puso para no modificar el principal.xsl. Como se usa en un monton de lados entonces la creo aca y lo unico que hago es mandar al home
 */
function treeOnStart() {
	//if (typeof oArbolPath != "undefined" && oArbolPath.aPila.length > 0) {
	//	oArbolPath.click(0);
	//}
	if(document.getElementById("ruta")){
		if(document.getElementById("ruta").childNodes){
			if(document.getElementById("ruta").childNodes[0]){
				if(document.getElementById("ruta").childNodes[0].onclick){
					document.getElementById("ruta").childNodes[0].onclick();
				}
			}
		}
	}
}
//**************  /app/fecha/js/fecha.js ********* //
<!--
function getCalendarDate(idioma,formato)
{
if(typeof formato=="undefined"){
		var formato=""
}
if(formato=="dd/mm/yyyy"){
		var now = new Date();
		var year = now.getFullYear();

		//RECORDAR: en getMonth, el primer mes inicia con "0"
		var month = now.getMonth()+1; 
		var month = (month<10 ? "0"+month : month);		

		var day = ((now.getDate()<10) ? "0" : "")+ now.getDate();

	if( idioma=="ING" )
	{
		dateString =   month + "/" + day + "/" +year;
	}
	else
	{
		dateString =  day + "/" + month + "/" +year;
	}
	
}else{	
	if( idioma=="ING" )
	{
		var now = new Date();
		var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
		var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
		var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
		dateString =  days[now.getDay()] + ", " + months[now.getMonth()] + " " + date + "th, " + (fourdigits(now.getYear())) ;
	}
	else if( idioma=="POR" || idioma=='LUS')
	{
		var now = new Date();
		var days = new Array('Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado');
		var months = new Array('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro');
		var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
		dateString =  days[now.getDay()] + ", " + date + " de " + months[now.getMonth()] + " de " + (fourdigits(now.getYear())) ;
	}
	else
	{
		var now = new Date();
		var days = new Array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado');
		var months = new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
		var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
		dateString =  days[now.getDay()] + ", " + date + " de " + months[now.getMonth()] + " de " + (fourdigits(now.getYear())) ;
	}
}//end if formato
	return dateString;
} // function getCalendarDate()

function fourdigits(number)	{	return (number < 1000) ? number + 1900 : number; }
//-->
//**************  /framework/js/framework.js ********* //
//==============================================================================
// FRAMEWORK - Javascript 
// Crafted by Goose!2006
//==============================================================================
// javascript:alert(principal.FWK.loadFrameInto('enlacesMod','principal'));

//==============================================================================
// INCLUSIONES 
//==============================================================================

/**
* Incluye archivos js
*/
	function fwk_requires()
	{
		sPath="/scripts/framework/js/";
		aRequires=Array(	"prototype.js",
											"scriptaculous.js"
											);
		for(a=0;a<aRequires.length;a++) document.write('<script type="text/javascript" src="'+sPath+aRequires[a]+'"></script>');
	} 

//==============================================================================
// FRIEND FUNCTIONS
//==============================================================================

//==============================================================================
// OBJETO FWK
//==============================================================================
if(typeof(FWK)=="undefined")
var FWK =	
{
	debug: false, 
	browser : navigator.appName, //find the browser name
	//==============================================================================
	// AHAH 
	//==============================================================================
		//==============================================================================
		// LOAD
		//==============================================================================
			ahah_open_return	:	function (url)
													{
														try
														{
															var req;
															if(this.browser == "Microsoft Internet Explorer")	req = new ActiveXObject("Microsoft.XMLHTTP");
															else req = new XMLHttpRequest();
															if(req)
															{
																req.open("POST",url,false);
																req.send(null)
																if(req.status<400)	return(req.responseText);
																else								return("FWK:Error: "+req.statusText);
															}
														}
														catch(e) { window.status="ahah_open_return	["+e.message+"]"; }
													},
			ahah_open_get	:	function (url)
													{
														try
														{
															var req;
															if(this.browser == "Microsoft Internet Explorer")	req = new ActiveXObject("Microsoft.XMLHTTP");
															else req = new XMLHttpRequest();
															if(req)
															{
																req.open("GET",url,false);
																req.send(null)
																if(req.status<400)	return(req.responseText);
																else								return("FWK:Error: "+req.statusText);
															}
														}
														catch(e) { window.status="ahah_open_return	["+e.message+"]"; }
													},													
			ahah_open_set	:	function(url,target)
											{
												try
												{
													var req;
													var onStateChangeLocal=this.onStateChangeLocal;
													if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
													else req = new XMLHttpRequest();
													if(req)
													{
														req.onreadystatechange=function()
															{
																if(req.readyState==4)
																	if(req.status<400)
																	{
																		results=req.responseText;																		
																		// no funcionaba ni en IE ni en otros navegadores
																		// el this.debug da undefiniend en IE y que siempre es un objeto (true) en  otros nav.
																		//if(this.debug) alert(results);																		
																		//onStateChangeDebug=this.debug
																		document.getElementById(target).innerHTML=results;																		
																		
																		
																		if(FWK) if(FWK.onStateChange) FWK.onStateChange(FWK.debug,"end_aha",target); //puesto con FWK por que el this parece que dentro no funciona ya que el alert nunca se ve
																	}
																	else	document.getElementById(target).innerHTML="<font color='red'>FWK:Error: "+req.statusText+"<br/></font>"+document.getElementById(target).innerHTML;
															};
														req.open("POST",url,true);
														req.send(null)
													}
												}
												catch(e) { window.status="ahah_open_set	["+e.message+"]"; }
											},
			ahah_open_getcallback	:	function(url,callback,callwhile)
														{
															try
															{
																var req;
																if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
																else req = new XMLHttpRequest();
																if(req)
																{
																	if(!callwhile) callwhile="fwk_doNothing";
																	eval("callbackFunc=function () { if (req.readyState == 4) "+callback+"(req); else "+callwhile+"(req.readyState); };");
																	req.onreadystatechange=callbackFunc;
																	req.open("GET",url,true);
																	req.send(null)
																}
															}
															catch(e) { window.status="ahah_open_callback2 ["+e.message+"]"; }
														},											
			ahah_open_callback	:	function(url,callback,callwhile)
														{
															try
															{
																var req;
																if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
																else req = new XMLHttpRequest();
																if(req)
																{
																	if(!callwhile) callwhile="fwk_doNothing";
																	eval("callbackFunc=function () { if (req.readyState == 4) "+callback+"(req); else "+callwhile+"(req.readyState); };");
																	req.onreadystatechange=callbackFunc;
																	req.open("POST",url,true);
																	req.send(null)
																}
															}
															catch(e) { window.status="ahah_open_callback2 ["+e.message+"]"; }
														},
		//==============================================================================
		// POST
		//==============================================================================
			ahah_post_return	:	function (url,form)
													{
														try
														{
															var req;
															if(this.browser == "Microsoft Internet Explorer")	req = new ActiveXObject("Microsoft.XMLHTTP");
															else req = new XMLHttpRequest();
															if(req)
															{
																req.open("POST",url,false);
																req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
																req.send(form)
																if(req.status<400)	return(req.responseText);
																else								return("FWK:Error: "+req.statusText);
															}
														}
														catch(e) { window.status="ahah_post_return	["+e.message+"]"; }
													},
			ahah_post_set	:	function(url,form,target)
											{
												try
												{
													var req;
													if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
													else req = new XMLHttpRequest();
													if(req)
													{
														req.onreadystatechange=function()
															{
																if(req.readyState==4)
																	if(req.status<400)
																	{
																		results=req.responseText;																		
																		// no funcionaba ni en IE ni en otros navegadores
																		// el this.debug da undefiniend en IE y que siempre es un objeto (true) en  otros nav.
																		//if(this.debug) alert(results);
																		document.getElementById(target).innerHTML=results;
																		
																		if(FWK) if(FWK.onStateChange) FWK.onStateChange(FWK.debug,"end_aha",target); //puesto con FWK por que el this parece que dentro no funciona ya que el alert nunca se ve
																	}
																	else	document.getElementById(target).innerHTML="<font color='red'>FWK:Error: "+req.statusText+"<br/></font>"+document.getElementById(target).innerHTML;
															};
														req.open("POST",url,true);
														req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
														req.send(form)
													}
												}
												catch(e) { window.status="ahah_post_set	["+e.message+"]"; }
											},
			ahah_post_callback	:	function(url,form,callback,callwhile)
														{
															try
															{
																var req;
																if(this.browser == "Microsoft Internet Explorer") req = new ActiveXObject("Microsoft.XMLHTTP");
																else req = new XMLHttpRequest();
																if(req)
																{
																	if(!callwhile) callwhile="fwk_doNothing";
																	eval("callbackFunc=function () { if (req.readyState == 4) "+callback+"(req); else "+callwhile+"(req.readyState); };");
																	req.onreadystatechange=callbackFunc;
																	req.open("POST",url,true);
																	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
																	req.send(form)
																}
															}
															catch(e) { window.status="ahah_post_callback	["+e.message+"]"; }
														},
	//==============================================================================
	// LOAD
	//==============================================================================
		//==============================================================================
		// FRAME
		//==============================================================================
		loadFrameInto	: function(destino,frame,parametros,onstateParams)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&FRAME="+frame+parametros;										
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\nparam:["+parametros+"]");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,frame,parametros,onstateParams);
										this.ahah_open_set(url,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,frame,parametros,onstateParams);
									},
		loadFrame			: function(frame,parametros)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&FRAME="+frame+parametros;
										if(this.debug) alert("url:["+url+"]\nparam:["+parametros+"]");
										return(this.ahah_open_return(url,null));
									},
		loadFrameCallback	: function(callback,frame,parametros,callwhile)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&FRAME="+frame+parametros;
										if(this.debug) alert("url:["+url+"]\nparam:["+parametros+"]");
										this.ahah_open_callback(url,callback,callwhile);
									},
		//==============================================================================
		// APP 
		//==============================================================================
		loadAppInto	: function(destino,app,parametros,onstateParams)
									{
										url="/scripts/app/framework.php?FWKINLINE=1&APP="+app+parametros;
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,app,parametros,onstateParams);
										this.ahah_open_set(url,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,app,parametros,onstateParams);
									},
		reloadIsNeed	: function (new_sitepage)
									{										
										//Esta funcion se implemento para evitar tener que propagar el Reload de Banners y de conteo de metricas por todas las aplicaciones
										//Esta vinculada con loadAppInto y loadFrameInto que al ser usadas por las aplicaciones de forma transparente realizan el refresco										
										if(FWK.debug) alert(" FWK :: reloadIsNeed Sitepage:"+new_sitepage);
										try{											
											if(typeof BANNERS!= "undefined"){if(BANNERS.reload){BANNERS.reload();}}
											if(typeof METRICAS!= "undefined"){if(METRICAS.reload){METRICAS.reload();}}	
										}catch(er){
											window.status="Er";
										}
									},
		loadApp			: function(app,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+parametros;
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]");
										return(this.ahah_open_return(url,null));
									},
		loadAppCallback	: function(callback,app,parametros,callwhile)
									{
										url="/scripts/app/framework.php?APP="+app+parametros;
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]");
										this.ahah_open_callback(url,callback,callwhile);
									},
		//==============================================================================
		// API
		//==============================================================================
		loadApiInto	: function(destino,app,token,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]");
										this.ahah_open_set(url,destino);
									},
		loadApi			: function(app,token,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]");
										return(this.ahah_open_return(url,null));
									},
		loadApiCallback	: function(callback,app,token,parametros,callwhile)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										if(this.debug) alert("url:["+url+"]\ntoken:["+token+"]\napp:["+app+"]\nparam:["+parametros+"]");
										this.ahah_open_callback(url,callback,callwhile);
									},

	//==============================================================================
	// LOAD
	//==============================================================================
		//==============================================================================
		// FRAME
		//==============================================================================
		postFrameInto	: function(destino,frame,pform,parametros,onstateParams)
									{
										url="/scripts/app/framework.php";
										sform="FWKINLINE=1&FRAME="+frame+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,app,parametros,onstateParams);
										this.ahah_post_set(url,sform,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,app,parametros,onstateParams);
										this.reloadIsNeed();
									},
		postFrame			: function(frame,pform,parametros)
									{
										url="/scripts/app/framework.php";
										sform="FWKINLINE=1&FRAME="+frame+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										return(this.ahah_open_return(url,sform));
									},
		postFrameCallback	: function(callback,frame,pform,parametros,callwhile)
									{
										url="/scripts/app/framework.php?";
										sform="FWKINLINE=1&FRAME="+frame+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_callback(url,sform,callback,callwhile);
									},
		//==============================================================================
		// APP 
		//==============================================================================
		postAppInto	: function(destino,app,pform,parametros,onstateParams)
									{
										url="/scripts/app/framework.php";
										sform="FWKINLINE=1&APP="+app+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										if(this.onStateChange) this.onStateChange(this.debug,"begin",destino,app,parametros,onstateParams);
										this.ahah_post_set(url,sform,destino);
										if(this.onStateChange) this.onStateChange(this.debug,"end",destino,app,parametros,onstateParams);
									},
		postApp			: function(app,pform,parametros)
									{
										url="/scripts/app/framework.php?";
										sform="APP="+app+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										return(this.ahah_post_return(url,sform));
									},
		postAppCallback	: function(callback,app,pform,parametros,callwhile)
									{
										url="/scripts/app/framework.php?";
										sform="APP="+app+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_callback(url,sform,callback,callwhile);
									},
		//==============================================================================
		// API
		//==============================================================================
		postApiInto	: function(destino,app,token,pform,parametros)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										sform="APP="+app+"&API="+token+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ndest:["+destino+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_set(url,sform,destino);
									},
		postApi			: function(app,token,pform,parametros)
									{
										url="/scripts/app/framework.php";
										sform="APP="+app+"&API="+token+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										return(this.ahah_post_return(url,sform));
									},
		postApiCallback	: function(callback,app,token,pform,parametros,callwhile)
									{
										url="/scripts/app/framework.php?APP="+app+"&API="+token+parametros;
										sform="APP="+app+"&API="+token+parametros+"&"+this.getFormValues(document.getElementById(pform));
										if(this.debug) alert("url:["+url+"]\ntoken:["+token+"]\napp:["+app+"]\nparam:["+parametros+"]\n\nPOST=\n-----------\n"+sform+"\n-----------");
										this.ahah_post_callback(url,sform,callback,callwhile);
									},
									
	//==============================================================================
	// UTILIDADES
	//==============================================================================
		getFormValues	:	function(fobj)
										{
											var str = "";
											for(var i = 0;i < fobj.elements.length;i++)
											{
												switch(fobj.elements[i].type)
												{
													case "password":
													case "textarea":
													case "hidden":
													case "text": str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&"; break;
													case "select-one": str += fobj.elements[i].name + "=" + escape(fobj.elements[i].options[fobj.elements[i].selectedIndex].value) + "&"; break;
													case "checkbox": if(fobj.elements[i].checked) str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&"; break;
													case "radio": if(fobj.elements[i].checked) str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&"; break;
												}
											}
											str = str.substr(0,(str.length - 1));
											if(this.debug) alert(str);
											return str;
										}

};

if(top.location){
	if(top.location.toString().search(/debugjsfwk=/)!=-1){
		FWK.debug=true;
	}
}

function	fwk_doNothing(estado) {  } //Esta funcion es el default de los "callwhile"
function	ltrim(s)	//trimeo de enters en respuestas de ajax
{
	i=0; while(s.charAt(i)=='\n'||s.charAt(i)=='\r'||s.charAt(i)==' ') i++;
	return(s.substr(i));
}

//==============================================================================
// OBJETO CSS
//==============================================================================

CSS=
{
	addCss: function(archivo,titulo,alternate)
			{
				if(this.debug) alert("::CSS>> addCss archivo=["+archivo+"] titulo=["+titulo+"]");
				if(!this.existCss(archivo))
				{
					var oHead = document.getElementsByTagName("HEAD")[0];
					var oLink = document.createElement("link");
					oLink.attributes.setNamedItem(this.crearAtributo("href",archivo));
					if(alternate)	oLink.attributes.setNamedItem(this.crearAtributo("rel","alternate stylesheet"));
					else					oLink.attributes.setNamedItem(this.crearAtributo("rel","stylesheet"));
					oLink.attributes.setNamedItem(this.crearAtributo("type","text/css"));
					oLink.attributes.setNamedItem(this.crearAtributo("title",titulo));
					oLink.attributes.setNamedItem(this.crearAtributo("id",titulo));
					if(this.debug) alert(oLink.outerHTML);
					oHead.appendChild(oLink);
					if(this.debug) alert(oHead.innerHTML);
					if(alternate) { this.turnCss(titulo,true); this.turnCss(titulo,false); } //bugfix para que no se prenda
				}
				else if(this.debug) alert("::CSS>> addCss archivo=["+archivo+"] titulo=["+titulo+"] --- YA EXISTIA !!!");
			},
	crearAtributo: function(nombre,valor)
			{
				var nItem = document.createAttribute(nombre);
				nItem.value = valor;
				return(nItem);
			},
	removeCss: function(archivo,titulo)
			{
				if(this.debug) alert("::CSS>> removeCss archivo=["+archivo+"] titulo=["+titulo+"]");
				var aLinks = document.getElementsByTagName("LINK");
				if(titulo==null)	
					for (i=0;i<aLinks.length;i++) 
					{ 
						if(aLinks[i].href==archivo) 
						{ 
								//this.turnCss(aLinks[i].title,false); 
								aLinks[i].removeNode(true); 
						} 
					}
				else							
					for (i=0;i<aLinks.length;i++) 
					{ 
						if(aLinks[i].title==titulo) 
						{ 
							//this.turnCss(aLinks[i].title,false); 
							aLinks[i].removeNode(true); 
						} 
					}
			},
	existCss: function(archivo)
			{
				if(this.debug) alert("::CSS>> existCss archivo=["+archivo+"]");
				for (i=0;i<document.styleSheets.length;i++) if(document.styleSheets(i).href==archivo) return(true);
				return(false);
			},
	turnCss: function(nom,estado)
			{
				if(this.debug) alert("::CSS>> TurnCss nom=["+nom+"] estado=["+estado+"]");
				estado=!estado;
				for (i=0;i<document.styleSheets.length;i++)
				{
					nombre=document.styleSheets(i).title;
					nombre=nombre.substr(0,nom.length);
					if(nom==nombre) { 
						//alert('OOOOO la encontre-----'+nom); 
						document.styleSheets(i).disabled=estado; return; }
				}
			},
	setCss: function(nom)
			{
				for (i=0;i<document.styleSheets.length;i++)
				{
					if(document.styleSheets(i).title==nom)	document.styleSheets(i).disabled=false;
					else																		document.styleSheets(i).disabled=true;
				}
			},
	getCssActivos: function()
			{
				aEstilos=new Array;
				if(this.debug) alert("::CSS>> Total de styles: "+document.styleSheets.length);
				for (i=0;i<document.styleSheets.length;i++) 
				{
					if(!(document.styleSheets(i).disabled))
					{
						if(this.debug) alert("::CSS>> Nro: "+i+" ACTIVO >> "+document.styleSheets(i).title);
						aEstilos.push(document.styleSheets(i).title);
					}
				}
				return(aEstilos);
			}
}

//==============================================================================
// LOAD 
//==============================================================================

//fwk_requires();
//alert("jsFramework\n\nLOAD r6.1.008\nPOST r1.0.000\nCSS r1.0.027");

/* ------------------
   JAVASCRIPT PARA SOCIALNETWORKS
   ------------------
*/

SOCNET=
{
	debug : true,
	
	// CAMBIOS DE PANEL --------------------------------------------------------
	turnTo : function(destino)
	{
		switch(destino)
		{
			case 'panel'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(false); 
								obImg=document.getElementById("socnet_form_verifImg");
								obImg.src=obImg.src+"1";
								obInp=document.getElementById("socnet_form_verificacion");
								obInp.value="";
							  	break;
			case 'error'	: 	this.showPanel(true); this.showError(true); this.showFinish(false); this.showSending(false); break;
			case 'finish'	: 	this.showPanel(false); this.showError(false); this.showFinish(true); this.showSending(false); break;
			case 'sending'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(true); break;
			default			: 	this.showPanel(false); this.showError(false); this.showFinish(false); this.showSending(false); break; // 'nada'
		}
	},
	showInicial : function()
	{
		document.getElementById("socnet_form_de").value="";
		document.getElementById("socnet_form_para").value="";
		document.getElementById("socnet_form_email").value="";
		document.getElementById("socnet_form_mensaje").value="";
		this.turnTo('panel');
	},
	showPanel : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetPanel");
		if(estado) 
		{
			ob.style.display="block";
		}
		else ob.style.display="none";
	},
	showError : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetError");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showFinish : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetFinish");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showSending : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetSending");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},

	// CHEQUEO Y ENVIO DE FORM -------------------------------------------------	
	checkForm : function()
	{
		ok=true;
		causa="";
		
		// TODO: aca van los chequeos
		obDe=document.getElementById("socnet_form_de");
		obPara=document.getElementById("socnet_form_para");
		obEmail=document.getElementById("socnet_form_email");
		obMensaje=document.getElementById("socnet_form_mensaje");
		if(obMensaje.value.lenght>1000) obMensaje.value=obMensaje.value.substr(0,1000);
		
		errDe=document.getElementById("errorDe");
		errPara=document.getElementById("errorPara");
		errEmail=document.getElementById("errorEmail");
		errGen=document.getElementById("socnetErrorMessage");
		errGen.style.display="none";
		errDe.style.visibility="hidden";
		
		if(obDe.value.length<2)
		{ 
			ok=false; 
			errDe.style.display="block";
			errDe.style.visibility="visible";
		}
		else 
		{
			errDe.style.display="none";
			errDe.style.visibility="hidden";
		}
		
		if(obPara.value.length<2) 
		{ 
			ok=false; 
			errPara.style.display="block";
			errPara.style.visibility="visible";
		}
		else 
		{
			errPara.style.display="none";
			errPara.style.visibility="hidden";
		}
		
		if(obEmail.value.length<2) 
		{ 
			ok=false; 
			errEmail.style.display="block";
			errEmail.style.visibility="visible";
		}
		else 
		{
			errEmail.style.display="none";
			errEmail.style.visibility="hidden";
		}
		
		if(ok)	this.sendForm();
		else	this.turnTo('error'); // prendo el error
	},
	sendForm : function()
	{
		// agrego el url
		ur=document.getElementById('inputUrl');
		socnetur=document.getElementById('socnet_url');
		if(ur!=null && socnetur!=null) socnetur.value=ur.value;
		
		this.turnTo('sending');
		this.objForm=document
		//FWK.debug=true; // for debugging 
		FWK.postApiCallback("SOCNET.resultForm","socialnetworks:mixplay","saveForm","socnetForm","")
		// TODO: aca va el envio por ajax!!
	},
	resultForm : function(req)
	{
		if(req.responseText=="OK") //todo vino ok!
		{
			this.turnTo('finish');
		}
		else
		{
			document.getElementById("errorDe").style.display="none";
			document.getElementById("errorDe").style.visibility="hidden";
			document.getElementById("errorPara").style.display="none";
			document.getElementById("errorPara").style.visibility="hidden";
			document.getElementById("errorEmail").style.display="none";
			document.getElementById("errorEmail").style.visibility="hidden";
			document.getElementById("socnetErrorMessage").style.display="block";
			document.getElementById("socnetErrorMessage").style.visibility="visible";
			document.getElementById('socnetErrorMessage').innerHTML=req.responseText; // seteo el mensaje
			this.turnTo('error'); // prendo el error
		}
	}
}

AMIGO=
{
	debug : true,
	
	// CAMBIOS DE PANEL --------------------------------------------------------
	turnTo : function(destino)
	{
		switch(destino)
		{
			case 'panel'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(false); 
								obImg=document.getElementById("amigo_form_verifImg");
								obImg.src=obImg.src+"1";
								obInp=document.getElementById("amigo_form_verificacion");
								obInp.value="";
							  	break;
			case 'error'	: 	this.showPanel(true); this.showError(true); this.showFinish(false); this.showSending(false); break;
			case 'finish'	: 	this.showPanel(false); this.showError(false); this.showFinish(true); this.showSending(false); break;
			case 'sending'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(true); break;
			default			: 	this.showPanel(false); this.showError(false); this.showFinish(false); this.showSending(false); break; // 'nada'
		}
	},
	showInicial : function()
	{
		document.getElementById("amigo_form_de").value="";
		document.getElementById("amigo_form_para").value="";
		document.getElementById("amigo_form_email").value="";
		document.getElementById("amigo_form_mensaje").value="";
		this.turnTo('panel');
	},
	showPanel : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoPanel");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showError : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoError");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showFinish : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoFinish");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showSending : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoSending");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},

	// CHEQUEO Y ENVIO DE FORM -------------------------------------------------	
	checkForm : function()
	{
		ok=true;
		causa="";
		
		// TODO: aca van los chequeos
		obDe=document.getElementById("amigo_form_de");
		obPara=document.getElementById("amigo_form_para");
		obEmail=document.getElementById("amigo_form_email");
		obMensaje=document.getElementById("amigo_form_mensaje");
		if(obMensaje.value.lenght>1000) obMensaje.value=obMensaje.value.substr(0,1000);
		
		errDe=document.getElementById("errorDe");
		errPara=document.getElementById("errorPara");
		errEmail=document.getElementById("errorEmail");
		errGen=document.getElementById("amigoErrorMessage");
		errGen.style.display="none";
		errDe.style.visibility="hidden";
		
		if(obDe.value.length<2)
		{ 
			ok=false; 
			errDe.style.display="block";
			errDe.style.visibility="visible";
		}
		else 
		{
			errDe.style.display="none";
			errDe.style.visibility="hidden";
		}
		
		if(obPara.value.length<2) 
		{ 
			ok=false; 
			errPara.style.display="block";
			errPara.style.visibility="visible";
		}
		else 
		{
			errPara.style.display="none";
			errPara.style.visibility="hidden";
		}
		
		if(obEmail.value.length<2) 
		{ 
			ok=false; 
			errEmail.style.display="block";
			errEmail.style.visibility="visible";
		}
		else 
		{
			errEmail.style.display="none";
			errEmail.style.visibility="hidden";
		}
		
		if(ok)	this.sendForm();
		else	this.turnTo('error'); // prendo el error
	},
	sendForm : function()
	{
		// agrego el url
		ur=document.getElementById('inputUrl');
		amigour=document.getElementById('amigo_url');
		if(ur!=null && amigour!=null) amigour.value=ur.value;
		
		// agrego el nodo
		c1=document.getElementById("combo1");
		c2=document.getElementById("combo2");
		c3=document.getElementById("combo3");
		if(c3.value!="") cf=c3;
		else
		{
			if(c2.value!="") cf=c2;
			else cf=c1;
		}
		document.getElementById("amigo_nodo").value=cf.value;
		
		this.turnTo('sending');
		this.objForm=document
		//FWK.debug=true; // for debugging 
		FWK.postApiCallback("AMIGO.resultForm","socialnetworks:mixplay","saveFormAmigo","amigoForm","")
		// TODO: aca va el envio por ajax!!
	},
	resultForm : function(req)
	{
		if(req.responseText=="OK") //todo vino ok!
		{
			this.turnTo('finish');
		}
		else
		{
			document.getElementById("errorDe").style.display="none";
			document.getElementById("errorDe").style.visibility="hidden";
			document.getElementById("errorPara").style.display="none";
			document.getElementById("errorPara").style.visibility="hidden";
			document.getElementById("errorEmail").style.display="none";
			document.getElementById("errorEmail").style.visibility="hidden";
			document.getElementById("amigoErrorMessage").style.display="block";
			document.getElementById("amigoErrorMessage").style.visibility="visible";
			document.getElementById('amigoErrorMessage').innerHTML=req.responseText; // seteo el mensaje
			this.turnTo('error'); // prendo el error
		}
	}
}


//**************  /socialnetworks/js/socialnetworks.js ********* //
/* ------------------
   JAVASCRIPT PARA SOCIALNETWORKS
   ------------------
*/

SOCNET=
{
	debug : true,
	
	// CAMBIOS DE PANEL --------------------------------------------------------
	turnTo : function(destino)
	{
		switch(destino)
		{
			case 'panel'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(false); 
								obImg=document.getElementById("socnet_form_verifImg");
								obImg.src=obImg.src+"1";
								obInp=document.getElementById("socnet_form_verificacion");
								obInp.value="";
							  	break;
			case 'error'	: 	this.showPanel(true); this.showError(true); this.showFinish(false); this.showSending(false); break;
			case 'finish'	: 	this.showPanel(false); this.showError(false); this.showFinish(true); this.showSending(false); break;
			case 'sending'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(true); break;
			default			: 	this.showPanel(false); this.showError(false); this.showFinish(false); this.showSending(false); break; // 'nada'
		}
	},
	showInicial : function()
	{
		document.getElementById("socnet_form_de").value="";
		document.getElementById("socnet_form_para").value="";
		document.getElementById("socnet_form_email").value="";
		document.getElementById("socnet_form_mensaje").value="";
		this.turnTo('panel');
	},
	showPanel : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetPanel");
		if(estado) 
		{
			ob.style.display="block";
		}
		else ob.style.display="none";
	},
	showError : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetError");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showFinish : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetFinish");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showSending : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("socnetSending");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},

	// CHEQUEO Y ENVIO DE FORM -------------------------------------------------	
	checkForm : function()
	{
		ok=true;
		causa="";
		
		// TODO: aca van los chequeos
		obDe=document.getElementById("socnet_form_de");
		obPara=document.getElementById("socnet_form_para");
		obEmail=document.getElementById("socnet_form_email");
		obMensaje=document.getElementById("socnet_form_mensaje");
		if(obMensaje.value.lenght>1000) obMensaje.value=obMensaje.value.substr(0,1000);
		
		errDe=document.getElementById("errorDe");
		errPara=document.getElementById("errorPara");
		errEmail=document.getElementById("errorEmail");
		errGen=document.getElementById("socnetErrorMessage");
		errGen.style.display="none";
		errDe.style.visibility="hidden";
		
		if(obDe.value.length<2)
		{ 
			ok=false; 
			errDe.style.display="block";
			errDe.style.visibility="visible";
		}
		else 
		{
			errDe.style.display="none";
			errDe.style.visibility="hidden";
		}
		
		if(obPara.value.length<2) 
		{ 
			ok=false; 
			errPara.style.display="block";
			errPara.style.visibility="visible";
		}
		else 
		{
			errPara.style.display="none";
			errPara.style.visibility="hidden";
		}
		
		if(obEmail.value.length<2 || !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(obEmail.value)) 
		{ 
			ok=false; 
			errEmail.style.display="block";
			errEmail.style.visibility="visible";
		}
		else 
		{
			errEmail.style.display="none";
			errEmail.style.visibility="hidden";
		}
		
		if(ok)	this.sendForm();
		else	this.turnTo('error'); // prendo el error
	},
	sendForm : function()
	{
		// agrego el url
		ur=document.getElementById('inputUrl');
		socnetur=document.getElementById('socnet_url');
		if(ur!=null && socnetur!=null) socnetur.value=ur.value;
		
		this.turnTo('sending');
		this.objForm=document
		//FWK.debug=true; // for debugging 
		FWK.postApiCallback("SOCNET.resultForm","socialnetworks:mixplay","saveForm","socnetForm","")
		// TODO: aca va el envio por ajax!!
	},
	resultForm : function(req)
	{
		if(req.responseText=="OK") //todo vino ok!
		{
			this.turnTo('finish');
		}
		else
		{
			document.getElementById("errorDe").style.display="none";
			document.getElementById("errorDe").style.visibility="hidden";
			document.getElementById("errorPara").style.display="none";
			document.getElementById("errorPara").style.visibility="hidden";
			document.getElementById("errorEmail").style.display="none";
			document.getElementById("errorEmail").style.visibility="hidden";
			document.getElementById("socnetErrorMessage").style.display="block";
			document.getElementById("socnetErrorMessage").style.visibility="visible";
			document.getElementById('socnetErrorMessage').innerHTML=req.responseText; // seteo el mensaje
			this.turnTo('error'); // prendo el error
		}
	}
}

AMIGO=
{
	debug : true,
	
	// CAMBIOS DE PANEL --------------------------------------------------------
	turnTo : function(destino)
	{
		switch(destino)
		{
			case 'panel'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(false); 
								obImg=document.getElementById("amigo_form_verifImg");
								obImg.src=obImg.src+"1";
								obInp=document.getElementById("amigo_form_verificacion");
								obInp.value="";
							  	break;
			case 'error'	: 	this.showPanel(true); this.showError(true); this.showFinish(false); this.showSending(false); break;
			case 'finish'	: 	this.showPanel(false); this.showError(false); this.showFinish(true); this.showSending(false); break;
			case 'sending'	: 	this.showPanel(true); this.showError(false); this.showFinish(false); this.showSending(true); break;
			default			: 	this.showPanel(false); this.showError(false); this.showFinish(false); this.showSending(false); break; // 'nada'
		}
	},
	showInicial : function()
	{
		document.getElementById("amigo_form_de").value="";
		document.getElementById("amigo_form_para").value="";
		document.getElementById("amigo_form_email").value="";
		document.getElementById("amigo_form_mensaje").value="";
		this.turnTo('panel');
	},
	showPanel : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoPanel");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showError : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoError");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showFinish : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoFinish");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},
	showSending : function(estado)
	{
		if(null==estado) estado=false;
		ob=document.getElementById("amigoSending");
		if(estado) ob.style.display="block";
		else ob.style.display="none";
	},

	// CHEQUEO Y ENVIO DE FORM -------------------------------------------------	
	checkForm : function()
	{
		ok=true;
		causa="";
		
		// TODO: aca van los chequeos
		obDe=document.getElementById("amigo_form_de");
		obPara=document.getElementById("amigo_form_para");
		obEmail=document.getElementById("amigo_form_email");
		obMensaje=document.getElementById("amigo_form_mensaje");
		if(obMensaje.value.lenght>1000) obMensaje.value=obMensaje.value.substr(0,1000);
		
		errDe=document.getElementById("errorDe");
		errPara=document.getElementById("errorPara");
		errEmail=document.getElementById("errorEmail");
		errGen=document.getElementById("amigoErrorMessage");
		errGen.style.display="none";
		errDe.style.visibility="hidden";
		
		if(obDe.value.length<2)
		{ 
			ok=false; 
			errDe.style.display="block";
			errDe.style.visibility="visible";
		}
		else 
		{
			errDe.style.display="none";
			errDe.style.visibility="hidden";
		}
		
		if(obPara.value.length<2) 
		{ 
			ok=false; 
			errPara.style.display="block";
			errPara.style.visibility="visible";
		}
		else 
		{
			errPara.style.display="none";
			errPara.style.visibility="hidden";
		}
		
		if(obEmail.value.length<2 || !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(obEmail.value)) 
		{ 
			ok=false; 
			errEmail.style.display="block";
			errEmail.style.visibility="visible";
		}
		else 
		{
			errEmail.style.display="none";
			errEmail.style.visibility="hidden";
		}
		
		if(ok)	this.sendForm();
		else	this.turnTo('error'); // prendo el error
	},
	sendForm : function()
	{
		// agrego el url
		ur=document.getElementById('inputUrl');
		amigour=document.getElementById('amigo_url');
		if(ur!=null && amigour!=null) amigour.value=ur.value;
		
		// agrego el nodo
		c1=document.getElementById("combo1");
		c2=document.getElementById("combo2");
		c3=document.getElementById("combo3");
		if(c3.value!="") cf=c3;
		else
		{
			if(c2.value!="") cf=c2;
			else cf=c1;
		}
		document.getElementById("amigo_nodo").value=cf.value;
		
		this.turnTo('sending');
		this.objForm=document
		//FWK.debug=true; // for debugging 
		FWK.postApiCallback("AMIGO.resultForm","socialnetworks:mixplay","saveFormAmigo","amigoForm","")
		// TODO: aca va el envio por ajax!!
	},
	resultForm : function(req)
	{
		if(req.responseText=="OK") //todo vino ok!
		{
			this.turnTo('finish');
		}
		else
		{
			document.getElementById("errorDe").style.display="none";
			document.getElementById("errorDe").style.visibility="hidden";
			document.getElementById("errorPara").style.display="none";
			document.getElementById("errorPara").style.visibility="hidden";
			document.getElementById("errorEmail").style.display="none";
			document.getElementById("errorEmail").style.visibility="hidden";
			document.getElementById("amigoErrorMessage").style.display="block";
			document.getElementById("amigoErrorMessage").style.visibility="visible";
			document.getElementById('amigoErrorMessage').innerHTML=req.responseText; // seteo el mensaje
			this.turnTo('error'); // prendo el error
		}
	}
}


/****************************************************************************************************
 FUNCIONES DE GADGET
****************************************************************************************************/
function gadget_ProcesarPrincipal(){
	//campos ocultos
	var var_idmenu	= document.getElementById("var_idmenu");
	var var_codigo	= document.getElementById("var_codigo");
	var var_skin	= document.getElementById("var_skin");
	
	//combos
	var combo1 = document.getElementById("combo1");
	var combo2 = document.getElementById("combo2");
	var combo3 = document.getElementById("combo3");
	
	
	//value contiene: "ID_ITEM,CODIGO,ID_MENU,SKIN"
	//ejemplo: "623,moda,202,sk_mixplay"
	arrValue	= combo1.value.split(",");
	
	id_item		= arrValue[0];
	codigo		= arrValue[1];
	id_menu		= arrValue[2];
	skin		= arrValue[3];

	//cargar variable global
	var_codigo.value	= codigo;
	var_idmenu.value	= id_menu;
	var_skin.value		= skin;
	
	//alert("hidden codigo: "+var_codigo.value);
	//alert("id_item:"+id_item+"codigo:"+codigo+"id_menu:"+id_menu+"skin:"+skin);
		
	//remover valores de combo2
	gadget_RemoverTodo(combo2);
	combo2.disabled=true;
	
	//remover valores de combo3
	gadget_RemoverTodo(combo3);
	combo3.disabled=true;
	
	
	//ejecutar FWK
	request		= FWK.loadApi("socialnetworks|playlist|playlist|player", "procesarcombos", "&id_item="+id_item+"&id_menu="+id_menu+"&rand="+Math.random());
	arrLineas	= request.split("\n");
	
	for(i=0; i<arrLineas.length; i++){
		arrLineas[i] = gadget_Trim(arrLineas[i]);
		
		if(arrLineas[i]!=""){
			if(combo2.disabled==true){
				combo2.disabled=false;
				gadget_AgregarItem(combo2, "", "Selecciona");
			}
			
			//línea: "623,moda,sk_mixplay,Moda"			
			arrDato = arrLineas[i].split(",");
			gadget_AgregarItem(combo2, arrDato[0]+","+arrDato[1]+","+arrDato[2], arrDato[3]);
		}
	}
		
	return false;
	
}

function gadget_ProcesarCombos(combo){
	
	//campos ocultos
	var var_idmenu	= document.getElementById("var_idmenu");
	var var_codigo	= document.getElementById("var_codigo");
	var var_skin	= document.getElementById("var_skin");
	
	//combos
	var combo1 = document.getElementById("combo1");
	var combo2 = document.getElementById("combo2");
	var combo3 = document.getElementById("combo3");
	
	switch(combo){
		case 2:
			if(!combo2.value) return;

			// El VALUE del COMBO contiene: "ID_ITEM,CODIGO,SKIN"
			// ej:"623,moda,sk_mixplay"
			arrTMP		= combo2.value.split(",");
			id_item		= arrTMP[0];
			codigo		= arrTMP[1];
			sking		= arrTMP[2];
			
			//seteando variables globales
			var_skin.value		= sking;
			var_codigo.value	= codigo;
			
			//alert("hidden codigo: "+var_codigo.value);
			//alert("id_item:"+id_item+"codigo:"+codigo+"id_menu[global]:"+var_idmenu.value+"skin:"+skin);
			
			//vaciar, desabilitar combo3
			gadget_RemoverTodo(combo3);
			combo3.disabled=true;
			
			//ejecutar FWK
			request		= FWK.loadApi("socialnetworks|playlist|playlist|player", "procesarcombos", "&id_item="+id_item+"&id_menu="+var_idmenu.value+"&rand="+Math.random());
			//alert(request);
			arrLineas	= request.split("\n");
			
			for(i=0; i<arrLineas.length; i++){
				arrLineas[i] = gadget_Trim(arrLineas[i]);
				
				if(arrLineas[i]!=""){
					if(combo3.disabled==true){
						combo3.disabled=false;
						gadget_AgregarItem(combo3, "", "Selecciona");
					}
					
					//arrLineas: "623,moda,sk_mixplay,Moda"
					arrDato = arrLineas[i].split(",");
					gadget_AgregarItem(combo3, arrDato[0]+","+arrDato[1]+","+arrDato[2], arrDato[3]);
				}
			}
			
			break;



		case 3:
			if(!combo3.value) return;
			
			// El VALUE del COMBO contiene: "ID_ITEM,CODIGO,SKIN"
			// ej:"623,moda,sk_mixplay"
			arrTMP	= combo3.value.split(",");
			id_item	= arrTMP[0];
			codigo	= arrTMP[1];
			sking	= arrTMP[2];
			
			var_codigo.value = codigo;
			//alert("codigo:"+codigo);			
			break;
	}
	
	return true;
}

function gadget_AgregarItem(combo,value,text) {
	combo.options[combo.length]=new Option(text,value);
}

function gadget_RemoverTodo(combo) {
     if(combo.length <= 0) return;
     var N = combo.length;
     for(var i=0; i<N; i++)	combo.options[0]=null;     
}
function gadget_Trim(cadena){
	return cadena.replace(/^\s+|\s+$/, ''); 
}

function gadget_Enviar(){
		
	//campos ocultos
	var var_idmenu	= document.getElementById("var_idmenu");
	var var_codigo	= document.getElementById("var_codigo");
	var var_skin	= document.getElementById("var_skin");
	
	f	= document.forms["form1"];
	url	= "";
	for(i=0;i<f.elements.length;i++){
		if(f.elements[i].type=="radio" && f.elements[i].checked==1){
			url = f.elements[i].tag;
			red = f.elements[i].params;
			break;
		}
	}
	
	//error, no se seleccionó una red social
	if(url==""){alert("Error no esperado.\nSeleccione una red social.");return;}
	
	//armar url completa
	url += "/nodo/"+var_codigo.value+"/"+red;
	
	//concatenando "template", es opcional
	if(var_skin.value) url += "/template/"+var_skin.value;
	
	
	//abrir nueva ventana
	window.open(url,"_blank","");
	
	//ocultar formulario, mostrar mensaje
	document.getElementById('formGadget').style.visibility	= "hidden";
	document.getElementById('msgGadget').style.display		= "block";
	
}