/*
MACAO - The Web Animation Framework
Copyright (C) 2005 Peter Trauberg

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
//##
function isKonqueror() {
	
	// test Konqueror
	return (navigator.userAgent.indexOf("Konqueror") >= 0) ? true : false
}  
//##
function isOpera() {
	
	// the Gecko engine is used by Mozilla, Firefox and Netscape 6+
	return (navigator.userAgent.indexOf("Opera") >= 0) ? true : false
}  
//##
function isGecko() {
	
	// the Gecko engine is used by Mozilla, Firefox and Netscape 6+
	return (navigator.userAgent.indexOf("Gecko") >= 0) ? true : false
} 
//##
function isMicrosoftIE() {
	return document.all ? true : false
}
//##
function isNetscape4() {
	return document.layers ? true : false
}
//##
function isBrowserSupported() {
	
	if(isNetscape4()) {
		
		// netscape 4 will never be supported
		return false
	} else if(isKonqueror()) {
		
		// crashs konqueror
		// the Konqueror can't handle the fast animations. It crashs
		return false
	} else if(isGecko()) {
		
		// the Gecko engine is used by Mozilla, Firefox and Netscape 6+
		// early versions of macao tested with Mozilla 1.3
		// current version tested with Mozilla 1.7 and Firefox 0.9
		return true
	} else if(isOpera()) {
		
		// tested with opera 7
		// earlier versions may have little problems
		return true
	} else if(isMicrosoftIE()) {
		
		// should work with IE 5 and more
		// early versions of macao tested with 5.0 and 5.5
		// current version tested with 6.0
		return true
	} else {
		
		// better don't try any no name browser
		// because much support for DHTML is needed
		return false
	}
}
 
//##
function displaySupportedBrwosers(language) {
	var message
	
	if(language == "de") {
		
		// build german message
		message =
			"Dieser Browser wird nicht unterstützt.\n" +
			"Bitte verwenden Sie einen der folgenden Browser, " +
			"um diese interaktive Webseite zu besuchen.\n\n" +
			"- Microsoft Internet Explorer 6\n" +
			"- Microsoft Internet Explorer 5.5\n" +
			"- Mozilla 1.7\n" +
			"- Firefox 1.0\n" +
			"- Opera 7\n" +
			"- Netscape 7\n" +
			"\noder entsprechende Browser mit höheren Versionsnummern." +
			"\nDanke für Ihr Verständnis."
	} else {
		
		// build english message
		message =
			"This browser is not supported.\n" +
			"Please use one of the following browsers " +
			"to visit this interactive website.\n\n" +
			"- Microsoft Internet Explorer 6\n" +
			"- Microsoft Internet Explorer 5.5\n" +
			"- Mozilla 1.7\n" +
			"- Firefox 1.0\n" +
			"- Opera 7\n" +
			"- Netscape 7\n" +
			"\nor higher versions of the browsers."
	}
	
	// display error message
	alert(message)
}
//##
function testBrowser() {
	var message = ""
	
	// sum up browser tests
	message += "appCodeName: " + navigator.appCodeName + "\n"
	message += "appVersion: " + navigator.appVersion + "\n"
	message += "userAgent: " + navigator.userAgent + "\n"
	message += "isKonqueror: " + isKonqueror() + "\n"
	message += "isOpera: " + isOpera() + "\n"
	message += "isGecko: " + isGecko() + "\n"
	message += "isMicrosoftIE: " + isMicrosoftIE() + "\n"
	message += "isNetscape4: " + isNetscape4() + "\n"
	message += "isBrowserSupported: " + isBrowserSupported() + "\n"
	
	// display message
	alert(message)   	
}       