//-----------------------------------------------------------------
// Juan Carlos Hernandez
// Jan 2000 
// Browser Object
// 	- creates global variable called browser that can be used thru out document for browser checking.
//-----------------------------------------------------------------

//--------------------------------------------------------
//	getVesion method - gets the current browsers full version number as Float
//--------------------------------------------------------

function getVersion()
{
	var temp = navigator.appVersion;
	if(this.isIE)
		this.version = temp.substr( (temp.indexOf("MSIE") + 4), temp.lastIndexOf("; W") - (temp.indexOf("MSIE") + 4));
	else if(this.isNS)
		this.version = parseFloat(temp);
	else
		this.version = -1;		
}

//--------------------------------------------------------
// getName method - gets browser name and sets flags 
//--------------------------------------------------------

function getName()
{
	var temp = navigator.userAgent.toLowerCase();
	if(temp.indexOf("opera") != -1)
	{
		this.isOpera = true;
		return;
	}
	else if(temp.indexOf("msie") != -1)
	{
		this.isIE = true;
		return;
	}
	else if(temp.indexOf("gecko") != -1)
	{
		this.isNS = true;
		return;
	}
	else if(navigator.appName.toLowerCase().indexOf("netscape") != -1)
	{
		this.isNS = true;
		return;
	}
	else
	{
		this.isOther = true;
		return;
	}
}
//--------------------------------------------------------
// getPlatform method - gets platform browser is running on and sets flags 
//--------------------------------------------------------

function getPlatform()
{
 var temp = navigator.platform;
 if(temp.toLowerCase().indexOf("mac") != -1)
 {
	this.isPC = false;
	this.isMac = true;
	return;
 }
 else if(temp.toLowerCase().indexOf("win") != -1)
 {
 		this.isPC = true;
		this.isMac = false;
 }
 else
 {
		this.isPC = false;
		this.isMac = false;
	}
}

//-------------------------------------------
// constructor
//-------------------------------------------
function Browser()
{
	this.isIE = false;
	this.isNS = false;
	this.isOpera = false;
	this.isOther = false;
	this.isPC = false;
	this.isMac = false;
	this.version;	
	this.getName = getName;	
	this.getVersion = getVersion;
	this.getPlatform = getPlatform;
	
	this.getName();
	this.getVersion();
	this.getPlatform();
}

//--------------------------------------------------------
// instantiation of global object
//--------------------------------------------------------

var oBrowser = new Browser();

