var abuse = new Array (
	"I don't think so.",
  "Best ease up on the red cordial.",	
	"WTF?",
	"You've got to be kidding!",
	"Not like that!",
	"Not on your nelly!",
	"Yeah, like that's gonna work!",
	"Tell me you didn't mean to do that.",
	"You may want to rethink that edit.",
	"Maybe on another planet!",
	"Oh please!"
)											 	

function getAbuse() {
	return abuse[Math.floor(Math.random() * abuse.length)];
}


Logger = {
	buffer : '',
	debug: 
	  function(s) {
	    this.buffer += s + "<br/>";
	  }, 
	reset: 
	  function() {
	    this.buffer = '';
  	},
	flush: 
	  function() {
    	return this.buffer;
  	}
}

function execute() {

  Logger.reset();
	try {
	    result = eval(document.getElementById('src').value);
		if (result) {
		    output(Logger.flush() +  "<pre>" + result + "</pre>");
	    }
		else {
		    output("WTF? " + Logger.flush());
		}
	}
	catch (e) {
		msg = getAbuse()
		output("<span class='error'>" + msg + "</span><br/><br/>" + e + "</span>");
	}
}


function copydiv(from, to) {
   var html = document.getElementById(from).innerHtml;
   if (document.getElementById || document.all) {
      var t = document.getElementById ? document.getElementById(to): document.all[to];
      var f = document.getElementById ? document.getElementById(from): document.all[from];
      if (t && typeof t.innerHTML != "undefined") t.innerHTML = f.innerHTML;
   }
}


function output(s) {
	document.getElementById('output').innerHTML = s;
}
