/**                     Sirocco -- Administation Office
 *                           -- EnvInspector.js --
 *
 * Platform and browser inspection tool
 * Acts as a Singleton object.
 *
 * Javascript version : 1.5
 *
 * @category	Framework Tool
 * @author	Luc Thibault <luc@suhali.net>
 * @copyright	2005 - Luc Thibault - SUHALI WEB DESIGN
 * @license	GNU General Public License
 * @version	2.1
 *
 * GNU General Public License 
 * 	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.,
 *	51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA ;
 *	or visit http://www.gnu.org/copy_nLeft/gpl.html
**/


var EnvInspector = {
	platform: new String,
	processor: new String,
	browser: new String,
	version: new String,
	DOM: false,
	dom2events: false,
	//ie6 : false,
	//ie7 : false,

	construct: function () {
		var agt = navigator.userAgent.toLowerCase();

		// Platform
		if (agt.indexOf("mac") > 0)
			EnvInspector.platform = 'mac';
		else if (agt.indexOf('linux') > 0)
			EnvInspector.platform = 'linux';
		else	EnvInspector.platform = 'pc';

		// Processor
		if (agt.indexOf("ppc") > 0 || agt.indexOf("powerpc") > 0)
			EnvInspector.processor = 'ppc';
		else if (agt.indexOf("intel") > 0)
			EnvInspector.processor = 'intel';
		else if (agt.indexOf("amd") > 0)
			EnvInspector.processor = 'amd';

		// Browser
		switch (navigator.appName) {
			case 'Netscape'	:			if (agt.indexOf('firefox') > 0)
									EnvInspector.browser = "ff";
								else	EnvInspector.browser = "ns";
								break;
			case 'Microsoft Internet Explorer' :	EnvInspector.browser = "ie";
								if (agt.indexOf('msie 7.0') > 0)
									EnvInspector.version = '7.0';
								else if (agt.indexOf('msie 6.0') > 0)
									EnvInspector.version = '6.0';
								else if (agt.indexOf('msie 5.5') > 0)
									EnvInspector.version = '5.5';
								break;
			case 'Konqueror'	:			EnvInspector.browser = "kq";
								break;
			case 'Safari'	:			EnvInspector.browser = "sf";
								break;
			case 'Opera'	:			EnvInspector.browser = "op";
		}

		//EnvInspector.ie6 = (agt.indexOf('msie 6.0') > 0);
		//EnvInspector.ie7 = (agt.indexOf('msie 7.0') > 0);

		// Capabilities
		if (document.getElementById)
			EnvInspector.DOM =  true;
		if (document.addEventListener && document.removeEventListener)
			EnvInspector.dom2events = true;
	},
	status: function () {
		alert(navigator.userAgent.toLowerCase());
		var str = "Environment Inspector :\n\n";
		str += "Platform : "+EnvInspector.platform+"\n";
		str += "Processor : "+EnvInspector.processor+"\n";
		str += "Browser : "+EnvInspector.browser+"\n";
		str += "Version : "+EnvInspector.browser+"\n";
		str += "DOM : "+EnvInspector.DOM+"\n";
		str += "dom2events : "+EnvInspector.dom2events+"\n";
		//str += "IE6 : "+EnvInspector.ie6+"\n";
		//str += "IE7 : "+EnvInspector.ie7+"\n";
		alert(str);
	}

}

EnvInspector.construct();
useEvents = false;

