function getWindowWidth() {
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}


var widthSet = -1;
function setPageWidth() {
	var myWidth = getWindowWidth();
	if ((myWidth < 1258) && (widthSet != 1)) {
		setSessionCookie('page_width', '1024');
		changeStyleSheet('ngi_width_', '1024');
		widthSet = 1;
	}
	if ((myWidth >= 1258) && (widthSet != 2)) {
		setSessionCookie('page_width', '1280');
		changeStyleSheet('ngi_width_', '1280');
		widthSet = 2;
	}
}
function setFontSize(intSize) {
	switch(intSize) {
		case 2:
			setSessionCookie('CSS_FONT_SIZE', 'large');
			changeStyleSheet('ngi_common_font_', 'large');
			break;
		case 1:
			setSessionCookie('CSS_FONT_SIZE', 'medium');
			changeStyleSheet('ngi_common_font_', 'medium');
			break;
		default:
			setSessionCookie('CSS_FONT_SIZE', 'normal');
			changeStyleSheet('ngi_common_font_', 'normal');
			break;
	}
	
	fixHeightElements()
}

			
function changeStyleSheet(title, layoutsheet) {
	var i, a, main;
	
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute('href').indexOf(title) != -1 ) {
			if (a.getAttribute('href').indexOf(layoutsheet) != -1 ) {
				a.disabled = false;
			} else {
				a.disabled = true;
			}
		}
	}
}
/*
document.apgf_attachEvent('onload', setPageWidth) ;
document.apgf_attachEvent('onresize', setPageWidth) ;
*/

function setPageSheets() {
	setPageWidth();
	/* zou niet hoeven omdat css al aan server kant goed gezet word
	switch(setSessionCookie('CSS_FONT_SIZE')) {
		case 'large':
			setFontSize(2);
			break;
		case 'medium':
			setFontSize(1);
			break;
		default:
			setFontSize(0);
			break;
	}*/
}

if (window.addEventListener) 
		window.addEventListener("load", setPageSheets, false) 
	else if (window.attachEvent) 
		window.attachEvent("onload", setPageSheets)
	else
		window.onload=setPageSheets

if (window.addEventListener) 
		window.addEventListener("resize", setPageWidth, false) 
	else if (window.attachEvent) 
		window.attachEvent("onresize", setPageWidth)
	else
		window.onresize=setPageWidth
		
		

