
	
	function aconnection(id, url)
	{
		this.id = id;
		this.url = url;
		this.method = "GET";
		this.params = new Array();
		this.rpc = null;
		this.callback = null;
		
		this.init = function()
		{
			if(document.all)
			{
				this.rpc = new ActiveXObject("Msxml2.XMLHTTP");
				if(!this.rpc)
					this.rpc = new ActiveXObject("Microsoft.XMLDOM");
			}
			else
				this.rpc = new XMLHttpRequest();
		}
		
		this._arr2Str = function(arr)
		{
			var params = new Array();
			var i = 0;
			for(key in arr)
					params[i++] = key+"="+arr[key];
			return params.join("&");
		}
		
		this.sendGet = function(arr)
		{
			this.method = "GET";
			if(arr) this.params = arr;
			this.send();
		}
		
		this.sendPost = function(arr)
		{
			this.method = "POST";
			if(arr) this.params = arr;
			this.send();
		}
		
		this.readystate = function()
		{
			if(this.rpc.readyState==4)
			{
				var data = this.rpc.responseText;
				if(this.callback)
					this.callback(data, this);
			}
		}
		
		this.send = function()
		{
			if(!this.rpc)
				return false;

			var sendData = typeof(this.params)=="string"? this.params:this._arr2Str(this.params);
			var url = this.url+(this.url.indexOf("?")==-1? "?":"&")+"__dp_i="+this.id+"&"+((new Date()).getTime())+"&";
			this.rpc.onreadystatechange = function(){ connections.getConnection(id).readystate(); };
			this.rpc.open(this.method, url+(this.method=="GET"? sendData:"__dp_i="+this.id), true);
			if(this.method=="GET")
				this.rpc.send();
			else
			{
				this.rpc.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				this.rpc.send(sendData);
			}
			
		}
		
		this.init();
	}
	
	function aconnections()
	{
		this.conin = 0;
		this.cons = new Array();
		this.getConnection = function(id)
		{
			return  this.cons[id]? this.cons[id]:null;
		}
		this.newConnection = function(url)
		{
			this.cons[this.conin] = new aconnection(this.conin, url);
			return this.cons[this.conin++];
		}
	}
	
	connections = new aconnections();
	
	// User Define Function
	function showPage(u)
	{
		var c = connections.newConnection(u);
		c.callback = function(data){document.getElementById("data").innerHTML=data;};
		c.sendPost({sync:1});
		document.getElementById("data").innerHTML = "<div style='margin-bottom:36px;text-align:center'><img src='http://www.khabarads.ir/images/l.gif'></div>";
		return false;	
	}
	
	function mv()
	{
		document.getElementById("bottomBar").style.top = (document.documentElement.clientHeight+document.documentElement.scrollTop-40)+"px";
		document.getElementById("bottomFlag").style.top = (document.documentElement.clientHeight+document.documentElement.scrollTop-76)+"px";		
	}
	var ind1 = navigator.appVersion.indexOf("MSIE");
	if(ind1>-1 && document.getElementById("bottomBar"))
	{
		
		var ver = parseInt(navigator.appVersion.slice(ind1+4, navigator.appVersion.indexOf(";", ind1+4)));
		if(!isNaN(ver) && ver<7)
			window.onscroll = mv;
		mv();
	}