function UniquifiedUrl(url) {
 var urlParts = url.split("?");
 var uniqueUrl = urlParts[0];
 uniqueUrl += "/rnd" + Math.floor(Math.random() * 1000000);
 if (urlParts.length == 2)
  uniqueUrl += '?' + urlParts[1];
 return uniqueUrl;
}

function fold(searchdescription) {
 if (document.getElementById) {
  var foldingbox = document.getElementById(searchdescription).style;
  if (foldingbox.display == "block") {
   foldingbox.display = "none";
  } else {
  foldingbox.display = "block";
  }
  return false;
 } else {
  return true;
 }
}

var elements = new Array();

function Element(id, href, onClick, color)
{
 this.Id = id;
 this.Href = null;
 this.OnClick = null;
 this.Color = null;
 this.Disabled = false;
}

function GetElement(elementId)
{
 for (var elementIndex = 0; elementIndex < elements.length; elementIndex++)
  if (elements[elementIndex].Id == elementId)
   return elements[elementIndex];
 return null;
}

function GuaranteeId(el)
{
 if (el.nodeName == '#text')
  return false;
 if (el.id == '')
  el.id = Math.random();
 else
  if (!document.getElementById(el.id))
   el.id = Math.random();
 return true;
}

function GetExcludedId(excludedIds, excludedId)
{
 if (excludedIds == null)
  return null;
 for (var index = 0; index < excludedIds.length; index++)
  if (excludedIds[index] == excludedId)
   return excludedIds[index];
 return null;
}

function SetDisabledAndExclude(el, excludedIds, disabled)
{
 if (!GuaranteeId(el))
  return;
 if (GetExcludedId(excludedIds, el.id) == null)
 {
  try
  {
   if (el.tagName && el.tagName.toLowerCase() == "select")
   {
    if (disabled)
    {
     var element = GetElement(el.id);
     if (element == null)
     {
      element = new Element(el.id);
      element.Disabled = el.disabled;
      elements[elements.length] = element;
     }
     el.disabled = disabled;
    }
    else
    {
     var element = GetElement(el.id);
     if (element != null)
      el.disabled = element.Disabled;
    }
   }
   else if (el.tagName && el.tagName.toLowerCase() == "img")
   {
    if (disabled)
    {
     el.style.filter = 'alpha(opacity=10)';
     el.style.opacity = '.10';
    }
    else
    {
     el.style.filter = null;
     el.style.opacity = null;
    }
   }
   else if (el.tagName && el.tagName.toLowerCase() == "a")
   {
    if (disabled)
    {
     var element = GetElement(el.id);
     if (element == null)
     {
      element = new Element(el.id);
      element.Href = el.href;
      element.OnClick = el.onclick;
      element.Color = el.style.color;
      elements[elements.length] = element;
     }
     el.onclick = function() { return false; };
     el.style.cursor = 'default';
     el.style.textDecoration = 'none';
     el.style.color = '#cccccc';
     el.onfocus = el.blur();
    }
    else
    {
     var element = GetElement(el.id);
     if (element != null)
     {
      el.onclick = element.OnClick;
      el.href = element.Href;
      el.style.color = element.Color;
     }
     el.style.cursor = 'pointer';
     el.style.textDecoration = 'underlined';
    }
   }
  }
  catch (E) { }
  if (el.childNodes && el.childNodes.length > 0)
  {
   for (var x = 0; x < el.childNodes.length; x++)
   {
    SetDisabledAndExclude(el.childNodes[x], excludedIds, disabled);
   }
  }
 }
}

function SetDisabled(el, disabled)
{
 SetDisabledAndExclude(el, null, disabled);
}

function AjaxUpdateElementWithHtmlNode(elementId, url)
{
 var targetElement = document.getElementById(elementId);
 targetElement.style.cursor = 'wait';
 var response = GetXmlHttpRequestResponse(url);
 var xmlDocument = XmlStringToXmlObject(response);
 var childNodes = xmlDocument.documentElement.childNodes;
 for (childIndex = 0; childIndex < childNodes.length; childIndex++)
 {
  var childNode = childNodes[childIndex];
  switch (childNode.nodeName)
  {
   case 'Html':
    targetElement.style.cursor = 'default';
    targetElement.style.display = 'block';
    targetElement.innerHTML = XmlObjectToXmlString(childNode);
    break;
  }
 }
}