// *********************************
// Browser Class
// Version 0.2
// Redurban, 2004
// *********************************

Browser = function()
{
	this.appVersion = navigator.appVersion.toLowerCase();
	this.userAgent 	= navigator.userAgent.toLowerCase();
	this.appName	= navigator.appName.toLowerCase();

	this.mac	= (this.appVersion.indexOf("mac")>=0);
	this.win	= (this.appVersion.indexOf("win")>=0);
	this.xwin	= (this.appVersion.indexOf("x11")>=0);

	this.opera	= (this.userAgent.indexOf('opera')>=0);
	this.safari	= (this.userAgent.indexOf('safari')>=0);
	this.gecko	= ((this.userAgent.indexOf('gecko')>=0) && (!this.opera));
	this.ie		= ((this.userAgent.indexOf('msie')>=0) && (!this.opera));
	this.ns		= (document.layers);

	this.ver 	= 0;
	if (this.opera) this.ver = parseFloat(this.userAgent.slice(this.userAgent.indexOf('opera')+6));
	if (this.gecko) this.ver = parseFloat(this.appVersion);
	if (this.ie) this.ver = parseFloat(this.userAgent.slice(this.userAgent.indexOf('msie')+5));
	if (this.ns) this.ver = parseFloat(this.appVersion);

	this.compatible=((this.ie && (this.ver>=4)) || (this.ns && (this.ver>=4.04)) || (this.gecko) || (this.opera && (this.ver>=6)));

	if (this.ns)
	{
		var openPageWidth = innerWidth;
		var openPageHeight = innerHeight;
		onresize = this.nsResizeReload;
	}

	this.nsResizeReload = function()
	{
		if (this.openPageWidth != innerWidth || this.openPageHeight != innerHeight) location.reload();
	}

	this.width = function()
	{
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		{
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		{
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		return myWidth;
	}

	this.height = function()
	{
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		{
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		{
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		return myHeight;
	}

	this.docWidth = function()
	{
		if (this.ie) return document.body.scrollWidth;
		else if (this.opera) return document.body.style.width;
		else return document.width;
	}

	this.docHeight = function()
	{
		if (this.ie) return document.body.scrollHeight;
		else if (this.opera) return document.body.style.height;
		else return document.height;
	}

	this.scrollX = function ()
	{
		if (this.ie) return document.body.scrollLeft;
		else return self.pageXOffset;
	}

	this.scrollY = function ()
	{
		if (this.ie) return document.body.scrollTop;
		else return self.pageYOffset;
	}
}

mo = function(sImage,oPreload) {
	document[sImage].src = eval(oPreload + ".src")
}

// *********************************
// div_obj
// creates the div object
// *********************************

div_obj = function(id)
{
	if (browser.gecko || browser.opera) return document.getElementById(id);
	else if (browser.ns) return document.layers[id];
	else return document.all[id];
}

// *********************************
// div_show
// *********************************

div_show = function(id)
{
	this_obj = div_obj(id);
	if (browser.ns) this_obj.visibility = "show";
	else this_obj.style.visibility = "visible";
}

// *********************************
// div_hide
// *********************************

div_hide = function(id)
{
	this_obj = div_obj(id);
	if (browser.ns) this_obj.visibility = "hide";
	else this_obj.style.visibility = "hidden";
}