/*
	Author: Jonas Jonsson (jonas.jonsson@framehouse.se)
	Copyright (C) Jonas Jonsson 2002
	All Rights Reserved 2002
*/
	var browser = new Browser();
	var g_B = browser;

	function Browser()
	{
		this.eventMatrix = new Array();
		
		this.Name = (document.all)?"IE":"MZ";
		this.isIE = document.all?true:false;
		if(this.Name == "IE")
		{
			this.Version = parseFloat(window.navigator.appVersion.match(/MSIE\s*([0-9\.]+)/i)[1]);
		}
		else if(window.navigator.userAgent.indexOf("Firebird"))
		{
			this.Version = 1;
		}
		
		this.addEvent = function(whatEvent, fnEvent)
		{
			if(!this.eventMatrix[whatEvent])
			{
				this.eventMatrix[whatEvent] = new Array();
				window[whatEvent] = new Function("g_B.invokeEvent('" + whatEvent + "');");
			}
				
			this.eventMatrix[whatEvent][this.eventMatrix[whatEvent].length] = fnEvent;
		}
		this.invokeEvent = function(whatEvent)
		{
			for(var i = 0; i < this.eventMatrix[whatEvent].length; i++)
			{
				if(typeof(this.eventMatrix[whatEvent][i]) == "function")
					this.eventMatrix[whatEvent][i]();
			}
		}
	}
	
	function FButton(elementButton)
	{
		this.elementButton = elementButton;
		this.elementButtonImage = elementButton;
		this.src = elementButton.src;

		if(g_B.Version >= 4.0 && g_B.Version < 5.0)
		{
			elementButton.style.paddingBottom = "14px";
		}
		this.Hide = function() { this.elementButton.style.visibility = "hidden"; this.elementButton.style.backgroundImage = "url(Graphics/Navigation/btn0.gif)"; }
		this.Show = function() { window.setTimeout("(g_B.isIE?document.all." + this.elementButton.id + ":document.getElementById('" + this.elementButton.id + "')).style.visibility = 'visible';", 0); }
		this.Enable = function()
		{
			this.elementButton.disabled = false;
			if(g_B.Name == "IE")
				this.elementButtonImage.style.filter = "alpha(opacity: 100)";
		}
		this.Disable = function()
		{
			this.elementButton.disabled = true;
			if(g_B.Name == "IE")
				this.elementButtonImage.style.filter = "alpha(opacity: 30)";
		}
	}
