var resize = true;

window.onload = initPage;
window.onresize = alignPage;

function initPage() {
	fixflashie();
	alignPage();
}

function alignPage() {
	var undefined = undefined;
	var wh = getWindowHeight();
	var sub = getControl('wdItems');
	var con = getControl('wdContent');
	var pa = getControl('wdContainer');
	var pb = getControl('wdPowered');
	var subH = getControlOffSetHeight('wdItems') + getY(sub);// + 221; // 221 = offset top
	var conH = getControlOffSetHeight('wdContent') + getY(con);// + 221;
	var paH = getControlOffSetHeight('wdContainer');
	var pbH = 0;
	if (pb != undefined) {
		pbH = getControlOffSetHeight('wdPowered');
	}
	//var co = getControl('copy');
	var maxH = (Math.max(subH, conH));
	if ((maxH) < wh) {  //maxH + wdPowerd < wh????????
		// page is smaller than window
		var newH = wh;			
	} else {
		var newH = maxH;
	}
	//alert('wdItems: ' + getControlOffSetHeight('wdItems'));
	//alert('conH: '+conH+'\nsubH: '+subH+'\nnewH: '+newH);
	if (sub != undefined && subH < newH) {
		//sub.style.height = ((newH - getY(sub))) + 'px';
	} 
	if (con != undefined && conH < newH) {
		con.style.height = (newH - getY(con)) + 'px';
	}
	if (pa != undefined) {
		pa.style.height = (newH) + 'px';
	}
	if (pb != undefined) {
		pb.style.top = (newH - pbH) + 'px'; //(newH - getY(con) - pbH) + 'px'; 
	}
}


function createHeaders() {
	if(typeof sIFR == "function"){
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"#wdContent h1", sFlashSrc:"/wd/wdsite/scripts/eurosti.swf", sColor:"#FF6600", sLinkColor:"#0027A8", sBgColor:"#FFFFFF", sHoverColor:"#FF6600", nPaddingTop:0, nPaddingBottom:0, sFlashVars:""}));
		sIFR.replaceElement(named({sSelector:"#wdContent h2", sFlashSrc:"/wd/wdsite/scripts/eurosti.swf", sColor:"#FF6600", sLinkColor:"#0027A8", sBgColor:"#FFFFFF", sHoverColor:"#FF6600", nPaddingTop:0, nPaddingBottom:0, sFlashVars:""}));
		//sIFR.replaceElement(named({sSelector:"#wdItems h1", sFlashSrc:"/wd/wdsite/scripts/eurosti.swf", sColor:"#0027A8", sLinkColor:"#0027A8", sBgColor:"#FFFFFF", sHoverColor:"#0027A8", nPaddingTop:0, nPaddingBottom:0, sFlashVars:""}));
		//sIFR.replaceElement(named({sSelector:"#wdItems h2", sFlashSrc:"/wd/wdsite/scripts/eurosti.swf", sColor:"#0027A8", sLinkColor:"#0027A8", sBgColor:"#FFFFFF", sHoverColor:"#0027A8", nPaddingTop:0, nPaddingBottom:0, sFlashVars:""}));
	
	};
}
