var $j = jQuery.noConflict();
$j(document).ready(function(){
	initFadeSlider();
	initLightBox();
	
	$j(".gallery_wrapper .items .item-wrapper").each(function(e){
	  $j(this).addClass('item-wrapper-'+(e+1));
	})
	
	$j(".gallery_wrapper .items .item-wrapper .item").each(function(i){
		$j(this).addClass('item-'+(i+1));
	});
	
	$j(".gallery_wrapper .items .item-wrapper .item-video").each(function(q){
		$j(this).addClass('item-video-'+(q+1));
	});
	
	if ($j("ul#categories > li").hasClass('active')){
		$j("ul#nav-right li a[href *= 'videos_photos']").addClass('active');
	}
	
	var page_href = window.location.pathname;
	var page_length = page_href.lastIndexOf("/");
	var active_href = page_href.substr(0,page_length+1);
	$j("ul#nav-left li a[href *= "+active_href+"],ul#nav-right li a[href *= "+active_href+"]").first().addClass('active');

	if($j("ul#nav-left li.language div.floatleft").click()){
		$j("ul#nav-left li a").first().removeClass('active');
	}
	
	Shadowbox.init({
   		language: 'en',
   		players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv', 'mp4']
   		/*onOpen: function() {
 			$j('#sb-nav').appendTo($('#sb-title'));
 			$j('#sb-title-inner').hide();
 			$j('#sb-title').css('height', 'auto');
   }*/
	});
});

function initFadeSlider(){
	if ($j('.box-slider').length == 0){
		return false;
	}	
$j(".box-img").css("visibility","visible");

	$j('.box-slider .fader')
	.cycle({
		fx: 'fade',
		speed: 300, 
    	timeout: 6000
	});
};

function initLightBox(){
		$j(".gallery_wrapper .items .item a").fancybox();
		
		/*$j(".gallery_wrapper .items .item-video a.video").click(function() {
			$j.fancybox({
			'padding'               : 0,
			'autoScale'             : false,
			'title'                 : this.title,
			'width'         : 640,
			'height'                : 360,
			'href':this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'                  : 'swf'
			});
			return false;
		}); */
		
		
		/*$j(".gallery_wrapper .items .item-video a.video").click(function() {
			$j.fancybox({
			'padding': 0,
			'autoScale': false,
			'transitionIn' :'none',
			'transitionOut':'none',
			'title': this.title,
			'width': 400,
			'height' : 300,
			'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type' : 'swf',
			'swf' : {
			  'wmode' : 'transparent',
			  'allowfullscreen' : 'true'
			}

 			});

			return false;
		}); */
		
		/*$j(".gallery_wrapper .items .item-video a.video").fancybox({
			'hideOnContentClick': true,
			'frameWidth' : 600,
			'frameHeight' : 485
		});*/
}

