function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}


function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
}
function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}
function show_alert_window(hiba)
{
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	document.getElementById("overlay").style.width = (arrayPageSize[0] + 'px');
	document.getElementById("overlay").style.height = (arrayPageSize[1] + 'px');



	document.getElementById("alert_window").style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 100) / 2) + 'px');
	document.getElementById("alert_window").style.left=(((arrayPageSize[0] - 20 - 300) / 2) + 'px');

	document.getElementById("alert_window_content").innerHTML=hiba;
	document.getElementById("alert_window_buttons").innerHTML='<div class="button_ok" ><a href="javascript:close_alert_window()"></a></div>'
	document.getElementById("overlay").style.display="block";
	document.getElementById("alert_window").style.display="block";
}
function close_alert_window()
{
	document.getElementById("overlay").style.display="none";
	document.getElementById("alert_window").style.display="none";
}







function kodbekero_open(ellenorzo_kod_tipus, darab, t_kod)
{




	var req = new Request.HTML(
	{
		url:'kodbekero.php',
		method: 'get',
		async: false,
		data: {
			ellenorzo_kod_tipus: ellenorzo_kod_tipus,
			t_kod: t_kod,
			darab:darab
		},
		onComplete: function(result, str,  responseHTML){



			content="";

			if (responseHTML)
			{
				content=responseHTML;
				



			}




		},
		evalScripts:true
	}).send();

	return content;
}


function show_Window(content)
{
	
				var arrayPageSize = getPageSize();
				var arrayPageScroll = getPageScroll();
				document.getElementById("overlay").style.width = (arrayPageSize[0] + 'px');
				document.getElementById("overlay").style.height = (arrayPageSize[1] + 'px');


				var PageSizeWithScroll=getPageSizeWithScroll();


				//parseInt((screen.availHeight/2) - (height/2));

				document.getElementById("kodbekero").style.left=(((arrayPageSize[0] - 20 - 400) / 2) + 'px');

				//document.getElementById("kodbekero").style.top=((PageSizeWithScroll[1] - 20 - 400) / 2)-100 + 'px';


				document.getElementById("kodbekero").style.top=parseInt(((288)/2)+arrayPageScroll[1]) + 'px';


				document.getElementById("overlay").style.display="block";

				document.getElementById("kodbekero").innerHTML =content;
				document.getElementById("kodbekero").style.display="block";
}


function kodbekero_close()
{
	document.getElementById("overlay").style.display="none";
	document.getElementById("kodbekero").style.display="none";

}

function kodbekero_close_ok()
{
	
	document.getElementById("overlay").style.display="none";
	document.getElementById("kodbekero").style.display="none";
	
				++html_contents_index; 
				
if (html_contents.length>html_contents_index)				
{
	show_Window(html_contents[html_contents_index]);
}
else
{
	 document.kosar.submit();
}

	
	
	
	//document.kosar.submit();

}






