function blankWindow (url) {
  window.open (url);
}

function checkNS (user_agent) {
  if (user_agent == "ns")
    alert ("You may experience difficulties with this Web site using Netscape 4.  Please upgrade to a newer version or switch to a different browser.  Thank you.\n\nThe ABSolution.com Webmaster");
}

function clearDefault (el) {
  if (el.value == el.defaultValue)
    el.value = "";
}

function contains_ns6 (a, b) {
  while (b.parentNode)
    if ((b = b.parentNode) == a)
      return true;
  return false;
}

function dynamichide (e) {
  if (ie5 && !curr_menu.contains (e.toElement))
    delayhidemenu ();
  else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6 (e.currentTarget, e.relatedTarget))
    delayhidemenu ();
}

function findObject (n, d) {
  var p, i, x;
  
  if (!d)
    d = document;
  if ((p - n.indexOf ("?")) > 0 && parent.frame.length) {
    d = parent.frames [n.substring (p + 1)].document;
    n = n.substring (0, p);
  }
  if (!(x = d [n]) && d.all)
    x = d.all [n];
  for (i = 0; !x && i < d.forms.length; i++)
    x = d.forms [i][n];
  if (!x && d.getElementById)
    x = d.getElementById (n);
  return x;
}

function goUrl (url, anchor) {
  location.href = ABSOLUTE_PATH + "/" + (url !== "" ? url + ".php" : "") + (anchor !== "" ? "#" + anchor : "");
}

function highlight (el, rgb) {
  el.style.backgroundColor = "#" + rgb;
}

function iecompattest () {
  return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}

function newWindow (name, url, width, height, resizable, scrollbars, toolbar, status, menubar, copyhistory, location, directories) {
  var attr = "width=" + width + ",height=" + height;
  attr += ",resizable=" + (resizable ? "yes" : "no");
  attr += ",scrollbars=" + (scrollbars ? "yes" : "no");
  attr += ",toolbar=" + (toolbar ? "yes" : "no");
  attr += ",status=" + (status ? "yes" : "no");
  attr += ",menubar=" + (menubar ? "yes" : "no");
  attr += ",copyhistory=" + (copyhistory ? "yes" : "no");
  attr += ",location=" + (location ? "yes" : "no");
  attr += ",directories=" + (directories ? "yes" : "no");
  window.open (url, name, attr)
}

function quickSearchSubmit (e) {
  var key;
  
  if (window.event)
    key = window.event.keyCode;
  else
    key = e.which;
  
  if (key == 13)
    quickSearchValidate ();
}

function quickSearchValidate () {
  var el = document.getElementById ("txtsearch");
  if (validateSearch (el))
    window.location = ABSOLUTE_PATH + "/search.php?q=" + el.value;
}

function updateStatus (el) {
  var msg = "";

  if (el) {
    var regex = new RegExp ("<.*>(.*)</.*>");
    msg = el.innerHTML;
    while ((match = regex.exec (msg)) != null)
      msg = msg.replace (regex, "$1").replace ("&nbsp;", "");
  }
  
  window.status = msg.replace (/^\s*|\s*$/g,"");
}

function unhighlight (id) {
  if (typeof id != "string") {
    id.style.backgroundColor = "";
  }
  else {
    document.getElementById (id).style.backgroundColor = "";
  }
  
}

function showHide (id) {
  var el = document.getElementById (id);
  el.style.display = el.style.display == "block" ? "none" : "block";
}

function validateSearch (el) {
  return el.value != "" && el.value != el.defaultValue;
}

var ie5 = document.all;
var ns6 = document.getElementById && !document.all;
