// window.domready Events

jQuery(document).ready(function(){
    jQuery('.page-header-navigation-second', '#nav').each(
        function(){
            var primenav = jQuery(this).parent();
            var subnav = jQuery(this);

            var offset = 15;
            var subnavHeight = subnav.height();

            var primenavHeight = subnavHeight + offset;

            primenav.height(offset);
            subnav.animate({ opacity: 0, height: 0 });

            primenav.hover(
                function(){
                    primenav.height(primenavHeight);
                    subnav.stop();
                    subnav.animate({ opacity: 0.8, height: subnavHeight }, 200);
                },
                function(){
                    primenav.height(offset);
                    subnav.stop();
                    subnav.animate({ height: 0, opacity: 0 });
                }
            );
        }
    );


    /**
     * set hover state for linked images
     * @param {Object} element
     */
     jQuery('.content-teaser').each(
         function(){
             if(undefined != jQuery('a', jQuery(this)))
             {
                 var linkUrl = jQuery('a').attr('href');
                 if(linkUrl != undefined)
                 {
                     jQuery(this).addClass('clickable');
                     jQuery(this).click(function(){
                         document.location.href = linkUrl;
                     });
                 }
             }
         }
     );

	jQuery('#n-system a:first').click(function(){return false;});
	
	jQuery('#nav ul.page-header-navigation-second li:first-child').parent().addClass('child-elements');
	jQuery('#n-shootings').next().addClass('shooting-second');
});

/**
 * Scrolling needed by the newsletter iframe content
 * @return
 */
function scrollToTop()
{
    scrollTo(0,0);
}
