function disable(id) {
	var control = window.document.getElementById(id);
	if(control)
		control.disabled = true;
}

function popWin(url, name, features) {
	var win = window.open(url, name, features);
	win.focus();
}

function popGeneric(url) {
	popWin(url, "generic", "height=420,width=500,resizable=1,scrollbars=1,menubar=1,toolbar=1,location=1,status=1");
}

function popForgot(url) {
	popWin(url, "forgot", "resizable,height=160,width=310");
}

function say(s) {
	alert(s);
	return false;
}

function swapOrgImg(src) {
	document.orgImg.src = src;
}

function swapFrImg(src) {
	document.frImg.src = src;
}

function checkOtherRadio() {
	var el = document.getElementById("otherRadio");
	el.checked = true;
}

function otherRadioIsChecked() {
	return document.getElementById("otherRadio").checked;
}

function toggleChecks() {
	var el = document.donForm.checks;
	if (el) {
		var toggles = document.donForm.toggles;
		var status = (toggles.value % 2 == 0) ? true : false;
		if (el.length)
			for (var i = 0; i < el.length; i++) el[i].checked = status;
		else
			el.checked = status;
		toggles.value++;
	}
}

function getAnswerEl(x) {
	var el = document.getElementById("answer" + x);
	return el;
}

function getFocus(el) {
	if (el.type == "text" || el.type == "textarea" || el.type == "password" || el.type == "file") el.select(); 
	if (el.type != "hidden") el.focus();
}

function toggleFAQ(el) {
	var x = 1;
	var ans = getAnswerEl(x);
	if (el.checked) {
		while(ans) {
			ans.style.display = "inline";
			ans = getAnswerEl(++x);
		}
	}
	else {
		while(ans) {
			ans.style.display = "none";
			ans = getAnswerEl(++x);
		}	
	}
}

function toggleAnswer(x) {
	var el = getAnswerEl(x);
	if (el.style.display == "inline") el.style.display = "none";
	else el.style.display = "inline";
}

function submitForm(action) {
	document.donForm.action.value = action;
	document.donForm.submit();
}

function getCheckedValues() {
	var el = document.donForm.checks;
	var s = "";
	if(el.length) {
		for (var i = 0; i < el.length; i++) {
			if (el[i].checked) s += "," + el[i].value;
		}
	} else {
		if (el.checked) s += "," + el.value;
	}
	return s.substring(1);
}
