function change_xImg(img)
{
    var img_id     = new String(img.id);
    var project_id = img_id.split('_');
    var xImgPath   = img.src.split('/');
    var xImg_id    = project_id[0] + '_xImg';
    var photoLink  = project_id[0] + '_photoLink';
    var photoTitle = project_id[0] + '_photoTitle'
    var newImgPath = '/' + xImgPath[3] + '/' + xImgPath[4] + '/' + xImgPath[5] + '/' + 'x_small' + '/' + xImgPath[7].substring(1,xImgPath[7].length);
    var newLinkPath= '/' + xImgPath[3] + '/' + xImgPath[4] + '/' + xImgPath[5] + '/' + xImgPath[7].substring(3,xImgPath[7].length);
    //alert(newImgPath);
    document.getElementById(xImg_id).src    = newImgPath;
    document.getElementById(photoLink).href = newLinkPath;
    document.getElementById(photoTitle).innerHTML = document.getElementById(img.id).alt;
}
function isCheckboxSet()
{
    var len = document.forms[0].elements.length;
    for (i=0;i<len;i++)
    {
        if (document.forms[0].elements[i].type == 'checkbox')
        {
            if (document.forms[0].elements[i].checked)
                document.forms[0].submit();
        }
    }
}

$(document).ready(function(){
    $("a[rel^=lightbox]").lightbox();
    $.Lightbox.construct({
        "speed": 500,
        "show_linkback": false,
        "keys": {
                        close:  "q",
                        prev:   "z",
                        next:   "x"
                },
                "opacity": 0.3,
                text: {
                        image:          "image ",
                        of:             "of",
                        close:          "Close",
                        closeInfo:      "CloseInfo",
                        help: {
                                close:          "Close",
                        },

                },
                files: {
                        images: {
                                prev:           '/backend/js/gallery/lightbox_img/prev.gif',
                                next:           '/backend/js/gallery/lightbox_img/next.gif',
                                blank:          '/backend/js/gallery/lightbox_img/blank.gif',
                                loading:        '/backend/js/gallery/lightbox_img/loading.gif'
                        },
                        css : {lightbox : '/backend/js/gallery/lightbox.css'}
                },
    }),
    $("#delete_submit").click(function()
    {
        var result = new Array();
        $("input:checked").each(function()
        {
            result.push(this.name);
        }),
        $.post("/backend/portfolio/submitDelete", { 'project_delete[]': result}, function() { location.href = '/backend/portfolio/projects'; } );
    }),
    $("#delete_cancel").click(function()
    {
        location.href='/backend/portfolio/projects';
    });
});

