function validateHex(IntegerField, strMsg)
{
   var val = IntegerField.value;
   var valid = "0123456789abcdefABCDEF"
   var temp;
   var err = false;

   for (var i = 0; i < val.length; i++)
   {
      temp = "" + val.substring(i, i+1);
      if (valid.indexOf(temp) == "-1")
      {
	      err = true;
      }
   }
   if (err == true)
   {
	   alert(strMsg);
      IntegerField.value="";
      IntegerField.focus();
      return false;
   }
   return true;
}

function convertDecToHex(dec)
{
   dec = Math.abs(dec);
   var hex = "";
   var a = "" + dec;
   a = a.length;
   var h = "0123456789ABCDEF";
   for (n=0; n<a; n++)
   {
      he = h.charAt(dec-Math.floor(dec/16)*16);
      dec = (dec - h.indexOf(he)) / 16;
      hex = he + hex;
   }
   if (hex.charAt(0) == "0")
      hex = hex.substring(1,hex.length);
   return hex;
}
