function ge(id) {return document.getElementById(id);}
function showK() {
	ge(obj).innerHTML = tmpobj;
	return false;
}
tAjax.get = function(opt) {
	if (typeof(opt)!='undefined' && opt!=null) {
		var ajax = new tAjax();
		ajax.opcje(opt);
		ajax.startGET();
	}
}
tAjax.oAjax = function() {
	if (window.XMLHttpRequest) return new XMLHttpRequest(); 
	else if (window.ActiveXObject) 
		try {
			return new ActiveXObject('Msxml2.XMLHTTP'); 
		} 
		catch(e) {
			try {
				return new ActiveXObject('Microsoft.XMLHTTP'); 
			} 
			catch(e) {
				return null;
			}
		} 
	return null;
}
function tAjax() {
	var ax = new Object();
	ax._link = '';
	ax._form = '';
	ax.param = new Object();
	ax.onSuccess = null;
	ax.onError = null;
	ax.ajaxRequest = tAjax.oAjax();
	ax.ajaxRequest.onreadystatechange = function() {
		if (ax==null || ax.ajaxRequest==null) return false;
		if (ax.ajaxRequest.readyState==4) {
			ax.status = ax.ajaxRequest.status;
			ax.statusText = ax.ajaxRequest.statusText;
			ax.ajaxText = ax.ajaxRequest.responseText;
			ax.ajaxXML = ax.ajaxRequest.responseXML;
			if (ax.ajaxRequest.status==200 && typeof(ax.onSuccess)=='function') ax.onSuccess(ax);
			else if(typeof(ax.onError)=='function') ax.onError(ax);
			delete ax.ajaxRequest['onreadystatechange']; 
			ax.ajaxRequest = null;
		}
	}
	ax.startGET = function() {
		
		if (ax._link.length<3) return false;
		ax.ajaxRequest.open('get',ax._link,true);
		ax.ajaxRequest.send('');
	}
	ax.startPOST = function() {
		if (ax._link.length<3) return false;
		var oForm = ax._form;
		var sBody = getRequestBody(oForm);
		ax.ajaxRequest.open('post',ax._link,true);
		ax.ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ax.ajaxRequest.send(sBody);
	}
	ax.opcje = function(opt) {
		for(i in opt) 
			if(typeof(ax[i])=='undefined') ax.param[i]=opt[i]; 
			else ax[i]=opt[i];	
	}
	return ax;
}
function loadGET(_link,_obj) {
//	var yScroll = getPageScroll();
//	var pageSize = getPageSize();
//	var t = yScroll[1];
//	setTop('loadpage',t);
//	ge('maskpage').style.height = pageSize[1];
//	ge('loadpage').style.display='block';
//	ge('maskpage').style.display='block';
//	hideSelectBoxes();
	tAjax.get(
		{
			'_link':_link,
			'onSuccess':function(ax) {
//				showSelectBoxes();
//				ge('loadpage').style.display='none';
//				ge('maskpage').style.display='none';
				ge(_obj).innerHTML=ax.ajaxText;
				Slimbox.scanPage(); 
			},
			'onError':function(ax) {
//				showSelectBoxes();
//				ge('logpage').style.display='none';
//				ge('maskpage').style.display='none';
			}
		}
	);
	return false;
}
function tCookie() {
	this.get = function (name) {
		var start = document.cookie.indexOf(name+"="); 
		var len = start+name.length+1; 
		if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
		if (start == -1) return null; 
		var end = document.cookie.indexOf(";",len); 
		if (end == -1) end = document.cookie.length;
		return unescape(document.cookie.substring(len,end));
	}
	this.set = function (name,value,expires,path,domain,secure) {
		var cookieString = name + "=" +escape(value) + 
		   ((expires) ? ";expires=" + expires.toGMTString() : "") + 
		   ((path) ? ";path=" + path : "") + 
		   ((domain) ? ";domain=" + domain : "") + 
		   ((secure) ? ";secure" : ""); 
		document.cookie = cookieString; 		
	}
	this.del = function (name) {
		if (this.get(name)) document.cookie = name + "=" + 
			((path) ? ";path=" + path : "") + 
			((domain) ? ";domain=" + domain : "") + 
			";expires=Thu, 01-Jan-70 00:00:01 GMT"; 
	}
	this.noexpire = function () {
		return expire(60*24);
	}
	function expire( min ) {
		var today = new Date(); 
		var zero_date = new Date(0,0,0); 
		today.setTime(today.getTime() - zero_date.getTime()); 
		var cookie_ExpireDate = new Date(today.getTime() + ( min * 1000 * 60 ));
		return cookie_ExpireDate;
	}
}
