	var selectedcell=null;

function selectrow(thePointerColor,theNormalBgColor,theCell)
{
  if (selectedcell != null)
    {
      if (selectedcell != theCell)
        {
          if (selectedcell != "none")	document.getElementById(selectedcell).className = thePointerColor;
          selectedcell   = theCell;
         }
      setPointer(thePointerColor, theNormalBgColor, theCell)

    }
}
function setPointer(thePointerColor, theNormalBgColor, theCell)
{
  if (theCell != selectedcell)
    {
      if (thePointerColor == '')  return false;
      else
   	   {
         document.getElementById(theCell).className = theNormalBgColor;
         return true;
       }
    }
  else return false;
}

function LoadActivityDay()
{
   //var URLActday = "http://sam:8080/smartbrain/actividad_del_dia/index.html";
   var URLActday = "http://www.smartbrain.net/smartbrain/actividad_del_dia/index.html";
   window.open(URLActday,'_new');

}

function loadContent(numsection)
{
   var lateral_src = "";
   var content_src = "";
   switch(numsection)
    {
    	case 1:
    	  {
    	    lateral_src = "menu_presentacion.jsp";
    	    content_src = "presentacion_quees.jsp";
    	    break;
    	   }
    	case 2:
    	  {
    	    lateral_src = "menu_funcionamiento.jsp";
    	    content_src = "funcionamiento_sistema.jsp";
    	    break;
    	   }
    	case 3:
    	  {
    	    lateral_src = "menu_alzheimer.jsp";
    	    content_src = "eficacia_estudio.jsp";
    	    break;
    	   }
		case 4:
    	  {
    	    lateral_src = "menu_opciones.jsp";
    	    content_src = "contratacion_acceso.jsp";
    	    break;
    	   }
    	case 5:
    	  {
    	    lateral_src = "menu_suscripcion.jsp";
    	    content_src = "contratacion_main.jsp";
    	    break;
    	   }
    	default:
    	  {
    	    lateral_src = "publi.jsp";
    	    content_src = "inicio.jsp";
    	    break;
    	  }
    }

     parent.mainFrame.mainFrame.document.location.href=content_src;
     parent.mainFrame.leftFrame.document.location.href=lateral_src;
}

function loadSubContent(numsection)
{
   var content_src = "";

   if      (numsection == "1.1") content_src = "presentacion_quees.jsp";
   else if (numsection == "1.2") content_src = "presentacion_aquien.jsp";
   else if (numsection == "1.3") content_src = "presentacion_educamigos.jsp";
   else if (numsection == "1.4") content_src = "ecognitiva_fundacion.jsp";
   else if (numsection == "2.1") content_src = "ecognitiva_cognitiva.jsp";
   else if (numsection == "2.2") content_src = "ecognitiva_piloto.jsp";
   else if (numsection == "2.3") content_src = "ecognitiva_resultados.jsp";
   else if (numsection == "3.1") content_src = "funcionamiento_sistema.jsp";
   else if (numsection == "3.2") content_src = "funcionamiento_actividades.jsp";
   else if (numsection == "3.3") content_src = "funcionamiento_instalacion.jsp";
   else if (numsection == "3.4") content_src = "funcionamiento_navegacion.jsp";
   else if (numsection == "3.5") content_src = "funcionamiento_opciones.jsp";
   else if (numsection == "3.6") content_src = "funcionamiento_curso.jsp";
   else if (numsection == "3.7") content_src = "como_funciona.jsp";
   else if (numsection == "4.1") content_src = "eficacia_estudio.jsp";
   else if (numsection == "4.2") content_src = "eficacia_reconocimiento.jsp";
   else if (numsection == "4.3") content_src = "eficacia_publicaciones.jsp";
   else if (numsection == "4.4") content_src = "eficacia_difusion.jsp";
   else if (numsection == "5.1") content_src = "contratacion_main.jsp";
   else if (numsection == "5.11") content_src = "contratacion_acceso.jsp";
   else if (numsection == "5.2") content_src = "faq.jsp";
   else if (numsection == "5.3") content_src = "smartbrainHome.jsp";
   else if (numsection == "5.3.2") content_src = "smartbrainHome_info.jsp";
   else if (numsection == "5.3.3") content_src = "smartbrainHome_contenidos.jsp";
   else if (numsection == "5.3.4") content_src = "smartbrainHome_coste.jsp";
   else if (numsection == "5.4") content_src = "smartbrainWeb.jsp";
   else if (numsection == "5.4.2") content_src = "smartbrainWeb_info.jsp";
   else if (numsection == "5.4.3") content_src = "smartbrainWeb_contenidos.jsp";
   else if (numsection == "5.4.4") content_src = "smartbrainWeb_coste.jsp";
   else if (numsection == "5.5") content_src = "gratuito.jsp";
   else if (numsection == "5.6") content_src = "contacta.jsp";
   else if (numsection == "5.7") content_src = "funcionamiento_curso.jsp";
   else if (numsection == "5.8") content_src = "smartbrainMulti.jsp";
   else if (numsection == "5.9") content_src = "smartbrainTematico.jsp";
   else if (numsection == "5.9.2") content_src = "smartbrainTematico_info.jsp";
   else if (numsection == "5.9.3") content_src = "smartbrainTematico_contenidos.jsp";
   else if (numsection == "5.9.4") content_src = "smartbrainTematico_coste.jsp";
   else if (numsection == "5.8.2") content_src = "smartbrainMulti_info.jsp";
   else if (numsection == "5.8.3") content_src = "smartbrainMulti_activacion.jsp";
   else if (numsection == "5.8.4") content_src = "smartbrainMulti_contenidos.jsp";
   else if (numsection == "5.8.5") content_src = "smartbrainMulti_coste.jsp";
   else if (numsection == "5.8.6") content_src = "smartbrainMulti_plan.jsp";
   else if (numsection == "5.12") content_src = "smartbrainHome_opciones.jsp";
   else if (numsection == "5.13") content_src = "smartbrainTematico_opciones.jsp";
   else if (numsection == "5.14") content_src = "smartbrainMulti_opciones.jsp";
   else if (numsection == "5.15") content_src = "smartbrainWeb_opciones.jsp";
   else if (numsection == "5.16") content_src = "contenidos_programa.jsp";
   else if (numsection == "5.17") content_src = "smartbrainGames_opciones.jsp";
   parent.mainFrame.document.location.href=content_src;
}

