

Evonux.Gallery = {};

Evonux.Gallery.post = function (prefix, type, oid)
{
    var frm = $('frm-' + prefix);
    frm.target = '_upload';
    file = $(type + "_pic");    
    
    // Return if no image provided
    if (!file.value)
    return;

    // Post file form
    frm.pic_type.value = type;
    frm.state.value = 'addPic';
    frm.submit ();
    Evonux.Gallery.reload (type, oid);
    
    // Reset values
    file.value = "";
}

Evonux.Gallery.reload = function (type, oid, frame)
{
    var frm = $('frm');
    
    // Reload gallery
    Evonux.Page.get ('module=user&state=loadPics&type=' + type + '&oid=' + oid, (frame ? parent.document.getElementById (type + "_gallery") : type + '_gallery'), (frame ? true : false));
}

Evonux.Gallery.open = function (oid, type)
{
  gallery_window = window.open (U_ROOT + "/?module=user&state=gallery&oid=" + oid + "&type=" + type, "Gallery", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, border=no, left=" + g_left + ", top=" + g_top + ", width=" + g_width + ", height=" + g_height);
  gallery_window.focus ();
}

