// Funcion Fecha Formato 'Jueves, 10 de abril de 2003' 

// hide script from older browsers
function Item(){
  this.length = Item.arguments.length 
  for (var i = 0; i < this.length; i++)
    this[i] = Item.arguments[i]
}

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) {                // ano tiene 2 dígitos 19xx (más de 80)
    ano2 = "20" + ano
  } 
  else if (ano<=99) {               // ano tiene 2 dígitos 20xx (menor de 80)
    ano2 = "19" + ano
  }
  else if (ano<1000) {              // ano tiene 3 dígitos (100 es 2000)
    ano2 = eval(ano) + eval(1900)
  }
  else {
    ano2 = ano                      // ano tiene 4 dígitos
  }
  

  ahora = ndia[dia] + ", " + eval(aux.substring(7, 10)) + " " + "de" + " " + nmes[mes] + " " + "de" + " " + ano2
  return ahora
}

// Funcion Hora Formato '5:02:33 PM'

function hora(){
if (!document.layers&&!document.all)
return
var Digital=new Date()
var horas=Digital.getHours()
var minutos=Digital.getMinutes()
var segundos=Digital.getSeconds()
var dn="AM" 
if (horas>12){
dn="PM"
horas=horas-12
}
if (horas==0)
horas=12
if (minutos<=9)
minutos="0"+minutos
if (segundos<=9)
segundos="0"+segundos
mrelog=""+horas+":"+minutos+":"
+segundos+" "+dn+""
if (document.layers){
document.layers.relog.document.write(mrelog)
document.layers.relog.document.close()
}
else if (document.all)
relog.innerHTML=mrelog
setTimeout("hora()",1000)
}


function meter(texto) {
_insertar(document.form.mensaje, texto)
}

function BBCode(accion){ 
switch(accion){ 
  case "negrita": 
   negras = prompt("Texto en Negritas",""); 
   if(negras){ 
    negras="[b] "+negras+" [/b]"; 
    meter(negras); 
   } 
  break; 
  case "cursiva": 
   italica = prompt("Texto en Cursiva", ""); 
   if(italica) { 
    italica="[i] "+ italica +" [/i]"; 
    meter(italica); 
   } 
  break; 
  case "subrayado": 
   subrayado = prompt("Texto Subrayado", ""); 
   if(subrayado) { 
    subrayado="[u] "+subrayado+" [/u]"; 
    meter(subrayado); 
   } 
  break; 
  case "derecha": 
   right = "[right]  [/right]"; 
   meter(right); 
  break; 
  case "centrado": 
   center = "[center]  [/center]"; 
   meter(center); 
  break; 
  case "izquierda": 
   left = "[left]  [/left]"; 
   meter(left); 
  break; 
  case "justificado": 
   justify="[justify]  [/justify]"; 
   meter(justify); 
  break; 
  default: 
    meter(accion); 
  break; 
  } 
} 


