function GetURLContent(strURL)
{
   objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
   objXMLHttp.open("GET", strURL, false);
   objXMLHttp.send();
   strContent = objXMLHttp.responseText;

   nIndex = strContent.indexOf("</script>");
   if (nIndex != -1)
      strContent = strContent.substring(nIndex + 10, strContent.length);

   return strContent;
}

function Trim(strBuffer) 
{ 
   while (strBuffer.substring(0, 1) == ' ') 
      strBuffer = strBuffer.substring(1, strBuffer.length);

   while (strBuffer.substring(strBuffer.length - 1, strBuffer.length) == ' ')
      strBuffer = strBuffer.substring(0, strBuffer.length - 1);

   return strBuffer
} 

function ClearListbox(objListbox)
{
   if (objListbox.options)
      while (objListbox.options.length > 0)
         objListbox.options[0] = null;
}

function AddListboxItem(objListbox, value, text)
{
   option = document.createElement('OPTION');
   option.text = text;
   option.value = value;
   objListbox.add(option);
}

function ListBoxSelectByValue(objListBox, strValue)
{
   for (i = 0; i < objListBox.length; i++)
   {
      if (objListBox.options[i].value == strValue)
      {
         eval("objListBox.options[" + i + "].selected = true");
         return true;
         break;
      }
   }
   
   return false;
}

function AutoTab(objField, event, objDestination)
{
   reg = /^(0|8|9|16|17|18|37|38|39|40|46)$/;
   if (reg.test(event.keyCode))
      return;

   if (objField.getAttribute && objField.value.length == objField.getAttribute("maxlength"))
      objDestination.focus();
}

function SetCookie(strCookie, strValue)
{
   var dateExpire = new Date();
   dateExpire.setTime(dateExpire.getTime() + 365 * 24 * 3600 * 1000);
   document.cookie = strCookie + "=" + escape(strValue) + ";expires=" + dateExpire.toGMTString();
}

function ReadCookie(strCookie)
{
   var nStart = document.cookie.indexOf(strCookie);
   if (nStart == -1)
      return "";
 
   var nEnd = document.cookie.indexOf(';', nStart);
   if (nEnd == -1) 
      nEnd = document.cookie.length; 

   return unescape(document.cookie.substring(nStart + strCookie.length + 1, nEnd));
}


