function getCachePrevent()
{
    return "&rand=" + escape( Math.round( Math.random() * 10000 ) );
}

function debugUrl(s)
{
    var elm = document.getElementById("debug");
    if (elm)
    {
        elm.innerHTML = "Debug: <a target=\"_blank\" href=\"" + s + "\">" + s + "</a>";
    }
}

function addOption(selectlabel, testo, valore)
{
  var elSel = document.getElementById(selectlabel);
  var elOptNew = document.createElement('option');
  elOptNew.text = testo;
  elOptNew.value = valore;

  try {
    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
  }
  catch(ex) {
    elSel.add(elOptNew); // IE only
  }

}

function removeAllOption(selectlabel)
{
  num_option=document.getElementById(selectlabel).options.length;
  for(a=num_option;a>=0;a--){
    document.getElementById(selectlabel).options[a]=null;
  }
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function IsInteger(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


