

    //Fills the given element with the httpObject's response text as innerHTML.
	function FillWithResponse(element, httpObject)
	{
	  if (httpObject.readyState == 4 && element)
	  {
	    element.innerHTML = httpObject.responseText;
//Not Working correctly, either
	  /*@cc_on
		@if (@_jscript_version >= 5)
	    //var newHtml = '<div id="' + element.id + '" class="' + element.className + '">' + httpObject.responseText + '</div>';
	    //element.outerHTML = newHtml;
	   @end @*/
	  }
	}
	function RemoveArrayEntry(arr, idx)
	{
	  var result = new Array();
	  for (var _idx = 0; _idx < selectedDS.length; ++_idx)
	  {
	    if (idx != _idx)
	      result.push(arr[_idx]);
	  }
	  return result;
	}

	function GetHTTPObject()
	{
		var httpObject;
		/*@cc_on
		@if (@_jscript_version >= 5)
			try
			{
				httpObject = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					httpObject = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e2)
				{
					httpObject = false;
				}
			}
		@else
		httpObject = false;
		@end @*/
		if (!httpObject && typeof XMLHttpRequest != 'undefined')
		{
		  try
		  {
		    httpObject = new XMLHttpRequest();
		  }
		  catch (e)
		  {
		    httpObject = false;
		  }
		}
		return httpObject;
	}

    function IsPositiveInt(val)
    {
      var hasPositiveNumber = false;
      for (i = 0; i < val.length; ++i)
      {
        var ch = val.charAt(i);
		if (ch <"0" || ch  > "9")
		  return false;
		else
		  if (ch != "0")
		    hasPositiveNumber = true;
	  }
	  return hasPositiveNumber;
    }

    function IsPositiveReal(val, decPoint)
    {
      id (val.indexOf(decPoint) == -1)
        return IsPositiveInt(val);

      var parts = val.split(decPoint);
      if (parts.length != 2)
        return false;

       return IsPositiveInt(parts[0]) && IsPositiveInt(parts[1]);
    }

	function $(id)
	{
	  return document.getElementById(id);
	}

    function SetValue(formElement, value)
    {
         options = formElement.options;
         if (options)
         {
           for (var i = 0; i < options.length; ++i)
             if (options[i].value == value)
               options[i].selected = true;
         }
         else
           formElement.value = value;
    }

    function GetValue(formElement)
    {
        options = formElement.options;
        if (options)
          return options[options.selectedIndex].value;

        return formElement.value;
    }

    function ClearOptions(options)
    {
      while(options.length > 0)
      {
        options[options.length - 1] = null;
      }
    }

    function SetOpacity(element, value)
    {
	  element.style.opacity = value;
	  ieVal =Math.round(value * 100, 0);
	  element.style.filter = 'alpha(opacity=' + ieVal + ')';
	}

    function IndexOf(arr, value)
    {
      for (var idx = 0; idx < arr.length; ++idx)
      {
        if (arr[idx] == value)
          return idx;
      }
      return -1;
    }

	function KeyCode(evt)
	{
	  if (!evt)
	  {
	    return event.keyCode;
	  }
	  else
	  {
	    return evt.keyCode;
	  }
	}

    function UrlEncode(str)
    {
      return escape(str)
       .replace(/\+/g, '%2B')
          .replace(/\"/g,'%22')
             .replace(/\'/g, '%27');
    }

    function ToggleView(element)
    {
      if (element != null)
      {
        if (element.style.display != "none")
          element.style.display = "none";
        else
          element.style.display = "";
      }
    }
  function Unselect(selectElement)
  {
    selectElement.selectedIndex = -1;
  }