/*
Doesn't work for IE5.x
It appears that if a page is valid, the clientWidth value doesn't work for IE5.x
*/


// this is the value that defines when the page should load the 1024 css
var WIDE_BROWSER = 1000;
window.wideBrowser = detectWideBrowser();

// ===================================================
// SMH METHOD
/*
var width = 0;

if (window.innerWidth) // browser supports innerWidth
	width = window.innerWidth;
	
else if (document.all) // supports document.all (IE 4+) {
	width = document.documentElement.clientWidth;
	//width = document.body.clientWidth;
}

if (width >= large)
	document.write('<link type=\"text/css\" rel=\"stylesheet\" href=\"1024.css\">');
*/



// ===================================================
// ALTERNATE METHOD
// IE5.x fails all tests
function detectWideBrowser() {
	var myWidth = 0, myHeight = 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 >= WIDE_BROWSER);
}

function writeWideBrowserCSS() {
	if(window.wideBrowser)
		document.write('<link type=\"text/css\" rel=\"stylesheet\" href=\"css/1024.css\">');
}

function writeFlashTag(isMSIE) {
	var movie;
	if(window.wideBrowser) {
		movie = 'homefeature_1024.swf';
		width = 943;
	}
	else {
		movie = 'homefeature_800.swf';
		width = 724;
	}

	if(isMSIE) {
		html  = '<object type="application/x-shockwave-flash" width="' + width + '" height="148">\n';
		html += '  <param name="movie" value="flash/' + movie + '" />\n'; 
		//html += '  <param name="wmode" value="transparent" />\n'; 
		html += '</object>';
	}
	else {
		html  = '<object type="application/x-shockwave-flash" width="' + width + '" height="148" data="flash/' + movie + '">\n';
		//html += '  <param name="wmode" value="transparent" />\n';
		html += '</object>';
	}

	document.write(html);
}
