//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;
}
//Limit textareas and textfields
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
/*
//iframe auto resize;
var iframeids=["newsletterFrame"]

 //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
 var iframehide="yes"

 var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
 var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

 function resizeCaller() {
 var dyniframe=new Array()
 for (i=0; i<iframeids.length; i++){
 if (document.getElementById)
 resizeIframe(iframeids[i])
 //reveal iframe for lower end browsers? (see var above):
 if ((document.all || document.getElementById) && iframehide=="no"){
 var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
 tempobj.style.display="block"
 }
 }
 }

 function resizeIframe(frameid){
 var currentfr=document.getElementById(frameid)
 if (currentfr && !window.opera){
 currentfr.style.display="block"
 if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
 currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
 else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
 currentfr.height = currentfr.Document.body.scrollHeight;
 if (currentfr.addEventListener)
 currentfr.addEventListener("load", readjustIframe, false)
 else if (currentfr.attachEvent){
 currentfr.detachEvent("onload", readjustIframe) // Bug fix line
 currentfr.attachEvent("onload", readjustIframe)
 }
 }
 }

 function readjustIframe(loadevt) {
 var crossevt=(window.event)? event : loadevt
 var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
 if (iframeroot)
 resizeIframe(iframeroot.id);
 }

 function loadintoIframe(iframeid, url){
 if (document.getElementById)
 document.getElementById(iframeid).src=url
 }

 if (window.addEventListener)
 window.addEventListener("load", resizeCaller, false)
 else if (window.attachEvent)
 window.attachEvent("onload", resizeCaller)
 else
 window.onload=resizeCaller
*/
