
	
		 var ie4 = false;
        var isAnimated = false;
        if(document.all) {
                ie4 = true; 
        }       
        function setContent(name, value) {
                var d;  
                if (ie4) { 
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }       
                d.innerHTML = value;
                d.style.display = 'block'; 
        }       

	function getContent(name) {
		var d;
                if (ie4) {
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }
                return d.innerHTML;
	}

        function setColor(name, value) {
                var d;  
                if (ie4) { 
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }
                d.style.color = value;  
        }

	function getColor(name) {
                var d;
                if (ie4) {
                        d = document.all[name];
                } else {
                        d = document.getElementById(name);
                }
                return d.style.color;
        }

        function animate(name, col) {
		var value = getContent(name);
		if (value.indexOf('<span') >= 0) { return; }
		if (isAnimated) { return; }
		
		isAnimated = true;
		var length = 0;
                var str = '';
		var ch;
		var token = '';
		var htmltag = false;	
                for (i = 0; i < value.length; i++) {
			ch = value.substring(i, i+1);
			if (i < value.length - 1) { nextch = value.substring(i+1, i+2); } else { nextch = ' '; }
			token += ch;
			if (ch == '<' && '/aAbBpPhHiIoOuUlLtT'.indexOf(nextch) >= 0) { htmltag = true; }
			if (ch == '>' && htmltag) { htmltag = false; }
			if (!htmltag && ch.charCodeAt(0) > 30 && ch != ' ' && ch != '\n') {		
                        	str += '<span id="' + name + '_' + length + '">' + token + '</span>';
				token = '';
				length++;
			}
              }
                setContent(name, str);
                command = 'animateloop(\'' + name + '\', ' + length + ', 0, 1, \'' + col + '\')';
                setTimeout(command , 100);
         
        }

        function animateloop(name, length, ind, delta, col) {
		var next = ind + delta;
		if (next >= length) { delta = delta * -1; next = ind + delta; }
		if (next < 0) { delta = delta * -1; next = ind + delta; }
                setColor(name + '_' + ind, getColor(name + '_' + next));
                setColor(name + '_' + next, col);
                command = 'animateloop(\'' + name + '\', ' + length + ', ' + next + ', ' + delta + ', \'' + col + '\')';
                setTimeout(command , 100);
        }
        
	// Abre una popup centrada en la pantalla
	// parametros : 
	// -----------> URL_Ventana : url pagina 
	// -----------> OpcionesVentana : width, heigh, scroll etc (ver window.open())
	// -----------> Centrada : true or false
	// -----------> PosX, PosY : si centrada=false especifican las coordenadas de la ventana
	// --------------------------------------------------------------------------------------//
	function AbreVentana(URL_Ventana, OpcionesVentana, Ancho, Alto, Centrada, PosX, PosY) {

	if (Centrada) {
		PosX = (screen.availWidth)? ((screen.availWidth - Ancho)/2):20;
		PosY = (screen.availHeight)? ((screen.availHeight - Alto)/2):20;
		}
		
	if (OpcionesVentana == '')
		OpcionesVentana = 'width=' + Ancho;
	else
		OpcionesVentana += ',width=' + Ancho;

	OpcionesVentana += ',height=' + Alto + ',left=' + PosX
		+ ',top=' + PosY;
		
	return window.open(URL_Ventana, "", OpcionesVentana);
	
	}
	
	function abrirgarrapata()
	{
	AbreVentana("./juegos/website/sm_play_flash.htm?groupId=Im&gameId=bulletman&ruta=media/im/bulletman/bulletman.swf#","",700,525,true);
	}
	function abrirlidia_original()
	{	  
	  AbreVentana("./juegos/website/sm_play_flash.htm?groupId=setachallenge&gameId=grandprix&ruta=#","",700,525,true);	
	}
	
	function abrirlidia()
	{
	AbreVentana("./juegos/parejas/actividad_parejas_5.swf","",700,525,true);
	}	
	
	function abrirpablodiablo()
	{
	AbreVentana("./juegos/website/sm_play_flash.htm?groupId=setachallenge&gameId=bubbles&ruta=#","",700,525,true);
	}
	function abrirfrayperico()
	{
	location.href="./ver_apartado.aspx?id=2340";
	}
	function abrirfrayperico1()
	{
	AbreVentana("./juegos/website/sm_play_flash.htm?groupId=frayPerico&gameId=frayPerico01&ruta=media/frayPerico/engine/engine.swf#","",700,525,true);
	}
	function abrirfrayperico2()
	{
	AbreVentana("./juegos/website/sm_play_flash.htm?groupId=frayPerico&gameId=frayPerico02&ruta=media/frayPerico/engine/engine.swf#","",700,525,true);
	}
	function abrirfrayperico3()
	{
	AbreVentana("./juegos/website/sm_play_flash.htm?groupId=frayPerico&gameId=frayPerico03&ruta=media/frayPerico/engine/engine.swf#","",700,525,true);
	}
	function abrirfrayperico4()
	{
	AbreVentana("./juegos/website/sm_play_flash.htm?groupId=frayPerico&gameId=frayPerico04&ruta=media/frayPerico/engine/engine.swf#","",700,525,true);
	}
	function abrirfrayperico5()
	{
	AbreVentana("./juegos/website/sm_play_flash.htm?groupId=frayPerico&gameId=frayPerico05&ruta=media/frayPerico/engine/engine.swf#","",700,525,true);
	}
	
	function abrircapitancalzoncillos()
	{
	AbreVentana("./juegos/website/lanzaCalzoncillos.html","",700,525,true);
	}

	function abrirsitokesito()
	{
	AbreVentana("./juegos/BarcoDeVaporF2/sito/Sito.swf","",700,525,true);
	}	

	function abrirmundo()
	{
	AbreVentana("./juegos/BarcoDeVaporF2/acuatic/engine.swf","",700,525,true);
	}


	function printBook(){
		var htmlFicha = document.getElementById("fichaLibroHtml").innerHTML;
		var paginaHtml = "<html><head><title>BARCO DE VAPOR - ficha libro</title></head>";
		paginaHtml += "<LINK REL=STYLESHEET TYPE=TEXT/CSS HREF=/Plantillas/BarcoVapor/css/estilosG.css media=screen>";
		paginaHtml += "<LINK REL=STYLESHEET TYPE=TEXT/CSS HREF=/Plantillas/BarcoVapor/css/estilosG.css media=print>";
		paginaHtml += "<script>function printBook(){window.print();return false;}</script><body  topmargin=0 leftmargin=0><center>";
		paginaHtml += htmlFicha + "</body></html>";
		popVentana = AbreVentana("","fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no",500, 300, true);
		popVentana.document.write(paginaHtml);
		
		//alert (htmlFicha);
	}
	
	function openScolastic()
	{
	AbreVentana("./Formularios/coyrightScholastic.html","",580,360,true);	
	} 
	
	