
// blättern für die Suche
var gPagePos = 0;
var gShowItems = 10;

function toggleSearchButtons()
{
    var obj = document.getElementById('aussenrahmen');
    if (!document.getElementById('search-up')) {
        // up arrow
        var up = document.createElement('a');
        up.setAttribute('id', 'search-up');
        up.style.position = 'absolute';
        up.style.top = '170px';
        up.style.left = '60px';
        up.style.display = 'block';
        var upImg = document.createElement('img');
        upImg.setAttribute('src', 'pix/navi/search_up.gif');
        up.appendChild(upImg);
        obj.appendChild(up);
        // down arrow
        var down = document.createElement('a');
        down.setAttribute('id', 'search-down');
        down.style.position = 'absolute';
        down.style.top = '515px';
        down.style.left = '60px';
        down.style.display = 'block';
        var downImg = document.createElement('img');
        downImg.setAttribute('src', 'pix/navi/search_down.gif');
        down.appendChild(downImg);
        obj.appendChild(down);
    } else if (document.getElementById('search-up').style.display == 'none') {
        document.getElementById('search-up').style.display = 'block';
        document.getElementById('search-down').style.display = 'block';
    } else {
        document.getElementById('search-up').style.display = 'none';
        document.getElementById('search-down').style.display = 'none';
    }
}

function browseSearch(pos)
{
    var obj = document.getElementById('suchen_liste');
    var links = obj.getElementsByTagName('li');
    gPagePos = pos;
    if ((pos - gShowItems) < 10) {
        document.getElementById('search-up').setAttribute('href', 'javascript:browseSearch(' + pos + ');');
    } else {
        document.getElementById('search-up').setAttribute('href', 'javascript:browseSearch(' + (pos - gShowItems) + ');');
    }
    if (links.length > (pos + gShowItems)) {
        document.getElementById('search-down').setAttribute('href', 'javascript:browseSearch(' + (pos + gShowItems) + ');');
    } else {
        document.getElementById('search-down').setAttribute('href', 'javascript:browseSearch(' + pos + ');');
    }
    for (var i = 0; i < links.length; i++) {
        if (i < (pos + gShowItems) && i >= (pos - 10)) {
            links[i].style.display = 'block';
        } else {
            links[i].style.display = 'none';
        }
    }
}

function suche()
{
    $("div#suchen_liste").toggle();
    toggleSearchButtons();
    browseSearch(10);
    if (document.getElementById('detail_name') && document.getElementById('detail_name').style.top == '140px') {
        $("div#detail_name").css({ top: "265" });
    } else {
        $("div#detail_name").css({ top: "140" });
    }
    if (document.getElementById('suchen_knopf') && document.getElementById('suchen_knopf').style.backgroundPosition == "1000px 1000px") {
        $("div#suchen_knopf").css({ backgroundPosition: "bottom center" });
        $("div#suchen_knopf").css({ height: "30px" });
    } else {
        $("div#suchen_knopf").css({ backgroundPosition: "1000px 1000px" });
        $("div#suchen_knopf").css({ height: "20px" });
    }
}

function ajax(seite, prefix) {

 // Falls index aufgerufen wird nur den Content laden....
  if (seite == 'index.html')
 {
  seite = 'index_content.html';
  }

 // Falls prefix vorhanden, PHP erweitern...
 if (prefix > '')
 { prefix = '?display='+prefix}
 else {prefix = ''}

 $("div#ajax").load(seite+prefix);
// alert(seite+prefix)
}

function doHover(b, i)
{
    document.fangfrisch.src = 'pix/navi/ueber_uns_fangfrisch.gif';
    document.frisches.src = "pix/navi/ueber_uns_frisches.gif";
    document.kontakt.src = "pix/navi/ueber_uns_kontakt.gif";
    document.bewerbung.src = "pix/navi/ueber_uns_bewerbung.gif";
    document.freunde.src = "pix/navi/ueber_uns_freunde.gif";
    document.impressum.src = "pix/navi/ueber_uns_impressum.gif";

    if (b == 'fangfrisch') {
        document.all.detail_name.innerHTML = b + ' berlin';
    } else {
        document.all.detail_name.innerHTML = b;
    }

    //f = document[b].src;
    //f = f.substr(0, f.length - 4);
    //f += '_' + i + '.gif';
    //document[b].src = f;
}

function setCookie(Bezeichner,Wert,Dauer)
   {
     var OrginalWert;
     var auswahl;

     jetzt=new Date();
     Auszeit=new Date(jetzt.getTime()+Dauer*86400000);

     auswahl = "auswahl=";

     Wert = "["+Wert+"]";

     OrginalWert = document.cookie;
     if (OrginalWert > '')
     {auswahl= "";}

     document.cookie=auswahl+OrginalWert+Wert+";expires="+Auszeit.toGMTString()+";";
//   alert(OrginalWert+";"+Bezeichner+"="+Wert+";expires="+Auszeit.toGMTString()+";");

alert(document.cookie);
   }
