 $(window).load(function(){   
    
    
    $('#mediadata_video').click(function(){
        $('.mediadata ul a').removeClass('active');
        $(this).addClass('active');
        $('.objects div.container').hide();
        $('#video').show(); 
    });
    $('#mediadata_screenshots').click(function(){
        $('.mediadata ul a').removeClass('active');
        $(this).addClass('active');
        $('.objects div.container').hide();
        $('#screenshots').show();
    });
    $('#mediadata_referenzen').click(function(){
        $('.mediadata ul a').removeClass('active');
        $(this).addClass('active');
        $('.objects div.container').hide();
        $('#referenzen').show();       
    });
    
    Galleria.loadTheme('/templates/frontend/simploostart/_res/galleria/themes/twelve/galleria.twelve.min.js');
    $("#screenshots").galleria({
        width: 350,
        height: 260,
        showCounter: false,
        _showPopout: false,
        _showFullscreen: false,
        autoplay:true 
    });
    $("#referenzen").galleria({
        width: 350,
        height: 260,
        showCounter: false,
        _showPopout: false,
        _showFullscreen: false,
        autoplay:true
    });
      
    
    var contact = $('#contact');
    
    contact_init(contact);
    
    $(window).resize(function(){
        contact_init(contact);    
    });
    
    $(window).scroll(function(){
        contact_init(contact);    
    });
    
    contact.mouseenter(function(){
        contact.animate({left: 0});
    });
    
    contact.mouseleave(function(){
        contact_init(contact);
        
    });
    
    $('h1.toggle').click(function(){
        var uid = $(this).attr('id');
        
        $('#content_' + uid).toggle();
    });
 });
 
 function contact_init(contact){
    var window_height = $(window).height();
    var scroll_top    = $(window).scrollTop();
    var contact_height = contact.height();
    var contact_width  = contact.width();
    contact.css({top: (window_height - contact_height)/3.5 + scroll_top, left: 20 - contact_width});
    contact.show();
 } 
 
