// cv910-rutinas.js - Copyright (c) 2002-2010 by Juan Rodríguez & Begues Internet, s.l.

window.onload=function() {Pagina()};
window.onresize=new Function("window.location=window.location.href");

// google_adtest="on";

var ancho;
if (self.innerHeight) {ancho=self.innerWidth}
else if (document.documentElement && document.documentElement.clientHeight) {ancho=document.documentElement.clientWidth}
else if (document.body) {ancho=document.body.clientWidth}
var AncDis=parseInt(ancho);

var url=parent.location.href;
var VerCv=url.search("cv_");
if ((ancho < 1025) & (VerCv < 0)) {document.write('<link rel="stylesheet" href="rc/cv901-1024.css" type="text/css">') }
if ((ancho < 1025) & (VerCv > 0)) {document.write('<link rel="stylesheet" href="../rc/cv901-1024.css" type="text/css">') }

function Pagina(pag) { 
PosMen=""; 
AncIzq=30; AncCue=800; AncDer=140;
if ((AncDis > 1000) & (AncDis < 1025)) {AncDis=1000; AncCue=800; AncDer=140}
if ((AncDis > 1275) & (AncDis < 1281)) {AncDic=1270; AncCue=900; AncDer=175}     // AncDic ??
if (AncDis > 1280) {AncCue=900; AncDer=175}
document.getElementById("Cuerpo").style.width=AncCue+"px";
document.getElementById("Derecha").style.width=AncDer+"px";
document.getElementById("Help").style.width=AncDer+"px";

SepDis=AncDis -AncIzq -AncCue -AncDer;
if (SepDis < 0) {SepInt=0} else {SepInt=parseInt(SepDis/4); if (SepInt ==43) {SepInt=42}}; 
posIzq=AncIzq + SepInt;

PosMen=leerCookie('Ubicacion_Menu_Vertical');
if (PosMen !=null) {PosMen=PosMen} else {PosMen="Derecha"};

if (pag==1 || pag==2) {document.getElementById("Cuerpo").style.top=0 +"px"};    
if (pag==1 && AncDis <=1024) {document.getElementById("Extra1024").style.display="none"; document.getElementById("Extra1024").style.visibility="hidden"};

if (PosMen=="Derecha") {document.getElementById("Cuerpo").style.left=posIzq +"px"; 
document.getElementById("Help").style.left=AncIzq + SepInt + AncCue + SepInt +"px";
document.getElementById("Derecha").style.left=AncIzq + SepInt + AncCue + SepInt +"px"};
if (PosMen=="Izquierda") {document.getElementById("Derecha").style.left=posIzq +"px"; document.getElementById("Help").style.left=posIzq +"px"; document.getElementById("Cuerpo").style.left=AncIzq + SepInt + AncDer + SepInt +"px"};
// SepLat=SepInt; alert("AncDis: "+AncDis+" SepLat: "+SepLat+" AncIzq: "+AncIzq+" SepInt: "+SepInt+" AncCue: "+AncCue+" SepInt: "+SepInt+" AncDer: "+AncDer+"")
// PubliGoogle()
}

function CamMenu(pag) {
if (PosMen=="Derecha") {crearCookie('Ubicacion_Menu_Vertical', 'Izquierda'); PosMen="Izquierda"} else {crearCookie('Ubicacion_Menu_Vertical', 'Derecha'); PosMen="Derecha"} 
Pagina(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; }

function Ampliar(num) {
document.getElementById("ampliar"+num).style.display="block";
document.getElementById("ampliar"+num).style.visibility="visible"}

function AnularAmpliar(num) {
document.getElementById("ampliar"+num).style.display="none";
document.getElementById("ampliar"+num).style.visibility="hidden"}

ayuda="";
function help(ayuda) {
mostrar="Help"+ayuda;
var txtayuda=document.getElementById(mostrar).innerHTML;
// alert(txtayuda);
document.getElementById("Help").innerHTML=txtayuda;
document.getElementById("Help").style.visibility="visible";
document.getElementById("Derecha").onmouseout=function() {cHelp()}
}
function cHelp() {document.getElementById("Help").innerHTML=""; document.getElementById("Help").style.visibility="hidden"}

// CORREO
arroba="@";
// function CorreoAmigo(asunto) {location= "mailto:" + "?subject=" + asunto + "&amp;body=En cuanto puedas, visita: " + document.location + " "; }
function CorreoAmigo(asunto) {parent.location.href= "mailto:" +"?subject=" +asunto+ "&body=En cuanto puedas, visita:%0D" +"  "+document.title +"%0Den:%0D" +"  "+document.location}

function CV() {return "correo" + arroba + "casaenventa.info" }
function CorreoCasa(asunto) {document.write("<a href='mailto:" + CV() + "?subject=" + asunto + " '>" + CV() + "</a>") }

function PubliGoogle() {
if ( document.getElementById('GoogleDossier') ) {
document.getElementById('Cuerpo').appendChild(document.getElementById('GoogleDossier')); document.getElementById('GoogleDossier').style.display="block"}  
if ( document.getElementById('GoogleCuadro') ) {document.getElementById('PreGoogleCuadro').appendChild(document.getElementById('GoogleCuadro')); document.getElementById('GoogleCuadro').style.display="block"} 
if ( document.getElementById('GoogleBanda') ) {document.getElementById('PreGoogleBanda').appendChild(document.getElementById('GoogleBanda')); document.getElementById('GoogleBanda').style.display="block"} 
}

