var xmlHttp = null;

function id(v) 
{
	return document.getElementById(v);
}
function toggle (v)
{
   id(v).style.display = id(v).style.display=="block" ? "none" : "block";
}
function show(v)
{
	id(v).style.display="block";
}
function hide(v)
{
        id(v).style.display="none";
}
function ajaxFunction(el,query)
  {
	// handle empty input (thx to martin)
	if (query=='/ajax.php?search=') {
		id(el).style.display="none";
		return;
	}

  //# show the bouncing ball
  id(el).style.display="block";
  id(el).innerHTML="<img src=\"theme/images/ajax-loader.gif\" alt=\"\" />";
  try
    {
      // Firefox, Opera 8.0+, Safari
		if (!xmlHttp) {
			xmlHttp=new XMLHttpRequest();
		}
		else {
			xmlHttp.abort();
			xmlHttp=new XMLHttpRequest();
		}
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      	if (!xmlHttp) {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			else {
				xmlHttp.abort();
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
         id(el).innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",query,true);
    xmlHttp.send(null);
  }
