var myrules = {
	'#region' : function(element){
		element.onchange = function(){
      if(this.value == 0) {
        $('country').value = 0;
        $('country').disabled = true;
        $('location').value = 0;
        $('location').disabled = true;
      } else {
        $('country').disabled = false;
        $('country').innerHTML = "";
        var opt = document.createElement('option');
        opt.value = 0;
        opt.innerHTML = "all countries...";
        $('country').appendChild(opt);
        search_countries[this.value].each(function(c){
          var opt = document.createElement('option');
          opt.value = c[1];
          opt.innerHTML = c[0];
          $('country').appendChild(opt);
        });
        $('location').value = 0;
        $('location').disabled = true;
      }
		}
	},
	'#country' : function(element){
		element.onchange = function(){
      if(this.value == 0) {
        $('location').value = 0;
        $('location').disabled = true;
      } else {
        $('location').disabled = false;
        $('location').innerHTML = "";
        var opt = document.createElement('option');
        opt.value = 0;
        opt.innerHTML = "all locations...";
        $('location').appendChild(opt);
        search_locations[this.value].each(function(c){
          var opt = document.createElement('option');
          opt.value = c[1];
          opt.innerHTML = c[0];
          $('location').appendChild(opt);
        });
        
      }
		}
	},
	'#holiday_type' : function(element){
		element.onchange = function(){
      if(this.value == 0) {
        $('activity_type').value = 0;
        $('activity_type').disabled = true;
      } else {
        $('activity_type').disabled = false;
        $('activity_type').innerHTML = "";
        var opt = document.createElement('option');
        opt.value = 0;
        opt.innerHTML = "all activites...";
        $('activity_type').appendChild(opt);
        search_activities[this.value].each(function(c){
          var opt = document.createElement('option');
          opt.value = c[1];
          opt.innerHTML = c[0];
          $('activity_type').appendChild(opt);
        });
        
      }
		}
	}
};

Behaviour.register(myrules);
