﻿// JavaScript Document

var loadingGraphic='<img src="/assets/images/global/loading.gif">';

$(document).ready(function(){
	$("form#storeLocator").submit(function(){
		formLabelsAndValues=$("form#storeLocator").serialize();
		$("#StoreLocatorResults").html(loadingGraphic);
		$.post('/components/storeLocator/dspResults.cfm',formLabelsAndValues, function(response) {
				storeLocatorResponse(response);
		});
		return false;
	});	
});

function storeLocatorResponse(response) {
	if($("status",response).text() == "2") return;
	$("#StoreLocatorResults").replaceWith(response);
}		

function nextStores(urlLocation) {
	$("#StoreLocatorResults").html(loadingGraphic);
	$.get(urlLocation, function(response){
		$("#StoreLocatorResults").replaceWith(response);
	});
}