// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function push(a, v) {
    a[a.length] = v;
}


/// form_section_toggle stuff.
/// Page must call form_section_toggle_init() helper in application_helpers.
function form_section_toggle_add_div(section, divID) {
    if (!_form_section_toggle[section]) { 
	_form_section_toggle[section] = []; 
    } 
    push(_form_section_toggle[section], divID);
}
function form_section_toggle_show_div(section, divID) {
    var a = _form_section_toggle[section];
    for (var i = 0; i < a.length; ++i) {
	if (a[i] != divID) {
	    $(a[i]).hide();
	}
    }
    $(divID).show();
}


function copy_input_to_hidden(input_id, hidden_id) {
    var iel = $(input_id);
    var hel = $(hidden_id);
    if (iel && hel) {
	hel.value = iel.value;
    }
}

