function CheckAddFileForm(FormName){
    if(document.forms[FormName].file_file_name.value!=""){
        if(document.forms[FormName].use_file_url.value!=""){
            window.alert("Jeżeli wbrałeś plik lokalny, to pole zawierające adres pliku zewnętrznego musi pozostać puste.");
            document.forms[FormName].use_file_url.focus();
            return false;
        }
        if(document.forms[FormName].use_file_file_name.value!=""){
            window.alert("Jeżeli wbrałeś plik lokalny, to pole zawierające nazwę pliku zewnętrznego musi pozostać puste.");
            document.forms[FormName].use_file_file_name.focus();
            return false;
        }
        if(document.forms[FormName].use_file_file_size.value!=""){
            window.alert("Jeżeli wbrałeś plik lokalny, to pole zawierające rozmiar pliku zewnętrznego musi pozostać puste.");
            document.forms[FormName].use_file_file_size.focus();
            return false;
        }
    } else {
        if(document.forms[FormName].use_file_url.value==""){
            window.alert("Jeżeli nie wbrałeś pliku lokalnego, to pole zawierające adres pliku zewnętrznego musi być uzupełnione.");
            document.forms[FormName].use_file_url.focus();
            return false;
        }
        if(document.forms[FormName].use_file_file_name.value==""){
            window.alert("Jeżeli nie wbrałeś pliku lokalnego, to pole zawierające nazwę pliku zewnętrznego musi być uzupełnione.");
            document.forms[FormName].use_file_file_name.focus();
            return false;
        }
        if(document.forms[FormName].use_file_file_size.value==""){
            window.alert("Jeżeli nie wbrałeś pliku lokalnego, to pole zawierające rozmiar pliku zewnętrznego musi być uzupełnione.");
            document.forms[FormName].use_file_file_size.focus();
            return false;
        }
    }
    if(document.forms[FormName].file_description.value==""){
        window.alert("Wpisz opis kampanii.");
        document.forms[FormName].file_description.focus();
        return false;
    }
    if(typeof(document.forms[FormName].no_spam_code)!="undefined"){
        test_no_spam_code=/^[0-9a-z]{4}$/;
        if(test_no_spam_code.test(document.forms[FormName].no_spam_code.value)==false){
            window.alert("Wpisz poprawny SPAM kodzik.");
            document.forms[FormName].no_spam_code.focus();
            return false;
        }
    }
}
function CheckEditFileForm(FormName){
    if(document.forms[FormName].new_file_url.value!="local"){
        if(document.forms[FormName].new_file_url.value==""){
            window.alert("Wpisz adres pliku.");
            document.forms[FormName].new_file_url.focus();
            return false;
        }
        if(document.forms[FormName].new_file_file_name.value==""){
            window.alert("Wpisz nazwę pliku.");
            document.forms[FormName].new_file_file_name.focus();
            return false;
        }
        if(document.forms[FormName].new_file_file_size.value==""){
            window.alert("Wpisz rozmiar pliku.");
            document.forms[FormName].new_file_file_size.focus();
            return false;
        }
    }
    if(document.forms[FormName].new_file_description.value==""){
        window.alert("Wpisz opis kampanii.");
        document.forms[FormName].new_file_description.focus();
        return false;
    }
}
function DisplayFiles(GetFilesArray){
    for(a=0;a<GetFilesArray.length;a++){
        GetFilesArraySplit = GetFilesArray[a].split("[%|%]");
        document.write('<a name="opinion_anchor_'+GetFilesArraySplit[0]+'"></a>');
        document.write('<table class="body_table" style="width:640px;" cellspacing="0" cellpadding="0" border="0" align="center">');
            document.write('<tr>');
                document.write('<td class="body_table_text" style="width:160px;text-align:right;font-weight:bold;">Kampania:</td>');
                document.write('<td class="body_table_text" style="width:480px;" colspan="3"><a class="body_table_text" href="javascript: GetFile('+GetFilesArraySplit[0]+',\'Campaign\',\'campaigns_modulos/files\');" title="Kliknij, aby rozpocząć pobieranie kampanii.">'+GetFilesArraySplit[1]+'</a></td>');
            document.write('</tr>');
            document.write('<tr>');
                document.write('<td class="body_table_text" style="width:160px;text-align:right;vertical-align:top;font-weight:bold;">Opis:</td>');
                document.write('<td class="body_table_text" style="width:160px;" colspan="3">');
                    document.write(GetFilesArraySplit[3]);
                    document.write('<div class="body_table_text" style="margin-top:5px;">');
                        document.write('<img class="pixel" src="'+ServiceCssGfx +'/pixel.gif" style="width:340px;">');
                    document.write('</div>');
                    document.write('<div class="body_table_text" style="margin-top:5px;">');
                        document.write(GetFilesArraySplit[7]+' ');
                        document.write('<b>Średnia:</b> '+GetFilesArraySplit[8]+' ');
                        document.write('<b>Ocen:</b> '+GetFilesArraySplit[9]);
                    document.write('</div>');
                document.write('</td>');
            document.write('</tr>');
            document.write('<tr>');
                document.write('<td class="body_table_text" style="width:160px;text-align:right;"><b>Dodano:</b><br>'+GetFilesArraySplit[4]+'</td>');
                document.write('<td class="body_table_text" style="width:160px;text-align:right;"><b>Dodał:</b><br><a class="body_table_text" href="users.php?name='+GetFilesArraySplit[5]+'" title="Zobacz profil: '+GetFilesArraySplit[5]+'">'+GetFilesArraySplit[5]+'</a></td>');
                document.write('<td class="body_table_text" style="width:160px;text-align:right;"><b>Rozmiar:</b><br>'+GetFilesArraySplit[2]+'</td>');
                document.write('<td class="body_table_text" style="width:160px;text-align:right;"><b>Pobrano:</b><br>'+GetFilesArraySplit[6]+'</td>');
            document.write('</tr>');
            //////////////////////////////
            // Sprawdzanie uprawnień użytkowników
            //////////////////////////////
            if(
                (GetFilesArraySplit[10]==1)||
                (GetFilesArraySplit[11]==1)||
                (GetFilesArraySplit[12]==1)||
                (GetFilesArraySplit[13]==1)||
                (GetFilesArraySplit[14]==1)
            ){
                EID++;
                document.write('<tr id="eid_'+EID+'">');
                    document.write('<td class="body_table_text_manage" colspan="4">');
                        if(GetFilesArraySplit[10]==1){
                            document.write('<a class="body_table_text_manage" href="'+GetScriptName+'?m=manage_files&opt=index&pd=1" title="Wyświetl spis kampanii"><img src="'+ServiceCssGfx +'/index.gif" border="0" style="margin-right:5px;"></a>');
                        }
                        if(GetFilesArraySplit[11]==1){
                            document.write('<a class="body_table_text_manage" href="'+GetScriptName+'?m=manage_files&opt=add&step=1&pd=0"><img src="'+ServiceCssGfx +'/add_entry.gif" border="0" style="margin-right:5px;"></a>');
                        }
                        if(GetFilesArraySplit[12]==1){
                            document.write('<a class="body_table_text_manage" href="javascript: ConfirmWindow(\'Czy na pewno chcesz edytować wybraną kampanię?\',\''+GetScriptName+'?m=manage_files&opt=edit&step=1&sid='+GetFilesArraySplit[0]+'&s='+S+'&pd=0\');"><img src="'+ServiceCssGfx +'/edit_entry.gif" border="0" style="margin-right:5px;"></a>');
                        }
                        if(GetFilesArraySplit[13]==1){
                            document.write('<a class="body_table_text_manage" href="javascript: ConfirmWindow(\'Czy na pewno chcesz usunąć wybraną kampanię?\',\''+GetScriptName+'?m=manage_files&opt=delete&sid='+GetFilesArraySplit[0]+'&s='+S+'&pd=0\');"><img src="'+ServiceCssGfx +'/delete_entry.gif" border="0" style="margin-right:5px;"></a>');
                        }
                        if(GetFilesArraySplit[14]==1){
                            document.write('<input type="checkbox" name="sel_sid[]" value="'+GetFilesArraySplit[0]+'" id="'+GetFilesArraySplit[0]+'" title="Kliknij, aby zaznaczyć." style="margin-right:2px;"> <label for="'+GetFilesArraySplit[0]+'" title="Kliknij, aby zaznaczyć."><img src="'+ServiceCssGfx +'/check_entry.gif" border="0" style="margin-right:5px;"></label>');
                        }
                    document.write('</td>');
                document.write('</tr>');
            } // Koniec sprawdzania uprawnień użytkowników
        document.write('</table>');
    }
}

