var idstates_row = 'states-row';
var idstates = 'states';
var idcountry = 'country';
function hideStates(hide){
  //if hide is passed true .. then hide the states row
  if(hide){
    ID(idstates_row).style.display = 'none';
  }
  else{
    ID(idstates_row).style.display = '';
  }

}

function ByID(id) {
  if (!document.getElementById) return false;
  return document.getElementById(id);
}

function ID(id) {
  if (!document.getElementById) return false;
  return document.getElementById(id);
}

function SelectIndexByID(id) {
  s=ByID(id); if (!s) return false;
  if(s.options.length==0 || !s.options.length > s.options.selectedIndex) return false;
  return s.options[s.options.selectedIndex].value;
}

function UpdateStates(){
  var country = SelectIndexByID(idcountry)
  if(country == 'Australia'){
    hideStates(false);
  }
  else
    hideStates(true);
  
}

function ValidateCompulsoryFields(){
  
  var err = '';  
  var profession=SelectIndexByID('profession');  
  var location=SelectIndexByID('location');

  if (profession == '')
    err = err + "Please nominate your profession \n";
      
  /*if (location == "")
    err = err + "Please select a location where you wish to work \n"; */
    
  if (err == '')
  {
    return 0;
  }    
  return err;
  
}

