/* v1.0 | 20091127 */
/* JobManager */
/* custom scripts */

$(document).ready(function(){
    $("#header h1 a, #main a, #footer a, abbr").not(".more, .download").easyTooltip({tooltipId: "tooltip"});
    $("a", "#nav").hover(function() {
        $(this).next("em").stop(true, true).animate({opacity: "show", top: "-60"}, "slow");
    }, function() {
        $(this).next("em").animate({opacity: "hide", top: "-70"}, "fast");
    });
    $("a.more", "#main").css({paddingLeft: "0", backgroundPosition: "-36px .4em"}).hover(function() {
        $(this).stop(true, true).animate({paddingLeft: "36", backgroundPosition: "0px .4em"}, "fast");
    }, function() {
        $(this).animate({paddingLeft: "0", backgroundPosition: "-36px .4em"}, "fast");
    });
    $("a.more", "#main").css({paddingLeft: "0", backgroundPosition: "-36px .4em"}).focusin(function() {
        $(this).stop(true, true).animate({paddingLeft: "36", backgroundPosition: "0px .4em"}, "fast");
    }).focusout(function() {
        $(this).animate({paddingLeft: "0", backgroundPosition: "-36px .4em"}, "fast");
    });
    if ( $("#slides", "#slider").length ) {
        $("#slider").anythingSlider({
            delay: 9000,
            startText: "",
            stopText: ""
        });
    }
    if ( $("#page").hasClass("home") ) {
        $("#clients", "#slider").hover(function() {
            $(this).css("background-color", "#FFF");
        }, function() {
            $(this).css("background-color", "#EEE");
        });
        $("a", "#clients").colorbox({width:"80%", height:"80%", iframe:true, title: function(){
            var url = $(this).attr('href');
            var text = $("#tooltip").text();
            return text+' <a href="'+url+'" target="_blank">in neuem Fenster &ouml;ffnen</a>';
        }});
    }
    if ( $("#page").hasClass("features") ) {
        $("li h4", "#content").css({"cursor":"pointer", "margin-bottom":"0"}).next().hide().css("width", "288px").parent().css({"background":"url(images/plus.gif) no-repeat 5px 1px", "width":"288px"});
        $("li h4", "#content").click(function() {
            $("li h4", "#content").next(":visible").slideUp("slow").parent().css("background-image", "url(images/plus.gif)");
            $(this).next(":hidden").slideDown("slow").parent().css("background-image", "url(images/minus.gif)");
        });
        $("li a", "#slider").colorbox({title: function(){
            var title = $("#tooltip").text();
            return title;
        }});
        $("li a[rel='screens']", "#sidebar").colorbox({title: function(){
            var desc = $(this).next().text();
            return desc;
        }});
        $("li", "#slider").hoverIntent(function() {
            $(this).find("img").stop(true, true).animate({width: 842, height: '+=254'}).parents("#slider, #viewport").stop(true, true).animate({height: '+=254'});
        }, function() {
            $(this).find("img").stop(true, true).animate({width: 440, height: '-=254'}).parents("#slider, #viewport").stop(true, true).animate({height: '-=254'});
        });
    }
    if ( $("#page").hasClass("references") ) {
        $("#slider li a, #content li a").colorbox({width:"80%", height:"80%", iframe:true, title: function(){
            var url = $(this).attr('href');
            if ( $("#tooltip").text() ) {
                var text = $("#tooltip").text();
            } else {
                var text = $(this).attr('title');
            }
            return text+' <a href="'+url+'" target="_blank">in neuem Fenster &ouml;ffnen</a>';
        }});
        $("li", "#slider").hoverIntent(function() {
            $(this).find("img").stop(true, true).animate({width: 842, height: '+=254'}).parents("#slider, #viewport").stop(true, true).animate({height: '+=254'});
        }, function() {
            $(this).find("img").stop(true, true).animate({width: 440, height: '-=254'}).parents("#slider, #viewport").stop(true, true).animate({height: '-=254'});
        });
    }
    if ( $("#page").hasClass("copyright") ) {
        $("h5", "#disclaimer").css({"cursor":"pointer", "background":"url(images/plus.gif) no-repeat 98% 1px"}).next().hide().css("width", "285px");
        $("h5", "#disclaimer").click(function() {
            $("h5", "#disclaimer").next(":visible").slideUp("slow").prev().css("background-image", "url(images/plus.gif)");
            $(this).next(":hidden").slideDown("slow").prev().css("background-image", "url(images/minus.gif)");
        });
    }
});
