var stylesheet, width;
stylesheet = width = null;

function choosecss() {
	try {
		if (window && (typeof(window) == 'object') && window.innerWidth) width = window.innerWidth;
		else if (document && (typeof(document) == 'object')) {
			if (document.documentElement && (typeof(document.documentElement) == 'object') && document.documentElement.clientWidth) width = document.documentElement.clientWidth;
			else if (document.body && (typeof(document.body) == 'object') && document.body.clientWidth) width = document.body.clientWidth;
		}
		if (!isNaN(width)) {
			if ((width >= 800) && (width < 1000) && (width = 780)) stylesheet = '/styles/themes/'+ globals.site.theme +'/screen_780.css';
			else if ((width >= 1000) && (width < 1200) && (width = 980)) stylesheet = '/styles/themes/'+ globals.site.theme +'/screen_980.css';
			else if ((width >= 1200) && (width = 1180)) stylesheet = '/styles/themes/'+ globals.site.theme +'/screen_1180.css';
			if (typeof(stylesheet) == 'string') {
				document.writeln('<link rel="stylesheet" media="screen" href="'+ stylesheet +'" type="text/css" />');
				globals.site.width = width;
			}
		}
		return true;
	} catch(e) { return false; }
}

choosecss();
