/*****************************************************************************/
/* GLOBALE VARIABELN                                                         */
/*****************************************************************************/
var nachquestionmark;

window.captureEvents(Event.LOAD);
window.onload = Handler;



/*****************************************************************************/
/* FUNCTION HANDLER (EREIGNIS)                                               */
/*****************************************************************************/
function Handler (Ereignis)
{
    if (window.location.search != "")
    {
        var Titel, Vorname, Nachname, Bereich, Funktion;
        nachquestionmark = window.location.search;

        if (nachquestionmark.length > 20)
        {
            Index = getstring(0);
            
            Titel = getstring(1);
            if (Titel != "NOTITEL" && Titel != false)
            document.Search.txt3.value = unescape(Titel);
            
            Vorname = getstring(2);
            if (Vorname != "NOVORNAME" && Vorname != false)
            document.Search.txt1.value = unescape(Vorname);
            
            Nachname = getstring(3);
            if (Nachname != "NONACHNAME" && Nachname != false)
            document.Search.txt2.value = unescape(Nachname);
            
            Bereich = getstring(4);
            Funktion = getstring(5);
            if (Bereich != "NOBEREICH" && Bereich != false)
            {
                for (var i = 0; i < document.getElementsByName("cbo14")[0].length; i++)
                {
                if (document.Search.cbo14[i].text == unescape(Bereich))
                document.Search.cbo14[i].selected = true;
                }
            } 
                     
            if (Funktion != "NOFUNCTION" && Funktion != false)
            {
                for (var i = 0; i < document.getElementsByName("cbo19")[0].length; i++)
                {
                var docFunk = document.Search.cbo19[i].text;
                docFunk = docFunk.toLowerCase();
                if (docFunk == unescape(Funktion))
                document.Search.cbo19[i].selected = true;
                } 
            } 
            document.Search.sbmStart.click(); //Damit wird der Submit Button ausgeloesst
        }
    }
}



/*****************************************************************************/
/* FUNCTION GETSTRING ()                                                     */
/*****************************************************************************/
function getstring (aufruf)
{
    nachquestionmark = nachquestionmark.substring(1, nachquestionmark.length);
    var subtext;

    if (nachquestionmark.indexOf("?") != -1)
    {
        subtext = nachquestionmark.substring(0,nachquestionmark.indexOf("?"));
        nachquestionmark = nachquestionmark.substring(nachquestionmark.indexOf("?"), nachquestionmark.length);
    }
    else if (aufruf==5)
    {
        subtext = nachquestionmark.substring(0,nachquestionmark.length);
        nachquestionmark = nachquestionmark.substring(0, nachquestionmark.length);
    }
    else return false;
    while (subtext.indexOf("%20") != -1)
    {
    subtext = subtext.replace(/%20/, " ");
    }
    if (subtext.indexOf("%ae%") != -1)
    subtext = subtext.replace(/%ae%/, "ä");
    if (subtext.indexOf("%ue%") != -1)
    subtext = subtext.replace(/%ue%/, "ü");  
    if (subtext.indexOf("%oe%") != -1)
    subtext = subtext.replace(/%oe%/, "ö"); 
    if (subtext.indexOf("%ss%") != -1)
    subtext = subtext.replace(/%ss%/, "ß"); 
    
    return subtext;
}
