var submitCompare = function() {
    var pairs = [];
    $('.add_compare').each(function() {
        if ($(this).attr('checked')) {
            pair = $(this).attr('name') + '=' + $(this).attr('value');
            pairs.push(pair);
        }
    });
    
    var loc = ''
    
    if (window.location.pathname.substr(window.location.pathname.length-1, 1) === '/') {
        loc = window.location.pathname;
    } else {
        loc = window.location.pathname + '/';
    }
    
    if (pairs.length > 0) {
        window.location = loc + 'compare/?' + pairs.join('&');
    }
}

var submitTrash = function() {
    var pairs = [];
    $('.add_trash').each(function() {
        if ($(this).attr('checked')) {
            pair = $(this).attr('name') + '=' + $(this).attr('value');
            pairs.push(pair);
        }
    });
    
    var loc = ''
    
    if (window.location.pathname.substr(window.location.pathname.length-1, 1) === '/') {
        loc = window.location.pathname;
    } else {
        loc = window.location.pathname + '/';
    }
    
    loc = loc.replace('compare/', '');
    loc = loc.replace('compare', '');
    
    if (pairs.length > 0) {
        window.location = loc + 'trash/?' + pairs.join('&');
    }
}

var profiles = {
    windowCenter: {
        width: $(window).width() / 1.5,
        height: $(window).height() / 1.5,
        center: 1,
        scrollbars: 1
    }
};


$(function() {
    $('.popupwindow').popupwindow(profiles);
});