function checkUncheckAll(node,nodeid)
{
        var boxes = document.getElementsByTagName("input");
        for(i=0; i<boxes.length;i++)
        if(boxes[i].id==nodeid)
                boxes[i].checked=node.checked;
}
function popup(mylink, windowname)
//, width, height)
{
SW=window.open(mylink,windowname,'toolbar=no,menubar=no,location=no,resizable=no,status=no,scrollbars=no');
}

function OnAddFunction(id,type,query,insid)
{

    var nextReadPos = 0;
   	var iframe = document.createElement("iframe");
        req ="admin/AddtoUser.php?ID="+id+"&TYPE=\""+type+"\"&TERM="+query+"&insid="+insid;
   	iframe.src = req;
  	//alert(req);
	// Make the iframe invisible.
   	iframe.style.display = "none";
 
   	// Add the iframe to the DOM.  The process
   	//  will begin execution at this point.
   	document.body.appendChild(iframe);
        document.getElementById(id).firstChild.data ='Added';
}

function OnRemoveFunction(id,type,query)
{

        var nextReadPos = 0;
   	var iframe = document.createElement("iframe");
        req ="admin/RemovefromUser.php?ID="+id+"&TYPE=\""+type+"\"&TERM="+query;
   	iframe.src = req;
    	//alert(req);
	// Make the iframe invisible.
   	iframe.style.display = "none";
 
   	// Add the iframe to the DOM.  The process
   	//  will begin execution at this point.
   	document.body.appendChild(iframe);
        document.getElementById(id).firstChild.data ='Removed';
}


function OnAddFunction0(id,type,query)
{
  try
    {
 // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
  url="admin/AddtoUser.php?ID="+id+"&TYPE=\""+type+"\"&TERM="+query;
  xmlHttp.open("GET",url,true);
  xmlHttp.onreadystatechange=function()
  {
  if(xmlHttp.readyState==4)
    {
//alert(type);
      if(type=="Movies")
      {
      //alert("adding movie to user");
      document.getElementById(id).firstChild.data ='Added';
      }
     if(type=="Audios")
      {
      //alert("adding movie to audio");
      document.getElementById(id).firstChild.data ='Added';
      }
     if(type=="Videos")
      {
      //alert("adding movie to video");
      document.getElementById(id).firstChild.data ='Added';
      }
      if(type=="Actor")
      {
      //alert("adding movie to stars");
      document.getElementById(id).firstChild.data ='Added';
      }
      if(type=="Image")
      {
      //alert("adding movie to images");
      //alert(url);
      document.getElementById(id).firstChild.data ='Added';
      }
    }
  }
xmlHttp.send(null);
}