function AreaSelection( formName,areaBoxName,selectedAreaBoxName,owner,department) {
	this.form = document.forms[formName]; //naam formulier
	this.areaBox = this.form[areaBoxName]; //naam van de plaatsen box
	this.selectedAreaBox = this.form[selectedAreaBoxName]; //naam geselecteerde plaatsen box
	this.owner = owner; //owner Id voor ophalen areas
	this.department = department;  //department Id voor ophalen areas

	this.exists = function() {
		alert("areas");
	};

	this.areaSelector = function(){
		this.areaBox.disabled = true;
		this.areaBox.options.length = 0;
		this.areaBox.options[0] = new Option( 'Bezig met laden..' );
		//make ajax request
		requestURI = '/public/mod/areas.cfm?method=list&owner='+this.owner+'&department='+this.department
		http("GET", requestURI , this.areaResponse);	
	}
	
	this.areaResponse = function( obj ) {
		this.areaBox.options.length = 0;
		if(obj.length) {
			for(i=0;i < obj.length; i++) {
				this.areaBox.options[i] = new Option(obj[i].areadescription, obj[i].areadescription);
			}
		}
	};

	this.addArea = function(valueIsText) {
		var selectedOption = this.areaBox.options[this.areaBox.selectedIndex];
		var isSelected = false;
		for(y=0;y < this.selectedAreaBox.options.length; y++) {
			if(this.selectedAreaBox.options[y].value == selectedOption.value){
				isSelected = true;
			}
		}
		if( !isSelected ) {
			if(!valueIsText){
			this.selectedAreaBox.options[this.selectedAreaBox.options.length] = new Option(selectedOption.text,selectedOption.value);
			}
			else{
			this.selectedAreaBox.options[this.selectedAreaBox.options.length] = new Option(selectedOption.text,selectedOption.text);
			}
			isSelected = false;
		}
	};

	this.removeArea= function() {
		for(i=0;i < f.selected_areas.options.length; i++) {
			if( this.selectedAreaBox.options[i].selected ) {
				this.selectedAreaBox.options[i] = null;
			}
		}
	};
	this.selectAll = function( name ) {
		if(name == "selected") {
			for(i=0;i < this.selectedAreaBox.options.length ; i++) {
				this.selectedAreaBox.options[i].selected = true;
			}
		} else {
			for(i=0;i < this.areaBox.options.length ; i++) {
				this.areaBox.options[i].selected = true;
			}
		}
	};
	return this;
}
