
function LogItem(pLink,pPage,pDebug) {
	this.time=new Date();
	this.link=pLink;
	this.page=pPage;
	this.debug=pDebug;
}


function Log() {
	this.odd="#dddddd";
	this.even="#ffffff";
	this.items=[];
}

Log.prototype.addItem = function(pLink,pPage,pDebug) {
	this.items[this.items.length]=new LogItem(pLink,pPage,pDebug);
}

Log.prototype.getLog = function(pCont,pUseHTML) {
	if (new String(pUseHTML)=="undefined") {
		pUseHTML=true;	/* default */
	}
	var str='';
	if (pUseHTML) {
		str+='<table border=0 cellspacing=0 cellpadding=2>';
	}
	for (var i=0;i<this.items.length;i++) {
		if (pUseHTML) {
			str+='<tr bgcolor="'+(i%2==0 ? this.odd : this.even)+'">';
		}
		if (pUseHTML) {
			str+='<td>'+this.items[i].time.getDateFormat("hh:mm:ss.ms")+'</td>';
		}else{
			str+=' '+this.items[i].time.getDateFormat("hh:mm:ss.ms");
		}
		if (pUseHTML) {
			str+='<td>'+this.items[i].link+'</td>';
		}else{
			str+=' '+this.items[i].link;
		}
		if (pUseHTML) {
			str+='<td>'+this.items[i].page+'</td>';
		}else{
			str+=' '+this.items[i].page;
		}
		if (pUseHTML) {
			str+='<td>'+this.items[i].debug+'</td>';
		}else{
			str+=' '+this.items[i].debug;
		}
		if (pUseHTML) {
			str+='</tr>';
		}else{
			str+='\n';
		}
	}
	if (pUseHTML) {
		str+='</table>';
	}
	return str;
}

Log.prototype.printLog = function(pCont,pUseHTML) {
	pCont.innerHTML=this.getLog(pCont,pUseHTML);
}

Log.prototype.sortBy = function(pSort) {
	this.items.propSort(pSort,false);
}

