﻿// cst011-castefa.js - (c) Juan Rodríguez, consultor & Begues Internet, s.l.

window.onload=function() {Pagina()};
// window.onresize=new Function("window.location=window.location.href");
// google_adtest="on";
var ancPant=0; var altPant=0; var AncDis; var AncCue=900; var AncDer=180; var PosMen=""; var SepLat=0; var posMV=-500;

function MedirAncho() {
if (window.innerHeight) {ancPant=window.innerWidth; altPant=window.innerHeight}
else if (document.documentElement && document.documentElement.clientWidth) {ancPant=document.documentElement.clientWidth; altPant=document.documentElement.clientHeight}
else if (document.body) {ancPant=document.body.clientWidth; altPant=document.body.clientHeight};
AncDis=parseInt(ancPant);
if (AncDis < 920) {AncDis=AncDis-17; AncCue=760}
if ((AncDis >= 920) & (AncDis < 990)) {AncDis=AncDis-17; AncCue=900}
if ((AncDis >= 990) & (AncDis < 1010)) {AncDis=990; AncCue=770; document.write('<link rel="stylesheet" href="rc/cst003-1024.css" type="text/css">') } // 1024x
if ((AncDis >= 1010) & (AncDis < 1260)) {AncCue=900}
if ((AncDis >= 1260) & (AncDis <= 1280)) {AncDis=1260; AncCue=900} // 1280x
return AncDis }
var AncDis=MedirAncho();

function Pagina() {
if (ancPant==0) {MedirAncho()};
document.getElementById("Cuerpo").style.width=AncCue+"px";
SepDis=parseInt(AncDis -AncCue -AncDer);
if (SepDis <= 0) {SepLat=0; SepInt=0} else {SepInt=parseInt(SepDis*20/100); SepLat=parseInt(SepDis*40/100)}; 
if (SepInt > 50) {Exceso=SepInt-50; SepInt=50; SepLat=SepLat+(Exceso/2)};
if (AncDis < (AncCue + AncDer) ) {AncDer=0; SepLat=(AncDis-AncCue)/2; if (SepLat < 0) {SepLat=0}; document.getElementById("Derecha").style.display="none"; aBloque(800)};
PosMen=leerCookie('Ubicacion_Menu_Vertical');
if (PosMen !=null) {PosMen=PosMen} else {PosMen="Derecha"}
if (PosMen=="Derecha") {posMV=SepLat+AncCue+SepInt-235-15;
document.getElementById("Cabecera").style.left=SepLat+"px"; document.getElementById("Cuerpo").style.left=SepLat+"px"; document.getElementById("Derecha").style.left=SepLat+AncCue+SepInt+"px";
document.getElementById("cst031").src="rc/cst031A-logo_castefa.png"}
if (PosMen=="Izquierda") {posMV=SepLat+AncDer+5;
document.getElementById("Cabecera").style.left=SepLat+AncDer+SepInt+"px"; document.getElementById("Cuerpo").style.left=SepLat+AncDer+SepInt+"px"; document.getElementById("Derecha").style.left=SepLat+"px"; 
document.getElementById("cst031").src="rc/cst031C-logo_castefa_izq.png"}
posicionarPiePag ();
TraductorGoogle();
AperturaLinkExterno() }

function posicionarPiePag() {
if (document.getElementById("PiePosicionado")) {
document.getElementById("PiePosicionado").style.position="absolute"; document.getElementById("PiePosicionado").style.width=AncCue+"px";
if ((document.getElementById("Pie700")) && (altPant > 500)) {document.getElementById("PiePosicionado").style.top=altPant-170+"px"};
if (altPant > 760) {document.getElementById("PiePosicionado").style.top=altPant-170+"px"}; 
document.getElementById("PiePosicionado").style.visibility="visible"}; }

function googleTranslateElementInit() {new google.translate.TranslateElement({pageLanguage: 'es'}, 'google_translate_element');}
function TraductorGoogle() {var script=document.createElement("script"); script.src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"; script.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(script) }

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") {anchor.target="self"}  
if (anchor.getAttribute("rel") && anchor.getAttribute("rel") == "nofollow") {anchor.target="self"}  }  } 

function CamMenu() {
document.getElementById("google_translate_element").innerHTML="";
if (PosMen=="Derecha") { crearCookie('Ubicacion_Menu_Vertical', 'Izquierda'); PosMen="Izquierda"} else { crearCookie('Ubicacion_Menu_Vertical', 'Derecha'); PosMen="Derecha"} 
Pagina()}

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 }

