$(document).ready(function() {
	$('.slider-carousel > ul').jcarousel({
		'scroll' : 1,
		'auto': 0,
		'buttonNextHTML': '',
		'buttonPrevHTML': '',
		'initCallback':  init_carousel,
		'itemFirstInCallback': set_active,
		'wrap': 'both'
	});
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		DD_belatedPNG.fix('.main-top ,.main-bottom ');
	};
		
	$("a[rel='gallery']").colorbox();
	$(".video-lightbox").colorbox({
		scrolling: false,
		iframe:true,
		width:"602px", 
		height:"419px"
	});
	
	$('a.box-form').colorbox({
		scrolling: false,
		onComplete: function(){
			$.colorbox.resize();
		}
	});
	
	$(".box-form-2").colorbox({width:"1005px", height:"700px", iframe:true});
	
	//Slider-Videos
	//Hiding all tabs
	$(".video .tab ").hide();

	// Showing First Tab
	$(".video .tab ").eq(0).show().addClass("active");
	$(".video-nav  a").eq(0).addClass('active');
	$(".video-nav  a").hover(function(){
		var number =  $(this).parents('.video-nav').find('a').index(this);
		if ($(this).hasClass('active')) {
			}else{
			$(".video .tab ").hide();
			$(".video .tab ").stop(true , true).eq(number).fadeIn();
			$(".video-nav  a").removeClass('active');
			$(this).addClass('active');
		};

		return false;
	});
	
	
	//Slider-Videos
	//Hiding all tabs
	$(".tabs .holder .tab ").hide();

	// Showing First Tab
	$(".tabs .holder .tab ").eq(0).show().addClass("active");
	
	$(".tabs .nav a").click(function(){
		var number =  $(this).parents('.tabs .nav').find('a').index(this);
		$(".tabs .holder .tab ").hide();
		$(".tabs .holder .tab ").stop(true , true).eq(number).fadeIn();
		return false;
	});
	
	$('.row-slider ul').jcarousel({
		'vertical': true,
		'scroll' : 1,
		'auto': 10,
		'buttonNextHTML': '',
		'buttonPrevHTML': '',
		'wrap': 'both'
	});


});
function init_carousel(carousel) {
	$('.slider .slider-nav a.prev').click(function(){
		carousel.prev();
		return false;
	});
	
	$('.slider .slider-nav a.next').click(function(){
		carousel.next();
		return false;
	});
	
	$('.slider .slider-nav a').click(function(){
		if( $(this).hasClass('prev') || $(this).hasClass('next') ) {
			return;
		}
		var slider_number =  $(this).parents('.slider-nav').find('a').index(this)+1;
		carousel.scroll( slider_number );
		return false;
	});
};
	
function set_active(carousel, item, idx, state){
	$('.slider .slider-nav a').removeClass('active');
	$('.slider .slider-nav a').eq(idx-1).addClass('active');
}
