function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 

function BrowserCheck() 
{
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
  //check for firefox
  if(navigator.userAgent.indexOf("Firefox")) this.b = "ff";
	this.v = parseInt(navigator.appVersion)
	this.version = navigator.appVersion	
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	if (this.ie5) this.v = 5
	this.min = (this.ns||this.ie)
}

//Create the "is" object
is = new BrowserCheck()

function setDivOrLayerContents(thisDivOrLayer,thisContents) {
	documentAll=(is.ie ? document.all : document.layers)
	if (documentAll[thisDivOrLayer])
	{
		if (is.ie) {
			documentAll[thisDivOrLayer].innerHTML=thisContents
		} else {
			documentAll[thisDivOrLayer].document.write(thisContents)
			documentAll[thisDivOrLayer].document.close()
		}
	}
}

// This function sets any style attribute in a DIV or LAYER (x-browser)
// Use the BrowserCheck function to set the "is" object
function setStyle(thisDivOrLayer,thisStyle,thisValue) {
  //documentAll=(is.ie ? document.all : document.layers)
  if(is.ie) {
    documentAll = document.all;
  } else if(is.ff) {
    documentAll = document.thisDivOrLayer;
  } else {
    documentAll = document.layers;
  }
	if (!is.ie) {
		thisValue=="hidden" ? thisValue="hide" : null
		thisValue=="visible" ? thisValue="show" : null
	}
  if(is.ie) {
    documentAll[thisDivOrLayer].style[thisStyle]=thisValue;
  } else if(is.ff) {
    documentAll.style.thisStyle=thisValue;
  } else {
    documentAll[thisDivOrLayer][thisStyle]=thisValue
  }
}
