//	JavaScript part of vear's fotozajezdnia modernisation project
//	(c) 2009-2010 by Radoslaw Kolodziej
//			a.k.a. vear <veareal (at) gmail (dot) com>
//
//	Modyfikacja na wylaczonsc serwisu fotozajezdnia.pl
//	Inne wykorzystanie jest naruszeniem praw autorskich.
//
//	MOD excusively for fotozajezdnia.pl web gallery
//	Using elsewhere is considered a copyright infringement

function FZAjax(state_event)
{
	this.busy_offset = 2*1000; //miliseconds
	this.state_event = state_event;
	this.url = '';

	if (window.XMLHttpRequest)
	{
		this.xhr = new XMLHttpRequest();
	}
	else
	{
		if (window.ActiveXObject)
		{
		this.xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
}

FZAjax.prototype.send_ajax_get = function(url)
{
	this.url = url;
	this.check_if_xhr_busy(url);
}

FZAjax.prototype.check_if_xhr_busy = function()
{
	if(this.xhr.readyState != 0 && this.xhr.readyState != 4)
	{
		//setTimeout(this.check_if_xhr_busy, this.busy_offset);
	}
	else
	{
		this.xhr.open('GET', this.url, true);
		this.xhr.send(null);
		this.xhr.onreadystatechange = this.state_event;
	}
}
