// wbn012-wwwbeguesnet.js - Copyright (c) 2002-2009 by Juan Rodríguez [Consultor] & Begues Internet, s.l.

function Resize() {window.location.reload()}
window.onresize=Resize;

function Pagina(pag) { 
// Todos menos el I.Explorer
if (self.innerHeight) {ancho= self.innerWidth; alto= self.innerHeight}
//  I.Explorer 6 en Strict Mode
else if (document.documentElement && document.documentElement.clientHeight) {ancho= document.documentElement.clientWidth; alto= document.documentElement.clientHeight}
// Otras versiones de I.Explorer
else if (document.body) {ancho=document.body.clientWidth; alto= document.body.clientHeight}
document.getElementById("Derecha").style.height=1+"px";

AncDis=parseInt(ancho);

if (AncDis >1075) {AncCue=900; AncDer=175} else {AncCue=775; AncDer=140};
document.getElementById("Derecha").style.width=AncDer+"px";
document.getElementById("Cuerpo").style.width=AncCue+"px";
AncIzq=24;
PosMen="";
PagCuerpo(pag) }

function PagCuerpo(pag) {
if (AncDis < (AncIzq + AncCue + AncDer) ) {AncIzq=0; AncDer=0};
SepDis=parseInt(AncDis -AncIzq -AncCue -AncDer);
if (SepDis < 0) {SepLat=0; SepInt=0} else {SepInt=parseInt(SepDis*20/100); SepLat=parseInt(SepDis*30/100) }; 

PosMen=leerCookie('Ubicacion_Menu_Vertical');
if ( PosMen !=null) {PosMen=PosMen} else {PosMen="Derecha"};

if (PosMen=="Derecha") {
document.getElementById("Cuerpo").style.left=SepLat + AncIzq + SepInt +"px"; 
MargenSpanMenu=-269;
if (pag==4) {document.getElementById("Bandera").style.left=SepLat + AncIzq + SepInt +"px"};
document.getElementById("Derecha").style.left=SepLat + AncIzq + SepInt + AncCue + SepInt +"px"; }

if (PosMen=="Izquierda") {
document.getElementById("Derecha").style.left=SepLat + AncIzq + SepInt +"px"; 
MargenSpanMenu=AncDer +13;
if (pag==4) {document.getElementById("Bandera").style.left=SepLat + AncIzq + SepInt + AncDer + SepInt -4 +"px"};
document.getElementById("Cuerpo").style.left=SepLat + AncIzq + SepInt + AncDer + SepInt -4 +"px" }

if (AncIzq > 0) {
  document.getElementById("Izquierda").style.left=SepLat +"px"; 
  document.getElementById("Izquierda").style.top=alto-350 +"px";
  document.getElementById("Izquierda").style.visibility="visible";}
  else {document.getElementById("Izquierda").style.display="none"} 

document.getElementById("Derecha").style.width=AncDer+"px";
if (AncDer > 0) {Menu()} else {
document.getElementById("Cuerpo").style.left=0 +"px";
document.getElementById("Derecha").style.display="none"; Ampliar(800)} }

function AperturaLinkExterno() { 
if (!document.getElementsByTagName) return; 
var anchors=document.getElementsByTagName("a"); 
for (var i=0; i < anchors.length; i++) {
var anchor=anchors[i]; 
if (anchor.getAttribute("rel") && anchor.getAttribute("rel") == "WE") {
// alert("WebExterna: " +anchor +""); 
anchor.target="self"}  
if (anchor.getAttribute("rel") && anchor.getAttribute("rel") == "nofollow") {
// alert("nofollow: " +anchor +""); 
anchor.target="self"}  }  } 

function CamMenu(pag) {
if (PosMen=="Derecha") { 
    crearCookie('Ubicacion_Menu_Vertical', 'Izquierda'); 
    if (pag==4) {document.getElementById("Bandera").style.left=SepLat + AncIzq + SepInt + AncDer + SepInt -4 +"px"};
    PosMen="Izquierda";}
else {
    crearCookie('Ubicacion_Menu_Vertical', 'Derecha'); 
    if (pag==4) {document.getElementById("Bandera").style.left=SepLat + AncIzq + SepInt +"px"};
    PosMen="Derecha"} 
PagCuerpo(pag); }

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(); }

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; }

AltVis=0;
function Menu() {
if (AltVis < 100 ) {
document.getElementById("Derecha").style.height=AltVis+"%"; 
document.getElementById("Derecha").style.visibility="visible";
AltVis=AltVis+2; setTimeout("Menu()",10) } else {MargenSpan(); return} }

function MargenSpan() {
var e = document.getElementById('Derecha');
e= e.getElementsByTagName('span'); i=0;
while(i < e.length) {e[i].style.marginLeft=MargenSpanMenu +"px"; i++ ; }  }

// MOSTRAR TEXTOS OCULTOS
function Ampliar(num) {
document.getElementById("ampliar"+num).style.height="auto";
document.getElementById("ampliar"+num).style.display="block";
document.getElementById("ampliar"+num).style.visibility="visible";}

function AnularAmpliar(num) {
document.getElementById("ampliar"+num).style.height=1+"px";
document.getElementById("ampliar"+num).style.display="none";
document.getElementById("ampliar"+num).style.visibility="hidden"}

// ADAPTAR DIRECCION DE CORREO
arroba="@";
function CB() {return "web" + arroba + "begues.net" }
function CorreoBegues(asunto) {document.write("<a href='mailto:" + CB() + "?subject=" + asunto + " '>" + CB() + "</a>") }

function CM() {return "jr_castelldefels" + arroba + "msn.com" }
function CorreoMessenger(asunto) {document.write("<a href='mailto:" + CM() + "?subject=" + asunto + " '>" + CM() + "</a>") }