function checkEmail(eml) {

  AtPos = eml.indexOf("@")
  StopPos = eml.lastIndexOf(".")
  
  if (eml == "") return false;
  
  if (AtPos <= 0 || StopPos == -1) return false;
  if (StopPos < AtPos) return false;
  if (StopPos - AtPos == 1) return false;
  
  return true;  

}

function chkFields() {

  if(document.getElementById("nam").value=="") {
    alert("Please fill in a name!");
    return false;
  }  
  
  if (!checkEmail(document.getElementById("eml").value)) {
    alert("Please fill in a valid email address!");
    return false;
  }
  
  if(document.getElementById("msg").value=="") {
    alert("Please fill in a message!");
    return false;
  } 
  
  return true;
}

function openLnk(url) {

 w = window.open("./index.php?redir="+url);
 w.focus();
  
  return false;
}

function fadeData(_id1, _id2, _min, _max, _grad) {
  this.op=_max;
  this.dir=-1;
  this.id1=_id1;
  this.id2=_id2;
  this.min = _min;
  this.max = _max;
  this.grad=_grad;
  
  //set starting opacity
  //moz
  document.getElementById(_id1).style.MozOpacity=1;
  document.getElementById(_id2).style.MozOpacity=0;
  
  //ie
  document.getElementById(_id1).style.filter="alpha(opacity=100)";
  document.getElementById(_id2).style.filter="alpha(opacity=0)";
  
  return this;
}
    
function fade(fd)
{
  if(fd.dir==1)
  { if (fd.op<fd.max) fd.op+=fd.grad; else fd.dir=-fd.dir; }
  else 
  { if (fd.op>fd.min) fd.op-=fd.grad; else fd.dir=-fd.dir; }
  
  var val = fd.op;
  if(val<0) val=0;
  if(val>1) val=1;

  //moz
  document.getElementById(fd.id1).style.MozOpacity=val;
  document.getElementById(fd.id2).style.MozOpacity=1-val;
  
  //ie
  document.getElementById(fd.id1).style.filter="alpha(opacity="+(val*100)+")";
  document.getElementById(fd.id2).style.filter="alpha(opacity="+((1-val)*100) +")";
}

function showInfo(id) {
    document.getElementById(id).style.visibility = 'visible';
    //document.getElementById(id).zIndex = 0;
    
}

function hideInfo(id) {
    document.getElementById(id).style.visibility = 'hidden';
}

