var menu, menuStyle;
function mainMenu()
 {
 document.getElementById("searchInput").value="Search...";
 document.getElementById("addMenu").innerHTML=menu;
 document.getElementById("addMenu").style.padding="0px";
 document.getElementById("addMenu").style.width="165px";
 document.getElementById("addMenu").style.height="378px";
 }

function changeAddMenu()
 {
 if(!menu){ menu=document.getElementById("addMenu").innerHTML; }
 document.getElementById("addMenu").innerHTML='<a href="main menu" onclick="mainMenu();return false" id="back">&lt;&lt;&nbsp;&nbsp;Back&nbsp;&nbsp;&lt;&lt;</a><div id="addMenuChild"><img src="img/waiting.gif" alt="Loading..." /></div>';
 document.getElementById("addMenu").style.padding="3px 1px 5px 3px";
 document.getElementById("addMenu").style.width="161px";
 document.getElementById("addMenu").style.height="370px";
 }

function startSearch(sInput)
 {
 if(sInput.value=="Search...")
  {
  sInput.value="";
  }
 }

function search(q)
 {
 if(q=="")
  {
  stopSearch(document.getElementById("searchInput"));
  document.getElementById("searchInput").value="";
  return;
  }
 changeAddMenu();
 xmlHttp=GetXmlHttpObject();
 var url="ajax/s.php?q="+q;
 xmlHttp.onreadystatechange=getSongs;
 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
 }

function stopSearch(sInput)
 {
 if(sInput.value=="")
  {
  sInput.value="Search...";
  mainMenu();
  }
 }

function allSongs()
 {
 changeAddMenu();
 xmlHttp=GetXmlHttpObject();
 var url="ajax/getAllSongs.php";
 xmlHttp.onreadystatechange=getSongs;
 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
 }

function artists()
 {
 changeAddMenu();
 xmlHttp=GetXmlHttpObject();
 var url="ajax/getArtists.php";
 xmlHttp.onreadystatechange=getSongs;
 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
 }

function getSongs()
 {
 if(xmlHttp.readyState==4)
  {
  document.getElementById("addMenuChild").innerHTML=xmlHttp.responseText;
  }
 }