$(document).ready(function()
	{ 
		$("#haberler p.red_header").each(function(index){
			$(this).click(function(){
				if( !$(this).children("a").eq(0).attr("class")){
					$(this).children("a").eq(0).attr("class","selected");
					acKapa(index);
				}
				else{
					$(this).children("a[class!=ex]").eq(0).removeAttr("class");
					$(".leftNav:eq("+index+")").css("display","none");
				}							
			});
		});
		
		$(".leftNav a").each(function(s){
			$(this).click(function(){
				$(this).attr("class","selected");
				var ye = $('.leftNav').index($(this).parents('.leftNav'));
				acKapa2(ye, s);		
			});
			
		});
		
		
		function acKapa2(y, h){
			$(".leftNav a").each(function(n){
				if(n != h){
					$(this).removeAttr("class");
				}
			});
			
			$("#main .yil .haber").each(function(t){
				var se = $('.yil').index($(this).parents('.yil'));
				if( (h==t) && (se==y) ){
					$(this).css("display","block");
				}
				else{
					$(this).css("display","none");
				}
			});
		}
		
		function acKapa(k){
			$("#haberler p.red_header").each(function(i){
				if(k != i){
					$(this).children("a").eq(0).removeAttr("class");
				}
			});
			
			$(".leftNav").each(function(ind){
				if(ind == k){
					$(this).css("display","block");
				}
				else{
					$(this).css("display","none");
				}
			});
			
		};
	});