
// written by Alvin Wilson.  All rights reserved.  No warranty expressed or implied
var BrowserVendor = "UNKNOWN"; 
var BrowserName = "UNKNOWN";
var OpSys = "UNKNOWN";
var offset = 85; // percentage of default size

function initAlsLib() {
//***************************************
// call this function within the <body> tag
BrowserVendor = navigator.appVersion.toUpperCase(); 
if (BrowserVendor == null) {
    BrowserVendor = "UNKNOWN";
}
if (BrowserVendor.indexOf("MSIE") > -1) {
    BrowserName="MSIE";
}
else if (BrowserVendor.indexOf("MOZILLA") > -1) {
    BrowserName="MOZILLA";
}
if (BrowserVendor.indexOf("MICROSOFT") > -1) {
    OpSys = "MICROSOFT";
}
else if (BrowserVendor.indexOf("MACINTOSH") > -1) {
    OpSys = "MACINTOSH";
}
else if (BrowserVendor.indexOf("X11") > -1) {
    OpSys = "UNIX";
}
}


function trunc(n,decimals) {
var d = Math.pow(10,decimals);
var i = Math.round(n*d);
return(i/d);
}
function getScreenWidth() {
	 var n = 0;
	 if (BrowserVendor.indexOf("MICROSOFT") > -1 || BrowserVendor.indexOf("MSIE")>-1) {
		 n = document.body.clientWidth; //trunc(screen.availWidth*0.95,0);
	}
	else {
		 n = screen.width;
	}
	if (n<200) {
	   n = 500;
	}
	return n;
}
function getScreenHeight() {
     var n = 0;
	 if (BrowserVendor.indexOf("MICROSOFT") > -1 || BrowserVendor.indexOf("MSIE")>-1) {
		n =  document.body.clientHeight;
	}
	else {
		 n = screen.height;
	}
	return n;
}
function getAvailWidth() {
	 var n = 0;
	 // if (BrowserVendor.indexOf("MICROSOFT") > -1 || BrowserVendor.indexOf("MSIE")>-1) {
	if (BrowserName.indexOf("MSIE")>-1) {
		 n = document.body.offsetWidth;
	}
	else {
		 n = window.innerWidth;
	}
	return n;
}

function getAvailHeight() {
     var n = 0;
	 //if (BrowserVendor.indexOf("MICROSOFT") > -1 || BrowserVendor.indexOf("MSIE")>-1) {
	if (BrowserName.indexOf("MSIE")>-1) {
		 n = document.body.offsetHeight;
	}
	else {
		 n = window.innerHeight;
	}
	return n;
}

function setOffset( o ) {
    offset = o;
    if ((navigator.appVersion.toUpperCase().indexOf("MAC") > -1)) {
	document.write("<STYLE>TD { font-family: sans-serif; font-size: "+trunc(1.1*offset,1)+"%; }</STYLE>");
    }
    else if ((navigator.appVersion.toUpperCase().indexOf("X11") != -1 ||  navigator.appVersion.toUpperCase().indexOf("LINUX") > -1)) {
	 var a = trunc(1*offset,1);
	 //document.write(a);
	 document.write("<STYLE>TD { font-family: sans-serif; font-size: "+a+"%; }</STYLE>");
    }
    else {  // windows
	 if (navigator.appVersion.toUpperCase().indexOf("MICROSOFT") > -1) {
		document.write("<STYLE>TD { font-family: sans-serif; font-size: "+trunc(0.9*offset,1)+"%; }</STYLE>");
	 }
	 else {	
		 var a = trunc(1.2*offset,1);
		 document.write("<STYLE>TD { font-family: sans-serif; font-size: "+a+"%; }</STYLE>");
	}
    }
}


function bigWindow(s) {
    window.open(encodeURI(s),"","width=500px,height=400px,top=50px,left=50px,screenX=50px,screenY=50px,scrollbars=yes,menubar=yes,resizable=yes");
}

function newWindow(s,t,l,w,h) {
    var xwin = window.open(encodeURI(s),"","width="+w+"px,height="+h+"px,top="+t+"px,left="+l+"px,screenX="+l+"px,screenY="+t+"px,scrollbars=yes,menubar=yes,resizable=yes");
    return xwin;
}


function getElementPosition(ElemID) {
    var OffsetTrail = document.getElementById(ElemID);
    var OffsetLeft =0;
    var OffsetTop = 0;
    while (OffsetTrail) {
        OffsetLeft += OffsetTrail.offsetLeft;
        OffsetTop += OffsetTrail.offsetTop;
        OffsetTrail = OffsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") {
        OffsetLeft += document.body.leftMargin;
        OffsetTop += document.body.topMargin;
    }
    return {left:OffsetLeft, top:OffsetTop};
}

var HelpTimerID;
    
function attachHelpPopUp(ElemID,Xoffset,Yoffset,DelayMS,Message) {
    var Elem = document.getElementById(ElemID);
    var cmd1="";
    if (Elem) {
        var ElemPos = getElementPosition(ElemID);
        var SpanID = "Span"+ElemID;
        var Top = ElemPos.top+Yoffset;
        var Left = ElemPos.left + Xoffset;
        cmd1 = '<span id="'+SpanID+'" style="position:absolute;top:'+Top+'px;left:'+Left+'px;background:khaki;visibility:hidden;padding:5px;border-style:groove;border-width:medium;border-right-width:thick;border-bottom-width:thick;border-color:darkgray;">';
        cmd1 += Message;
        cmd1 += '</span>';
        var omo = 'if(HelpTimerID){window.clearTimeout(HelpTimerID);}HelpTimerID = window.setTimeout("document.getElementById(\\"'+SpanID+'\\").style.visibility=\\"visible\\";",'+DelayMS+');';
        //alert(omo);
        Elem.setAttribute("onmouseover",omo);
        Elem.setAttribute("onmouseout","window.clearTimeout(HelpTimerID);document.getElementById(\""+SpanID+"\").style.visibility=\"hidden\";");
        if (Elem.hasAttribute("onclick")) {
        Elem.setAttribute("onclick","window.clearTimeout(HelpTimerID);"+Elem.getAttribute("onclick"));
        }
    }
    return cmd1;
}

document.write('<style>A {text-decoration: none;}</STYLE>');
document.write('<style>A:hover {color:red ; background: CCFFFF}</STYLE>');
document.write('<style>font.L1 {color: maroon; font-family:sans-serif;font-size:0.8em;}</style>');
document.write("<style>font.L3 {color: navy; font-family:sans-serif;font-size:0.85em;}</style>");
document.write("<style>font.L4 {color:navy;background:lightsteelblue;font-size:0.85em;font-family:sans-serif;}</style>");
document.write('<style>font.L2 {color: maroon; font-size:1.2em; font-weight:bold;}</style>');
document.write('<style>font.PageTitle {color:maroon; font-size:1.1em; font-weight:bold;}</style>');
document.write('<style>font.ParagraphTitle {color:darkgreen; font-size:1.1em; font-weight:bold;}</style>');


initAlsLib();
setOffset(100);

