  $(document).ready(function(){

    $("#recommandForm").validate({
        rules:{
            name: "required",
            phone: "required",
            recommand_text : "required",
            fromemail: {
               required: true,
               email: true
            },
            email: {
               required: true,
               email: true
            },
            captcha: {
                required: true,
                remote: "./captcha/process.php"
            }
        },

        messages: {
            captcha: "Falscher Sicherheitscode!"
        }
    });

     $("#captcha").click(function(){
        $.post('./captcha/newsession.php');
        $("#captchaimage").load('./captcha/image_req.php');
        return false;
    });

    //$("#commentForm").validate();
    $("#persoForm").validate();
    /*$('.form_next').click(function(){
          if($("#persoForm[@name=pname]").valid()){
            $(this).parent().parent().parent().hide();
            $(this).parent().parent().parent().next('div.page').show();
           }else{
               return false;
           }

    });*/

    $(".radio").change(function(){
        $('#firma').parent().toggle();

        /*
        if($('#firma').val() == 'Bewerber'){
            $('#firma').removeClass('required');
        }else{
            $('#firma').addClass('required');
        }*/
    });

});


$(function(){

        /* Scroll to top */

        $('a[href=#top]').click(function(){
            $('html, body').animate({scrollTop:0}, 'slow');
            return false;
        });

        /* recommand */

        $(".recommand_link").fancybox({
                'transitionIn'      : 'fade',
                'transitionOut'     : 'fade',
                'autoDimensions'    : true,
                'titleShow'         : false
            });

         /* Jobanzeige */
        $.tablesorter.addParser({
          id: 'germandate',
          is: function(s) {
                  return false;
          },
          format: function(s) {
            var a = s.split('.');
            a[1] = a[1].replace(/^[0]+/g,"");
            return new Date(a.reverse().join(".")).getTime();
          },
          type: 'numeric'
        });

        $(".jobtable").tablesorter({
            widgets: ['zebra'],
            stripingRowClass: ['even','odd'],   // Class names for striping supplyed as a array.
            stripeRowsOnStartUp: true,
            headers: { 4: { sorter: false}, 5: {sorter: false} },
            locale: 'de',
          //  sortList: [[1,0], [2,0]],
            dateFormat: 'dd/mm/yy'
        }).tablesorterPager({container: $(".pager")});
        $(".jobtable th:last-child").removeClass('header');
        /*$(".jobtable th:last-child").prev('th').andSelf().
        Class('header');*/

         /*
         *    Downloadbereich
         *
         */
         $(".downloadtable").tablesorter({
             widgets: ['zebra'],
            stripingRowClass: ['even','odd'],   // Class names for striping supplyed as a array.
            stripeRowsOnStartUp: true,       // Strip rows on tableSorter init.
            headers: { 3: { sorter: false}}
        });

        /*
        *    Newsticker
        *    Newsticker using jquery-li-scroller.1.0
        *
        */
        $("ul#ticker").liScroll();


        /*
        *    Menu Hover
        *    Top Menu Hover Effekt
        *
        */
         $('.record, .count,.label').hover(function() {
            $(this).toggleClass("highlight");
         });

         /*
         *
         *    Downloadnavigation
         *
         */
         $('.download_navigation_menu .down_nav').click(function() {

            $('.navigation_left_li').removeClass('active');

            var tabname = $(this).attr("title");

            if(tabname == 'all'){
            $('div.downloadchapter').show();}else{
            $('div.downloadchapter[id!='+tabname+']').hide();
            $('div.downloadchapter[id='+tabname+']').show();}

            $(this).parent().addClass('active');

         });


         $('.toogle_img').toggle(
                    function(){
                         $(this).attr('src', 'images/bullet_toggle_minus.png');
                         $(this).parent().parent().find('.download_desc').slideDown('fast');

                    }, function(){
                         $(this).attr('src', 'images/bullet_toggle_plus.png');
                         $(this).parent().parent().find('.download_desc').slideUp('fast');
         });


        $('.toogle_details').toggle(
            function(){
                 $(this).attr('src', 'images/bullet_toggle_minus.png');
                 $(this).parent().parent().find('.quick_view').slideDown('fast');

            }, function(){
                 $(this).attr('src', 'images/bullet_toggle_plus.png');
                 $(this).parent().parent().find('.quick_view').slideUp('fast');
         });


         /* Bookmark Modul */

         $('.bookmark_sites').bookmark({sites: ['facebook', 'delicious', 'digg','twitter','myspace']});

         $('.bookmark_link').click(function () {
             $('.bookmark_sites').toggle();
             });
        /* Sitebar Last Entry Modul*/

        $('.last_entry_link').hover(function() {

            $(this).next('.last_entries_date').toggle();

         });

         /*
         *
         *    Formular
         *
         */
        $('#Persoform').formpager('.page', {
          navId: 'nav_form',
          prevText: 'Previous',
          nextText: 'Next',
          height: '760',
          navAttach: 'prepend',
          linkWrap: '<div></div>',
          linkText: ['Kontakt', 'Stelle', 'Kenntnisse', 'Erfahrungen','Zusatz']

        });

       $('#OfferWork').formpager('.page', {
          navId: 'nav_form',
          prevText: 'Previous',
          nextText: 'Next',
          height: '760',
          navAttach: 'prepend',
          linkWrap: '<div></div>',
          linkText: ['Persönliche Daten', 'Angaben zum Gesuch']

        });

         $(".googlemaps").fancybox({
                'transitionIn'      : 'fade',
                'transitionOut'     : 'fade',
                'titleShow'         : 'false',
                'width'             : 800,
                'height'            : 600,
                'type'              : 'iframe'
            });



});
