/**
 * Some javascript functions used in forms for Silverback
 * Make sure you include prototype.js!
**/

/**
 * This function toggles state and region form fields depending on if the country selected is domestic or international
 * @param country_selector the id of the country selector dropdown form field
 * @param state_selector the id of the state selector dropdown form field
 * @param state_div the id of the div element that the state dropdown is in
 * @param region_textbox the id of the region textbox form field
 * @param region_div the id of the div element that the region textbox is in
**/

function toggleStateRegion(country_selector, state_selector, state_div, region_textbox, region_div){
  if ($(country_selector).value != 'US' && $(country_selector).value != ""){
    Element.hide(state_div);
    $(state_selector).value = "";
    Element.show(region_div);
  }else{
    Element.hide(region_div);
    $(region_textbox).value = "";
    Element.show(state_div);
  }
}

function showHide(button, div_selector){
    Element.hide(button);
    Element.show(div_selector);
}
