Cufon.replace('#mainnav a, #subnav a, li.slash, #footer, h1, h2, h3, .cufon', {
    hover:true,
    textShadow: '1px 1px #ccc',
    hover: {
        textShadow: '1px 1px #ccc'
    }
});

$(document).ready(function(){
    $.backstretch("fileadmin/templates/img/background.jpg");
    
    $('a.lightbox').each(function(){ 
        $image = $('img', this).before('<img class="magnify" src="fileadmin/templates/img/magnify.png" alt="" width="16" height="16" />');

        $('a.lightbox .magnify').css({'opacity' : 0.5});
        var $icon = $image.prev("img");
        
        $(this).hover(function(){
            $icon.stop().fadeTo('fast', 1.0);    
        },function(){
            $icon.stop().fadeTo('fast', 0.5);        
        });
    });
    
    $('a.fancybox').each(function(){ 
        $image = $('img', this).before('<img class="scicon" src="fileadmin/templates/img/soundcloud.png" alt="" width="25" height="14" />');

        $('a.fancybox .scicon').css({'opacity' : 0.5});
        var $icon = $image.prev("img");
        
        $(this).hover(function(){
            $icon.stop().fadeTo('fast', 1.0);    
        },function(){
            $icon.stop().fadeTo('fast', 0.5);        
        });
    });
 
    
    $("a[rel=lightbox]").fancybox({
        'transitionIn' : 'fade',
        'transitionOut' : 'fade',
        'speedIn' : 300,
        'speedOut' : 300,
        'centerOnScroll':'true'
      });
      
    $("a.fancybox").fancybox({
		'type':'inline',
		'centerOnScroll':'true',
		'showNavArrows':'false'
	});

      
    var config = {    
        sensitivity: 10, // number = sensitivity threshold (must be 1 or higher)    
        interval: 100,  // number = milliseconds for onMouseOver polling interval    
        over: doOpen,   // function = onMouseOver callback (REQUIRED)    
        timeout: 200,   // number = milliseconds delay before onMouseOut    
        out: doClose    // function = onMouseOut callback (REQUIRED)    
    };

    function doOpen() {
        $level2 = $(this).find('ul');
        position = $level2.position();
        $level2.css({'left':position.left - 80});
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');
    }

    function doClose() {
        $level2 = $(this).find('ul');
        $level2.attr('style','');
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');
    }

    $("#mainnav ul.level1 li").hoverIntent(config);
    $("#mainnav ul.level1 li ul li:has(ul)").find("a:first").append(" &raquo; ");
});




