var browserName = navigator.appName;
if (browserName != "Microsoft Internet Explorer")
    HTMLElement.prototype.click = function() {
        var evt = this.ownerDocument.createEvent('MouseEvents');
        evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
        this.dispatchEvent(evt);
    };


function ShowError(id, value) {
    var pnlError = document.getElementById(id);
    if (pnlError != null)
        pnlError.innerHTML = value;
}

function getCitiesList(countryId) {
    document.getElementById('selectedCountry').value = countryId;
    document.getElementById('getByCountry').click();
}

function getCitiesListMerchant(countryId) {
    document.getElementById('selectedCountryMerchant').value = countryId;
    document.getElementById('getByCountryMerchant').click();
}

function roundNum(val) {
    if (val.charAt(val.length - 1) == '0') { // xx.00
        val = val.substr(0, val.length - 1);
    }
    if (val.charAt(val.length - 1) == '0') { // xx.0
        val = val.substr(0, val.length - 1);
    }
    if (val.charAt(val.length - 1) == '.') { // xx.
        val = val.substr(0, val.length - 1);
    }
    return val;
}

(function($) {
    var cache = [];
    // Arguments are image paths relative to the current page.
    $.preLoadImages = function() {
        var args_len = arguments.length;
        for (var i = args_len; i--; ) {
            var cacheImage = document.createElement('img');
            cacheImage.src = arguments[i];
            cache.push(cacheImage);
        }
    };
})(jQuery);


