//get the content area dimensions for a browser window
function getScreenWidth()
{
	if (window.innerWidth) //firefox
		return window.innerWidth;
	else if (document.all) //ie4+
		return document.body.clientWidth;
}

function getScreenHeight()//ie6,7 seem to return the document height rather than the content area height
{
	if (window.innerHeight) //firefox
		return window.innerHeight;
	else if (document.all) //ie4+
		return document.body.clientHeight;
}

//check if IE 6 is running in standards compliant mode
function getIECompliant()
{
	if (document.compatMode && document.compatMode != "BackCompat")
		return true;
	else return false;
}

//get scroll offsets for a browser window
function getScrollLeft()
{
	var iebody=(getIECompliant())? document.documentElement : document.body
	return document.all ? iebody.scrollLeft : pageXOffset
}

function getScrollTop()
{
	var iebody=(getIECompliant())? document.documentElement : document.body
	return document.all? iebody.scrollTop : pageYOffset
}

//cross-browser opacity setting, best used with divs
function setOpacity(elem,value) {
	elem.style.opacity = value/10;
	elem.style.filter = 'alpha(opacity=' + value*10 + ')';
}

//functions and properties to allow fading of divs
var fadedivs=new Array();

function FadeDiv(name,callfunc,func,opacity)
{
	this.name=name;
	this.callfunc=callfunc;
	this.func=func;
	this.opacity=opacity;
	this.index=fadedivs.length;
}

//fades a div to invisibility - requires the div to have
//an opacity object associated with it to keep track of the opacity
function fadeDiv(ind,fadeTime)
{
	if (fadedivs[ind].opacity>0) {
		fadedivs[ind].opacity--;
		setOpacity(document.getElementById(fadedivs[ind].name),fadedivs[ind].opacity);
		setTimeout("fadeDiv("+ind+","+fadeTime+")",fadeTime);
	}
	else {
		if (fadedivs[ind].callfunc)
			fadedivs[ind].func();
	}
}

//detects whether the browser is firefox1.0+
function checkFF()
{
	if(navigator.userAgent.indexOf("Firefox")!=-1) {
		var versionindex=navigator.userAgent.indexOf("Firefox")+8
		if (parseInt(navigator.userAgent.charAt(versionindex))>=1)
			return true;
	}
	
	return false;
}

//detects whether the browser is ie5.5+
function checkIE()
{
	var version=0
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}

	if (version>=5.5) //NON IE browser will return 0
		return true;
	
	return false;
}

