$ = function(id){
	return document.getElementById(id);
};

getDocumentHeight = function(){
	return (document.all) ? document.documentElement.clientHeight : window.innerHeight;
};

getDocumentWidth = function(){
	return (document.all) ? document.documentElement.clientWidth : window.innerWidth;
};

size = function(){
	var mainHeight = getDocumentHeight();
	var height;

	if(mainHeight){
		height = (document.all) ? (mainHeight - 97) : (mainHeight - 91);
		if(height < 410){
			height = 410;
		}
	}
	
	if ($("answersContainer")){
			$("answersContainer").style.height = (getDocumentHeight() - 398) + "px";
	}
	if (height){
		$("mainContent").style.height = height + "px";		
	}
};

g_tray = "";

setTray = function(){
	$("userguidetray").innerHTML = g_tray;	
};

activatePrev = function(aState,aPage){
	if ($("prevButton")){
		$("prevButton").style.visibility = "visible";
		$("prevButton").innerHTML = '<a href="http://www.whitesmoke.com/client_v2/help/index.php?state='+aState+'&page='+aPage+'"><img width="20" height="14" src="img/spacer.gif" border="0" /></a>';
		$("prevButton").onclick = function(){ location.href = "http://www.whitesmoke.com/client_v2/help/index.php?state=" + aState + "&page=" + aPage; };
		return;
	} else {
		setTimeout("activatePrev("+aState+","+aPage+");",350);
	}
};

activateNext = function(aState,aPage){
	if ($("nextButton")){
		$("nextButton").style.visibility = "visible";
		$("nextButton").innerHTML = '<a href="http://www.whitesmoke.com/client_v2/help/index.php?state='+aState+'&page='+aPage+'"><img width="20" height="14" src="img/spacer.gif" border="0" /></a>';
		$("nextButton").onclick = function(){ location.href = "http://www.whitesmoke.com/client_v2/help/index.php?state=" + aState + "&page=" + aPage;} ;
		return;
	} else {
		setTimeout("activateNext("+aState+","+aPage+");",350);
	}
};

window.onload = function(){
	size();
	objectSwap();
	setTray();
};

window.onresize = function(){size();};

gotoPosition = function(aNum){
	$("answersContainer").scrollTop = aNum;
	return;
};