//
// iewarning.js (c) 2003 Edward H. Trager
//

//
// hackForIE():
//
function hackForIE(showWarning,navTopPosition){
	//alert(navigator.userAgent);
	//alert(navigator.userAgent.indexOf("MSIE"));
	//alert(navigator.userAgent.indexOf("Opera"));
	//alert(navigator.userAgent.indexOf("Gecko"));
	
	//alert(navigator.appName);
	//alert(navigator.appVersion);
	
	//
	// We can normally distinguish a true IE from, say, Opera masquerading as IE
	// from the presence of "MSIE" _and_ absence of "Opera" (or whatever other browser name)
	// in the userAgent string.  However some browsers, such as Konqueror, will give up all
	// traces of their own identity when implementing the "hack" to identify themselves as
	// IE.  However, since that is not the default behaviour, I feel the following is
	// sufficient for distinguishing within the class of recent DOM-enabled browsers:
	//
	//if(navigator.userAgent.indexOf("MSIE")){
	var agent=navigator.userAgent;
	if(agent.indexOf("MSIE")>0){
		//
		// Check against other browsers masquerading as IE:
		//
		if(agent.indexOf("Opera")>0) return;
		if(agent.indexOf("Gecko")>0) return;
		if(agent.indexOf("Konqueror")>0) return;
		if(agent.indexOf("KHTML")>0) return;
		if(agent.indexOf("Safari")>0) return;
		
		//
		// Warn the user about the problems with viewing in IE:
		//
		if(showWarning){
			warningNode=document.getElementById("IEWarning");
			warningText  = '<p><span class="warning">Warning:</span> ';
			warningText += 'Ender\'s web pages adhere to <a href="http://www.w3c.org">W3C</a> ';
			warningText += 'web standards and will appear correctly in <em>all modern browsers ';
			warningText += 'except Internet Explorer</em> ';
			warningText += 'which has serious <a href="http://www.w3.org/Style/CSS/">CSS</a> ';
			warningText += 'bugs which Microsoft has not fixed. ';
			warningText += 'Please <em>download for free</em> a <em>better</em> and <em>more secure</em> modern browser such as ';
			warningText += '<a href="http://www.mozilla.org">Firefox</a>, ';
			warningText += '<a href="http://www.opera.com">Opera</a>, ';
			warningText += '<a href="http://www.apple.com/safari/download/">Safari</a>, ';
			warningText += 'or <a href="http://www.konqueror.org/">Konqueror</a> ';
			warningText += 'to use instead. Thanks!</p>';
			warningNode.innerHTML=warningText;
			
		}
		//
		// IE on Windows does not handle the "fixed" navigation properly,
		// so we compromise by changing it to "absolute" on IE (Windows) only: 
		//
		document.getElementById("navigation").style.position="absolute";
		document.getElementById("news").style.position="absolute";
		//if(navTopPosition){
		//	document.getElementById("navigation").style.top=navTopPosition;
		//}
	}
	
}
