var changed = 0;

function markChange() {
	++changed;
}

function didChange() {
	if(changed) {
		return confirm('You made changes to this form. Continue without saving changes? (select cancel and hit the save button at the bottom of the form to save changes)');
	}
	else {
		return true;
	}
}

function initOnChange() {
	var form = document.getElementById('theform');
	
	if(form) {
		for(var i = 0; i < form.elements.length; ++i) {
			form.elements[i].onchange = markChange;
		}
	}
}

function toggleVisibility(pane){
	var arrow = document.getElementById(pane + '_arrow');
	var div = document.getElementById(pane);
	if(div) {
		if(arrow) {
			// default state is closed
			if(!arrow.getAttribute('state') || arrow.getAttribute('state') == 'closed'){
				arrow.setAttribute('state','open');
				arrow.src = '/images/arrows_8x6_gray_open-trans.png';
				Effect.BlindDown(pane, { duration:.3 });
			}
			else {
				arrow.setAttribute('state','closed');
				arrow.src = '/images/arrows_6x8_gray_closed-trans.png';
				Effect.BlindUp(pane, { duration:.3 });
			}
		}
		else {
			alert("could not find " + pane + '_arrow');
		}
	}
	else {
		alert("could not find " + pane);
	}
}
