a = new Image();
a.src = 'imagenes/concepto_deliterraneo_on.jpg'
b = new Image();
b.src = 'imagenes/como_pedir_on.jpg'
c = new Image();
c.src = 'imagenes/libreria_on.jpg'
d = new Image();
d.src = 'imagenes/sabias_on.jpg'
e = new Image();
e.src = 'imagenes/menu_on.jpg'
f = new Image();
f.src = 'imagenes/donde_estamos_on.jpg'

function on(img,id)
{
	document.getElementById('img' + id).src = 'imagenes/' + img + '_on.jpg';
}
function off(img,id)
{
	document.getElementById('img' + id).src = 'imagenes/' + img + '_off.jpg';
}

function emailCheck (emailStr) {
/* Verificar si el email tiene el formato user@dominio. */
var emailPat=/^(.+)@(.+)$/ 

/* Verificar la existencia de caracteres. ( ) < > @ , ; : \ " . [ ] */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]" 

/* Verifica los caracteres que son válidos en una dirección de email */
var validChars="\[^\\s" + specialChars + "\]" 

var quotedUser="(\"[^\"]*\")" 

/* Verifica si la dirección de email está representada con una dirección IP Válida */ 


var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/


/* Verificar caracteres inválidos */ 

var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
//domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
alert("La dirección de Email debe tener tanto @ como .")
return false
}
var user=matchArray[1]
var domain=matchArray[2]

// Si el user "user" es valido 
if (user.match(userPat)==null) {
// Si no
alert("El nombre de usuario no es válido.")
return false
}

/* Si la dirección IP es válida */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("IP de destino inválida")
return false
}
}
return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
alert("El dominio parece no ser válido.")
return false
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
/*if domArr[domArr.length-1].length<2 { /*|| domArr[domArr.length-1].length>3({

alert("La dicrección debe tener 3 letras si es ."com" o 2 si en de algún pais.");
return false
}*/

if (len<2) {
var errStr="La dirección es erronea"
alert(errStr)
return false
}

// La dirección de email ingresada es Válida
return true;
}

function nwindow(mypage,myname,w,h,scroll,pos)
{
  if (pos=="random")
  {
    LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
    TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
  }
  else if (pos=="center")
  {
    LeftPosition=(screen.width)?(screen.width-w)/2:100;
    TopPosition=(screen.height)?(screen.height-h)/2:100;
  }
  else
  {
    LeftPosition=0;
    TopPosition=20;
  }

  settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
  win=window.open(mypage,myname,settings);

  if(win.focus)
  {
    win.focus();
  }
}

function redimensionar (ancho, alto)
{
  LeftPosition=(screen.width)?(screen.width-ancho)/2:100;
  TopPosition=(screen.height)?(screen.height-alto)/2:100;

  window.moveTo(LeftPosition,TopPosition);
  window.resizeTo(ancho,alto);
  window.focus();
}


function redondear(value, precision)
{
  value = "" + value //convert value to string
  precision = parseInt(precision);

  var whole = "" + Math.round(value * Math.pow(10, precision));
  var decPoint = whole.length - precision;

  if(decPoint != 0)
  {
    result = whole.substring(0, decPoint);
    result += ".";
    result += whole.substring(decPoint, whole.length);
  }
  else
  {
    result = 0;
    result += ".";
    result += whole.substring(decPoint, whole.length);
  }
  return (result);
}