function popup (type, id)
{
    image_window = window.open("?module=bild_gross&type="+type+"&id="+id, "Image", "width=680, height=720, resizable=yes");
    image_window.focus();
}

/*function knaller_popup (tag)
{
    image_window = window.open("?module=knaller_gross&tag="+tag, "Knaller", "width=690, height=850, resizable=yes");
    image_window.focus();
}*/

function knaller_popup (tag)
{
    image_window = window.open("?module=knaller_gross", "Knaller", "width=690, height=850, resizable=yes, scrollbars=yes");
    image_window.focus();
}

function brandstifter_popup (monat, jahr)
{
    url = "?module=brandstifter_gross&monat="+monat;
    
    if (jahr) {
        url += "&jahr="+jahr;
    } 
    
    image_window = window.open(url, "Brandstifter", "width=690, height=790, resizable=yes");
    image_window.focus();
}

function kollegenanfrage_popup (to_id)
{
    popup_window = window.open("/?module=kollegenanfrage&to_id="+to_id, "Kollegenanfrage", "width=350, height=270, resizable=yes");
    popup_window.focus();
}

function termin_eintragen_popup ()
{
    termin_eintragen_window = window.open("https://www.stadtbrandfluss.de/?module=termin_eintragen", "Termineintrag", "width=350, height=580, resizable=yes");
    termin_eintragen_window.focus();
}

function brandmeldung_eintragen_popup ()
{
    brandmeldung_eintragen_window = window.open("https://www.stadtbrandfluss.de/?module=brandmeldung_eintragen", "Brandmeldung", "width=350, height=400, resizable=yes");
    brandmeldung_eintragen_window.focus();
}

function seite_weiterempfehlen_popup ()
{
    seite_weiterempfehlen_window = window.open("https://www.stadtbrandfluss.de/?module=seite_weiterempfehlen", "Brandmeldung", "width=350, height=400, resizable=yes");
    seite_weiterempfehlen_window.focus();
}

function knaller_vorschlagen_popup ()
{
    knaller_vorschlagen_window = window.open("/?module=knaller_vorschlagen", "Knallervorschlag", "width=350, height=550, resizable=yes");
    knaller_vorschlagen_window.focus();
}

function disable_upload_button () 
{
    if (document.getElementById) {
        if (document.getElementById("submit_button")) {
            //document.getElementById("submit_button").disabled = true;
        }
        if (document.getElementById("message")) {
            document.getElementById("message").innerHTML = "<strong>Datei wird hochgeladen, bitte das Fenster nicht schliessen!</strong><br><br>Das Hochladen und Umrechnen der Datei kann einige Zeit in Anspruch nehmen.";
        }
    }
    return true;
}

function open_upload_window(type,id)
{
    upload_window = window.open("https://www.stadtbrandfluss.de/?module=upload&type="+type+"&id="+id, "Upload", "width=300, height=300, resizable=yes");
    upload_window.focus();
}

function switch_input(this_object)
{
    this_object.style.color = "#000000";
    this_object.select();
}

function textarea_length (obj, max_length)
{
    // cut textarea content if longer than max_length
    if (obj.value.length > max_length) {
        obj.value = obj.value.substr (0, max_length);
    }
}

function praesentation(id)
{
    window.open("presentation.php?id="+id, "Praesentation",  "width="+screen.availWidth+", height="+screen.availHeight);
}

 function praesentation_demo()
        {
            popup = window.open("portfoliopraesentation/fullscreen.html", "Pr�sentation", "width="+screen.availWidth+", height="+screen.availHeight);
            popup.focus();
        }

function search()
{
    // ajax search
    
    target_id = "ajax_search";
    
    if(!document.getElementById || !document.getElementById(target_id)) {
        return;
    }
    document.getElementById(target_id).style.visibility = "visible";
    
    if(document.getElementById("search_string").value.length > 2) {
        document.getElementById(target_id).value = "Bitte warten...";
        //alert (encodeURI(document.getElementById("search_string").value));
        doHttpRequest("ajax/search.php?search="+encodeURI(document.getElementById("search_string").value), target_id);
        
        search_block = true;
        
        window.setTimeout("search_unblock()", 2000);
    }
    else {
        return;
    }
}

function mehr_kollegen(user_id, start_index)
{
    // ajax search
    
    target_id = "kollegen_inhalt";
    
    if(!document.getElementById || !document.getElementById(target_id)) {
        return;
    }
    document.getElementById(target_id).value = "Bitte warten...";
    doHttpRequest("ajax/kollegen.php?user_id="+user_id+"&start_index="+start_index, target_id);
}

function search_unblock()
{
      search_block = false;
}

function search_hide_now()
{
    target_id = "ajax_search";
    
    if(!search_block && document.getElementById && document.getElementById(target_id)) {
        document.getElementById(target_id).style.visibility = "hidden";
    } 
}

function search_hide()
{
    target_id = "ajax_search";
    
    window.setTimeout("search_hide_now()", 2000);
}


