// oldal általános inicializálása
loadEventBinding( window, initPage );
// oldal átméretezése - egyszerű funkciók kötése :: opera7!

var oTime;
function initPage() {
	var elNews, nBoxAlfa, 
	nBoxAlfa = 0;
	elNews = document.getElementById('pg-news');
	if ( !elNews ) return;
	elNews.nBoxAlfa = nBoxAlfa;
	elNews.aBoxAlfa = []; 
	elNews.aItem = []; // ez a görgetéshez kell!
	elNews.nCurrentBoxAlfa = 0; // egy elemet sem alfáz
	els = elNews.getElementsByTagName('DIV');
	if ( nBoxAlfa > els.length )
		nBoxAlfa = els.length;
	for ( i = 0; i < els.length; i++ ) {
		if ( i < nBoxAlfa ) {
			els[i].nOpacity = 0;
			elNews.aBoxAlfa[elNews.aBoxAlfa.length] = els[i];
			
		}
		else {
			//if ( is.gecko )
			//	els[i].style.MozOpacity = '1';
			//if ( is.ie6 )
			//	els[i].filters.alpha.opacity = 100;
		}
		elNews.aItem[elNews.aItem.length] = els[i];

	}
	if ( nBoxAlfa > 0 )
		oTime = setInterval( function() { showBox( elNews ) }, 50 );
	elNews.oWindow = window;
	parent.elNews = elNews;
}

function showBox( elNews ) {
	var el;
	el = elNews.aBoxAlfa[elNews.nCurrentBoxAlfa];
	if ( el.nOpacity == 1 ) {
		elNews.nCurrentBoxAlfa++;
		if ( elNews.nCurrentBoxAlfa == elNews.aBoxAlfa.length )
			return clearInterval( oTime );
		el = elNews.aBoxAlfa[elNews.nCurrentBoxAlfa]
	}
	if ( is.gecko ) {
		el.style.MozOpacity = String( el.nOpacity + 0.2 );
		el.nOpacity = Number( el.style.MozOpacity );
	}
	if ( is.ie ) {
		el.filters.alpha.opacity += 20;
		el.nOpacity = el.filters.alpha.opacity / 100;
	}
}

function openWindow( sURL, sWindowName, nWidth, nHeight, sScroll, sResize ) {
	win = null;
	sWindowName = ( !sWindowName ) ? 'UnnamedWindow' : sWindowName;
	nWidth = ( !nWidth ) ? 400 : nWidth;
	nHeight = ( !nHeight ) ? 400 : nHeight;
	sScroll = ( !sScroll ) ? 'yes' : sScroll;
	sResize = ( !sResize ) ? 'yes' : sResize;
	nLeftPosition = ( screen.width ) ? ( screen.width - nWidth ) / 2 : 0;
	nTopPosition = ( screen.height ) ? ( screen.height - nHeight) / 2 : 0;
	sSettings = 'status=no,height=' + nHeight + ',width=' + nWidth + ',top=' + nTopPosition + ',left=' + nLeftPosition + ',scrollbars=' + sScroll + ',resizable=' + sResize
	win = window.open( sURL, sWindowName, sSettings );
}
