/* Ajax javascript */
function CreateRequest(){
  if(window.XMLHttpRequest){
	xmlHttp = new XMLHttpRequest();
  }else if(window.ActiveXObject){
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
}

function AjaxAction(url){
  CreateRequest();
  xmlHttp.open("GET",url,true);
  xmlHttp.onreadystatechange = Callback;
  xmlHttp.send(null);
}

function Callback(){
  if(xmlHttp.readyState == 4){
    if(xmlHttp.status == 200 || xmlHttp.status == 304){
	  var arTemp;
	  arTemp = xmlHttp.responseText.split("#");
	  if(arTemp.length > 1){
	      temp = arTemp[2]+"_level3";
	      objForm = document.getElementById(temp);
          if(objForm.disabled){
	         objForm.disabled = false;
	      }
	      objForm.innerHTML = arTemp[1];
	  }else{
	     if(xmlHttp.responseText){
	     }
	  }
	}
  }
}

function SwapImage(item){
    img = document.getElementById('dropimg');
    pic = img.src;
    if(pic.match("plus")){
        img.src = pic.replace(/plus/,"minus");
        url = "ajax.php?parent="+item;
        AjaxAction(url);
    }else{
        img.src = "images/stories/plus.gif";
        objForm = document.getElementById(item+'_level3');
        objForm.innerHTML = "";
    }
}
