/**
 * Page Load Events 1.0
 *
 * 12.04.2011
 *
 * mediaman technology
 */
jQuery(function(){
    //$(document).pngFix();
    $('.openWindow').popupWindow({ 
        height:500, 
        width:800, 
        centerBrowser:1 
    });
    
    // Navigation
    $('#navpanel li').click(function(){
        navigatePanel($(this));									 
    });
    
    // Logo scroll to home
    $('#navpanel').bind('click', function() {   
        // close gallery if showing
        if($('#homeGalleryWidget').css('display') === "block"){
            $('#homeGalleryWidget').gallery("closeGallery");
        }
        
        $('html,body').animate({ scrollTop: 0 }, 1500, function(){
            if ((navigator.userAgent.match(/iPad/i) !== null) || (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
                $(document).trigger('scrollstop');
            }
        });
        return false;
    });
    
    // Animation
    if (Modernizr.touch) {
        touchInit();
    }
    else {
        init();
        $(window).scroll(position);
        position();		
    }	
});
