function firstState(cat)
{
  if(cat == "categories") {
    javascript:document.getElementById(cat).style.display='none';
  }
  javascript:document.getElementById(cat+'Td').style.backgroundColor='#ea9a00';
}

function newState(cat) {
  if(cat == "categories") {
    javascript:document.getElementById(cat).style.display='block';
  }
  javascript:document.getElementById(cat+'Td').style.backgroundColor='#D20000';
}

function firstStateLi(cat) {
  javascript:document.getElementById(cat).innerHTML='&bull;';
}

function newStateLi(cat) {
  javascript:document.getElementById(cat).innerHTML='&raquo;';
}

function saveToSession(field, value)
{
  ajaxnopage("nocallback.php?field=" + field + "&value=" + value)
}

function hideLogRow(id) {
  document.getElementById('row'+id).style.display = 'none';
  ajaxnopage("nocallback.php?hideLogRow&id=" + id)
}

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
var timestring

function ajaxnopage(url) {
timestring = Math.floor(Math.random()*1000000)
  var page_request = false;
  if(window.XMLHttpRequest) { // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
  } else if(window.ActiveXObject) { // if IE
    try {
      page_request = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e) {
      try {
        page_request = new ActiveXObject("Microsoft.XMLHTTP")
      }
      catch (e) {}
    }
  } else {
    return false
  }
  if(bustcachevar) { //if bust caching of external page
    bustcacheparameter=(url.indexOf("?")!=-1)? "&bc="+timestring : "?bc="+timestring
  }

  page_request.open('GET', url+bustcacheparameter, true)
  page_request.send(null)
}
