function errorEntry(msg,field){
	
	this.msg=msg;
	this.field=field;

}

function errorLog(){
	
	this.length=0;
	this.entries=new Array();;
	this.addEntry = _addEntry;
	this.clearLog=_clearLog;
	this.outputLog=_outputLog;
	this.alertLog=_alertLog;
}


function _addEntry(msg,field) {
	this.entries[this.entries.length] = new errorEntry(msg,field);
}

function _clearLog(){
	this.entries.length=0;
}

function _alertLog(){

	if (this.entries.length>0){
		alert(this.entries[0].msg);
		this.entries[0].field.select();
		this.entries[0].field.focus();
		return false;
	}else{
		return true;
	}
}

function _outputLog(){
	//destinationTextarea.value="";
	for(var i = 0; i < this.entries.length; i++){	
		document.getElementById("errors").innerHTML=document.getElementById("errors").innerHTML+"* "+this.entries[i].msg+"\n"
	
	}
}