txtMV20="<p>Directorio de Castelldefels</p>Acceso a la portada del<br />Directorio de Castelldefels";
txtMV55="<p>Traducir</p>Seleccione otro idioma en que desea moverse por el Directorio.<br /><br /><i>(Esta selección no afecta a los mapas)</i>";
txtMV80="<p>Buscar y encontrar</p>Use el teclado JRc del Directorio<br />para encontrar lo que busca";
txtMV105="<p>Directorio por actividades</p>Empresas, comercios, profesionales y entidades de Castelldefels, agrupados por actividad";
txtMV145="<p>Mapas</p>Índice con todos los mapas<br />que puede consultar<br />en el Directorio de Castelldefels";
txtMV170="<p>Callejero</p>Callejero de Castelldefels<br />y buscador universal de direcciones";
txtMV195="<p>De turismo por Castelldefels</p>Información de interés para turistas y visitantes en Castelldefels";
txtMV235="<p>Prensa y actualidad</p>Lo que se acaba de publicar sobre Castelldefels en la prensa digital";
txtMV260="<p>El tiempo</p>El tiempo en Castelldefels";
txtMV285="<p>Agenda</p>Agenda de teléfonos y direcciones<br />de interés para Castelldefels";
txtMV325="<p>Lo + visitado</p>Lo más visitado en el<br />Directorio de Castelldefels";
txtMV350="<p>Mucha más info</p>Índice temático de toda la información en el Directorio de Castelldefels";
txtMV375="<p>Sugerencias</p>Algunas sugerencias desde<br />el Directorio de Castelldefels";
txtMV405="<p>Contactar</p>Por si desea opinar, criticar,<br />felicitarnos el cumpleaños,...";
txtMV430="<p>Menú</p>Sitúe este menú donde más le guste,<br />a la derecha o a la izquierda de su pantalla";
txtMV99="<p>&nbsp;</p><i>www.castefa.net</i>";

function aTxtMV(mv) {
codigoMV="txtMV"+mv; codigoTxt=eval(codigoMV); txtMV='<div id="TxtMV">'+codigoTxt+txtMV99+'</div>'; scrollTo(0,0);
document.getElementById("MV").style.top=mv+"px"; 
document.getElementById("MV").style.left=posMV+"px";
document.getElementById("MV").style.visibility="visible"; 
document.getElementById("MV").innerHTML=txtMV;
document.getElementById("Derecha").onmouseout=function() {cTxtMV()} }
function cTxtMV() {document.getElementById("MV").style.visibility="hidden"}

function aBloque(bq) {document.getElementById("Bloque"+bq).style.height="auto"; document.getElementById("Bloque"+bq).style.visibility="visible"; document.getElementById("Bloque"+bq).style.display="block"}
function cBloque(bq) {document.getElementById("Bloque"+bq).style.height=1+"px"; document.getElementById("Bloque"+bq).style.visibility="hidden"; document.getElementById("Bloque"+bq).style.display="none"}

var rCerradas=0; var tResenas=0; var mResenas=0; var eResenas="DC";
function cResena(resena,tr,mr,er) {
if (tr) {tResenas=tr}; if (mr) {mResenas=mr}; if (er) {eResenas=er};
document.getElementById("Cuerpo").style.paddingBottom=200+"px";
document.getElementById("RS"+resena).style.height=1+"px"; document.getElementById("RS"+resena).style.visibility="hidden"; document.getElementById("RS"+resena).style.display="none";
document.getElementById("RS99").style.visibility="visible";
rCerradas++; 
rtxtnomas="Hola, \n\nHas cerrado las "+tResenas+" reseñas de "+eResenas+".";
if (mResenas>1) {rtxtsimas="Hola, \n\nYa has cerrado "+tResenas+" reseñas.\nSi estás buscando "+eResenas+",\ntienes otras "+mResenas+" reseñas más donde escoger."};
if (mResenas==1) {rtxtsimas="Hola, \n\nYa has cerrado "+tResenas+" reseñas.\nSi estás buscando "+eResenas+",\ntienes otra reseña más donde escoger."};
rtxtgral="\n\n¿No encuentras lo que buscas?\nMándanos un mensaje y a ver que podemos hacer.\n\nGracias.";
if (rCerradas==tResenas) {if (mResenas==0) {alert(rtxtnomas+rtxtgral)}; if (mResenas >= 1) {alert(rtxtsimas+rtxtgral)}; rCerradas=0; scrollTo(0,0); RecuperarResenas(tResenas) } }

function RecuperarResenas(nr) {
var i=1;
for (i=1; i<=nr; i++) {document.getElementById("RS"+i).style.height="auto"; document.getElementById("RS"+i).style.display="block"; document.getElementById("RS"+i).style.visibility="visible" }
rCerradas=0; document.getElementById("RS99").style.visibility="hidden"}

