var F = document.all;
var saveStyle;
var saveFgColor;
var saveBgColor;
var saveBC;
var saveFC;
var DCP	= '{89820200-ECBD-11CF-8B85-00AA005B4383}';
var CID = 'componentid';
var goOrgShow = new Array();

function GetScriptEngineInfo(){
	var s = '';
	s += ScriptEngine() + ': ';
	s += ScriptEngineMajorVersion() + '.';
	s += ScriptEngineMinorVersion() + '.';
	s += ScriptEngineBuildVersion();
	return(s);
}
function initStatus(){
	var x, strMsg;
	with(oBody){
		var bMSvmAvailable = isComponentInstalled( DCP, CID );
		var sMSvmVersion   = getComponentVersion( DCP, CID );
	}
	if (sMSvmVersion != ''){
		sMSvmVersion = 'IE' + ' Version ' + sMSvmVersion;
	}
	var sNeg = (bMSvmAvailable) ? '' : 'NOT ';
	if (!bMSvmAvailable) sMSvmVersion = 'IE5.x Browser';
	var sIEver = sMSvmVersion + ' is ' + sNeg + 'installed.';
	if (!bMSvmAvailable){
		window.alert(sIEver);
		with(oBody){
			addComponentRequest( DCP, CID );
			doComponentRequest();
		}
	} else {
		sIEver = 'IE: ' + oBody.getComponentVersion( DCP, CID );
	}
	var sMver = GetScriptEngineInfo();
	if (sMver.substr(9, 1) < '5'){
		strMsg = 'Your current Script Engine is "' + sMver + '".\n';
		strMsg += 'This HTML requires "JScript Version 5" or above.\n';
		strMsg += 'Please contact with this page author.';
		window.alert(strMsg);
	}
	todayColor();
	if (! window.print){
		x = F[ 'PRN' ];
		if (x != null) x.disabled = true;
	}
	with(oBody.currentStyle){
		saveBgColor = backgroundColor;
		saveFgColor = color;
	}
	with(oBody){
		if ((width < 800) || (height < 600)){
			strMsg = 'Your current screen resolution is ' + width + ' * ' + height + '.\n';
			strMsg += 'We recommend 800 * 600 and above resolution for the best view.';
			window.alert(strMsg);
		}
		if (colorDepth < 16){
			strMsg = 'Your current screen color is ' + Math.pow(2, colorDepth) + ' colors.\n';
			strMsg += 'We recommend 65536 and above colors for the best view.';
			window.alert(strMsg);
		}
		strMsg = 'Screen: ' + width + '*' + height + ', Color: ' + colorDepth + ', ' + sMver + ', ' + sIEver;
		window.status = strMsg;
	}
}
function toggle(){
	var x = F[ 'SCORE' ];
	var y = F[ 'VIEW' ];
	if ((x != null) && (y != null)){
		with(x.style){
			display = (display == 'none') ? '' : 'none';
			y.value = (display == 'none') ? 'View Score' : 'Hide Score';
		}
		window.scrollBy(0, 290);
	}
}
function beforePrint(){
	var x = F[ 'BTN' ];
	var y = F[ 'SCORE' ];
	if ((x != null) && (y != null)){
		x.style.display = 'none';
		with(y.style){
			saveStyle = display;
			if (display == 'none') display = '';
		}
	} else if (x != null){
		x.style.display = 'none';
	}
	with(oBody.currentStyle){
		saveBC = backgroundColor;
		saveFC = color;
	}
	with(oBody.style){
		backgroundColor = 'white';
		color = 'black';
	}
	var section, ans;
	var coll = F.tags( 'legend' );
	ans = window.confirm('Click [OK] to print entire page. Click [CANCEL] to select print section.');
	if (!ans){
		ans = window.confirm('Click [OK] to print Index Section. Click [CANCEL] to skip.');
		if (!ans){
			x = F[ 'IDX' ];
			if (x != null) x.style.display = 'none';
		}
		for (var i=0; i<coll.length; i++){
			x = F[ 'LEG' + i.toString() ];
			if (x != null){
				y = F[ 'FLD' + i.toString() ];
				section = x.innerText;
				ans = window.confirm('Click [OK] to print ' + section + '. Click [CANCEL] to skip.');
				if (y){
					goOrgShow[i] = y.style.display;
					y.style.display = (!ans) ? 'none' : '';
				}
			}
		}
		ans = window.confirm('Click [OK] to print Footer Section. Click [CANCEL] to skip.');
		if (!ans){
			x = F[ 'FOOT' ];
			if (x != null) x.style.display = 'none';
		}
	} else {
		for (var i=0; i<coll.length; i++){
			x = F[ 'LEG' + i.toString() ];
			if (x != null){
				y = F[ 'FLD' + i.toString() ];
				if (y){
					goOrgShow[i] = y.style.display;
					y.style.display = '';
				}
			}
		}
	}
}
function afterPrint(){
	var x = F[ 'BTN' ];
	var y = F[ 'SCORE' ];
	if ((x != null) && (y != null)){
		x.style.display = '';
		y.style.display = saveStyle;
	} else if (x != null){
		x.style.display = '';
	}
	with(oBody.style){
		backgroundColor = saveBC;
		color = saveFC;
	}
	x = F[ 'IDX' ];
	if ((x != null) && (x.style.display == 'none')) x.style.display = '';
	var coll = F.tags( 'legend' );
	for (var i=0; i<coll.length; i++){
		x = F[ 'LEG' + i.toString() ];
		if (x != null){
			y = F[ 'FLD' + i.toString() ];
			if (y){
				y.style.display = goOrgShow[i];
			}
		}
	}
	x = F[ 'FOOT' ];
	if ((x != null) && (x.style.display == 'none')) x.style.display = '';
}
function swap(){
	with(oBody.currentStyle){
		var temp1 = backgroundColor;
		var temp2 = color;
	}
	with(oBody.runtimeStyle){
		backgroundColor = temp2;
		color = temp1;
	}
}
function reset(){
	var e = event.srcElement;
	if (e.value == 'W/B'){
		var fgColor = 'black';
		var bgColor = 'white';
		e.value = 'Resume';
		e.title = 'Resume orginal color';
	} else {
		var fgColor = saveFgColor;
		var bgColor = saveBgColor;
		e.value = 'W/B';
		e.title = 'Reset screen color';
	}
	with(oBody.runtimeStyle){
		backgroundColor = bgColor;
		color = fgColor;
	}
}
function makeBackColor(){
	var i = 0;
	this[i++] = "#FFDEAD";
	this[i++] = "#FFEBCD";
	this[i++] = "#009999";
	this[i++] = "#CCC1B2";
	this[i++] = "#E8E2D6";
	this[i++] = "#8B0000";
	this[i++] = "#009900";
	this[i	] = null;
	this.length = i;
}
function makeTextColor(){
	var i = 0;
	this[i++] = "#228B22";
	this[i++] = "#800000";
	this[i++] = "#FFCC99";
	this[i++] = "#660000";
	this[i++] = "#00008B";
	this[i++] = "#FDF5E6";
	this[i++] = "#FFE4B5";
	this[i	] = null;
	this.length = i;
}
function todayColor(){
	var t = new Date();
	var day = t.getDay();
	var BC = new makeBackColor();
	var TC = new makeTextColor();
	with(oBody){
		runtimeStyle["background"] = BC[day];
		runtimeStyle["color"] = TC[day];
	}
}
function showCaps(){
	var sTempStr;
	with(oBody){
	sTempStr = 'width		= ' + width + '\n' +
		'height		= ' + height	+ '\n' +
		'availWidth		= ' + availWidth + '\n' +
		'availHeight	= ' + availHeight	+ '\n' +
		'bufferDepth	= ' + bufferDepth + '\n' +
		'colorDepth		= ' + colorDepth + '\n' +
		'connectionType	= ' + connectionType + '\n' +
		'cookieEnabled	= ' + cookieEnabled	 + '\n' +
		'cpuClass		= ' + cpuClass + '\n' +
		'platform		= ' + platform + '\n' +
		'javaEnabled	= ' + javaEnabled + '\n' +
		'systemLanguage	= ' + systemLanguage + '\n' +
		'userLanguage	= ' + userLanguage + '\n';
	}
	window.alert(sTempStr);
}
function showThisTag( N ){
	var x = F[ "FLD" + N ];
	var y = F[ "H5"	 + N ];
	if (x){
		x.style.display = (x.style.display == "none") ? "" : "none";
	}
	if (y){
		y.style.display = (y.style.display == "none") ? "" : "none";
	}
}
function addAddFavoriteFolder(){
	var ua = window.navigator.userAgent ;
	var msie = ua.indexOf ( "MSIE " ) ;
	if (( msie >= 0 ) &&
		( 4 <= parseInt(ua.substring(msie+5, ua.indexOf( ".", msie ))) )){
		var strMsg = "";
		strMsg += "<P align='center'><U><SPAN class='CREDIT' ";
		strMsg += "onclick='window.external.AddFavorite(location.href,document.title);'>";
		strMsg += "Add this page to your favorites</SPAN></U></P>";
		document.write(strMsg);
	}
}
function OnMouse(){
	var e = window.event.srcElement;
	with(e.style){
		color = "lime";
		cursor = "hand";
	}
}
function OutMouse(){
	var e = window.event.srcElement;
	with(e.style){
		color = "";
		cursor = "";
	}
}

