// JavaScript Document
// (c) 1997 Felipe Nieto

// ******************************************************************************************************************
// Concatena direcciones de correo
// se invoca en el docuemnto con
// <script type="text/javascript">muestracorreo("DIR", "txtenlace2");</script>
// donde DIR es lo q van antes de la arroba (el dominio es una variable)
// ******************************************************************************************************************
function muestracorreo(destinatario,texto,clase){
	var dominio = "proel.net";
	if(texto==null){
		document.write("<a href=\"mailto:" + destinatario + "@" + dominio + "\" class=\""+ clase +"\">" + destinatario + "@" + dominio + "</a>");
	}else{
		document.write("<a href=\"mailto:" + destinatario + "@" + dominio + "\" class=\""+ clase +"\">" + texto + "</a>");
	}
}

// ******************************************************************************************************************
// Definición ventanas emergentes
// ******************************************************************************************************************
function popupper(url,x,y,name,sb,rs,st,lt,tb) {
	var win = null;
	var centerwidth=(screen.width/2)-(x/2);
	var centerheight=(screen.height/2)-(y/2);
	var scrollbarstext = 'scrollbars = no,';
	var resizabletext = 'resizable = no,';
	var statustext = 'status = no,';
	var locationtext = 'location = no,';
	var toolbartext = 'toolbar = no,';
	var features = '';
	if (sb == 1){
		scrollbarstext = 'scrollbars = yes,'
	}
	if (rs == 1){
		resizabletext = 'resizable = yes,'
	}
	if (st == 1){
		statustext = 'status = yes,'
	}
	if (lt == 1){
		locationtext = 'location = yes,'
	}
	if (tb == 1){
		toolbartext = 'toolbar = yes,'
	}
	features = scrollbarstext+resizabletext+statustext;
	features = features + locationtext+toolbartext;
	features = features + 'width = '+x+',height = '+y;
	features = features + ',top = ' + centerheight;
	features = features + ',left = ' + centerwidth;
	win = window.open(url, name, features);
}
function Item(){
  this.length = Item.arguments.length 
  for (var i = 0; i < this.length; i++)
    this[i] = Item.arguments[i]
}

// ******************************************************************************************************************
// Definición ventanas emergentes (versión accesible)
// ******************************************************************************************************************
function flvFPW1(){
var v1=arguments,v2=v1[2].split(","),v3=(v1.length>3)?v1[3]:false,v4=(v1.length>4)?parseInt(v1[4]):0,v5=(v1.length>5)?parseInt(v1[5]):0,v6,v7=0,v8,v9,v10,v11,v12,v13,v14,v15,v16;v11=new Array("width,left,"+v4,"height,top,"+v5);for (i=0;i<v11.length;i++){v12=v11[i].split(",");l_iTarget=parseInt(v12[2]);if (l_iTarget>1||v1[2].indexOf("%")>-1){v13=eval("screen."+v12[0]);for (v6=0;v6<v2.length;v6++){v10=v2[v6].split("=");if (v10[0]==v12[0]){v14=parseInt(v10[1]);if (v10[1].indexOf("%")>-1){v14=(v14/100)*v13;v2[v6]=v12[0]+"="+v14;}}if (v10[0]==v12[1]){v16=parseInt(v10[1]);v15=v6;}}if (l_iTarget==2){v7=(v13-v14)/2;v15=v2.length;}else if (l_iTarget==3){v7=v13-v14-v16;}v2[v15]=v12[1]+"="+v7;}}v8=v2.join(",");v9=window.open(v1[0],v1[1],v8);if (v3){v9.focus();}document.MM_returnValue=false;return v9;}


// ******************************************************************************************************************
// Cerrar ventanas sin confimación
// onClick="cerrar()"
// (c) 1997 Felipe Nieto 
// ******************************************************************************************************************
function cerrar() {
var ventana = window.self;
ventana.opener = window.self;
ventana.close();
}