lm=-450;
capaOpaca='<div id="capaOpaca" style="position:absolute; height:100%; width:100%; background-color:#CCCCCC; opacity:0.75; filter:alpha(opacity=75); z-index:30; top:0; left:0"></div>';
function LoMas(opc) {
if (opc==900) {document.getElementById("LoMas").style.zIndex="6"};
scrollTo(0,0); document.getElementById("LoMas").style.display="block"; document.getElementById("LoMas").style.visibility="visible"; 
document.getElementById("LoMas").style.top=lm+"px"; relojLM() };
function relojLM() {if (lm <80) {lm=lm+4; setTimeout("LoMas(lm)",1) } else {document.getElementById('Atajos').innerHTML=capaOpaca; document.getElementById("LoMas").style.zIndex="40"}}
function relojcLM() {if (lm > -450) {lm=lm-4; setTimeout("cLoMas(lm)",1) } else {cerrarLoMas()}}
function cLoMas(opc) {
if (opc==901) {document.getElementById("LoMas").style.zIndex="0"}; 
if (opc==900) {document.getElementById("LoMas").style.zIndex="6"}; 
document.getElementById("Atajos").innerHTML=""; 
document.getElementById("LoMas").style.top=lm+"px"; relojcLM();}
function cerrarLoMas () {document.getElementById("LoMas").style.height=1+"px"; document.getElementById("LoMas").style.visibility="hidden"; document.getElementById("LoMas").style.display="none"}

// Correo
arroba="@";
CorreoWeb="directorio"+arroba+"castefa.net";
function CorreoAmigo(asunto) {location = "mailto:" + "?subject=" + asunto + "&amp;body=En cuanto puedas, visita el Directorio de Castelldefels en http://www.castefa.net" }
function CorreoDirectorio(asunto) {document.write("<a href='mailto:"+CorreoWeb+"?subject="+asunto+" '>"+CorreoWeb+"</a>") };

function FuncionSelectRMasInfo() {
if (document.getElementById("SelectRMasInfo").value=="none") {document.getElementById("SelectRMasInfo").selectedIndex=0; return};
window.location.href=(document.getElementById("MenuRMasInfo").SelectRMasInfo.options[document.getElementById("MenuRMasInfo").SelectRMasInfo.selectedIndex].value);
document.getElementById("MenuRMasInfo").SelectRMasInfo.selectedIndex="0"};

// Atajos
tAtaVisible=0; jsAtajos=0;
document.onkeydown=oirTeclado;

function include(ficheroJS) {var jr=document.createElement("script"); jr.type="text/javascript"; jr.src=ficheroJS; document.body.appendChild(jr)};
function preleerTeclado() {if (jsAtajos==1) {leerTeclado()} else {alert("Hola,\n\nLa página no se ha cargado del todo.\n\nCierre esta ventana y complete su atajo.\n\nSi el problema persiste, verifique su conexión a Internet.\n\nGracias.")} }

function oirTeclado(e) {
if (document.getElementById('JRcF') )  {return}
var kC; if (!e) var e=window.event; if (e.keyCode) {kC=e.keyCode} else {if (e.which) {kC=e.which} }; 
if (kC==19) {window.location="cst249-abeja_castefa.html"};
if ((kC==27) && (tAtaVisible==1)) {document.getElementById('Atajos').innerHTML=""; tAtaVisible=0};
if ((kC==219) || (kC==221)) {window.location="230-castefa_como_buscar_en_el_directorio.html"};
if (kC <= 47) {return}; if ((kC >= 91) && (kC <= 95)) {return}; if ((kC >= 106) && (kC <=190)) {return}; if (kC >=193) {return};
if (tAtaVisible==0) {document.getElementById('Atajos').innerHTML=t21; tAtaVisible=1; document.getElementById('dAtajos').style.visibility="visible"; scrollTo(0,0); document.getElementById('cT').focus()};
if (jsAtajos==0) {include("rc/cst018-atajos.js")}; }

t21 ='<div id="dAtajos"><div id="vAtajos">';
t21 +='<h2>Atajos: El camino más corto</h2><p>No es necesario pulsar [Intro]. El sistema busca a medida que Vd. vaya escribiendo. Si sigue viendo esta ventana complete (o revise) el atajo escrito.</p>';
t21 +='<form action="javascript:void(0)" method="post" id="fAtajos"><p style="text-align:center"><input type="text" name="in" size="10" onkeyup="preleerTeclado()"; value="" id="cT" /></p></form>';
t21 +='<p>SUGERENCIAS:</p><p>* Si busca determinado tipo de empresas o profesionales escriba (2 veces) la inicial de la actividad. Por ejemplo: Escriba <b>AA</b> si busca abogados, academias, albañiles,...</p><p>* Si busca una información en concreto, escríbala.<br />Por ejemplo: <b>tiempo</b> para acceder a la información meteorológica.</p><p>* ¿ Necesita ayuda ?, pues escriba <b>ayuda</b>.</p><p>* Pulse <b>Esc</b> en su teclado físico para cerrar esta venta. También puede escribir <i>esc</i>, <i>salir</i>, <i>sortir</i> o <i>exit</i>.</p> ';
t21 +='</div></div>';
