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 wi = getControl('wdWhite');
	var wdp = getControl('wdPowered');	
	
	var subH = getControlOffSetHeight('wdItems') + 105;// + 221; // 221 = offset top
	var conH = getControlOffSetHeight('wdContent') + 371;// + 221;
	var paH = getControlOffSetHeight('wdContainer');
	var wiH = getControlOffSetHeight('wdWhite') + 63;

	//var co = getControl('copy');
	var maxH = (Math.max(subH, conH));
	if ((maxH) < wh) {
		// page is smaller than window
		var newH = wh;			
	} else {
		var newH = maxH;
	}

	if (sub != undefined) {
		//sub.style.height = (newH - 221) + 'px';
		sub.style.height = (newH - 105) + 'px';
//		sub.style.height = (newH - 200) + 'px';
	} 
	if (con != undefined) {
		con.style.height = (newH - 371) + 'px';
		//con.style.height = (newH - 220) + 'px';
	}
	if (pa != undefined) {
		pa.style.height = (newH) + 'px';
	}
	if (wi != undefined) {
		wi.style.height = (newH - 63) + 'px';
	}
	
	if (wdp != undefined) {
		wdp.style.top = (newH - 38) + 'px';
		wdp.style.left = '830px';
	}
}


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:""}));
	
	};
}