jQuery(document).ready ( function() {
    $("li>span div").hide(); 
    $("div#submenu").live('mouseleave', function(){
        $(this).fadeOut("slow");
    });

    $("li>span").live('mouseover', function () {
        $("li>span div").hide(); 
        $(this).children("div.position").show();
//        $(this).children("div.position").load("templates/dummy.php");
    });    
    
    $("li>span").click( function () {
          $(".position").fadeOut("slow");

    });     

 
    // select #flowplanes and make it scrollable. use circular and navigator plugins 
    $("#flowpanes").scrollable({size: 1}).circular().mousewheel(400).navigator({ 
 
        // select #flowtabs to be used as navigator 
        navi: "#flowtabs", 
 
        // select A tags inside the navigator to work as items (not direct children) 
       // naviItem: 'a', 
 
        // assign "current" class name for the active A tag inside navigator 
        activeClass: 'current' 
 
    }); 
    
    $("#accordion").accordion({
            autoHeight: false,
            navigation: true,
            active: false,
            collapsible: true
        });

 /*   $("#bewerben").live('click',function() {
        var stellen_id = $(this).attr('stellen_id');
        var sprache = $(this).attr('sprache');
        window.open("http://services.steinbach-partner.de/career/jobs/main_jobs_formular.php?stellen_id="+stellen_id+"&sprache_id="+sprache);
        $.get("http://services.steinbach-partner.de/career/jobs/main_jobs_formular.php", {
            stellen_id: stellen_id,
            sprache_id: sprache
        });

    });
*/

$.getJSON("../jobs.php",
        function(data) {
        $.each(data, function(i,item){
          $("#listticker").append("<li><a href='/cms/front_content.php?idcat=50&lang=1#"+ item.id +"'>" + item.titel + " &raquo;</a></li>");
          if ( i == 20 )  return false;
          });
        });

$.getJSON("../filter_rubrik.php",
        function(data) {
        $.each(data, function(i,item){
          $("#form_rubrik_elements").append("<tr><td><input name='rubrik[]' type=checkbox id=checkbox value=" + item.id +"></td><td>" + item.rubrik_text +"</td></tr>");
          if ( i == 20 )  return false;
          });
        });


    
    var first = 0;
    var speed = 700;
    var pause = 4000;
    
        function removeFirst(){
            first = $('ul#listticker li:first').html();
            $('ul#listticker li:first')
            .animate({opacity: 0}, speed)
            .fadeOut('fast', function() {$(this).remove();});
            addLast(first);
        }
        
        function addLast(first){
            last = '<li style="display:none">'+first+'</li>';
            $('ul#listticker').append(last)
            $('ul#listticker li:last')
            .animate({opacity: 1}, speed)
            .fadeIn('fast')
        }
    
    interval = setInterval(removeFirst, pause);




});
