/**
 * @author Kalapuc Roman (rkalapuc@gmail.com)
 * @copyright Finport Technologies Inc
 * @since 2006
 * @version 1.0
 */
function wlpProperty(_name,_value){
	this.name = _name;
	this.value = _value;
}

wlpProperty.prototype.parse = function(/* String */str){
	var tmpArr = str.split("=");
	
	if (tmpArr.length==2){
		this.name = String.trim(tmpArr[0]);
		this.value = String.trim(tmpArr[1]);
	}
}

wlpProperty.prototype.toString = function(){
	return this.name+"="+this.value;
}

wlpProperty.prototype.toStringWithWrapper = function(/**/ wrapperStr){
	return wrapperStr+"["+this.name+"]="+this.value;
}

function wlpIterator(arr){this.obj=arr;this.position=0;this.hasNext=(this.position<this.obj.length);this.current=this.obj[this.position];}wlpIterator.prototype.moveNext=function(){if(++this.position<this.obj.length){this.hasNext=true;}else{this.hasNext=false;}if(!this.hasNext){return false;}this.current=this.obj[this.position];return true;};wlpIterator.prototype.reset=function(){this.position=0;this.atEnd=false;this.current=this.obj[this.position];}

/**
 * @author Kalapuc Roman (rkalapuc@gmail.com)
 * @copyright Finport Technologies Inc
 * @since 2006
 * @version 1.0
 */

function wlpPropertyList(arr){
	this.items = [];
	if (arr) this.items = this.items.concat(arr);
	this.count = this.items.length;
}

wlpPropertyList.prototype.add = function(property){
	this.items.push(property);
	this.count = this.items.length;
};

wlpPropertyList.prototype.clear = function(){
	this.items.splice(0, this.items.length);
	this.count = 0;
};

wlpPropertyList.prototype.clone = function(){
	return new wlpPropertyList(this.items);
};

wlpPropertyList.prototype.containsProperty = function(_property){
	for (var i = 0; i < this.items.length; i++){
		if (this.items[i].name == _property.name) {
			return true;
		}
	}
	return false;
};

wlpPropertyList.prototype.containsName = function(_name){
	for (var i = 0; i < this.items.length; i++){
		if ((this.items[i].name!=null)&&(this.items[i].name == _name)) {
			return true;
		}
	}
	return false;
};

wlpPropertyList.prototype.getIterator = function(){
	return new wlpIterator(this.items);
};

wlpPropertyList.prototype.get = function(_name){

	for (i=0;i<this.items.length;i++){
		//alert(this.items[i].name);
		if (this.items[i]){
			if(this.items[i].name == _name) {
				return this.items[i].value;
			}
		}
	}

	return false;
};

wlpPropertyList.prototype.property = function(k){
	return this.items[k];
};

wlpPropertyList.prototype.indexOfProperty = function(_property){
	for (var i = 0; i < this.items.length; i++){
		if (this.items[i].name == _property.name) {
			return i;
		}
	}
	return -1;
};

wlpPropertyList.prototype.indexOfName = function(_name){
	for (var i = 0; i < this.items.length; i++){
		if (this.items[i].name == _name) {
			return i;
		}
	}
	return -1;
};

wlpPropertyList.prototype.removeProperty = function(_property){
	var i = this.indexOfProperty(_property);
	if (i >=0) {
		this.items.splice(i,1);
	}
	this.count = this.items.length;
};

wlpPropertyList.prototype.removeName = function(_name){
	var i = this.indexOfName(_name);
	if (i >=0) {
		this.items.splice(i,1);
	}
	this.count = this.items.length;
};


wlpPropertyList.prototype.toArray = function(){
	return [].concat(this.items);
}

wlpPropertyList.prototype.toAssocArray = function(){
	var arr = new Array();

	for (i=0;i<this.items.count;i++){
		arr[this.items[i].name] = this.items[i].value;
	}

	return arr;
}

/**
 * @author Kalapuc Roman (rkalapuc@gmail.com)
 * @copyright Finport Technologies Inc
 * @since 2006
 * @version 1.0
 */

function wlpArrayList(arr){	
	this.items = [];		
	if (arr) this.items = this.items.concat(arr);
	this.count = this.items.length;		
}

wlpArrayList.prototype.add = function(obj){
	this.items.push(obj);
	this.count = this.items.length;
};

wlpArrayList.prototype.addRange = function(a){
	if (a.getIterator) {
		var e = a.getIterator();
		while (!e.atEnd) {
			this.add(e.current);
			e.moveNext();
		}
		this.count = this.items.length;
	} else {
		for (var i=0; i<a.length; i++){
			this.items.push(a[i]);
		}
		this.count = this.items.length;
	}
};
	
wlpArrayList.prototype.clear = function(){
	this.items.splice(0, this.items.length);
	this.count = 0;
};
	
wlpArrayList.prototype.clone = function(){
	return new wlpArrayList(this.items);
};

wlpArrayList.prototype.contains = function(obj){
	for (var i = 0; i < this.items.length; i++){
		if (this.items[i] == obj) {
			return true;
		}
	}
	return false;
};

wlpArrayList.prototype.getIterator = function(){
	return new wlpIterator(this.items);
};

wlpArrayList.prototype.indexOf = function(obj){
	for (var i = 0; i < this.items.length; i++){
		if (this.items[i] == obj) {
			return i;
		}
	}
	return -1;
};

wlpArrayList.prototype.insert = function(i, obj){
	this.items.splice(i,0,obj);
	this.count = this.items.length;
};

wlpArrayList.prototype.item = function(k){
	return this.items[k];
};

