	
	function PropertyType_ShowAnimation(){
		$('propertytype_onprocess').innerHTML = "<table width=\"100%\"><tbody><tr><td height=\"23\" align=\"center\"><img src=\"images/wait16trans.gif\" width=\"16\" height=\"16\"/></td></tr></tbody></table>";
		$('propertytype_onprocess').style.display = 'block';
		$('propertytype_onprocess').style.visibility = 'visible';
		$('propertytype_onactive').style.display = 'none';
		$('propertytype_onactive').style.visibility = 'hidden';
	}
	function PropertyType_HideAnimation(){
		$('propertytype_onprocess').style.display = 'none';
		$('propertytype_onprocess').style.visibility = 'hidden';
		$('propertytype_onactive').style.display = 'block';
		$('propertytype_onactive').style.visibility = 'visible';
	}
	
	function PropertyType_ShowResponse(transport){
		// get combo target 
		var propertyTypeTarget = $('propertytype');
		// Process response
		if (transport.status == 200){
			// Get response Xml
			var xmlResponse = transport.responseXML;
			// read Xml parent node
			var docElements = xmlResponse.getElementsByTagName('property_types');
			// Empty SelectBox
			removeAllOptions(propertyTypeTarget);
			// Add Default SelectBox Option
			addOption(propertyTypeTarget, '0', '-- Todos --');
			// Fill SelectBox with a new 
			for(var i=0;i<docElements[0].childNodes.length;i++){//percorrendo os filhos do nó
				if(docElements[0].childNodes[i].nodeType == 1){//ignorar espaços em branco
					addOption(propertyTypeTarget, docElements[0].childNodes[i].attributes[0].value, docElements[0].childNodes[i].attributes[1].value);
				}
			}
			// Hide animation
			PropertyType_HideAnimation();
		} else {
			// Hide animation
			PropertyType_HideAnimation();
		}
	}
	
	function RequestPropertyType(propertyType){
		//
		switch(propertyType.toUpperCase())
		{
			case 'ALOJAMENTO': 
				$F('searchtype_select').value = 'A';
			case 'COMERCIAL': 
				$F('searchtype_select').value = 'C';
			case 'TURISMO': 
				$F('searchtype_select').value = 'T';
		}
		// Show animation
		PropertyType_ShowAnimation();
		// Set ajax call
		var url = wServiceRequesterURL;
		var pars = 'COMMAND=REQUEST_PROPERTY_TYPE&TARGET=' + propertyType;

		var myAjax = new Ajax.Request(
			url, 
			{
				method: 'GET', 
				parameters: pars, 
				onComplete: PropertyType_ShowResponse
			});
	}
	
	function setDefaultPropertyTypeValues(){
		RequestPropertyType('alojamento');
		$('searchtype_1').checked = true;
	}
