// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function countryChanged(obj)
{
  //see if our value is one of the countries with states
  if (obj.value == "United States")
  {
    //hide the other state selects
    $("state_text").hide();
    $("state_text").name = "state_default"
    var objCAN = $("state_canada");
    objCAN.hide();
    objCAN.name = "state_canada"
    //show the us state select
    var objUS = $("state_us");
    objUS.show();
    objUS.name = "contact[state]"
  }
  else if (obj.value == "Canada")
  {
    //hide the other state selects
    $("state_text").hide();
    $("state_text").name = "state_default"
    var objUS = $("state_us");
    objUS.hide();
    objUS.name = "state_us"
    //show the canada province select
    var objCAN = $("state_canada");
    objCAN.show();
    objCAN.name = "contact[state]"
  }
  else
  {
    //hide the other state selects
    var objUS = $("state_us");
    objUS.hide();
    objUS.name = "state_us"
    objUS.selectedIndex = 0;
    var objCAN = $("state_canada");
    objCAN.hide();
    objCAN.name = "state_canada"
    objCAN.selectedIndex = 0;
    //show the text box
    $("state_text").show();
    $("state_text").name = "contact[state]"
  }
}