function servicecenter(){
    if (document.getElementById('container_services').style.display=='none'){
        document.getElementById('container_services').style.display='block';
    }else{
        document.getElementById('container_services').style.display='none';
    }
}
function pull_produkt(){
    if (document.getElementById('pull_produkt').style.display == "block"){
        document.getElementById('pull_produkt').style.display = "none";
    }else{
        document.getElementById('pull_produkt').style.display = "block";
        document.getElementById('pull_marke').style.display = "none";
        document.getElementById('pull_zweck').style.display = "none";
    }
}
function pull_marke(){
    if (document.getElementById('pull_marke').style.display == "block"){
        document.getElementById('pull_marke').style.display = "none";
    }else{
        document.getElementById('pull_marke').style.display = "block";
        document.getElementById('pull_produkt').style.display = "none";
        document.getElementById('pull_zweck').style.display = "none";
    
    }
}
function pull_zweck(){
    if (document.getElementById('pull_zweck').style.display == "block"){
        document.getElementById('pull_zweck').style.display = "none";
    }else{
        document.getElementById('pull_zweck').style.display = "block";
        document.getElementById('pull_marke').style.display = "none";
        document.getElementById('pull_produkt').style.display = "none";
    
    }
}
window.addEvent("domready", function(){
    
    new MooScroller('content1', 'scrollKnob1', {
        mode: 'vertical',
        scrollLinks: {
            forward: 'scrollForward1',
            back: 'scrollBack1'
        },
        scrollSteps: 8,
        wheel: true,
        maxThumbSize:0
    });
    
    new MooScroller('content2', 'scrollKnob2', {
        mode: 'vertical',
        scrollLinks: {
            forward: 'scrollForward2',
            back: 'scrollBack2'
        },
        scrollSteps: 8,
        wheel: true,
        maxThumbSize:0
    });
    
    new MooScroller('content3', 'scrollKnob3', {
        mode: 'vertical',
        scrollLinks: {
            forward: 'scrollForward3',
            back: 'scrollBack3'
        },
        scrollSteps: 8,
        wheel: true,
        maxThumbSize:0
    });
    
    if ($('login_form')){
    $('login_form').addEvent('submit', function(e) {
        // Prevents the default submit event from loading a new page.
        e.stop();

        // Show the spinning indicator when pressing the submit button...
        //$('ajax_loading').setStyle('display','block');

        // Hide the submit button while processing...
        //$('submit').setStyle('display','none');

        // Set the options of the form's Request handler.
        // ("this" refers to the $('login') element).
        this.set('send', { onComplete: function(response) {
            //$('ajax_loading').setStyle('display','none');
            if(response == 'OK'){
                
                window.location = "index.php?seite_id=74";

                //$('status').set('html', '<strong>Sie sind eingelogged!</strong><br><a href="anmeldung.php?action=logout" class="link_ws">logout</a>');
                $('service_postbox').set('html', '<a href="index.php?seite_id=74"  target="_top"><img src="templates/img/service_menu4_out.jpg" width="155" height="89" alt="" onmouseover="this.src=\'templates/img/service_menu4_ovr.jpg\'" onmouseout="this.src=\'templates/img/service_menu4_out.jpg\'" border="0" /></a>');
                $('service_mein_bereich').set('html', '<a href="index.php?seite_id=74" target="_top"><img src="templates/img/service_menu1_out.jpg" width="155" height="63" alt="" onmouseover="this.src=\'templates/img/service_menu1_ovr.jpg\'" onmouseout="this.src=\'templates/img/service_menu1_out.jpg\'" border="0" /></a>');
               //  '<img align="absmiddle" src="images/loader-bar.gif">' +
            //  '<br /> Please wait while we redirect you to your private page...</div>');

            //setTimeout('go_to_private_page()', 3000);
            //}
            //else
            //{
            //  $('login_response').set('html', response);
              // Show the login button
            //  $('submit').setStyle('display','block');
            //}
            }else{
                $('status').set('html', response);
            }
        }});

        // Send the form.
        this.send();
    });
    }
    
    var registerIn = new Fx.Tween('container_anmeldung', {
                        'duration': 1700,
                        'transition': Fx.Transitions.Bounce.easeOut, 
                        'wait':true
                  });
    var registerOut = new Fx.Tween('container_anmeldung', {
                        'duration': 500,
                        'transition': Fx.Transitions.linear, 
                        'wait':true
                  });
    
    if ($('button_anmeldung')){
        $('button_anmeldung').addEvent('click', function(e){
            e = new Event(e);
            var top = $('container_anmeldung').getStyle('top').toInt();
            if (top == "-572"){
                registerIn.start('top', -572, 0);
            }else{
                registerOut.start('top', 0, -572);
            }
            e.stop();
        });
    }
        
    if($('service_postbox')){
    $('service_postbox').addEvent('click', function(e){
        e = new Event(e);
        var top = $('container_anmeldung').getStyle('top').toInt();
        if (top == "-572"){
            registerIn.start('top', -572, 0);
        }else{
            registerOut.start('top', 0, -572);
        }
        e.stop();
    });
    }
    
    if ($('close_anmeldung')){
    $('close_anmeldung').addEvent('click', function(e){
        e = new Event(e);
        registerOut.start('top', 0, -572);
        e.stop();
    });
    }

    new Autocompleter.Request.HTML('search_word', 'source/ajax/autocompleter.php', {
        'indicatorClass': 'autocompleter-loading',
        'postData': {
            'extended': '1' // send additional POST data, check the PHP code
        },
        'injectChoice': function(choice) {
            // choice is one <li> element
            
            //var text = choice.getFirst('div');
            //var value = text.get('html');
            //alert(value);
            //$('search_word').set('html', value);
            choice.inputValue ='xxxxxx';
        },
        'width': 200,
        'minLength':2
    });

    
});

