//direcciones de correo
principal="oxo";
webmaster="webmaster";
reclutas="reclutas";
retos="retos";
dominio="oxo-team.com"; 
arroba="@";

//funciones para escribir correos
function dir_principal(){ 
   return principal + arroba + dominio 
} 
function dir_webmaster(){ 
   return webmaster + arroba + dominio 
}
function dir_reclutas(){ 
   return reclutas + arroba + dominio 
}
function dir_retos(){ 
   return retos + arroba + dominio 
}
function mail_principal(){ 
   document.write("<a href='mailto:" + dir_principal() + "' class='links'>" + dir_principal() + "</a>") 
} 
function mail_webmaster(){ 
   document.write("<a href='mailto:" + dir_webmaster() + "' class='links'>" + dir_webmaster() + "</a>") 
} 
function mail_reclutas(){ 
   document.write("<a href='mailto:" + dir_reclutas() + "' class='links'>" + dir_reclutas() + "</a>") 
} 
function mail_retos(){ 
   document.write("<a href='mailto:" + dir_retos() + "' class='links'>" + dir_retos() + "</a>") 
} 

//Mensaje en Barra Estado
function LimpiaMensaje(){
	window.status='';
	return true;
}

//Monta un array
function montaArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  return this;
}

// Muestra fecha
function displayDate() {
  var this_month = new montaArray(12);
  this_month[0]  = "Enero";
  this_month[1]  = "Febrero";
  this_month[2]  = "Marzo";
  this_month[3]  = "Abril";
  this_month[4]  = "Mayo";
  this_month[5]  = "Junio";
  this_month[6]  = "Julio";
  this_month[7]  = "Agosto";
  this_month[8]  = "Septiembre";
  this_month[9]  = "Octubre";
  this_month[10] = "Noviembre";
  this_month[11] = "Diciembre";

  var this_day_e = new montaArray(7);
  this_day_e[0]  = "Domingo";
  this_day_e[1]  = "Lunes";
  this_day_e[2]  = "Martes";
  this_day_e[3]  = "Miércoles";
  this_day_e[4]  = "Jueves";
  this_day_e[5]  = "Viernes";
  this_day_e[6]  = "Sábado";

  var today = new Date();
  var day   = today.getDate();
  var month = today.getMonth();
  var year  = today.getYear();
  var dia = today.getDay();
    if (year < 1000) {
       year += 1900; }
  return( " " + this_day_e[dia] + ", " + day + " de " + this_month[month] + " " + year);
}
var start=new Date();
var url_auto="/";
start=Date.parse(start)/1000;
var counts=5;
function CountDown(){
	var now=new Date();
	now=Date.parse(now)/1000;
	var x=parseInt(counts-(now-start),10);
	if(document.form1){document.form1.clock.value = x;}
	if(x>0){
		timerID=setTimeout("CountDown()", 100)
	}else{
		location.href=url_auto;
	}
}
function verdatos(miembro) {
	var izquierda = (screen.availWidth - 600) / 2; 
    var arriba = (screen.availHeight - 250) / 2;
	var dir ='/mdl/usuario/info_user.php?m='+miembro;
	var objw =	window.open(dir,'Info','width=600,height=250,status=no,resizable=no,top='+arriba+',left='+izquierda+',dependent=yes,alwaysRaised=yes');
	objw.focus();
}	

var nav4 = window.Event ? true : false;
function acceptNum(evt){ 
	var key = nav4 ? evt.which : evt.keyCode; 
	return (key <= 13 || (key >= 48 && key <= 57));
}

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function mail(texto){ 
    var mailres = true;             
    var cadena = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@._-"; 
     
    var arroba = texto.indexOf("@",0); 
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1; 
     
    var punto = texto.lastIndexOf("."); 
                 
     for (var contador = 0 ; contador < texto.length ; contador++){ 
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){ 
            mailres = false; 
            break; 
     } 
    } 

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1)){ 
     mailres = true; 
    } else {
	 alert('E-mail incorrecto'); 
	 mailres = false; 
	}
	return mailres;
                 
} 

function sonido(soundobj) {
  //var thissound= eval("document."+soundobj);
  //thissound.Play();
}

var abierto = 0;
var velocidad = 15;
var altura=0;
var altura_div=0;
	
function controlMenu (objectID) {
  obj = document.getElementById(objectID);
  if (abierto==1){
    esconde();
  } else {
   
    curleft = 0;
    if(obj.offsetParent)
      while(1){
        curleft += obj.offsetLeft;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
      else if(obj.x)
          curleft += obj.x;
      
      menu = document.getElementById('menupop');
      curleft = curleft - 3;
      menu.style.left= curleft+'px';
      alto_pantalla = Alto_pantalla();
      menu.style.top = alto_pantalla + 'px';
      ensena();   
      abierto=1;   
  }
  return
}

function ensena() {
  var objeto = document.getElementById('menupop');
  var alt_pantalla = Alto_pantalla();
  objeto.style.visibility = 'visible';
  altura += velocidad;
  altura_div = alt_pantalla - altura;
  total = alt_pantalla - 160;
  if (altura_div >= total) {
    objeto.style.top = altura_div + 'px';
    window.setTimeout ("ensena();", 20);
  } 
}

function esconde(alt_pantalla) {
  var objeto = document.getElementById('menupop');
  var alt_pantalla = Alto_pantalla();
  altura -= velocidad;
  altura_div = alt_pantalla - altura;
  if (altura_div <= alt_pantalla) {
    objeto.style.top = altura_div +'px';
    window.setTimeout ("esconde();", 20);
  } else {
    abierto=0;
    objeto.style.visibility = 'hidden';
  }
}
function controla_menu(){
    if (abierto==1){
      var objeto = document.getElementById('menupop');
      var alt_pantalla = Alto_pantalla();
      
      curtop = 0;
      if(objeto.offsetParent)
        while(1){
          curtop += objeto.offsetTop;
          if(!objeto.offsetParent)
            break;
          objeto = objeto.offsetParent;
        }
        else if(objeto.x)
            curtop += objeto.x;
      
      //alt_pantalla = alt_pantalla + document.body.scrollTop;
      altura_div = alt_pantalla - 140;
      var objeto = document.getElementById('menupop');
      objeto.style.top = altura_div +'px';
    }
}
function Resize(){
    if (abierto==1){
      abierto=0;
      document.getElementById('menupop').style.visibility = 'hidden';
    }
}
function Alto_pantalla(){
  var alto_pantalla = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    alto_pantalla = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    alto_pantalla = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    alto_pantalla = document.body.clientHeight;
  }
  alto_pantalla = document.body.scrollTop + alto_pantalla; 
  return alto_pantalla;
}
window.onresize=Resize;
window.onscroll=controla_menu; 

