if (typeof(Option)+"" != "undefined") v=true;
if(v){a=new Array(60);aln=22;}
function getFormNum (formName) {
	var formNum =-1;
	for (i=0;i<document.forms.length;i++){
		tempForm = document.forms[i];
		if (formName == tempForm) {
			formNum = i;
			correctForm = tempForm;
			break;
		}
	}
	return formNum;
}

function getElementNumbyId(FormName,ElementName) {
	var ElementNum =-1;
	var FormIndex = getFormNum(FormName);
	for (i=0;i<document.forms[FormIndex].elements.length;i++) {
		if(document.forms[FormIndex].elements[i].id.match(ElementName)) {
			ElementNum=i;	
		}
    }
    return ElementNum;
}

function jmp(form, elt)
// The first parameter is a reference to the form.
{
	if (form != null) {
		with (form.elements[elt]) {
			if (options[selectedIndex].value != "NULL") {
				//location = options[selectedIndex].value;
				parts = new Array();
				parts=options[selectedIndex].value.split("|");
				form.elements[getElementNumbyId(form,"cnct_school")].value=parts[0];
				form.elements[getElementNumbyId(form,"cnct_person")].value=parts[1];
				form.elements[getElementNumbyId(form,"cnct_email")].value=parts[2];
			}
		}
	}
}

var catsIndex = -1;
var itemsIndex;
var subItemsIndex;
function newCat(){
	catsIndex++;
	a[catsIndex] = new Array();
 	itemsIndex = -1;
}

function O(txt,url) {
	itemsIndex++;
	a[catsIndex][itemsIndex] = new Array();
	a[catsIndex][itemsIndex].text = txt;
	a[catsIndex][itemsIndex].value = url;
	subItemsIndex = 0;
}

function OO(txt,url) {
	a[catsIndex][itemsIndex][subItemsIndex] = new myOptions(txt,url);
	subItemsIndex++;
}

function myOptions(txt,url){
	this.text = txt;
	this.value = url;
}

function relate(formName,elementNum,j) {
	// relate first to second (and third) menus
	// ie change first menu, changes second, then change third
	//
	if(v){
		var formNum = getFormNum(formName);
		if(document.forms[formNum].elements[elementNum].value != "NULL") {
			if (formNum>=0) {
				with (document.forms[formNum].elements[elementNum]) {
					for(i=options.length-1;i>0;i--) options[i] = null; // null out in reverse order (bug workarnd)
					options[0]= new Option("Please select...","NULL");
					for(i=0;i<a[j].length;i++){
						options[i+1] = new Option(a[j][i].text,a[j][i].value);
					}
				}
			document.forms[formNum].elements[elementNum].selectedIndex=0;
			}
		}
	}
}

function relate2(formName,elementNum,j,fromRelate) {
	if(v){
		var formNum = getFormNum(formName);
		if(document.forms[formNum].elements[elementNum].value != "NULL") {
			if (formNum>=0) {
				// find first menu's selection
				// fromRelate means "coming from relate function?"
				//   then increment formNum so k refers to first form,
			 	//   not the nonexistent one before it (-1)
				if (fromRelate) formNum++; // assumes forms follow each other
			    k=0;
				with (document.forms[formNum].elements[elementNum+1]) {
					for(i=options.length-1;i>0;i--) options[i] = null; // null out in reverse order (bug workarnd)
					options[0]= new Option("Please select...","NULL");
					for(i=0;i<a[k][j-1].length;i++){
						options[i+1] = new Option(a[k][j-1][i].text,a[k][j-1][i].value);
					}
				}
			document.forms[formNum].elements[elementNum+1].selectedIndex=0;
			}
		}
	}
}

if (v) { // ns 2 fix
	//MENU DATA
	var num_nbsp1 = 25; //number of spaces in the NULL option for SELECT 1
	var nbspoption1 = "";
	for (x=0; x<num_nbsp1; x++) {
		nbspoption1 = nbspoption1 + ".";
	}
	var num_nbsp2 = 40; //number of spaces in the NULL option for SELECT 2
	var nulloption2 = "";
	var nbspoption2 = "";

	for (x=0; x<num_nbsp2; x++) {
		nulloption2 = nulloption2 + ".";
		nbspoption2 = nbspoption2 + ".";
	}

	var num_nbsp3 = 65; //number of spaces in the NULL option for SELECT 3
	var nulloption3 = "";
	var nbspoption3 = "";

	for (x=0; x<num_nbsp3; x++) {
		nulloption3 = nulloption3 + ".";
		nbspoption3 = nbspoption3 + ".";
	}
	newCat();
	applySchoolList();
} // if (v)


