function wlpURLParamSet(_id,_wrapperStr,_params){this.wrapperStr=_wrapperStr;this.id=_id;this.params=new wlpArrayList(_params);}wlpURLParamSet.prototype.setId=function(_id){this.id=_id;};wlpURLParamSet.prototype.toString=function(){var strParams="";var listIterator=this.params.getIterator();var wrapStr=this.wrapperStr;if(this.id!=''){wrapStr+='['+this.id+']';}var isFirst=true;while(listIterator.hasNext){if(!isFirst&&listIterator.current.value.length!=0)strParams+="&";if(listIterator.current.value.length!=0){if(this.wrapperStr!="")strParams+=listIterator.current.toStringWithWrapper(wrapStr);else strParams+=listIterator.current.toString();}listIterator.moveNext();isFirst=false;}if(strParams=="")return null;return strParams;};wlpURLParamSet.prototype.replace=function(param){this.params.clear();this.params.add(param);};wlpURLParamSet.prototype.set=function(name,value){var listIterator=this.params.getIterator();while(listIterator.hasNext){if(listIterator.current.name==name){listIterator.current.value=value;return true;}listIterator.moveNext();}return false;};wlpURLParamSet.prototype.add=function(param){this.params.add(param);};wlpURLParamSet.prototype.get=function(name){var listIterator=this.params.getIterator();while(listIterator.hasNext){if(listIterator.current.name==name){return listIterator.current.value;}listIterator.moveNext();}return false;}

function wlpURL(_host,_lang,_link,_params){this.host=_host;this.lang=_lang;this.link=_link;this.defaultParam='&s=ajax&';this.params=new wlpArrayList(_params);}wlpURL.prototype.toString=function(){var resStr=this.host+this.lang+"/"+this.link;var listIterator=this.params.getIterator();var strParams="";while(listIterator.hasNext){strParams+=listIterator.current.toString();listIterator.moveNext();if(listIterator.hasNext)strParams+="&";}if(strParams!=""){resStr+="?"+this.defaultParam+strParams;}return resStr;};wlpURL.prototype.addParam=function(param){this.params.add(param);}

/**
 * @author Kalapuc Roman (rkalapuc@gmail.com)
 * @copyright Finport Technologies Inc
 * @since 2006
 * @version 1.0
 */

function wlpURL(_host,_lang,_link,_params){
	this.host = _host;
	this.lang = _lang;
	this.link = _link;
	this.defaultParam = '&s=ajax&';	//added by Izzet Mustafayev <webdizz@gmail.com>
									//to support ajax request 
									//and invoke only one method per page not all
	this.params = new wlpArrayList(_params);
}

wlpURL.prototype.toString = function(){
	var resStr = this.host+this.lang+"/"+this.link;
	var listIterator = this.params.getIterator();
	
	var strParams="";
	
	while (listIterator.hasNext){
		strParams+=listIterator.current.toString();
		listIterator.moveNext();
		if (listIterator.hasNext) strParams+="&";
	}
	
	if (strParams!=""){
		resStr+="?"+this.defaultParam+strParams;
	}
	return resStr;
}

wlpURL.prototype.addParam = function(param){
	this.params.add(param);
}

/**
 * @author Kalapuc Roman (rkalapuc@gmail.com)
 * @copyright Finport Technologies Inc
 * @since 2006
 * @version 1.0
 */

function wlpURLParamSet(/*String*/ _id,/*String*/ _wrapperStr,/*array*/_params){
	this.wrapperStr = _wrapperStr;
	this.id = _id;
	this.params = new wlpArrayList(_params);
}

wlpURLParamSet.prototype.setId = function (/*String*/ _id){
	this.id = _id;
}

wlpURLParamSet.prototype.toString = function(){
	var strParams="";
	var listIterator = this.params.getIterator();
	
	var wrapStr = this.wrapperStr;	
	
	if (this.id!=''){
		wrapStr+='['+this.id+']';
	}
	
	var isFirst = true;
	while (listIterator.hasNext){
		if (!isFirst && listIterator.current.value.length!=0) strParams+="&";

		if (listIterator.current.value.length!=0) {
			
			if (this.wrapperStr!="") strParams+=listIterator.current.toStringWithWrapper(wrapStr);
				else strParams+=listIterator.current.toString();
		}
		listIterator.moveNext();		
		isFirst = false;
	}

	if (strParams=="") return null;
	
	return strParams;
}

