function init() {
   document.body.style.height = document.documentElement.scrollHeight+'px';
}

function getAbsY(elm) {
	if (elm.y) return elm.y;
	pos = 0;

	while (elm != null) {
		pos += elm["offsetTop"];
		elm = elm.offsetParent;
	}

	return pos;
}

function submitForm(formObj) {
      // TODO: Probably have a check for netscape or IE here
      formObj.submit();
} // submitForm

// Remove leading and trailing whitespace from a string
function trimWhitespace(string) {
	var newString  = '';
	var substring  = '';
	beginningFound = false;
	
	// copy characters over to a new string
	// retain whitespace characters if they are between other characters
	for (var i = 0; i < string.length; i++) {
		
		// copy non-whitespace characters
		if (string.charAt(i) != ' ' && string.charCodeAt(i) != 9) {
			
			// if the temporary string contains some whitespace characters, copy them first
			if (substring != '') {
				newString += substring;
				substring = '';
			}
			newString += string.charAt(i);
			if (beginningFound == false) beginningFound = true;
		}
		
		// hold whitespace characters in a temporary string if they follow a non-whitespace character
		else if (beginningFound == true) substring += string.charAt(i);
	}
	return newString;
}

// js functionality for toggling in support section

toggleDone = false;
togglePerform = true;

function toggleSublist(listItem,paragraph){
	if ( togglePerform ) {
		//alert(toggleDone + "-" + paragraph);
		if ( toggleDone == false ) {
			var subElement = listItem.getElementsByTagName("ul")[0];
			if(!subElement){
				subElement = listItem.getElementsByTagName("p")[0];
			}
			subElement.className=="showchild"?newClass="hidechild":newClass="showchild";
			subElement.className=newClass;
		}
		if ( !paragraph ) {
			toggleDone = true;
		}else{
			if ( toggleDone == false ) {
				listItem.className=="paragraphClose"?paraClass="paragraphOpen":paraClass="paragraphClose";
				listItem.className=paraClass;
			}
			toggleDone = false;
		}
	}
}

function toggleSwitch(){
	togglePerform==true?togglePerform=false:togglePerform=true;
	togglePerform==false?setTimeout("toggleSwitch()",10):"";
}

function gotoLink(sel)
{			
	var link = sel.options[sel.selectedIndex].value;
	if (link != null && link != "")
		window.location = link;
}

function clearNewsletterTextBox(box, defaultValue) {
	if (box.value == defaultValue) 	{
		box.value = '';
	}
}

function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase(); 

   // browser name
   this.isOpera       = (ua.indexOf('opera') != -1); 
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   
   // platform
   this.isMac    = (ua.indexOf('mac') != -1);
}
var browser = new BrowserDetect();

if ((browser.isIE)&&(browser.isMac)) location.replace('/old_browser.htm');