function DisplayFilesIndex(GetFilesIndexArray){
    for(a=0;a<GetFilesIndexArray.length;a++){
        GetFilesIndexArraySplit = GetFilesIndexArray[a].split("[%|%]");
        document.write('<tr>');
            document.write('<td class="body_table_text" style=""><a class="body_table_text" href="javascript: GetFile('+GetFilesIndexArraySplit[0]+',\'Campaign\',\'campaigns_modulos/files\');" title="Kliknij, aby rozpocząć pobieranie kampanii.">'+GetFilesIndexArraySplit[2]+'</td>');
            document.write('<td class="body_table_text" style="text-align:center;">[<a class="body_table_text" href="'+GetScriptName+'?m='+M+'&opt=preview&sid='+GetFilesIndexArraySplit[0]+'&s='+S+'&pd=1" title="Zobacz szczegóły kampanii">&gt;&gt;&gt;</a>]</td>');
            document.write('<td class="body_table_text" style="text-align:center;">');
                if(GetFilesIndexArraySplit[1]=="local"){
                    document.write('<span title="Plik lokalny" style="color:#008000;">lok.</span>');
                } else {
                    document.write('<span title="Plik zewnętrzny" style="color:#0000ff;">zew.</span>');
                }
            document.write('</td>');
            document.write('<td class="body_table_text" style="text-align:center;">'+GetFilesIndexArraySplit[4]+'</td>');
            document.write('<td class="body_table_text" style="text-align:center;"><a class="body_table_text" href="users.php?name='+GetFilesIndexArraySplit[5]+'" title="Zobacz profil: '+GetFilesIndexArraySplit[5]+'">'+GetFilesIndexArraySplit[5]+'</a></td>');
            document.write('<td class="body_table_text" style="text-align:center;">');
                if(GetFilesIndexArraySplit[6]==1){
                    document.write('<span style="color:#008000;" title="Kampania aktywna">aktyw.</span>');
                } else {
                    document.write('<span style="color:#ff0000;" title="Kampania nieaktywna">nieakt.</span>');
                }
            document.write('</td>');
            document.write('<td class="body_table_text" style="text-align:center;">');
                if(GetFilesIndexArraySplit[6]==1){
                    if(GetFilesIndexArraySplit[7]!=1){
                        document.write('<span style="color:#ff0000;" title="Brak uprawnień"><img src="'+ServiceCssGfx +'/index_deactivate_entry_disabled.gif" border="0"></span>');
                    } else {
                        document.write('<a class="body_table_text" href="'+GetScriptName+'?m='+M+'&opt=deactivation&sid='+GetFilesIndexArraySplit[0]+'&s='+S+'&pd=1" title="Deaktywuj wybraną kampanię"><img src="'+ServiceCssGfx +'/index_deactivate_entry.gif" border="0"></a>');
                    }
                } else {
                    if(GetFilesIndexArraySplit[7]!=1){
                        document.write('<span style="color:#ff0000;" title="Brak uprawnień"><img src="'+ServiceCssGfx +'/index_activate_entry_disabled.gif" border="0"></span>');
                    } else {
                        document.write('<a class="body_table_text" href="'+GetScriptName+'?m='+M+'&opt=activation&sid='+GetFilesIndexArraySplit[0]+'&s='+S+'&pd=1" title="Aktywuj wybraną kampanię"><img src="'+ServiceCssGfx +'/index_activate_entry.gif" border="0"></a>');
                    }
                }
            document.write('</td>');
            document.write('<td class="body_table_text" style="text-align:center;">');
                if(GetFilesIndexArraySplit[7]!=1){
                    document.write('<span style="color:#ff0000;" title="Brak uprawnień"><img src="'+ServiceCssGfx +'/index_edit_entry_disabled.gif" border="0"></span>');
                } else {
                    document.write('<a class="body_table_text" href="javascript: ConfirmWindow(\'Czy na pewno chcesz edytować wybraną kampanię?\',\''+GetScriptName+'?m='+M+'&opt=edit&step=1&sid='+GetFilesIndexArraySplit[0]+'&s='+S+'&pd=1\');" title="Edytuj wybraną kampanię"><img src="'+ServiceCssGfx +'/index_edit_entry.gif" border="0"></a>');
                }
            document.write('</td>');
            document.write('<td class="body_table_text" style="text-align:center;">');
                if(GetFilesIndexArraySplit[8]!=1){
                    document.write('<span style="color:#ff0000;" title="Brak uprawnień"><img src="'+ServiceCssGfx +'/index_delete_entry_disabled.gif" border="0"></span>');
                } else {
                    document.write('<a class="body_table_text" href="javascript: ConfirmWindow(\'Czy napewno chcesz usunąć wybraną kampanię?\',\''+GetScriptName+'?m='+M+'&opt=delete&sid='+GetFilesIndexArraySplit[0]+'&s='+S+'&pd=1\');" title="Usuń wybraną kampanię"><img src="'+ServiceCssGfx +'/index_delete_entry.gif" border="0"></a>');
                }
            document.write('</td>');
            document.write('<td class="body_table_text" style="text-align:center;"><input type="checkbox" name="sel_sid[]" value="'+GetFilesIndexArraySplit[0]+'" title="Zaznacz wybraną kampanię"></td>');
        document.write('</tr>');
    }
}

