	/**
	 * opens the treeparam dialog 
	 */
 	function openParamTree(type, componentName) {
 		var component = document.getElementById(componentName);
		var qwForm = component.form;
		
		qwForm.selectedComponentName.value = componentName;
		qwForm.selectedPropType.value = type;
		qwForm.selectedPropValue.value = component.value;
		editedComponent = componentName;

	 	var url = "openQuestionWizParameterTree.do?";
 		for(i=0; i < qwForm.length; i++) {
 			if(qwForm.elements[i].value != "") {
	 			url += qwForm.elements[i].name + "=" + qwForm.elements[i].value + "&";
 			}
 		}
		url += "submit.x=";

 		openWin(url, "openTree", 700, 500, true);
 		
	}

	/**
	 * selects a filter
	 * paramName : the name of the UI component that represent the filter
	 * paramValue : the value that needs to be set in the component.
	 * 
	 */
	function selectParameter(paramValue,displayedValue, param, popupWindow) {
		window.focus();
		popupWindow.close();
		
		var numOptions = document.getElementById(param).options.length;
		var foundIndex = -1;
		var i=0;
		var bPropertyExists = false;
		for(i=0; i < numOptions && !bPropertyExists; i++ ) {
			if(document.getElementById(param).options[i].text == displayedValue ) {
				bPropertyExists = true;
				foundIndex = i;
			}
		}

		// add property at the 2nd last position (just before the -- more -- option).
		if(!bPropertyExists) {
			foundIndex = numOptions - 1;
			var props = document.getElementById(param);
			var po = props.options[numOptions-1];
			props.options[numOptions] = new Option(po.text, po.value);
			props.options[numOptions-1] = new Option(displayedValue, paramValue);
		}

		document.getElementById(param).selectedIndex = foundIndex;
		// Force triggering the onChange event (for the disease combo)
		if(document.getElementById(param).onchange != null) {
			document.getElementById(param).onchange();
		}
	}
		
