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 adultNoticeInit() {
    var adultNoticeObj = document.getElementById('adultNotice');
    var pageSize = getPageSize();

    // positioning
    adultNoticeObj.style.left = pageSize[0] / 2 - 410 + "px";
    adultNoticeObj.style.top = pageSize[1] / 2 - 250 + "px";

    var objBody = document.getElementsByTagName("body").item(0);

    // create overlay div
    var objOverlay = document.createElement("div");
    objOverlay.setAttribute('id','adultNoticeOverlay');
    objOverlay.style.display = 'block';
    objOverlay.style.position = 'absolute';
    objOverlay.style.top = '0';
    objOverlay.style.left = '0';
    objOverlay.style.zIndex = '90';
    objOverlay.style.width = '100%';
    objOverlay.style.height = '10000px';
    objOverlay.style.backgroundImage = 'url(http://www.hullahaz.hu/wp-content/themes/k2/styles/hullahaz/overlay.png)';
    objBody.insertBefore(objOverlay, objBody.firstChild);
}

function adultNoticeHide() {
    var objOverlay = document.getElementById('adultNoticeOverlay');
    var adultNoticeObj = document.getElementById('adultNotice');

    objOverlay.style.display = 'none';
    adultNoticeObj.style.display = 'none';

    var date = new Date();
    var days = 7;
    date.setTime( date.getTime() + ( days*24*60*60*1000 ) );
    document.cookie = "adultNoticePassed=1; expires="+date.toGMTString();
}

adultNoticeInit();
