/*
+--------------------------------------------------------
+	Copyright (c) 2004-2007 WeSofts
+	JavaScript Project for wespace
+	http://www.wesofts.com
+--------------------------------------------------------
*/
function ajaxhistory_object(){
	this.recordid = 0;
	this.recordarray = new Array();
	this.ishistory = false;
	this.setter = function(cmd,str){
		this.records = this.recordarray.length;
		this.setmpi = 0;
		this.setmparray = new Array();
		if (this.records > 0) {
			for (var i = 0; i < this.records; i++){
				this.setmparray[i] = [this.recordarray[i][0],this.recordarray[i][1]];
				this.setmpi++;
				if (this.setmpi > this.recordid){
					break;
				}
			}			
		}
		this.recordid = this.setmpi;
		this.setmparray[this.setmpi] = [cmd,str];
		this.recordarray = this.setmparray;
		this.setmparray = null;
	}
	this.backer = function(){
		this.records = this.recordarray.length;
		if (this.records > 1 && this.recordid > 0){
			this.ishistory = true;
			this.recordid--;
			this.evaler();
		}
	}
	this.leader = function(){
		this.records = this.recordarray.length;
		this.loadmaxi = this.records - 1;
		if (this.records > 1 && this.recordid < this.loadmaxi){
			this.ishistory = true;
			this.recordid++;
			this.evaler();
		}
	}
	this.loader = function(){
		this.records = this.recordarray.length;
		this.loadmaxi = this.records - 1;
		if (this.recordid >= 0 && this.recordid <= this.loadmaxi) {
			this.ishistory = true;
			this.evaler();
		}
	}
	this.evaler = function(){
		this.records = this.recordarray.length;
		for (var i = 0; i < this.records; i++){
			if (i == this.recordid) {
				this.tmp  = this.recordarray[i][0] + '("';
				this.tmp += this.recordarray[i][1].replace(/,/g,'","');
				this.tmp += '")';
				eval(this.tmp);
				this.ishistory = false;
			}
			if (i > this.recordid) {
				break;
			}
		}
	}
	this.show = function(id){
		if ($(id)){
			this.tmp = '';
			this.comma = '';
			this.records = this.recordarray.length;
			for (var i = 0; i < this.records; i++){
				i == this.recordid ? 
				this.tmp += this.comma + '<b>' + i + '</b> : [' + this.recordarray[i][0] + '] -> [' + this.recordarray[i][1] + ']' :
				this.tmp += this.comma + '[' + i + '] : [' + this.recordarray[i][0] + '] -> [' + this.recordarray[i][1] + ']';
				this.comma = '<br />';
			}
			$(id).innerHTML = this.tmp;
		}
	}
}
browser = new ajaxhistory_object();
