// v21-002-rutinas.js - Funciones de JavaScript para Veintiuno - Copyright (c) 2007 by Juan Rodríguez

function Resize() {if ((navigator.appName == "Microsoft Internet Explorer") && (showHeader==1)) {return} else {window.location.reload()} }
window.onresize=Resize;

function reemplaza_fecha(d){
var da = d.split(" ");
mes = "<div class='fecha_mes'>" +da[1].slice(0,3) +"</div>"; 
dia = "<div class='fecha_dia'>" +da[0] +"</div>"; 
anio = "<div class='fecha_anio'>" +da[2] +"</div>"; 
document.write(mes+dia); }

if (self.innerHeight) {ancho= self.innerWidth; alto= self.innerHeight}
else if (document.documentElement && document.documentElement.clientHeight) {ancho= document.documentElement.clientWidth; alto= document.documentElement.clientHeight}
else if (document.body) {ancho=document.body.clientWidth; alto= document.body.clientHeight};
AncDis=parseInt(ancho);
AltDis=parseInt(alto);

function AjustesMonitor() {
if (AncDis < 1025) {document.getElementById("content-wrapper").style.marginRight=5+"px"};
PosicionSidebar() }

PosSidebar="";
PutoIE="no";

function PosicionSidebar() {
PosSidebar=leerCookie('Ubicacion_Sidebar');
if ( PosSidebar !=null) {PosSidebar=PosSidebar} else {PosSidebar="Derecha"};
if (navigator.appName == "Microsoft Internet Explorer") {PutoIE="si"} else {PutoIE="no"};
if (PosSidebar=="Izquierda") {MoverSidebarIzquierda() } }

function MoverSidebarIzquierda() {
document.getElementById("main-wrapper").style.float="none";
document.getElementById("main-wrapper").style.display="none";
if (PutoIE=="si") {document.getElementById("sidebar-wrapper").style.styleFloat="left"} else {document.getElementById("sidebar-wrapper").style.cssFloat="left"};
if (PutoIE=="si") {document.getElementById("main-wrapper").style.styleFloat="right"} else {document.getElementById("main-wrapper").style.cssFloat="right"};
document.getElementById("main-wrapper").style.display="block";
PosSidebar="Izquierda"; return }
    
function CambiarSidebar() {
if (PosSidebar=="Derecha") {    
   MoverSidebarIzquierda();
   PosSidebar="Izquierda";
   crearCookie('Ubicacion_Sidebar', 'Izquierda'); }
else {
    document.getElementById("sidebar-wrapper").style.float="none";
    document.getElementById("sidebar-wrapper").style.display="none";
    if (PutoIE=="si") {document.getElementById("main-wrapper").style.styleFloat="left"} else {document.getElementById("main-wrapper").style.cssFloat="left"};
    if (PutoIE=="si") {document.getElementById("sidebar-wrapper").style.styleFloat="right"} else {document.getElementById("sidebar-wrapper").style.cssFloat="right"};
    document.getElementById("sidebar-wrapper").style.display="block";
    PosSidebar="Derecha";
    crearCookie('Ubicacion_Sidebar', 'Derecha'); } }
 
function leerCookie(name) {
 var cname = name + "=";
 var dc = document.cookie;
 if (dc.length > 0) { begin = dc.indexOf(name);
    if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin);
    if (end == -1) end = dc.length; return unescape(dc.substring(begin, end) ) ; } }
return null; }

function crearCookie(nombre, valor) {
var caducidad = new Date();
caducidad.setTime(caducidad.getTime() + ( 60 * 24 * 60 * 60 * 1000) ) ;
document.cookie = nombre + "=" + escape(valor) + "; expires=" + caducidad.toGMTString(); }

var showHeader=0;
function ShowHideNav() {
var nav=document.getElementById("navbar-iframe");
if (showHeader==0) {nav.style.visibility="visible"; nav.style.height=30+"px"; nav.style.display="block"; showHeader=1}
else  {nav.style.visibility="hidden"; nav.style.height=0; nav.style.display="none"; showHeader=0}  }

function MostrarEtiquetasFlotantes() {
var etiq=document.getElementById("Label2");
etiq.style.display="block"; etiq.style.visibility="visible"; etiq.style.height="auto"; etiq.style.top=195+"px"; etiq.style.left=(AncDis-210)/2 +"px"}

function OcultarEtiquetasFlotantes() {
var etiq=document.getElementById("Label2");
etiq.style.display="none"; etiq.style.visibility="hidden"; etiq.style.height=0+"px"}

// ADAPTAR DIRECCION DE CORREO
arroba="@";
function CC() {return "veintiuno" + arroba + "begues.net" }
function CorreoVeintiuno(asunto) {document.write("<a href='mailto:" + CC() + "?subject=" + asunto + " '>" + CC() + "</a>") }