function goContacta()
{
   selectedcell = "td4";
   parent.mainFrame.leftFrame.document.location.href="menu_suscripcion.jsp";
   parent.mainFrame.mainFrame.document.location.href="contacta.jsp";
}

function goSite()
{
   selectedcell = "td4";
   parent.parent.mainFrame.leftFrame.document.location.href="../../publi.jsp";
   parent.parent.mainFrame.mainFrame.document.location.href="../../inicio.jsp";
}

function LoadBlanc()
{
  parent.parent.mainFrame.leftFrame.document.location.href="../../blanc.jsp";

}

function openResult(html)
{
  open(html,'graf','toolbar=no,menubar=no,scrollbars=no,width=550,height=500');
}
function SaveCookie(lang)
   	{
	   var expDate=new Date();

      	   expDate.setTime(expDate.getTime()+1000*60*60*24*365);
	       SetCookie ('language-S',lang,expDate,"/",null,false);
	       document.location.href="previo.html";
	}
function SaveCookieLogin(lang)
   	{
	   var expDate=new Date();

      	   expDate.setTime(expDate.getTime()+1000*60*60*24*365);
	       SetCookie ('language-S',lang,expDate,"/",null,false);
	      // document.location.href="previo.html";
	}

//-- Función que Hace saltar un popUp para Activar el cdRom de Smartbrain todos los ficheros están
//-- en Educamigos porqué como tenía que guardar en la base de datos de educamigos se hizo así
function openActivacion(language)
{
    var URL = 'http://www.educamigos.com/educamigos/sta/savelanguagecdromactivation.nta?lang=' + language;
    //var URL = 'http://sam:8080/educamigos/sta/savelanguagecdromactivation.nta?lang=' + language;
	open(URL,'win','statusbar=no,toolbar=no,menubar=no,scrollbars=no,width=750,height=410');
}



//-- Formateo de valores con decimales y miles ---------------------

function oNumero(numero)
{
	//Propiedades
	this.valor = numero || 0
	this.dec = -1;

	//Métodos
	this.formato = numFormat;
	this.ponValor = ponValor;
	//Definición de los métodos
	function ponValor(cad)
	{
	if (cad =='-' || cad=='+') return
	if (cad.length ==0) return
	if (cad.indexOf('.') >=0)
	this.valor = parseFloat(cad);
	else
	this.valor = parseInt(cad);
	}

	function numFormat(dec, miles)
	{

		var num = this.valor, signo=3, expr;
		var cad = ""+this.valor;
		var ceros = "", pos, pdec, i;

		for (i=0; i < dec; i++)
		ceros += '0';
		pos = cad.indexOf('.')
		if (pos < 0)
		cad = cad+"."+ceros;
		else
		{
		pdec = cad.length - pos -1;
		if (pdec <= dec)
		{
		for (i=0; i< (dec-pdec); i++)
		cad += '0';
		}
		else
		{

		  num = num*Math.pow(10, dec);
		  num = Math.round(num);
		  num = num/Math.pow(10, dec);
          var cadnum = String(num);

		  if(cadnum.indexOf('.') != -1)
           var posicion = cadnum.length - (cadnum.indexOf('.')+1);
          else
		  {
			num = num + ".00";
			var posicion = dec;
          }


		  if (posicion<dec)
		  {
		    num += '0';
			posicion++;
		  }
		  cad = new String(num);
		}
		}
		pos = cad.indexOf('.')
		if (pos < 0) pos = cad.lentgh
		if (cad.substr(0,1)=='-' || cad.substr(0,1) == '+')
		signo = 4;
		if (miles && pos > signo)
		do{
		expr = /([+-]?\d)(\d{3}[\.\,]\d*)/
		cad.match(expr)
		cad=cad.replace(expr, RegExp.$1+','+RegExp.$2)
		}
		while (cad.indexOf(',') > signo)
		if (dec<0) cad = cad.replace(/\./,'')
		return cad;
	}

}//Fin del objeto oNumero:


function ReplaceComayPunto(Cadena)
{

    while (Cadena.indexOf('.') > -1)
    Cadena = Cadena.replace('.','\'');

    while (Cadena.indexOf(',') > -1)
	Cadena = Cadena.replace(',','.');

    while (Cadena.indexOf('\'') > -1)
    Cadena = Cadena.replace('\'', ',');

    return Cadena;

}




