wlpURLParamSet.prototype.replace = function(/*wlpProperty*/ param){
	this.params.clear();
	this.params.add(param);
}

wlpURLParamSet.prototype.set = function(/*String*/ name,/*String*/ value){
	
	var listIterator = this.params.getIterator();
	while (listIterator.hasNext){
		if (listIterator.current.name == name){
			listIterator.current.value = value;
			return true;
		}
		listIterator.moveNext();
	}
	
	return false;
}

wlpURLParamSet.prototype.add = function(/*wlpProperty*/ param){
	this.params.add(param);
}

wlpURLParamSet.prototype.get = function(/*String*/ name){
	
	var listIterator = this.params.getIterator();
	while (listIterator.hasNext){
		if (listIterator.current.name == name){
			return listIterator.current.value;
		}
		listIterator.moveNext();
	}		
	
	return false;
}

/**
 * @author Kalapuc Roman (rkalapuc@gmail.com)
 * @copyright Finport Technologies Inc
 * @since 2006
 * @version 1.0
 */

function wlpAjax()
{		
	this.sURL = '';
}

wlpAjax.prototype.setURL = function(_url){
	this.sURL = _url;
}

wlpAjax.prototype._request = undefined;

wlpAjax.prototype.get = function()
{
	this._request = this._getXMLHTTPRequest();		
	var _this = this;
	
	this._request.onreadystatechange = function(){_this._process()};
	this._request.open("GET",this._getURL(), true);
	this._request.send(null);
}


wlpAjax.prototype._getURL = function()
{	
	return this.sURL;
}

wlpAjax.prototype._process = function()
{
	
	if(this._request.readyState == 4)
	{
		
		if(this._request.status == "200")
		{			
			if(this.onLoad != undefined)
			{				
				this.onLoad(this._request.responseText);
			}
		}
		else
		{	
			if(this.onError != undefined)
			{
				this.onError({status:this_request.status,statusText:this._request.statusText});
			}
		}
		
		delete this._request;
	}
}

wlpAjax.prototype._getXMLHTTPRequest = function()
{
	var xmlHttp;
	try
	{
		xmlHttp = new ActiveXObject("Msxml2.XMLHttp");
	}
	catch(e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
		}
		catch(e2)
		{
		}
	}
	
	if(xmlHttp == undefined && (typeof XMLHttpRequest != 'undefined'))
	{
		xmlHttp = new XMLHttpRequest();
	}
	
	return xmlHttp;
}

function getRandomString(len){
	var resStr='';
	var alphabet ='aAbBcCdDeEfFgGhHhjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789';
	for (i=0;i<len;i++){
		j = Math.floor(Math.random()*66);
		resStr+=alphabet.substr(j,1);
	}
	return resStr;
} 

function wlpAjax(){this.sURL='';}wlpAjax.prototype.setURL=function(_url){this.sURL=_url;};wlpAjax.prototype._request=undefined;wlpAjax.prototype.get=function(){this._request=this._getXMLHTTPRequest();var _this=this;this._request.onreadystatechange=function(){_this._process()};this._request.open("GET",this._getURL(),true);this._request.send(null);};wlpAjax.prototype._getURL=function(){return this.sURL;};wlpAjax.prototype._process=function(){if(this._request.readyState==4){if(this._request.status=="200"){if(this.onLoad!=undefined){this.onLoad(this._request.responseText);}}else{if(this.onError!=undefined){this.onError({status:this_request.status,statusText:this._request.statusText});}}delete this._request;}};wlpAjax.prototype._getXMLHTTPRequest=function(){var xmlHttp;try{xmlHttp=new ActiveXObject("Msxml2.XMLHttp");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHttp");}catch(e2){}}if(xmlHttp==undefined&&(typeof XMLHttpRequest!='undefined')){xmlHttp=new XMLHttpRequest();}return xmlHttp;};function getRandomString(len){var resStr='';var alphabet='aAbBcCdDeEfFgGhHhjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789';for(i=0;i<len;i++){j=Math.floor(Math.random()*66);resStr+=alphabet.substr(j,1);}return resStr;}

