/* 
    Roman Mroziński 2006 - forum JS  
    
    processModAction type 
    - 1 : temat
    - 2 : wiadomosc
        
*/

function processModAction(message_id) {
    var modDialogForm = document.getElementById('modDialogForm_' + message_id);
    if (modDialogForm.mod_description.value!='' && modDialogForm.mod_description.getAttribute('clean')==1) {
        modDialogForm.submit();
    }
    else {
        alert('Napisz dlaczego chcesz aby ktoś zmoderował ten post ?')
        modDialogForm.mod_description.focus();
        return false;
    }
}
function hideModDialog(message_id) {
    var modContainer = document.getElementById('mod_' + message_id);
    modContainer.innerHTML = '<a href="#'+message_id+'" onclick="showModDialog('+message_id+');"><img src="/img/forum/zglos.gif" border="0"></a>';
}
function showModDialog(message_id,type) {
    var modContainer = document.getElementById('mod_' + message_id);
    modContainer.innerHTML = '<form id="modDialogForm_'+message_id+'" method="POST" action="" style="margin: 0;"><input type="hidden" name="mod_message_id" value="'+message_id+'"><input type="hidden" name="mod_message_type" value="'+type+'"><input clean="0" type="text" name="mod_description" value="Wpisz dlaczego ta wiadmość powinna być zmoderowana..." onfocus="this.value=\'\';this.setAttribute(\'clean\',1);" class="notificationInfo"><br><input type="button" class="notificationSend" onClick="processModAction('+message_id+');"><input type="button" class="notificationCancel" onclick="hideModDialog('+message_id+');"></form>';
}

function openPanel(message_id,type,width,height) {
    
    if (!width) {
        width = 400;
    }
    
    if (!height) {
        height = 400;
    }
    
    newwin = window.open('/secure/panel/popup.php?action=showModeration&type='+type+'&messageId='+message_id,'ModPan','width=' + width + ',height=' + height +',scrollbars=no,status=no');
}