function bugs() {  }
bugs.prototype=new penumbra();
bugCatcher=new bugs();

bugs.prototype.completeBug=function(bugID) {
	o={requestType:'completeBug', targetBug:bugID}
	this.irequest(o,'bugCatcher', 'refreshBugs');
}
bugs.prototype.submit=function() {
	o={requestType:'submitBug'}
	o.bugText=$("_bugText").value
	o.bugPriority=$("_bugPriority").value
	o.bugType = ($("_bugType_bug").checked==true) ? "b" : "i";
	this.irequest(o,'bugCatcher', 'submitReturn')
	this.submitWait()
}

bugs.prototype.submitWait=function() {
	if ($("bugConfirm")) {
	 $("bugForm").removeChild($("bugConfirm"))
	}
	this.bugEntryFormHTML=$("bugEntry").innerHTML
	$("bugEntry").innerHTML=translations['saving'];
}

bugs.prototype.restoreBugs=function(myStatus) {
 $("bugEntry").innerHTML=this.bugEntryFormHTML
 $('bugForm').style.height="210px";
 var notification=document.createElement("div")
 notification.setAttribute("class", "box")
 notification.setAttribute("id", "bugConfirm")

 var messageText= (myStatus==100) ? document.createTextNode("Item Saved!") : document.createTextNode("Did not save.");

 notification.appendChild(messageText)
 $("bugForm").insertBefore(notification, $("bugEntry"))
}

bugs.prototype.submitReturn=function(obj) {
 bugCatcher.restoreBugs(obj.responseText)
 bugCatcher.refreshBugs()
}

bugs.prototype.refreshBugs=function() {
	o={requestType:'refreshBugs'};
	bugCatcher.irequest(o,'bugCatcher', 'refreshReturn')
	bugCatcher.refreshWait();
}
bugs.prototype.refreshWait=function() {
 $('_flypaperBuglist').innerHTML="Reloading..."
}

bugs.prototype.refreshReturn=function(obj) {
 $('_flypaperBuglist').innerHTML=obj.responseText
}

bugs.prototype.display=function() {
 var s = $('bugForm').style;
 if(s.display=='block') {
  s.display = "none";
  s.height="10px";
 } else {
  s.display = 'block';
  s.height="170px";
 }
}