var hash = {list:'',id:''};

function sethash(list, id)
{
  //alert("sethash('" +list+ "','" +id+ "');");
  var href_array = window.location.href.split("#");
//   if (empty(list)) list = hash.list;
//   if (empty(id)) id = hash.id;

  window.location.href = href_array[0] + "#" + "list=" +list+ "-" + "id=" +id;
}

function checkhash()
{
  var href_array = window.location.href.split("#");
  if (!empty(href_array[1]))
  {
    var hash_ar = href_array[1].split('-');
    if (hash_ar.length == 2)
    {
      var list = hash_ar[0].split('=');
      var list_val = '';
      if (!empty(list[1])) list_val = list[1];

      var id = hash_ar[1].split('=');
      var id_val = '';
      if (!empty(id[1])) id_val = id[1];

      if (!empty(list_val) && list_val != hash.list)
      {
        hash.list = list_val;
        xajax_getdata(hash.list,'left','');
      }
      
      if (!empty(id_val) && id_val != hash.id)
      {
        hash.id = id_val;
        xajax_getdata(hash.list,'right',hash.id);
        //alert("called getdata('"+hash.list+"','right','"+hash.id+"');");
      }
      
    }
  }
  hilighter();
  setTimeout("checkhash()",250);
}

function empty(item)
{
  if (item === undefined) return true;
  if (item.length == 0) return true;
  else return false;
}

function hilighter()
{
  document.getElementById("menu_projects").classname = 'menuitem';
  document.getElementById("menu_events").classname = 'menuitem';
  document.getElementById("menu_artists").classname = 'menuitem';

  if (!empty(hash.list))
  {
    var selected = "menu_"+hash.list;
    document.getElementById(selected).classname = 'menuitemselected';
  }
}

function loading()
{
  document.getElementById('loading').className = 'loadshow';
}
