var searchschool = "";
var loc = "";
var program = "";
var degree = "";

function updateSearch() {
	loc = document.search.location.value;
	program = document.search.program.value;
	degree = document.search.degree.value;
	updateLink();
}

function updateLink() {
	searchschool = getObj("search-btn");
	var target = "";
	if (loc!=0) {
		target = loc + "/";
	}
	if (program!=0 && degree!=0) {
		target += program+"-"+degree;
	}else if (program!=0) {
		target += program;
	}else if (degree != 0) {
		target += degree;
	}else {
		target += "index";
	}
	if (loc==0 && program==0 && degree==0) {
		target = "search";
	}

	if (searchschool!=null) {
		searchschool.href = "/"+target+".html";
	}
}

function updateCity(target) {
	var state = target.substring(0,target.indexOf("/"));
	var page = target.substring(target.lastIndexOf("/")+1,target.length);
	if (document.citySelect.city.value=="0") {
		self.location = "/"+state+"/"+"index.html";
	} else {
		self.location = "/"+state+"/"+document.citySelect.city.value+"/"+page+".html";
	}
}

function gotoLink(id, type, position) {
	document.link.id.value = id;
	document.link.type.value = type;
	document.link.position.value = position;
	document.link.submit();
}

function gotoSchool(abbrv, type, position) {
	document.link.school.value = abbrv;
	document.link.type.value = type;
	document.link.position.value = position;
	document.link.submit();
}

function getObj(name)
{
	if (document.getElementById)
	{
		if (document.getElementById(name)!=null) {
			return document.getElementById(name);
			return;
		}
	}
	else if (document.all)
	{
		if (document.all[name]!=null) {
			return document.all[name];
		}
	}
	else if (document.layers)
	{
		if (document.layers[name]!=null) {
			return document.layers[name];
		}
	}
	return null;
}

var program_status = new Array(11);

function init() {
	for (i=1;i<=10;i++) {
		program_status[i] = 'none';
	}
}
	
function programAction(id) {
	if (id<program_status.length) {
		if (program_status[id]=='none') {
			program_status[id]='block';			
			getObj('program-box-' + id).style.display = 'block';
			getObj('program-ctrl-' + id).innerHTML = 'Hide Programs';
		} else {
			program_status[id]='none';
			getObj('program-box-' + id).style.display = 'none';			
			getObj('program-ctrl-' + id).innerHTML = 'Show Programs';
		}			
	}
}

function programDisplay() {
	void(0);
}
	
init();

