﻿function $$(elementId) {
    return document.getElementById(elementId);
}

function KeyDownHandler(sName) {
    // process only the Enter key
    if (event.keyCode == 13) {
        // cancel the default submit
        event.returnValue = false;
        event.cancel = true;
        // submit the form by programmatically clicking the specified button
        document._ctl0[sName].click();
    }
}

function EditControl(sUrl) {
    //alert(sUrl);
    tb_show('Edit text', '/Site/EditText.aspx?' + sUrl + '&TB_iframe=1&height=700&width=600', false);
}

function UpdateShoppingCart(shpCartTotal, shpCartItemsTotal) {
    $('#SHPCART_TOTAL').html(shpCartTotal);
    $('#SHPCART_ITEMS').html(shpCartItemsTotal);
}

function CurrencyFormatted(amount) {
    var minus = '';
    if (amount < 0) { minus = '-'; }
    amount = Math.abs(amount);
    amount = parseInt((amount + .005) * 100);
    amount = amount / 100;
    s = new String(amount);
    if (s.indexOf('.') < 0) { s += '.00'; }
    if (s.indexOf('.') == (s.length - 2)) { s += '0'; }
    s = minus + s;
    return s;
}

