// ®RM500¯®PL100¯®TS3,6,9,12,15,18¯
myprog="/cgi-bin/billopts.exe";

var httpOb=false;

/* ®MDBO¯---------- SERVER_SEND ---------®MDNM¯ÿ20*/
function server_send(what) {
var httpOb=false;
try { httpOb = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) {
	try { httpOb = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) {
		try { httpOb = new XMLHttpRequest(); }
		catch (e) {
			alert("Your browser does not support XMLHTTP that is required for communication with the server to display the proper options available for the selected year.\n\nXMLHTTP has become a standard for transmitting data to Web pages with modern browsers. It has been included in the W3C proposed standards.  W3C is the international organization that sets standards for the World Wide Web.\n\nUnfortunately, Apple can be a bit of a problem. Browsers for Apple have been slower in implementing newer features and standards for the Web.  If you get this message, try updating your browser to the latest version.");
			return false;
			}
		}
	}
httpOb.open("POST",myprog,false);
httpOb.send(what);
if (httpOb.responseText.indexOf("ERROR",0)!=-1)
	alert(httpOb.responseText);
return httpOb.responseText;
}

/* ®MDBO¯---------- LOAD_STATUS -------®MDNM¯ */
function load_status(year) {
var what="0";
var tstr="YEAR="+year+"&WHAT="+what+"&date="+Date();
var retstr=server_send(tstr);
var got=retstr.split(String.fromCharCode(9));
// document.all.STATUS.length=0;
document.getElementById('STATUS').length=0;
var opt=document.createElement("OPTION");
opt.text="ALL";
document.getElementById('STATUS').options.add(opt);
if ( (got) && (got.length>0) ) {
	for (var i=0;i<got.length;i++) {
		if (got[i].length>0) {
			var opt=document.createElement("OPTION");
			opt.text=got[i];
			document.getElementById('STATUS').options.add(opt);
			}
		}
	}
}

/* ®MDBO¯--------- SWITCH_STATUS --------®MDNM¯ */
function switch_status() {
// var i=document.all.YEAR.selectedIndex;
// load_status(document.all.YEAR.options[i].text);
var i=document.getElementById('YEAR').selectedIndex;
load_status(document.getElementById('YEAR').options[i].text);
}


/* ®MDBO¯---------- LOAD_BEATS ----------®MDNM¯ */
function load_beats(year) {
var what="1";
var tstr="YEAR="+year+"&WHAT="+what+"&date="+Date();
var retstr=server_send(tstr);
var got=retstr.split(String.fromCharCode(9));
// document.all.BEATS.length=0;
document.getElementById('BEATS').length=0;
var opt=document.createElement("OPTION");
opt.text="ALL";
opt.value="";
document.getElementById('BEATS').options.add(opt);
if ( (got) && (got.length>0) ) {
	for (var i=0;i<got.length;i++) {
		if (got[i].length>0) {
			var opt=document.createElement("OPTION");
			opt.text=got[i];
			opt.value=String.fromCharCode(65+i);
			document.getElementById('BEATS').options.add(opt);
			}
		}
	}
}

/* ®MDBO¯--------- SWITCH_BEATS --------®MDNM¯ */
function switch_beats() {
// var i=document.all.YEAR.selectedIndex;
// load_beats(document.all.YEAR.options[i].text);
var i=document.getElementById('YEAR').selectedIndex;
load_beats(document.getElementById('YEAR').options[i].text);
}

/* ®MDBO¯---------- LOAD_CALS----------®MDNM¯ */
function load_cals(year) {
var what="2";
var tstr="YEAR="+year+"&WHAT="+what+"&date="+Date();
var retstr=server_send(tstr);
var got=retstr.split(String.fromCharCode(9));
// document.all.CALS.length=0;
document.getElementById('CALS').length=0;
var opt=document.createElement("OPTION");
if (got.length==0)
	return;
if ( (got) && (got.length>0) ) {
	for (var i=0;i<got.length;i++) {
		if (got[i].length>0) {
			my_item=got[i].split(String.fromCharCode(1));
			var opt=document.createElement("OPTION");
			opt.text=my_item[0];
			opt.value=my_item[1];
			document.getElementById('CALS').options.add(opt);
			}
		}
	}
}

/* ®MDBO¯--------- SWITCH_CALS --------®MDNM¯ */
function switch_cals() {
// var i=document.all.YEAR.selectedIndex;
// load_cals(document.all.YEAR.options[i].text);
var i=document.getElementById('YEAR').selectedIndex;
load_cals(document.getElementById('YEAR').options[i].text);
}

/* ®MDBO¯--------- SWITCH_ALL ------®MDNM¯ */
function switch_all() {
switch_status();
switch_beats();
switch_cals();
}

/* ®MDBO¯------- LOAD_ALL -----®MDNM¯ */
function load_all() {
var i=document.getElementById('YEAR').selectedIndex;
var year=document.getElementById('YEAR').options[i].text;
load_status(year);
load_beats(year);
load_cals(year);
}

//