wlpArrayList.prototype.remove = function(obj){
	var i = this.indexOf(obj);
	if (i >=0) {
		this.items.splice(i,1);
	}
	this.count = this.items.length;
};

wlpArrayList.prototype.removeAt = function(i){
	this.items.splice(i,1);
	this.count = this.items.length;
};

wlpArrayList.prototype.reverse = function(){
	this.items.reverse();
};

wlpArrayList.prototype.sort = function(fn){
	if (fn){
		this.items.sort(fn);
	} else {
		this.items.sort();
	}
};

wlpArrayList.prototype.setByIndex = function(i, obj){
	this.items[i]=obj;
	this.count=this.items.length;
};

wlpArrayList.prototype.toArray = function(){
	return [].concat(this.items);
}

wlpArrayList.prototype.toString = function(){
	return this.items.join(",");
};

function wlpArrayList(arr){this.items=[];if(arr)this.items=this.items.concat(arr);this.count=this.items.length;}wlpArrayList.prototype.add=function(obj){this.items.push(obj);this.count=this.items.length;};wlpArrayList.prototype.addRange=function(a){if(a.getIterator){var e=a.getIterator();while(!e.atEnd){this.add(e.current);e.moveNext();}this.count=this.items.length;}else{for(var i=0;i<a.length;i++){this.items.push(a[i]);}this.count=this.items.length;}};wlpArrayList.prototype.clear=function(){this.items.splice(0,this.items.length);this.count=0;};wlpArrayList.prototype.clone=function(){return new wlpArrayList(this.items);};wlpArrayList.prototype.contains=function(obj){for(var i=0;i<this.items.length;i++){if(this.items[i]==obj){return true;}}return false;};wlpArrayList.prototype.getIterator=function(){return new wlpIterator(this.items);};wlpArrayList.prototype.indexOf=function(obj){for(var i=0;i<this.items.length;i++){if(this.items[i]==obj){return i;}}return -1;};wlpArrayList.prototype.insert=function(i,obj){this.items.splice(i,0,obj);this.count=this.items.length;};wlpArrayList.prototype.item=function(k){return this.items[k];};wlpArrayList.prototype.remove=function(obj){var i=this.indexOf(obj);if(i>=0){this.items.splice(i,1);}this.count=this.items.length;};wlpArrayList.prototype.removeAt=function(i){this.items.splice(i,1);this.count=this.items.length;};wlpArrayList.prototype.reverse=function(){this.items.reverse();};wlpArrayList.prototype.sort=function(fn){if(fn){this.items.sort(fn);}else{this.items.sort();}};wlpArrayList.prototype.setByIndex=function(i,obj){this.items[i]=obj;this.count=this.items.length;};wlpArrayList.prototype.toArray=function(){return[].concat(this.items);};wlpArrayList.prototype.toString=function(){return this.items.join(",");};

/**
 * @author Kalapuc Roman (rkalapuc@gmail.com)
 * @copyright Finport Technologies Inc
 * @since 2006
 * @version 1.0
 */

function wlpIterator(arr){
	this.obj = arr;	
	this.position = 0;
	this.hasNext = (this.position<this.obj.length);	
	this.current = this.obj[this.position];
}

wlpIterator.prototype.moveNext = function(){
	
	if(++this.position<this.obj.length){
		this.hasNext = true;
	} else {
		this.hasNext = false;
	}
	
	if(!this.hasNext){
		return false;
	}
	
	this.current=this.obj[this.position];
	return true;
}

wlpIterator.prototype.reset = function(){
	this.position = 0;
	this.atEnd = false;
	this.current = this.obj[this.position];
}

function wlpPropertyList(arr){this.items=[];if(arr)this.items=this.items.concat(arr);this.count=this.items.length;}wlpPropertyList.prototype.add=function(property){this.items.push(property);this.count=this.items.length;};wlpPropertyList.prototype.clear=function(){this.items.splice(0,this.items.length);this.count=0;};wlpPropertyList.prototype.clone=function(){return new wlpPropertyList(this.items);};wlpPropertyList.prototype.containsProperty=function(_property){for(var i=0;i<this.items.length;i++){if(this.items[i].name==_property.name){return true;}}return false;};wlpPropertyList.prototype.containsName=function(_name){for(var i=0;i<this.items.length;i++){if(this.items[i].name==_name){return true;}}return false;};wlpPropertyList.prototype.getIterator=function(){return new wlpIterator(this.items);};wlpPropertyList.prototype.get=function(_name){for(i=0;i<this.items.length;i++){if(this.items[i].name==_name){return this.items[i].value;}}return false;};wlpPropertyList.prototype.property=function(k){return this.items[k];};wlpPropertyList.prototype.indexOfProperty=function(_property){for(var i=0;i<this.items.length;i++){if(this.items[i].name==_property.name){return i;}}return -1;};wlpPropertyList.prototype.indexOfName=function(_name){for(var i=0;i<this.items.length;i++){if(this.items[i].name==_name){return i;}}return -1;};wlpPropertyList.prototype.removeProperty=function(_property){var i=this.indexOfProperty(_property);if(i>=0){this.items.splice(i,1);}this.count=this.items.length;};wlpPropertyList.prototype.removeName=function(_name){var i=this.indexOfName(_name);if(i>=0){this.items.splice(i,1);}this.count=this.items.length;};wlpPropertyList.prototype.toArray=function(){return[].concat(this.items);};wlpPropertyList.prototype.toAssocArray=function(){var arr=new Array();for(i=0;i<this.items.count;i++){arr[this.items[i].name]=this.items[i].value;}return arr;}

