﻿function getTradeIds() {
    var returnString = '';
    jQuery('.TransGrid tbody tr').each(function () {
        var isSelected = jQuery(this).find('.CheckSelect input').attr('checked');
        if (isSelected) {
            returnString += jQuery(this).find('.CheckSelect').attr('commandargument') + ',';
        }
    });
    return returnString;
}

jQuery('.TradeButtonPrint').live('click', function () {
    window.open('/Controls/Custom_PrintTradeInvoices.aspx?Ids=' + getTradeIds());
});

jQuery(function () {
    if (jQuery('body').hasClass('print')) {
        window.print();
    }
});

jQuery('#LoginPanel table tr .SwitchToCard').live('click', function () {
    jQuery('#LoginPanel table.loginMainTable').css('background', 'url(/data/media/images/panel_middle.gif) repeat-y');
    jQuery('#LoginPanel table.loginMainTable tr #LoginImgPanelFooter').attr('src', '/Data/Media/Images/panel_footer.gif');
    jQuery('#LoginPanel table.loginMainTable tr div.CardLoginPanel').css('display', 'block');
    jQuery('#LoginPanel table.loginMainTable tr div.TradeLoginPanel').css('display', 'none');
});
jQuery('#LoginPanel table tr .SwitchToTrade').live('click', function () {
    jQuery('#LoginPanel table.loginMainTable').css('background', 'url(/data/media/images/panel_middle_pink.gif) repeat-y');
    jQuery('#LoginPanel table.loginMainTable tr #LoginImgPanelFooter').attr('src', '/Data/Media/Images/panel_footer_pink.gif');
    jQuery('#LoginPanel table.loginMainTable tr div.CardLoginPanel').css('display', 'none');
    jQuery('#LoginPanel table.loginMainTable tr div.TradeLoginPanel').css('display', 'block');
});
