function findPos(obj) {
 var curleft = curtop = 0;
 if (obj.offsetParent) {
  do {
   curleft += obj.offsetLeft;
   curtop += obj.offsetTop;
  } while (obj = obj.offsetParent);
 }
 return [curleft,curtop];
}

function showMenu(object) {
 hideAll();
 show[object]=1;
 if (document.getElementById('dd_'+object)) {
  n_coords=findPos(document.getElementById('n_'+object));
  document.getElementById('dd_'+object).style.left=n_coords[0]-1+"px";
  document.getElementById('dd_'+object).style.visibility='visible';
 }
}

function hideMenu(object) {
 if (show[object]==0) {
  if (document.getElementById('dd_'+object)) {
   document.getElementById('dd_'+object).style.visibility='hidden';
  }
 }
}

function preHide(object) {
 show[object]=0;
 setTimeout("hideMenu('"+object+"')",500);
}

function checkEmail(email) {
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.toLowerCase())) {
  return true;
 } else {
  return false;
 }
}

function isInt(myNum) {
 // get the modulus: if it's 0, then it's an integer
  var myMod = myNum % 1;
 if (myMod == 0) {
  return true;
 } else {
  return false;
 }
}

function urlEncode(sStr) {
 sStr = escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
 return sStr;
}
