/***********************************************************************************************************
 * com.oclib.javascript.util.log.20070108.Log
 * Location: http://www.oclib.com/library/com/oclib/javascript/util/Log.js
 * Version Location: http://www.oclib.com/library/com/oclib/javascript/util/log/20070108/Loader.js
 * Index Version Location: http://www.oclib.com/library/com/oclib/javascript/util/log/20070108/index.html
 * © Open Class Library (http://www.oclib.com/)
***********************************************************************************************************/
var Log = function (logElementId, logType, logPlace) { 
 this.completionStatus = 0;
 
 this.logType = logType;
 if(!this.logType) {this.logType = this.SYMPLE_TEXT_LOG_TYPE;}; 
 
 this.logPlace = logPlace;
 if(!this.logPlace) {this.logPlace = this.INTRO_ELEMENT_LOG_PLACE;}; 
 
 if(!logElementId || logElementId == "") {return -1;}
 this.logElementId = logElementId;
 this.createLogElement(); 
}
Log.prototype = new Root();

Log.prototype.className = "Log"; 
Log.prototype.classCreated = "20060101"; 
Log.prototype.classCreator = "http://www.oclib.com/"; 
Log.prototype.classLocation = "http://www.oclib.com/library/com/oclib/javascript/util/Log.js"; 
Log.prototype.classIndexLocation = "http://www.oclib.com/library/com/oclib/javascript/util/log/"; 
Log.prototype.classVersion = "20070108"; 
Log.prototype.classVersionLocation = "http://www.oclib.com/library/com/oclib/javascript/util/log/20070108/Log.js"; 
Log.prototype.classVersionIndexLocation = "http://www.oclib.com/library/com/oclib/javascript/util/log/20070108/"; 

Log.prototype.SYMPLE_TEXT_LOG_TYPE = (Log.SYMPLE_TEXT_LOG_TYPE = 100);

Log.prototype.BOTTOM_DOCUMENT_LOG_PLACE = (Log.BOTTOM_DOCUMENT_LOG_PLACE  = 3);
Log.prototype.HIDDEN_LOG_PLACE = (Log.HIDDEN_LOG_PLACE = 0);
Log.prototype.INTRO_ELEMENT_LOG_PLACE = (Log.INTRO_ELEMENT_LOG_PLACE = 1);
Log.prototype.TOP_DOCUMENT_LOG_PLACE = (Log.TOP_DOCUMENT_LOG_PLACE = 2);

Log.prototype.logElemen;
 Log.prototype.getLogElemen = function () {return this.logElemen;};
 Log.prototype.setLogElemen = function (logElemen) {this.logElemen = logElemen; return 1;};
Log.prototype.logElemenId;
 Log.prototype.getLogElemenId = function () {return this.logElemenId;};
 Log.prototype.setLogElemenId = function (logElemenId) {this.logElemenId = logElemenId; return 1;};

Log.prototype.println = function(text) {	
 if(!text) {return -1;};
 if(!this.logElement) {return -1;};
 if(!this.logElement.appendChild) {return -1;}; 
 var textNode = document.createTextNode(text);
 var divElement = document.createElement("div");
 divElement.appendChild(textNode);
 this.logElement.appendChild(divElement); 
 return 1;
}

Log.prototype.createLogElement = function() {
 if (this.logPlace == this.TOP_DOCUMENT_LOG_PLACE) {
  this.completionStatus =  this.createLogElementTop();
 } else if (this.logPlace == this.BOTTOM_DOCUMENT_LOG_PLACE) {
  this.completionStatus = this.createLogElementBottom();
 } else if (this.logPlace == this.INTRO_ELEMENT_LOG_PLACE) {
  this.completionStatus = this.createLogElementIntro();
 } else {
  return -1;
 };  
 this.logElement = document.getElementById(this.logElementId); 
 return 1; 
}

Log.prototype.createLogElementBottom = function() {
 var divElement = document.createElement("div");
 divElement.id = this.logElementID;
 divElement.style.textAlign = "left"
 var bodyElement = document.body;
 if(!bodyElement) {return -1;};
 bodyElement.appendChild(divElement);
 return 1;
}

Log.prototype.createLogElementIntro = function() {return 1;}

Log.prototype.createLogElementTop = function() {
 var divElement = document.createElement("div");
 divElement.id = this.logElementID;
 var bodyElement = document.body;
 if(!bodyElement) {return -1;};
 var bodyFirstChild = bodyElement.firstChild;
 if(!bodyFirstChild) {
  bodyElement.appendChild(divElement);
 } else {
  bodyElement.insertBefore (divElement, bodyFirstChild);
 };
 return 1;
}
