/*****************************************************
* variables used for absolute postitioning of elements
*/

var sx = screen.width;
var tx = 780;

if (sx < 1000){ //small screens
txoffset = 10; 
}else{
txoffset = 40; // amount pixels left to shift
}
var txpos = ((sx - tx) / 2) - txoffset; 


function amWindow(loc,LCR,TCB,winw,winh,S,R,NOTOOL){
/************************************************************************************************************
* 	amWindow Parameters: amWindow('url location', [-1 || 0 || 1] , [-1 || 0 || 1] , [width || 1 || 0] , [height || 1 || 0] , 0 || 1, 0 || 1)
*	> LCR  ~ number: -1 (left) or 0 (center) or 1 (right)
*	> TCB  ~ number: -1 (top) or 0 (center) or 1 (bottom)
*	> winw ~ width or 1 or 0 ( 1 is width of screen, 0 is 1/2 width of screen)
*	> winh ~ height or 1 or 0 ( 1 is height of screen, 0 is 1/2 height of screen)
*	> S    ~ boolean (1 or 0) scrollbars yes or no
*   > R    ~ boolean (1 or 0) resizable yes or no
*************************************************************************************************************/
//alert("loc= " + loc + " : LCR= " + LCR + " : TCB= " + TCB + " : winw= " + winw + " : winh= " + winh + " : S= " + S + " : R= " + R);

	var sbar = 5; // offset of scrollbars (width and height);
	var tbar = 54; // offset of taskbar (height)
	var swidth    = screen.availWidth - sbar;
	var sheight   = screen.availHeight - tbar; // compensate for taskbar
	var halfw = swidth / 2; var halfh = sheight / 2;
	if (R > 0){ R = "resizable," } else { R = "" }
	if (winw == 0){ winw = (halfw - sbar); } else if (winw == 1) { winw = (swidth - sbar); }
	if (winh == 0){ winh = (halfh - sbar); } else if (winh == 1) { winh = (sheight - sbar); }
	var centx = (swidth  - winw) / 2 ; var centy = (sheight - winh) / 2 ;
	switch (LCR){ case -1: LCR = 0; break; case 1: if (S == 1){ LCR = (swidth - winw) - sbar; }else{ LCR = (swidth - winw); } break; case 0: LCR = centx; break; }
	switch (TCB){ case -1: TCB = 0; break; case 1: if (S == 1){ TCB = (sheight - winh) - sbar; }else{ TCB = (sheight - winh); } break; case 0: TCB = centy; break; }
	
	if(NOTOOL){ T = "no" }else{ T = "yes" }
	
	if (self.amWin){
	amWin.close();
	amWin = null;
	bmWin = eval('window.open(loc,"bmwin","location=no,toolbar=' + T +',scrollbars=' + S + ',' + R + ' width=' + winw + ',height=' + winh + ',left=' + LCR + ',top=' + TCB + '")');
	bmWin.focus();
	return false;
	}else if (self.bmWin){
	bmWin.close();
	bmWin = null;
	amWin = eval('window.open(loc,"amwin","location=no,toolbar=' + T +',scrollbars=' + S + ',' + R + ' width=' + winw + ',height=' + winh + ',left=' + LCR + ',top=' + TCB + '")');
	amWin.focus();
	return false;
	}else{
	amWin = eval('window.open(loc,"amwin","location=no,toolbar=' + T +',scrollbars=' + S + '," + R + " width=' + winw + ',height=' + winh + ',left=' + LCR + ',top=' + TCB + '")');
	amWin.focus();
	return false;
	}
}


	/*=================================================================
	Function: ShowTooltip
	Purpose:  position, draw, and display tooltip element 
	Input:    fArg - indexes text array to display
	Returns:  undefined
	==================================================================*/
	
	var ttcount = 11;
	
	function ShowToolTip(fArg)
	{
if(document.readyState == 'complete'){
	window.scrollTo(0,0);
		for (i = 0 ; i < ttcount; i++){
			var tooltipOBJ = eval("document.all['tt" + i + "']");
			tooltipOBJ.style.visibility = "hidden";
			tooltipOBJ.style.display = "none";
			tooltipOBJ.style.zIndex = 2;
		}
	
		var tooltipOBJ = eval("document.all['tt" + fArg + "']");
		var tooltipOffsetTop = tooltipOBJ.scrollHeight;
		var testTop = (document.body.scrollTop + 148) - tooltipOffsetTop;
		var testLeft = 2;
		var tooltipAbsLft = (testLeft < 0) ? 10 : testLeft;
		var tooltipAbsTop = (testTop < document.body.scrollTop) ? document.body.scrollTop + 10 : testTop;
		tooltipOBJ.style.posLeft = tooltipAbsLft;
		tooltipOBJ.style.posTop = tooltipAbsTop;
		tooltipOBJ.style.zIndex = 100;
		tooltipOBJ.style.display = "block";
		tooltipOBJ.style.visibility = "visible";
	}
}
	/*=================================================================
	Function: HideToolTip
	Purpose:  set visibility attribute of tooltip to hidden
	Input:    none
	Returns:  undefined
	==================================================================*/
	function HideToolTip(fArg)
	{
if(document.readyState == 'complete'){
			for (i = 0 ; i < ttcount; i++){
			var tooltipOBJ = eval("document.all['tt" + i + "']");
			tooltipOBJ.style.visibility = "hidden";
			tooltipOBJ.style.display = "none";
			tooltipOBJ.style.zIndex = 2;
		}
	}
}

	