// javascript functions
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

// jquery functions
$(document).ready(function() {
	
	var type_id = $("select#location_type").val();
	var parent_id = $("select#parent_id").val();
	
	if (type_id < 2) { $("p.p_parent_id").css({ display:"none" }); }
	
	$("span#sub_location_cage").load("/phpscripts/real_estate_load_sub_locations.inc.php?location_type=" + parent_id);
	
	$("#new_location").focus();
	
	
	// functions
	
	$("select#location_type").change(function() {
		var selected_element = $(this).val();
		if (selected_element > 1) {
			$("p.p_parent_id").css({ display:"inline" });
			$("span#location_cage").load("/phpscripts/real_estate_load_locations.inc.php?location_type=" + selected_element);
		} else {
			$("p.p_parent_id").css({ display:"none" });
		}
		
		$("p.p_other_locations").css({ display:"none" });
	});
	
	$("select#parent_id").livequery("change", function() {
		var selected_element = $(this).val();
		// alert(selected_element);
		$("span#sub_location_cage").load("/phpscripts/real_estate_load_sub_locations.inc.php?location_type=" + selected_element);
		$("p.p_other_locations").css({ display:"inline" });
	});
	
	$("select#province").change(function() {
		var selected_element = $(this).val();
		// alert(selected_element);
		$("#city_cage").load("/phpscripts/real_estate_load_city.inc.php?province=" + selected_element);
	});
	
	/*
	$("#menu_top #languages img").fadeTo("fast", 0.50);
	
	// functions
	
	$('#menu_top #languages a img').hover(function() {
		$(this).fadeTo("fast", 1);
	}, function() {
		$(this).fadeTo("fast", 0.50);
	});
	*/
	
	try {
		var pageTracker = _gat._getTracker("UA-6033135-11");
		pageTracker._trackPageview();
	} catch(err) {}
});
