

/* ----- TOGGLE LISTS ----- */
function toggle(element, id) {
	$("#" + id).toggle();
	
	if ($("#" + id).css("display") == "block") { $(element).children("img").attr("src", "templates/images/list_open.png") }
	else { $(element).children("img:first").attr("src", "templates/images/list_closed.png"); }
}



/* ----- STATE POPUP LINKS ----- */
function init_state_popups() {
	$("area").colorbox({ 
				title:	"Choose a City", 
				speed:	2000,
				scrolling: false,
				width: "700px",
				onComplete:  function() {  
					$.fn.colorbox.resize();
				}
			});
}




/* ------ SHOW / HIDE CITY / STATE LABELS ----- */
function show_label(id) { $("#" + id).css("display","block"); }
function hide_label(id) { $("#" + id).css("display","none"); }




/* ----- CREATE BUILDING LINKS FOR A CITY ----- */
function get_buildings(el, state, city) {
	if ($("#cities").length > 0) { $("#cities").remove(); }
	
	var xpos = $(el).parent().css("left");
	var ypos = $(el).parent().css("top");
	
	$.get("templates/get_city.php", 
			{"state":state,"city":city},
			function(response) {
				$("#cboxLoadedContent").append("<div id='cities' style='position: absolute; padding: 5px; top: " + ypos + "; left:" + xpos + "; color: black; background: white;'>" + response + "</div>");
				$("#cities").click( function() { $("#cities").remove(); });
			});
}







