var ajaxRetail = new Array();
var ajaxComic = new Array();
function getCityRetail(form) {
    var stateRetail = form.stateRetail.options[form.stateRetail.selectedIndex].value;
    document.getElementById('cityRetail').options.length = 0;
    document.getElementById('storeRetail').options.length = 0;
    document.getElementById('addressRetail').options.length = 0;
    if (stateRetail.length > 0) {
        var index = ajaxRetail.length;
        ajaxRetail[index] = new sack();
        ajaxRetail[index].requestFile = 'includes/getInfoRetail.php?stateCode=' + stateRetail;
        ajaxRetail[index].onCompletion = function () {
            getCitiesRetail(index)
        };
        ajaxRetail[index].runAJAX()
    }
}
function getCitiesRetail(index) {
    var obj = document.getElementById('cityRetail');
    eval(ajaxRetail[index].response)
}
function getStoreRetail(form) {
    var cityRetail = form.cityRetail.options[form.cityRetail.selectedIndex].value;
    var stateRetail = form.stateRetail.options[form.stateRetail.selectedIndex].value;
    document.getElementById('storeRetail').options.length = 0;
    document.getElementById('addressRetail').options.length = 0;
    if (cityRetail.length > 0 && stateRetail.length > 0) {
        var index = ajaxRetail.length;
        ajaxRetail[index] = new sack();
        ajaxRetail[index].requestFile = 'includes/getInfoRetail.php?stateCode=' + stateRetail + '&cityCode=' + cityRetail;
        ajaxRetail[index].onCompletion = function () {
            getStoresRetail(index)
        };
        ajaxRetail[index].runAJAX()
    }
}
function getStoresRetail(index) {
    var obj = document.getElementById('storeRetail');
    eval(ajaxRetail[index].response)
}
function getAddrRetail(form) {
    var storeRetail = form.storeRetail.options[form.storeRetail.selectedIndex].value;
    var cityRetail = form.cityRetail.options[form.cityRetail.selectedIndex].value;
    var stateRetail = form.stateRetail.options[form.stateRetail.selectedIndex].value;
    document.getElementById('addressRetail').options.length = 0;
    if (cityRetail.length > 0 && storeRetail.length > 0 && stateRetail.length > 0) {
        var index = ajaxRetail.length;
        ajaxRetail[index] = new sack();
        ajaxRetail[index].requestFile = 'includes/getInfoRetail.php?stateCode=' + stateRetail + '&storeCode=' + storeRetail + '&cityCode=' + cityRetail;
        ajaxRetail[index].onCompletion = function () {
            getAddrsRetail(index)
        };
        ajaxRetail[index].runAJAX()
    }
}
function getAddrsRetail(index) {
    var obj = document.getElementById('addressRetail');
    eval(ajaxRetail[index].response)
}
function countAreaChars(areaName, counter, limit) {
    if (areaName.value.length > limit) {
        areaName.value = areaName.value.substring(0, limit)
    } else {
        counter.value = limit - areaName.value.length
    }
}