/*
var sI;
var cs = new c_suche();
function send_suche(begriff, page) {
    if(begriff.length>=3) {
        cs.clearOpts();
        cs.setOpts('search', begriff);
        cs.setOpts('p', page);
        window.clearInterval(sI);
        sI = window.setInterval("cs.sendRequest()", 1000);
     }
}
*/



/* ---------- Suche NEU Anfang --------- */
var sI=null;
var ss;
var la;
var pa;
function send_suche(begriff, lang, page) {
    if(begriff.length>2) {
        ss = escape(begriff);
        la = lang;
        pa = page
        if(sI) window.clearInterval(sI);
        sI = window.setInterval("requestSuche();window.clearInterval(sI);", 300);
    }
}
function requestSuche() {
    var URI = "/skripte/suche.php";
    var pars = "search=" + ss + "&lang=" + la + "&page=" + pa;
    new Ajax.Request(URI, {method:"post", postBody:pars, onComplete:showSearchResult});
}

function showSearchResult(request) {
    if(document.getElementById("contentFrameStart")) {
        $('contentFrameStart').innerHTML = request.responseText;
    } else {
        $('contentFrame').innerHTML = request.responseText;
    }
}

function createPageNav(s,e,m) {
    var pages = Math.ceil(m/10);
    var akt = Math.ceil(s/10);
    var d = document.createElement('div');
    d.style.marginTop="10px";
    d.style.marginBottom="10px";
    if(akt>0) {
        var l = document.createElement('a');
        l.href="javascript:;";
        l.onclick=showPage;
        l.title=akt;
        var l_t = document.createTextNode("<<");
        l.appendChild(l_t);
        d.appendChild(l);
    }
    for(var i=1; i<=pages; i++) {
        if(i != (akt+1)) {
            var l = document.createElement('a');
            l.href="javascript:;";
            l.onclick=showPage;
            l.title=i;
            var l_t = document.createTextNode(i);
        } else {
            var l = document.createElement('a');
            l.href="javascript:;";
            l.onclick=showPage;
            l.title=i;
            var l_t = document.createTextNode("["+i+"]");
        }
        l.appendChild(l_t);
        l.style.marginLeft="5px";
        d.appendChild(l);
    }
    if(akt+1<pages) {
        var l = document.createElement('a');
        l.href="javascript:;";
        l.onclick=showPage;
        l.title=akt+2;
        var l_t = document.createTextNode(">>");
        l.appendChild(l_t);
        l.style.marginLeft="5px";
        d.appendChild(l);
    }
    return d;
}
function showPage() {
    p=parseInt(this.title);
    cs.setOpts('p', p);
    cs.sendRequest();
    return false;
}
/* ---------- Suche NEU Ende --------- */        

function fctOpenPopup( url ) {
    window.open(url,"","left=100,top=100,width=740,height=300,status=no,scrollbars=yes,location=no,menubar=no,resizable=no");
}  

function fctPopup(url,name,fullscreen,win_width,win_height) {
    if(fullscreen){
        win_height = screen.height-65;
        win_width = screen.width-10;
        pos_horizon = 0;
        pos_vertical = 0;
    }else{
        pos_horizon = (((screen.width-10)/2)-(win_width/2));
        pos_vertical = (((screen.height-65)/2)-(win_height/2));
    }
    window.open(url,name,"width="+win_width+",height="+win_height+",top="+pos_vertical+",left="+pos_horizon);
}   


            function fctSetActive( elem,tag,classAct,classInact,exception,condition )
            {
                for ( i=0;i<elem.getElementsByTagName(tag).length;i++ )
                {
                    if ( elem.getElementsByTagName(tag)[i].className != exception )
                    {
                        elem.getElementsByTagName(tag)[i].onmouseover = function(){ if ( (condition == this.className && condition ) || !condition ) this.className = classAct;}
                        elem.getElementsByTagName(tag)[i].onmouseout = function(){ if ( this.className == classAct ) this.className = classInact;}
                    }
                }
            }

            var intTab = 0;
            var actTab = 1;
            var TimeSlideTab;

            function fctSlideTab()
            {
                actTab++;
                if( intTabs < actTab ) actTab = 1;
                fctShowTab( actTab );
            }

            function fctSlideTabTime( boolShow ){
                if( boolShow == true )
                    TimeSlideTab = window.setInterval("fctSlideTab()",3000);
                else
                    window.clearInterval( window.TimeSlideTab );
            }


            function fctShowTab( tab )
            {
                actTab = tab;
                tab--;
                tabNav = document.getElementsByName("TabNav");
                tabDetail = document.getElementsByName("TabDetail");

                for( i=0;i<tabNav.length;i++)
                {
                    if ( i == tab )
                    {
                        tabNav[i].className = "claElementActive";
                        tabNav[i].onmouseover = "";
                        tabNav[i].onmouseout = "";
                    } else
                        tabNav[i].className = "claElement";
                }
                fctSetActive( document.getElementsByName('Tab')[0],'div','claElementActive','claElement','claElementActive','claElement' );

                for( i=0;i<tabDetail.length;i++)
                {
                    if ( i == tab )
                        tabDetail[i].style.display = "block";
                    else
                        tabDetail[i].style.display = "none";
                }
            } 

    function fctCheckShadowbox(){
        if( document.getElementById("sb-body-inner").childNodes.length > 0 ) {
            document.getElementById("sb-body-inner").firstChild.src = "/bilder/layout/trans.gif";
            document.getElementById("sb-body-inner").firstChild.src = "/filialen/siebenlehn/webcam.jpg";
            var datum = new Date();
            Min = datum.getMinutes();
            if ( Min < 10 ) Min = "0"+Min;
            document.getElementById("sb-title-inner").innerHTML = "Live-Webcam zur Baustelle in Siebenlehn, "+ datum.getDate() +"."+ (datum.getMonth()+1) +"."+ datum.getFullYear() +" "+ datum.getHours() +":"+ Min;
        }
    }  
