function init(){
		$("#state").bind("change", StateClicked);	
		//$("#CategoryID").bind("change", CategoryClicked);
}
	
//function CategoryClicked(){	
//		$('#property_type').html($('#loadingicon').html());
//		var options = {
//			url: 'httprequest.php?page=advancedpropertytype&cate=' + $('#CategoryID').fieldValue() ,
//			success: function(data) {
//			 	$('#property_type').html(data);									
//			}
//		};
//		
//		$('#CategoryID').ajaxSubmit(options);		
//
//}
	
function StateClicked(){
		$('#Suburb').html($('#loadingicon').html());
		var options = {
			url: 'httprequest.php?page=getcities&state=' + $('#state').fieldValue(),
			success: function(data) {
			 	$('#Suburb').html(data);									
			}
		};
		
		$('#state').ajaxSubmit(options);
		
}


//Added by: Carlo DATE: Feb. 4, 2008
function Area_Code(){
	var sel = document.getElementById("state");
	if(sel.options[sel.selectedIndex].value == 'act'){
		document.getElementById("areacode").value="02";
	} else if(sel.options[sel.selectedIndex].value == 'ACT'){
		document.getElementById("areacode").value="02";
	}else if(sel.options[sel.selectedIndex].value == 'nsw'){
		document.getElementById("areacode").value="02";
	}else if(sel.options[sel.selectedIndex].value == 'NSW'){
		document.getElementById("areacode").value="02";
	}else if(sel.options[sel.selectedIndex].value == 'vic'){
		document.getElementById("areacode").value="03";
	}else if(sel.options[sel.selectedIndex].value == 'VIC'){
		document.getElementById("areacode").value="03";
	}else if(sel.options[sel.selectedIndex].value == 'tas'){
		document.getElementById("areacode").value="02";
	}else if(sel.options[sel.selectedIndex].value == 'TAS'){
		document.getElementById("areacode").value="02";
	}else if(sel.options[sel.selectedIndex].value == 'qld'){
		document.getElementById("areacode").value="07";
	}else if(sel.options[sel.selectedIndex].value == 'QLD'){
		document.getElementById("areacode").value="07";
	}else if(sel.options[sel.selectedIndex].value == 'wa'){
		document.getElementById("areacode").value="08";
	}else if(sel.options[sel.selectedIndex].value == 'WA'){
		document.getElementById("areacode").value="08";
	}else if(sel.options[sel.selectedIndex].value == 'sa'){
		document.getElementById("areacode").value="08";
	}else if(sel.options[sel.selectedIndex].value == 'SA'){
		document.getElementById("areacode").value="08";
	}else if(sel.options[sel.selectedIndex].value == 'nt'){
		document.getElementById("areacode").value="08";
	}else if(sel.options[sel.selectedIndex].value == 'NT'){
		document.getElementById("areacode").value="08";
	}
}

$(document).ready( init );
