function genCopyMoveConfirm()
{

    // TODO: error message when nothing selected
    var ac = $('action_copy');
    var am = $('action_move');

    var cm_str = "";

    if (ac) {
        if (ac.checked) {
            cm_str = "copy";
        }
    }

    if (am) {
        if (am.checked) {
            cm_str = "move";
        }
    }

    var fo_str = "";
    var fo = $('folder');
    if (fo) {
        if (fo.options[fo.selectedIndex].value == "_NEW") {
            fo_str = "a new folder";
        } else {
            fo_str = "'" + fo.options[fo.selectedIndex].text + "'";
        }
    }

    return window.confirm('Are you sure you want to ' + cm_str + ' the selected products to ' + fo_str + '?');

}



function starProduct(fo_id, pr_id)
{

    var pars = 'opt=star_product&fo_id=' + fo_id + '&pr_id=' + pr_id + '&value=1';

    // make ajax request
    var myAjax = new Ajax.Request(
                            ajax_url,
                            {
                                method: 'get',
                                parameters: pars,
                                onComplete: starProductResponse
                            });
}

function starProductResponse(originalRequest)
{
    try {
        eval("var result = "+originalRequest.responseText);
    } catch(exception) {
        alert(exception);
        alert(originalRequest.responseText);
    }

    if (result.status == 1) {
        // change image
        var data = result.data;

        var star = $('star_' + data.pr_id);
        if (star) {

            // get star image
            var star_img = star.getElementsByTagName('img')[0];
            if (star_img) {

                if (data.status == 1) {
                    Element.removeClassName(star_img, "star_off");
                    Element.addClassName(star_img, "star_on");
                    star_img.src = "/images/star.png";
                } else {
                    Element.removeClassName(star_img, "star_on");
                    Element.addClassName(star_img, "star_off");
                    star_img.src = "/images/star_off2.png";
                }
            }
        }

    } else {
        alert('Error: ' + result.message);
    }
}
