/////////////////////////////////////
//                                 //
// Javascript Graphic Library      //
// Copyright 2003 Stefano Angelici //
//                                 //
////////////////////////////////////

/////////////////
// Common objects
/////////////////

var myBrowserObj = new getBrowserObj();


//This function creates a browser info object
function getBrowserObj()
{
	this.agent = navigator.userAgent;
	this.version = navigator.appVersion;
	//Check for MAC platform
	if(this.agent.indexOf("Mac") > -1)
		this.isMac = true;
	else
		this.isMac = false;
	//Check for DOM
	if (document.getElementById)
		this.hasDom = true;
	else
		this.hasDom = false;
	//Check for Opera browser
	if (this.agent.indexOf("Opera 5") > -1)
		this.isOpera5 =  true;
	else
		this.isOpera5 =  false;
	//Check for Internet Explorer browser (any version)
	if (this.version.indexOf("MSIE") > -1 && this.hasDom && !this.isOpera5)
		this.isIE = true; 
	else
		this.isIE = false;
	//Check for Netscape browser (any version)
	if (this.hasDom && parseInt(this.version) >= 5)
		this.isNS6 = true;
	else
		this.isNS6 = false;
	if (document.layers && !this.hasDom) 
		this.isNS4 = true;
	else
		this.isNS4 = false;
	this.isNS = (this.isNS6 || this.isNS4);
	this.recognisedBrowser = (this.isIE || this.isNS4 || this.isNS6 || this.isOpera5)
	
	//Sets browser window sizes
	this.xStart = 0;
    this.xEnd = this.isIE && document.body.offsetWidth-20 ||innerWidth || 0;
//	this.xEnd = document.body.offsetWidth-20 ;
	if(this.isNS6) this.xEnd -= 2;
	this.yStart = 0;
	this.yEnd = this.isIE && document.body.offsetHeight-5 || innerHeight || 0;
//	this.yEnd =document.body.offsetHeight-5 ;
	if(this.isNS6) this.yEnd -= 4;
	if(!this.xEnd||!this.yEnd) return "Document has no width or height";
	this.yTop=140*100/this.yEnd;
	this.avail=(this.yEnd*(100-this.yTop))/100 ;
	
	return this
}
