$(document).ready(function() {
	
	/*
active: .active-ttab	
	*/
	
	// Anaonim Blok Ögeleri
	$('.anons-block-item-bottom').each(function() {
		var element = $(this).text().split(','); 
		for (j=0; j<element.length; j++)
			{
				var divs = element[j];
				$(this).append('<div class="'+divs+'"></div>');
			}
    });
	
	// Anonim Blok Ayarı
	$('.anons-block-item').hover(
		function() {
			$(this).addClass('anons-block-item-active');
		}, function() {
			$(this).removeClass('anons-block-item-active');
	});
	
	// Tabs Ayarı
	$('.tt-tabs').ttabs();
	
	$('.index-tabs2 span').hover(
		function() {
			$(this).addClass('index-tab-hover');
		}, function() {
			$(this).removeClass('index-tab-hover');
	});
	
	// Yeni Ögeler
	$('.news-item:odd').css({'background':'#191919'}).find('.news-item-text').css({'color':'#939393'});
	
	// Oynatma Ayarı
	$('.play').hover(
		function() {
			$(this).addClass('play2');
		}, function() {
			$(this).removeClass('play2');
	});
	
	// Gizli Çekim Ayarı 
	$('.hidden-shotstory').each(function() {
		var fixedWidth = $(this).width();
		var fixedHeight = $(this).height();
		$(this).css({'margin-left':-fixedWidth/2,'margin-top':-fixedHeight/2});
    });
	
	// Oynatma Kısımı
	$('.play').click(function(){
		$(this).parent().parent().find('.hidden-shotstory').fadeIn();
		$('.dark').fadeIn();
	});
	
	// Gizleme ve Kapatma
	$('.close, .dark').click(function(){
		$('.hidden-shotstory').fadeOut(0);
		$('.dark').fadeOut();
	});
	
	$('.video-news:first').addClass('video-news-active');
	
	// Yeni Videolar Sürdürme Kısımı
	function showVideoNext() {
		$('.video-news').removeClass('video-news-active');
		var currentVideo = $(this).parent().parent().parent();
		currentVideo.addClass('video-news-active');
		
		var nextVideo = currentVideo.next('.video-news').length ? currentVideo.next('.video-news') : $('.video-news:first');
		currentVideo.find('.hidden-shotstory').fadeOut(0);
		nextVideo.find('.hidden-shotstory').fadeIn(1000);
		nextVideo.find('.shadow-x').fadeIn(0).fadeOut(800);
		
	}
	
	// Yeni Videolar Gösterme Kısımı
	function showVideoPrev() {
		$('.video-news').removeClass('video-news-active');
		var currentVideo = $(this).parent().parent().parent();
		currentVideo.addClass('video-news-active');
		
		var nextVideo = currentVideo.prev('.video-news').length ? currentVideo.prev('.video-news') : $('.video-news:last');
		currentVideo.find('.hidden-shotstory').fadeOut(0);
		nextVideo.find('.hidden-shotstory').fadeIn(1000);
		nextVideo.find('.shadow-x').fadeIn(0).fadeOut(800);
	}
	
	// Panel Sağ/Sol Ayarı
	$('.panel-right').click(showVideoNext);
	$('.panel-left').click(showVideoPrev);
	
	// Panel Sağ Kısımı
	$('.panel-right').hover(
		function() {
			$(this).addClass('panel-right2');
		}, function() {
			$(this).removeClass('panel-right2');
	});
	
	$('.panel-left').hover(
		function() {
			$(this).addClass('panel-left2');
		}, function() {
			$(this).removeClass('panel-left2');
	});
	
	// Slayt Menü
	$('.slide-menu-1').hover(
		function() {
			$(this).addClass('slide-menu-2');
		}, function() {
			$(this).removeClass('slide-menu-2');
	});
	
	$('.slide-menu-1').click(function(){
		$(this).toggleClass('slide-menu-3').next('.slide-menu-hidden').slideToggle();
	});
	
	
	// Tabs Alanı
	$('.tt-tabs3').ttabs({
		activeClass: 'active-ttab2'
	});
	
	// Giriş Paneli
	$('.login-panel-open').click(function(){
		$('.login-block').slideToggle();
	});
	
	
	
});

