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


function override_feature(id) {
	
	if(document.getElementById("feature_" + id + "_override").checked)
	{
		var tmpElement =  document.getElementById("feature_" + id + "_prevent_override");
		if (tmpElement != null) {
			tmpElement.disabled = false
		}
		tmpElement =  document.getElementById("feature_" + id + "_value");
		if (tmpElement != null) {
			tmpElement.disabled = false
		}
		tmpElement =  document.getElementById("feature_" + id + "_value_0");
		if (tmpElement != null) {
			tmpElement.disabled = false
			tmpElement.checked = null
		}
		tmpElement =  document.getElementById("feature_" + id + "_value_1");
		if (tmpElement != null) {
			tmpElement.disabled = false
			tmpElement.checked = true
		}
	}
	else
	{
		document.getElementById("feature_" + id + "_prevent_override").disabled=true;
		var tmpElement =  document.getElementById("feature_" + id + "_prevent_override");
		if (tmpElement != null) {
			tmpElement.disabled = true
			tmpElement.value = null
			tmpElement.checked = null
		}
		tmpElement =  document.getElementById("feature_" + id + "_value");
		if (tmpElement != null) {
			tmpElement.disabled = true
			tmpElement.value = null
			tmpElement.checked = null
		}
		tmpElement =  document.getElementById("feature_" + id + "_value_0");
		if (tmpElement != null) {
			tmpElement.disabled = true
			tmpElement.value = null
			tmpElement.checked = null
		}
		tmpElement =  document.getElementById("feature_" + id + "_value_1");
		if (tmpElement != null) {
			tmpElement.disabled = true
			tmpElement.value = null
			tmpElement.checked = null
		}
	}
}


function activate_select(id) {
	
	if(document.getElementById("select_" + id + "_checked").checked)
	{
		var tmpElement =  document.getElementById("select_" + id + "_include_all_0");
		if (tmpElement != null) {
			tmpElement.disabled = false
			tmpElement.checked = false
		}
		tmpElement =  document.getElementById("select_" + id + "_include_all_1");
		if (tmpElement != null) {
			tmpElement.disabled = false
			tmpElement.checked = true
		}
		tmpElement =  document.getElementById("select_" + id + "_details");
		if (tmpElement != null) {
			tmpElement.className="hidden"
		}
	}
	else
	{
		var tmpElement =  document.getElementById("select_" + id + "_include_all_0");
		if (tmpElement != null) {
			tmpElement.disabled = true
			tmpElement.checked = false
		}
		tmpElement =  document.getElementById("select_" + id + "_include_all_1");
		if (tmpElement != null) {
			tmpElement.disabled = true
			tmpElement.checked = true
		}
		
		tmpElement =  document.getElementById("select_" + id + "_details");
		if (tmpElement != null) {
			tmpElement.className="hidden"
		}
		
		clear_all_options("select_" + id + "_select_option_ids");
	}
}

function clear_all_options(id) {
	var tmpElement =  document.getElementById(id);
	if (tmpElement != null) {
		for (var i=0; i < tmpElement.options.length; i++) {
			tmpElement.options[i].selected = false;
		}
	}
}