$(document).ready(function(){
	$("#advSearchBtn").bind("click", function(){
		switch ($("#locationadv").val()) {
			case "City and state, ZIP, or place of interest":
			case "":
				showTT(getObj("locationadv"));
				$("#locationadv").bind("keyup", function() {
					$(this).unbind("keyup");
					hideTT();
				});
				break;
			default:
				$("#ndadv").submit();
				break;
		}
	});
	$("#locationadv").bind("focus", configAdvLocation);
	$("#locationadv").bind("blur", checkAdvLocation);
	checkAdvLocation();
});

function checkAdvLocation(){ if ($("#locationadv").val() == "") { $("#locationadv").css({"color":"#999"});$("#locationadv").val("City and state, ZIP, or place of interest");$("#locationadv").bind("focus", configAdvLocation);}}
function configAdvLocation(){ $("#locationadv").val("");$("#locationadv").css({"color":"#555"});$("#locationadv").unbind("focus", configAdvLocation);$("#locationadv").focus();}

function showTT(inc){
	var tt = $("#tt");
	$(tt).hide();
	if (inc.title) {
		$("#ttcontent").html(inc.title);
		var pos = findPos(inc);
		var leftpos = pos[0];
		var toppos = pos[1];
		leftpos += (($(inc).width() - $(tt).width()) / 2);
		toppos -= ( $(tt).height() + 32 );
		$(tt).css({left: leftpos, top: toppos}).show();
	}
}
function hideTT() {
	var tt = $("#tt");
	$(tt).hide();
}

