function editLine(id, type) {
   document.getElementById("edit" + type + id).style.display = "none";
   document.getElementById("submit" + type + id).style.display = "inline";
   document.getElementById(type + id).style.display = "none";
   document.getElementById("editable" + type + id).style.display = "inline";
 
}

function updateLine(id, type) {
   document.getElementById("submit" + type + id).style.display = "none";
   document.getElementById("edit" + type + id).style.display = "inline";
   document.getElementById("editable" + type + id).style.display = "none";
   var value = document.getElementById("input" + type + id).value;
   document.getElementById(type + id).innerHTML = value;
   document.getElementById(type + id).style.display = "inline";
   
   var url = "editLine.php?id=" + id + "&type=" + type + "&value=" +  value;
   var xmlHttp = new XMLHttpRequest();
   xmlHttp.onreadystatechange = function() {
     if(xmlHttp.readyState == 4) {
        document.getElementById("error").innerHTML = xmlHttp.responseText;
     }
  }
   xmlHttp.open("GET", url, true);
   xmlHttp.send(null);
}

function toggle(id) {
       var tr_obj = document.getElementById(id); 
       var caret  = document.getElementById(id + "html");

    if (tr_obj.style.display == "none") {
	   tr_obj.style.display = "inline";
	   caret.innerHTML          = "[-]";
    } else {
	   tr_obj.style.display = "none";
	   caret.innerHTML            = "[+]"; 
    }
}
   
function collapse() {
      var ids = Array("annotation", "members", "domains", "related", "targets");
      for(i = 0; i < ids.length; i++) {
         document.getElementById(ids[i]).style.display = "none";
         document.getElementById(ids[i] + "html").innerHTML = "[+]";
      }
}
   
function expand() {
      var ids = Array("annotation", "members", "domains", "related", "targets");
      for(i = 0; i < ids.length; i++) {
         document.getElementById(ids[i]).style.display = "inline";
         document.getElementById(ids[i] + "html").innerHTML = "[-]";
      }
}

function popup(url, width, height) {
		newpopup = window.open(url, 'alignment', 'width=' + width + ',height=' + height + ',scrollbars=yes,resizable=yes');
		if(window.focus) {
			newpopup.focus();
		}
		return false;
}   
