function toggle(div_id) {


	var el = document.getElementById(div_id);


	if ( el.style.display == 'none' ) {el.style.display = 'block';}

	else {el.style.display = 'none';}

}


function blanket_size(popupboxVar) {


	if (typeof window.innerWidth != 'undefined') {

		viewportheight = window.innerHeight;

	} else {

		viewportheight = document.documentElement.clientHeight;
	}


	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {

		blanket_height = viewportheight;


	} else {


		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {

			blanket_height = document.body.parentNode.clientHeight;


		} else {
blanket_height = document.body.parentNode.scrollHeight;

		   }
		}


	var blanket = document.getElementById('blanket');


	var frameheight = document.getElementById('frame').offsetHeight + 30;

	if (frameheight > blanket_height) {

	blanket.style.height = frameheight + 'px';

	} else {

	blanket.style.height = blanket_height + 'px';

	}	
/*

	scrOfY = 0;
  	if( typeof( window.pageYOffset ) == 'number' ) {
    	//Netscape compliant
    	scrOfY = window.pageYOffset;
  	} else if( document.body && document.body.scrollBottom ) {
    	//DOM compliant
    	scrOfY = document.body.scrollBottom;
  	} else if( document.documentElement && document.documentElement.scrollBottom ) {
    	//IE6 standards compliant mode
    	scrOfY = document.documentElement.scrollBottom;
  	}
*/

/*	blanket.style.height = blanket_height + scrOfY + 'px';
	*/

/*
        var v = document.documentElement.scrollHeight || document.document.body.scrollHeight;
	blanket.style.height = v + 'px';
*/


	var registration = document.getElementById(popupboxVar);


	popupbox_height=60;//180 is half popup's height

	if (popupbox_height < 5) {popupbox_height = 5;} //minuszban ne legyen az ablak
	registration.style.top = popupbox_height + 'px';

}



function window_pos(popupboxVar) {


	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;

	} else {

		viewportwidth = document.documentElement.clientHeight;
	}



	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {


		window_width = viewportwidth;


	} else {

		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;

		} else {

			window_width = document.body.parentNode.scrollWidth;

		}
	}


	var registration = document.getElementById(popupboxVar);

	window_width=window_width/2-240;//240 is half popup's width

	registration.style.left = window_width + 'px';

}


function popup(windowname) {


	blanket_size(windowname);

	window_pos(windowname);
	toggle('blanket');

	toggle(windowname);

}


function onresize_event(windowname) {


	blanket_size(windowname);

	window_pos(windowname);

}


