
/************* section used for adding page to the layers or iframes **********/

function changeContent(page) {
	if (document.layers) {
		document.layers['helpDiv'].top = 110;
		document.layers['helpDiv'].left = 10;
		document.layers['helpDiv'].clip.top = 0;
		document.layers['helpDiv'].clip.left = 0;
		document.layers['helpDiv'].clip.bottom = 300;
		
		document.layers['helpDiv'].src = page;
	} else if (document.getElementById) {
		document.getElementById('help').src = page;
	} else {
		document.frames['helpFrame'].location.href = page;
	}
}

// original clip coords, change accordingly
var top = 0;
var left = 0;
var right = 300;
var bottom = 150;
// end original clip coords, change accordingly

var speed = 1; // speed of scroll
var stop = true;

function scroll(layer,dir) {
	var layerBottom, layerTop, otherHeight, staticTop, styleTop;
	staticTop = 120; // top coord of layer being scrolled, change accordingly
	
	if (document.layers) {
		layerBottom = document.layers[layer].document.height;
		otherHeight = layerBottom - document.layers[layer].clip.bottom;
		if ((dir == 1) && (otherHeight <= 0)) return false;
		if ((dir == -1) && (document.layers[layer].top >= staticTop)) return false;
		document.layers[layer].top -= dir;
		otherHeight -= dir;
		document.layers[layer].clip.top += dir;
		document.layers[layer].clip.bottom += dir;
		//alert(document.layers[layer].top);
	} else if (document.getElementById) {
		layerBottom = document.getElementById(layer).offsetHeight;
		otherHeight = layerBottom - bottom;		
		if ((dir == 1) && (otherHeight <= 0)) return false;
		if ((dir == -1) && (parseInt(document.getElementById(layer).style.top) >= staticTop)) return false;
		top += dir; bottom += dir;
		styleTop = parseInt(document.getElementById(layer).style.top) - dir;
		document.getElementById(layer).style.top = new String(styleTop + 'px');
		otherHeight -= dir;	
		document.getElementById(layer).style.clip = "rect(" + top + " " + left + " " + bottom + " " + right + ")";
	} else {
		layerBottom = document.all[layer].offsetHeight;
		otherHeight = layerBottom - bottom;	
		if ((dir == 1) && (otherHeight <= 0)) return false;
		if ((dir == -1) && (document.all[layer].style.pixelTop >= staticTop)) return false;
		top += dir; bottom += dir; 
		document.all[layer].style.pixelTop -= dir;
		otherHeight -= dir;	
		document.all[layer].style.clip = "rect(" + top + " " + left + " " + bottom + " " + right + ")";
	}
	if (stop) setTimeout("scroll('"+layer+"',"+dir+")",speed);
}

/******************** this function opens a help popup window *****************/

function openHelpPopup(uri, set, item) {
    helpPopup = window.open(uri + '?set=' + set + '&item=' + item, 'ONHelp', 'menubar=0,resizable=1,height=270,width=500,innerHeight=275,innerWidth=500,scrollbars=1,toolbar=0,titlebar=0');
    helpPopup.focus();
}

