
function LoadDirectory() {

	if ($("#nav-inner").length) {
		var navHeight = $("#nav-inner").css("height").replace("px", "");
		var contentHeight = $("#content").css("height").replace("px", "");

		if (parseInt(navHeight) < parseInt(contentHeight)) {
			$("#nav-inner").css("height", $("#content").css("height"));
		}
	}

	$("#therapist-search input[name='AppointmentDate']").datepicker();

	$(".therapist-name img").lazyload({
		placeholder: "/Content/images/grey.gif",
		effect: "fadeIn"
	});

	$("#therapist-search select[name='Product'] option:eq(0)").html("Select Below");

	// Set Autocomplete  
	$("#therapist-search input#PostalCode").autocomplete({
		minLength: 2,

		// define callback to format results  
		source: function (req, add) {
			var searchVal = $("#therapist-search input#PostalCode").val();
			var url = "/Home/GetCityState/?city=" + searchVal;

			// pass request to server  
			$.getJSON(url, req, function (data) {

				// create array for response objects  
				var suggestions = [];

				// process response  
				$.each(data, function (i, val) {
					suggestions.push(val.CityName + ", " + val.StateAbbr);
				});

				// pass array to callback  
				add(suggestions);
			});
		}
	});

	if ($("#nav-inner").length == 0) {
		$("#find-therapist").click(function () {
			$("#therapist-search").css("display", "block");
			$("#concierge-service-form").css("display", "none");
			$("#find-therapist").attr("class", "active");
			$("#concierge-service").attr("class", "");
		});

		$("#concierge-service").click(function () {
			$("#MassageTypeDescription").html("<u>Concierge Service</u><br />You enter appointment details and pay online.  GoMassage takes care of the rest.<br /> Requires 24 hour notice.");
			$("#therapist-search").css("display", "none");
			$("#concierge-service-form").css("display", "block");
			$("#find-therapist").attr("class", "");
			$("#concierge-service").attr("class", "active");
		});
	}

	if ($("#nav-secondary #concierge-service input[name='AppointmentDate']").length) {
		$("#concierge-service #ConciergeAppointmentDate").datepicker();
		$("#concierge-service input[name='Phone']").mask("999-999-9999");
		$("#concierge-service select[name='TimeStart'] option:eq(0)").html("Start Time");
	}

	$("input[name='MassageType'][value='100']").click(function () {
		$("#MassageTypeDescription").html("<u>Standard Massage</u><br />Swedish or Deep Tissue on a chair or table, one person at a time by a single therapist. Starts at $90.");
	});

	$("input[name='MassageType'][value='110']").click(function () {
		$("#MassageTypeDescription").html("<u>Couples Massage</u><br />Two people massaged in the same room, at the same time, by two therapists. Starts at $220.");
	});

	$("input[name='MassageType'][value='103']").click(function () {
		$("#MassageTypeDescription").html("<u>Pregnancy Massage</u><br />For expectant or recent mothers.<br> Starts at $100.");
	});

}

function LoadDirectoryPopUp() {
	if ($("#dialog-info-go-massage-now").length) {
		$("#dialog-info-go-massage-now").dialog({
			autoOpen: true,
			height: 'auto',
			width: '50%',
			modal: true,
			position: ['auto', 100],
			resizable: false,
			buttons: {
				'Book with GoMassage NOW': function () {
					window.location.replace("/BookGo/Start/");
				},
				'No Thanks': function () {
					window.location.replace("/BookGo/CloseDirectoryAd/");
				}
			}
		});
	}
}
