/**
 * This function is called while clicking links
 *
 * @param   object   the link
 * @param   object   the sql query to submit
 *
 * @return  boolean  whether to run the query or not
 */
function confirmLink(theLink, txt)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
    if (typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm(txt);

    return is_confirmed;
} // end of the 'confirmLink()' function

	var windowWidth = 0,windowHeight = 0;
	function calculateWindowSize() {
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			windowWidth = window.innerWidth;
			windowHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth ||	document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			windowWidth = document.documentElement.clientWidth;
		    windowHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
	}

	function openDiv(name, url, p) {
		//var args = $A(arguments);
	    var deltaY =	window.pageYOffset
						|| document.documentElement.scrollTop
						|| document.body.scrollTop
			            || 0;
		var deltaX =	window.pageXOffset
						|| document.documentElement.scrollLeft
						|| document.body.scrollLeft
						|| 0;
		calculateWindowSize();
		/*$(name).innerHTML = "<iframe src=\"urlap.php\" style=\"width:100px;height:250px;margin-left:1px;\" frameborder=\"0\" name=\"doboz\"></iframe>"
    							  + "<br><a href='javascript:elrejtDiv("+name+")'>Bezár</a>";*/
		//var rN = rand(200);
		var param = p + '&rnd=' + Math.random();
		var myAjax = new Ajax.Updater(
			$(name), 
			url, 
			{
				method: 'get', 
				parameters: param
			});
		var felUgroDivX = (windowWidth - $(name).getWidth()) / 2 + deltaX;
		var felUgroDivY = (windowHeight - $(name).getHeight()) / 2 + deltaY;
		$(name).style.left = felUgroDivX;
		$(name).style.top = felUgroDivY;
		$(name).show();
	}

	function elrejtDiv(name) {
		$(name).hide();
		$(name).innerHTML = "";
	}

	function doPost(name, url, form) {
		var pars = $(form).serialize() + "&rN=" + Math.random();
		var myAjax = new Ajax.Request(
			url, 
			{
				method: 'post', 
				parameters: pars, 
				onComplete: ret
			});
		
		function ret(resp) {
			//$('felUgroDiv').hide();
			$(name).innerHTML = resp.responseText;
//			$(name).innerHTML = '';
		}
	}

	function doGet(name, url, pars) {
		var myAjax = new Ajax.Request(
			url, 
			{
				method: 'get', 
				parameters: pars, 
				onComplete: ret
			});
		
		function ret(resp) {
			$(name).innerHTML = resp.responseText;
		}
	}

	function openWin(url, w, h) {
		var ablak = open(url, "ujablak", "width="+w+", height="+h+",toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,screenX=10,screenY=10")
    }

