
	function delAttribute(selected, available){
		availableList = document.getElementById(selected);
		selectedList = document.getElementById(available);
		
		var selIndex;
		selIndex = selectedList.selectedIndex;
		if(selectedList.length == 0 || selIndex < 0 ) {
			return;
		}
		else {
			availableList.appendChild(selectedList.options.item(selIndex));

				FillChoosen(selected, available);
		}
		
		SortOptions(availableList);
		
		availableList.options.item(0).selected = true;
	}


	function addAttribute(selected, available){
		availableList = document.getElementById(selected);
		selectedList = document.getElementById(available);

		var addIndex = availableList.selectedIndex;
		if(addIndex < 0) return;
		selectedList.appendChild(availableList.options.item(addIndex));
		
		if(addIndex == 0){
			availableList.options.item(0).selected = true;
			}
		else {
			availableList.options.item(addIndex-1).selected = true;
		}
			
		FillChoosen(selected, available);
		
		SortOptions(selectedList);
		
		selectedList.options.item(0).selected = true;
	}
	
	
	
	function delAll(selected, available){
		availableList = document.getElementById(selected);
		selectedList = document.getElementById(available);
		/* NATASCHA */
		//delete all selected from hidden
		//if (available == 'fish' || available == 'area' || available == 'areaspec') {
			document.getElementById('choosen' + available).value = '';
		//}
		/* NATASCHA */
		var len = selectedList.length -1;
		for(i=len; i>=0; i--){
			availableList.appendChild(selectedList.item(i));
		}
		
		SortOptions(availableList);
	}
	
	function addAll(selected, available){
		availableList = document.getElementById(selected);
		selectedList = document.getElementById(available);

		var len = availableList.length -1;
		for(i=len; i>=0; i--){
			selectedList.appendChild(availableList.item(i));
		}
		
		FillChoosen(selected, available);
		
		SortOptions(selectedList);
	}

	function FillChoosen( selected, available ){
	
		availableList = document.getElementById(selected);
		selectedList = document.getElementById(available);
	
		var choosen = document.getElementById('choosen' + available);
		choosen.value = '';
		
		for(i=0;i<selectedList.length;i++)
		{
			var addvalue = selectedList.options.item(i).value; 
			if (choosen.value == ''){
				choosen.value = addvalue + ',';
			} else {
				choosen.value = choosen.value + addvalue + ',';
			}
		}
	}

	function SortOptions(list) {
	  	
		var items = list.options.length;
	  	
		// create array and make copies of options in list
		var tmpArray = new Array(items);
	  	for ( i=0; i<items; i++ ){
	    	tmpArray[i] = new Option(list.options[i].text,list.options[i].value);
		}
	  	
		// sort options using given function
	  	tmpArray.sort(compareOptionText);
	  	
		// make copies of sorted options back to list
	  	for ( i=0; i<items; i++ ){
	    	list.options[i] = new Option(tmpArray[i].text,tmpArray[i].value);
		}
	}
	
	function compareOptionText(a,b) {
		/*
		* return >0 if a>b
		*         0 if a=b
		*        <0 if a<b
		*/
		// textual comparison
		return a.text!=b.text ? a.text<b.text ? -1 : 1 : 0;
	}

	function initForm() {
		if (document.getElementById('list_1')) {
			document.getElementById('choosenfish').value = '';
			document.getElementById('choosenarea').value = '';

			document.getElementById('list_1').onclick = function () {addAttribute('list_1' , 'fish');};
			document.getElementById('fish').onclick = function () {delAttribute('list_1', 'fish');};
			document.getElementById('copyList_fish').onclick = function () {addAll('list_1', 'fish');};
			document.getElementById('emptyList_fish').onclick = function () {delAll('list_1', 'fish');};
	
			document.getElementById('list_2').onclick = function () {addAttribute('list_2' , 'area');};
			document.getElementById('area').onclick = function () {delAttribute('list_2', 'area');};
			document.getElementById('copyList_area').onclick = function () {addAll('list_2', 'area');};
			document.getElementById('emptyList_area').onclick = function () {delAll('list_2', 'area');};
			
		}
	}
	
/**********************************************************************************   
* popup window                                                                       *
***********************************************************************************/
var w = screen.availWidth;
var h = screen.availHeight;
var popW = 520, popH = 507;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;

function popup(file) {
open(file,'window','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos +',toolbar=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1');
}

function ShowHideOverig(namelijk) {
	//alert(document.form_email.required_soort_bedrijf1.selectedIndex);
	if (document.form_email.required_soort_bedrijf1.selectedIndex == 7){
		document.getElementById('overigsrt').style.display = "block";
		document.form_email.soort_bedrijf_overig.value = namelijk
			}
	else {
		document.getElementById('overigsrt').style.display = "none";
		document.form_email.soort_bedrijf_overig.value = ""
		}
	}
	
function ClearOverigsrt(namelijk) {
	if (document.form_email.soort_bedrijf_overig.value == namelijk){
		document.form_email.soort_bedrijf_overig.value = "";
			}
	}