function show_image(url, width, height)
{
  var window_offsetX = 0, window_offsetY = 0, tmp;
  if (window.screen.availWidth > width)
  {
    tmp = (window.screen.availWidth - width)/2;
    if (tmp >= 0) window_offsetX = tmp;
  }
  if (window.screen.availHeight > height)
  {
    tmp = (window.screen.availHeight - height)/2;
    if (tmp >= 0) window_offsetY = tmp;
  }
  var picwindow = window.open("", "", "width="+width+",height="+height+",left="+window_offsetX+",top="+window_offsetY+",scrollbars=yes,resizable=no,dependent=no");
  picwindow.document.write("<html><head><title>"+url+"</title></head><body style=\"margin: 0px; overflow: auto;\">");
  picwindow.document.write("<img src=\""+url+"\" /></body></html>");
  picwindow.document.close();
}





function control_maxlength(obj, maxlength)
{
  if (obj.value.length >= maxlength) obj.value = obj.value.substring(0, maxlength-1);
}





function hide_menuitem(id)
{
  document.getElementById(id).style.visibility  = "hidden";
  document.getElementById(id).style.height      = "0px";
  //document.getElementById(id).height            = "0px";
}

function show_menuitem(id)
{
  document.getElementById(id).style.visibility  = "visible";
  document.getElementById(id).style.height      = "auto";
  //document.getElementById(id).height            = "auto";
}

function trigger_menuitem(id, idlist)
{
  var i         = 0;
  var t         = idlist.length;
  var item      = null;
  var item_name = "menublock_";
  var tmp_name  = null;
  var item      = null;

  while (i < t)
  {
    tmp_name = item_name+idlist[i];
    item     = document.getElementById(id);

    if (id == tmp_name)
    {
      if (item.style.visibility == "hidden")
        show_menuitem(id);
      /*
      else if (item.style.visibility == "visible")
        hide_menuitem(id);
      */
    }
    else
    {
      hide_menuitem(tmp_name);
    }

    i++;
  }
}





var timer;

function cc_run(id, list)
{
  var max    = list.length;
  var index  = Math.round(Math.random()*(max-2));
  index++;
  id.src     = list[0]+'/'+list[index];
  timer      = setTimeout(function() {cc_run(id, list)}, 2000);
}

