﻿

function loadStates(countryID, loadListings, format, stateName) {
    var html = ajaxServices.bindStates(countryID, format);

    jQuery('.cmdList')[0].innerHTML = html;

    if (loadListings) {
        loadStateListings(format, 0, countryID, stateName)
    }
}

function loadStateListings(format, stateID, countryID, stateName) {
    // show the loading panel
    jQuery('.loadingPanelWrapper').show();

    setTimeout(function() {
        var html = ajaxServices.bindStateListings(format, stateID, countryID);

        jQuery('.breadcrumb')[0].innerHTML = "Listings for " + stateName;
        jQuery('.ctrlList')[0].innerHTML = html;

        // hide the loading panel
        jQuery('.loadingPanelWrapper').hide();
    }, 2000);
}

function loadAlphabeticalListings(format, letter, countryID) {
    // show the loading panel
    jQuery('.loadingPanelWrapper').show();

    setTimeout(function() {
    var html = ajaxServices.bindAlphabeticalListings(format, letter, countryID);

        jQuery('.breadcrumb')[0].innerHTML = "Listings for Alphabetical " + letter;
        jQuery('.ctrlList')[0].innerHTML = html;

        // hide the loading panel
        jQuery('.loadingPanelWrapper').hide();
    }, 2000);
}


function Failure() {
    alert("oops, an error has occured.");
}

var ajaxServices;
jQuery(function() {
    ajaxServices = new AjaxServices();
});
 
