function mostrar(div)
{

document.getElementById("FondoRecordatorio").style.display = 'none';
document.getElementById("FondoGlosario").style.display = 'none';
document.getElementById("FondoMultimedia").style.display = 'none';
document.getElementById("FondoAdvertencias").style.display = 'none';


document.getElementById("opcionRecordatorio").style.display = 'block';
document.getElementById("opcionGlosario").style.display = 'block';
document.getElementById("opcionMultimedia").style.display = 'block';
document.getElementById("opcionAdvertencias").style.display = 'block';

document.getElementById("TextoTituloRecordatorio").style.display = 'none';
document.getElementById("TextoTituloGlosario").style.display = 'none';
document.getElementById("TextoTituloMultimedia").style.display = 'none';
document.getElementById("TextoTituloAdvertencias").style.display = 'none';



		switch(div)
		{
			case "R":
				document.getElementById("FondoRecordatorio").style.display = 'block';
				document.getElementById("TextoTituloRecordatorio").style.display = 'block';
				document.getElementById("opcionRecordatorio").style.display = 'none';
			break;
			case "G":
				document.getElementById("FondoGlosario").style.display = 'block';
				document.getElementById("TextoTituloGlosario").style.display = 'block';
				document.getElementById("opcionGlosario").style.display = 'none';
			break;
			case "M":
				document.getElementById("FondoMultimedia").style.display = 'block';
				document.getElementById("TextoTituloMultimedia").style.display = 'block';
				document.getElementById("opcionMultimedia").style.display = 'none';
			break;
			case "A":
				document.getElementById("FondoAdvertencias").style.display = 'block';
				document.getElementById("TextoTituloAdvertencias").style.display = 'block';
				document.getElementById("opcionAdvertencias").style.display = 'none';
			break;
		}

}

function SetCookie (nombre, valor, diasParaExpirar)
{
	var name = nombre;
	var value = valor;
	var expires = diasParaExpirar;
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	// if the expires variable is set, make the correct expires time, the
	// current script below will set it for x number of days, to make it
	// for hours, delete * 24, for minutes, delete * 60 * 24
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	//alert( 'today ' + today.toGMTString() );// this is for testing purpose only
	var expires_date = new Date( today.getTime() + (expires) );
	//alert('expires ' + expires_date.toGMTString());// this is for testing purposes only

	
	//document.cookie = name + '=' + value + '; expires=Fri, 3 Aug 2020 20:47:11 UTC; path=/; domain=190.2.63.89';
	
	document.cookie = name + "=" + escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
		";path=/";
		
}


function leerCookie(nombre)
{
	var check_name = nombre;
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	var i = '';
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found ) 
	{
		return null;
	}
}

function BorrarCookie(nombre)
{
	name = nombre;
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
			";path=/" +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function SeleccionaPerfil_old(x)
{
	alert(x);
	perfil = obtenerValorDeCookie(x);
	SetCookie('PerfilActual',perfil);
	pagina = document.URL;
	direccion = pagina.split("/");
	
	alert(direccion[direccion.length-1]);
	
	if (
		(direccion[direccion.length-1]=="Comunidad.asp")
		|| (direccion[direccion.length-1]=="Profesionales.asp")
		|| (direccion[direccion.length-1]=="SectorRegulado.asp")
		|| (direccion[direccion.length-1]=="principal.asp")
	)
	{
		switch(x)
		{
			case "Comunidad":
				pagina = "/comunidad.asp";
				break;

			case "Profesionales":
				pagina = "/Profesionales.asp";
				break;

			case "Sector Regulado":
				pagina = "/SectorRegulado.asp";
				break;

			case "Principal":
				pagina = "/principal.asp";
				break;

			default:
				pagina = document.URL;
		}
		alert(pagina);
		document.location = pagina;
	}
	else
	{
		location.reload(true);
	}	
}

function SeleccionaPerfil(x)
{
	perfil = obtenerValorDeCookie(x);
	SetCookie('PerfilActual',perfil);
	pagina = document.URL;
	direccion = pagina.split("/");
	if (
		(direccion[direccion.length-1]=="comunidad.asp")
		|| (direccion[direccion.length-1]=="Profesionales.asp")
		|| (direccion[direccion.length-1]=="SectorRegulado.asp")
		|| (direccion[direccion.length-1]=="principal.asp")
		
		|| (direccion[direccion.length-1]=="comunidad_en.asp")
		|| (direccion[direccion.length-1]=="Profesionales_en.asp")
		|| (direccion[direccion.length-1]=="SectorRegulado_en.asp")
		|| (direccion[direccion.length-1]=="principal_en.asp")		
	)
	{
		switch(x)
		{

			case "Comunidad_en":
				pagina = "/comunidad_en.asp";
				break;

			case "Profesionales_en":
				pagina = "/Profesionales_en.asp";
				break;

			case "Sector Regulado_en":
				pagina = "/SectorRegulado_en.asp";
				break;

			case "principal_en":
				pagina = "/principal_en.asp";
				break;

			case "Comunidad":
				pagina = "/comunidad.asp";
				break;

			case "Profesionales":
				pagina = "/Profesionales.asp";
				break;

			case "Sector Regulado":
				pagina = "/SectorRegulado.asp";
				break;

			case "principal":
				pagina = "/principal.asp";
				break;

			default:
				pagina = document.URL;
		}
		//alert(pagina);
		document.location = pagina;
	}
	else
	{
		//alert('reload');
		location.reload(true);
	}	
}

function IrAlInicioDe(x)
{
	switch(x)
	{
		case "Comunidad":
			pagina = "/comunidad.asp";
			break;

		case "Profesionales":
			pagina = "/Profesionales.asp";
			break;

		case "Sector Regulado":
			pagina = "/SectorRegulado.asp";
			break;

		case "Principal":
			pagina = "/principal.asp";
			break;
	}
	document.location = pagina;
}

function IrAlInicioDeIngles(x)
{
	switch(x)
	{
		case "Comunidad":
			pagina = "/comunidad_en.asp";
			break;

		case "Profesionales":
			pagina = "/Profesionales_en.asp";
			break;

		case "Sector Regulado":
			pagina = "/SectorRegulado_en.asp";
			break;

		case "Principal":
			pagina = "/principal_en.asp";
			break;
	}
	document.location = pagina;
}


function AlmacenaPerfil(x)
{
	//alert ("--" + x + "--");
	//BorrarCookie(PerfilActual);
	var perfil = obtenerValorDeCookie(x);
	//alert(perfil);
	SetCookie('Perfil',perfil);
	SetCookie('PerfilActual',perfil);
	if (x != "Principal")
	{
		location.reload(true);
	}
	else
	{
		document.location = 'principal.asp';
	}
}


function obtenerValorDeCookie(x)
{
	var valorCookie = "";
	switch(x)
	{

		case "Comunidad_en":
			valorCookie = "Comunidad_en";
			break;

		case "Profesionales_en":
			valorCookie = "Profesionales_en";
			break;

		case "Sector Regulado_en":
			valorCookie = "Sector Regulado_en";
			break;

		case "Comunidad":
			valorCookie = "Comunidad";
			break;

		case "Profesionales":
			valorCookie = "Profesionales";
			break;

		case "Sector Regulado":
			valorCookie = "Sector Regulado";
			break;

		default:
			valorCookie = "Principal";
	}
	//alert("valorCookie:" + valorCookie);
	return (valorCookie);
}
