<!--

var page = {
	
	addLoader : function(dvName, txt)
	{
		$(dvName).innerHTML = '<img src="images/loader.gif" style="vertical-align:middle;"> '+(txt || 'zaczekaj...');
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

	clearLoader : function(dvName, txt)
	{
		$(dvName).innerHTML = '';
	},	
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	msg : function(str)
	{
		$("msgDV").innerHTML = str;
		setTimeout('$("msgDV").innerHTML="&nbsp;";', 3000);
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	sendForm : function(fname, funct, param)
	{
		var req = mint.Request();
		req.retryNum = 1;
		req.timeout = 30 * 1000;
		var obj = null;

    	req.OnSuccess = function()
		{
			if(funct)
			{
				if (typeof funct != 'string')
				{
					alert('sendForm: bad func !!!');
					return;
				}

				if(funct.indexOf(".") != -1)
				{
					obj = eval(funct.substr(0, funct.indexOf(".")));
					funct.substr(funct.indexOf(".")+1);
				}

				//eval(funct+"('"+this.responseText+"', "+param+")");	

				if(param != undefined)
					eval(funct).apply(obj, [param, this.responseText]);
				else
					eval(funct).apply(obj, [this.responseText]);
			}
			else if(param)
			{
				if(typeof param == "string")
					$(param).innerHTML = this.responseText;
				else if(param.href)
					location.href = param.href;
			}
			else
				location.reload();
    	}
		
		req.OnError = function()
		{
			alert("Błąd wysłania formularza !");
		}
		
		req.OnTimeout = function()
		{
			alert("Błąd - minął czas oczekiwania serwera !");
		}		
		
		if(document.forms[fname].onsubmit && document.forms[fname].onsubmit.length > 0)
		{
			if(eval(document.forms[fname].onsubmit).apply())
				req.SendForm(fname);
		}
		else
			req.SendForm(fname);
	},
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	sendQuery : function(query, funct, param)
	{
		var req = mint.Request();
		req.retryNum = 1;
		req.timeout = 30 * 1000;
		req.evalScripts = true;
		var obj = null;

    	req.OnSuccess = function()
		{
			if(funct)
			{
				if (typeof funct != 'string')
				{
					alert('sendForm: bad func !!!');
					return;
				}

				if(funct.indexOf(".") != -1)
				{
					obj = eval(funct.substr(0, funct.indexOf(".")));
					funct.substr(funct.indexOf(".")+1);
				}

				//eval(funct+"('"+this.responseText+"', "+param+")");	
	
				if(param != undefined)
					eval(funct).apply(obj, [param, this.responseText]);
				else
					eval(funct).apply(obj, [this.responseText]);
			}
			else if(param)
			{
				if(typeof param == "string")
					$(param).innerHTML = this.responseText;
				else if(param.href)
					location.href = param.href;
			}
			else
				location.reload();
    	}
		
		req.OnError = function(s)
		{
			if(s != -1)
				alert("Błąd wysłania zapytania !");
		}
		
		req.OnTimeout = function()
		{
			alert("Błąd - minął czas oczekiwania serwera !");
		}

	    req.Send(query);
	}
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	//private function
	

	
}

//-->
