$(document).ready(function(){

		$("#ctrl_contentticker").tabs("ul#contentticker li", {effect: 'fade', fadeOutSpeed: "slow", rotate: true}).slideshow({autoplay: true});
		$("#ctrl_gallery").tabs("ul#gallery_imgs li", {effect: 'fade', fadeOutSpeed: "slow", rotate: true}).slideshow({autoplay: true});
		
		$('#filter_trigger').click(function () { 
			$('.sub_filter').slideToggle();
			 $(this).toggleClass("filter-highlight");
		});
		
		$(".sample a").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayColor'  :   '#000',
			'overlayOpacity':   '0.8',
			'titleShow'     :  false,
			'padding' : '0'
		});
			
});


$(function() {   

        var theWindow        = $(window),
            $bg              = $("#bg"),
            aspectRatio      = $bg.width() / $bg.height();

        function resizeBg() {

                if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
                    $bg
                        .removeClass()
                        .addClass('bgheight');
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');
                }

        }

        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");
		
		var theWindow        = $(window),
            $bg              = $("#bg2"),
            aspectRatio      = $bg.width() / $bg.height();

        function resizeBg() {

                if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
                    $bg
                        .removeClass()
                        .addClass('bgheight');
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');
                }

        }

        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");

});