// ******************************************************************************************************************
// Fechas (hoy)
// se invoca en el documento con
// <script> document.write(Fecha()) </script>
// (c) 1997 Felipe Nieto 
// ******************************************************************************************************************
function Fecha() {
  var ndia  = new Item('Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado')
  var nmes  = new Item('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 
                          'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre')
  var ahora
  var fecha = new Date()
  var ano   = fecha.getYear()
  var mes   = fecha.getMonth()
  var dia   = fecha.getDay()
  var aux   = "" + fecha
  
  if (ano<10) {
    ano2 = "200" + eval(ano)
  }
  else if (ano<80) {                // año tiene 2 dígitos 19xx (más de 80)
    ano2 = "20" + ano
  } 
  else if (ano<=99) {               // año tiene 2 dígitos 20xx (menor de 80)
    ano2 = "19" + ano
  }
  else if (ano<1000) {              // año tiene 3 dígitos (100 es 2000)
    ano2 = eval(ano) + eval(1900)
  }
  else {
    ano2 = ano                      // año tiene 4 dígitos
  }
  
  ahora = ndia[dia] + ", "  + eval(aux.substring(7, 10)) + " de " + nmes[mes] + " de " + ano2
  return ahora
}

// ******************************************************************************************************************
// Precarga de imagenes
// ******************************************************************************************************************
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// ******************************************************************************************************************
// Fechas (año actual)
// se invoca en el documento con
// <script>document.write(Anyo())</script>
// (c) 1997 Felipe Nieto 
// ******************************************************************************************************************
function Anyo() {
  
  var ahora
  var fecha = new Date()
  var ano   = fecha.getYear()
  
  if (ano<10) {
    ano2 = "200" + eval(ano)
  }
  else if (ano<80) {                // año tiene 2 dígitos 19xx (más de 80)
    ano2 = "20" + ano
  } 
  else if (ano<=99) {               // año tiene 2 dígitos 20xx (menor de 80)
    ano2 = "19" + ano
  }
  else if (ano<1000) {              // año tiene 3 dígitos (100 es 2000)
    ano2 = eval(ano) + eval(1900)
  }
  else {
    ano2 = ano                      // año tiene 4 dígitos
  }
  
  ahora = ano2
  return ahora

}

// ******************************************************************************************************************
// colorear fondo celdas con enlaces
// (c) 1997 Felipe Nieto 
// ******************************************************************************************************************
function mOvr(src,clrOver) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}
function mOut(src,clrIn) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
src.bgColor = clrIn;
}
}
function mClk(src) {
if(event.srcElement.tagName=='LI'){
src.children.tags('A')[0].click();
}
}

// ******************************************************************************************************************
// pop-it menu 
// (c) 2005 felipe nieto
// ******************************************************************************************************************
var defaultMenuWidth="200px" //define el ancho del menu

var linkset=new Array()
//especificar grupos de menus y sus enlaces

linkset[0]='<a href="/sistemas/index.html#redes">Redes</a>'
linkset[0]+='<a href="/sistemas/index.html#amedida">Equipos a medida</a>'
linkset[0]+='<a href="/sistemas/index.html#mantenimiento">Mantenimiento preventivo</a>'
linkset[0]+='<a href="/sistemas/index.html#tecnico">Servicio técnico</a>'
linkset[0]+='<a href="/sistemas/index.html#consulting">Consultoría tecnológica</a>'
linkset[0]+='<a href="/sistemas/index.html#integrales">Servicios integrales</a>'

linkset[1]='<a href="/internet/registro.de.dominios/">Registro de dominios</a>'
linkset[1]+='<a href="/internet/index.html#buscadores">Promoción y buscadores</a>'         // '<hr>' //separador opcional
linkset[1]+='<a href="/internet/index.html#certificados">Certificados de seguridad SSL</a>'
linkset[1]+='<a href="/internet/index.html#serprivados">Servidores privados</a>'
linkset[1]+='<a href="/internet/index.html#serdedicados">Servidores dedicados</a>'
linkset[1]+='<a href="/internet/index.html#desarrollo">Desarrollo web</a>'
linkset[1]+='<a href="/internet/index.html#legales">Servicios legales</a>'
linkset[1]+='<a href="/internet/index.html#idea">Tengo una idea...</a>'

linkset[2]='<a href="#">Comercio electrónico</a>'
linkset[2]+='<a href="#">Inmobiliaria virtual</a>'
linkset[2]+='<a href="#">Alquiler de coches</a>'
linkset[2]+='<a href="#">Voz sobre IP</a>'

////no tocar nada más a partir de aquí

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//lo mismo pero en posc vertical
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//determina si 1 elemento está contenido en otro- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu

