var d, dom, ie, ie4, ie5x, moz, mac, win, lin, old, ie5mac, ie5xwin, op;

d = document;
n = navigator;
na = n.appVersion;
nua = n.userAgent;
win = ( na.indexOf( 'Win' ) != -1 );
mac = ( na.indexOf( 'Mac' ) != -1 );
lin = ( na.indexOf( 'Linux' ) != -1 );

if ( !d.layers ){
	dom = ( d.getElementById );
	op = ( nua.indexOf( 'Opera' ) != -1 );
	konq = ( nua.indexOf( 'Konqueror' ) != -1 );
	saf = ( nua.indexOf( 'Safari' ) != -1 );
	moz = ( nua.indexOf( 'Gecko' ) != -1 );
	ie = ( d.all && !op );
	ie4 = ( ie && !dom );

	/*
	ie5x tests only for functionality. ( dom||ie5x ) would be default settings. 
	Opera will register true in this test if set to identify as IE 5
	*/

	ie5x = ( d.all && dom );
	ie5mac = ( mac && ie5x );
	ie5xwin = ( win && ie5x );


	if ( ie5mac ) {
		d.write('<link rel = "stylesheet" type = "text\/css" href = "styles\/iemac.css" \/\>');
	}
	else if ( saf ){
		d.write('<link rel = "stylesheet" type = "text\/css" href = "styles\/safari.css" \/\>');
	}
	else if ( ie ){
		d.write('<link rel = "stylesheet" type = "text\/css" href = "styles\/ie.css" \/\>');
	}
	else { // Mozilla / Netscape / Opera
		rv_pos = nua.indexOf( 'rv' );
		moz_rv = nua.substr( ( rv_pos + 3 ), 3 ); // use this for main version, like 0.9, 1.0, 1.1, 1.2
		moz_rv_sub = nua.substr( ( rv_pos + 7 ), 1 );
		moz_rv_sub = moz_rv + moz_rv_sub; // use this if exact version is required, like 0.9.4, ie netscape 6.2
		
		//alert (nua+" \nmoz version: "+moz_rv_sub + " moznu:" + moznu);

		//if (moz_rv_sub < 1.1) {
		//	d.write('<link rel = "stylesheet" type = "text\/css" href = "Styles\/netscape6.css" \/\>');
		//} else {
			d.write('<link rel = "stylesheet" type = "text\/css" href = "styles\/netscape.css" \/\>');
		//}
	}

} else {
	//window.location = "#";

}


