// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function selectThumbnail(prefix, value, input) {
  document.getElementsByClassName('option').each(function(e) { e.style.backgroundColor = '#eee'; });
  $(prefix+value).style.backgroundColor = '#FBCE1E';
  $(input).value = value;
}

function selectTab(tab_nr) {
  $('tab-selection').value = tab_nr;
  li_not_selected = {'background': '#600', 'color': '#fff'};
  li_selected = {'background': '#fff', 'color': '#000'};
  li = $('tab-'+tab_nr+'-li'); // Selected li

  document.getElementsByClassName('tab').each(function(e){ (e.id == 'tab-'+tab_nr) ? Element.show(e) : Element.hide(e) });
  document.getElementsByClassName('tab-li').each(function(e) {
    if(e == li) {
      e.childNodes[0].style.backgroundColor = li_selected['background'];
      e.childNodes[0].style.color = li_selected['color'];
    } else {
      e.childNodes[0].style.backgroundColor = li_not_selected['background'];
      e.childNodes[0].style.color = li_not_selected['color'];
    }
  });
  $('tab-selection').value = tab_nr;
}
