/*function otherSchool() {
	var loc = document.getElementById('schoolloc');
	var other = document.getElementById('othercheckbox');
	
	if (other.checked == true) {
		loc.value = "999999";
		loc.readOnly = true;
		loc.style.backgroundColor = "#eee";
		loc.style.border = "1px solid #ddd";
		loc.style.color = "#aaa";
	}
	else {
		loc.value = "";
		loc.readOnly = false;
		loc.style.backgroundColor = "";
		loc.style.border = "1px solid #bbb";
		loc.style.color = "";
	}
}*/

function otherSchool() {
	var loc = document.getElementById('schoolloc');
	var other = document.getElementById('othercheckbox');
	var otherselect = document.getElementById('otherschoolloc');
	var stunum = document.getElementById('stunum');
	var randstunum = document.getElementById('randstunum');
	
	if (other.checked == true) {
		// dim school loc field & stunum field
		loc.value = "";
		loc.readOnly = true;
		loc.style.backgroundColor = "#eee";
		loc.style.border = "1px solid #ddd";
		loc.style.color = "#aaa";
		stunum.value = randstunum.value;
		stunum.readOnly = true;
		stunum.style.backgroundColor = "#eee";
		stunum.style.border = "1px solid #ddd";
		stunum.style.color = "#aaa";
		
		// display select field
		otherselect.style.display = "inline";
		
	}
	else {
		// enable school loc field & stunum field
		loc.value = "";
		loc.readOnly = false;
		loc.style.backgroundColor = "";
		loc.style.border = "1px solid #bbb";
		loc.style.color = "";
		stunum.value = "";
		stunum.readOnly = false;
		stunum.style.backgroundColor = "";
		stunum.style.border = "1px solid #bbb";
		stunum.style.color = "";
		
		// hide select field
		// display select field
		otherselect.style.display = "none";
	}
}

function selectCandidate(x,y,office) {
	x = document.getElementById(x);
	x.checked = true;
	$("."+office).css("background","#fff");
	$("."+office).css("border","1px solid #fff");
	$("."+office).css("-moz-border-radius","8px");
	$("."+office).css("-webkit-border-radius","8px");
	
	$("#"+y).css("background-color","#ffffaa");
	$("#"+y).css("border","1px solid #aaaaaa");
	$("#"+y).css("-moz-border-radius","8px");
	$("#"+y).css("-webkit-border-radius","8px");
	$("#"+y).fadeTo("fast", .65);
	$("#"+y).fadeTo("fast", 1);
}

function findLoc(url) {
	newwindow=window.open(url,"Find your school location code","menubar=no,width=600,height=500,toolbar=no,scrollbars=yes,resizeable=yes");
	if (window.focus) {newwindow.focus()}
	return false;
}

function writeLoc(loc) {
	opener.document.getElementById('othercheckbox').checked = false;
	field = opener.document.getElementById('schoolloc')
	field.value = "";
	field.readonly = false;
	field.style.backgroundColor = "";
	field.style.border = "1px solid #bbb";
	field.style.color = "";
	opener.document.ballotForm.schoolloc.value = loc;
	javascript:self.close();
}