function changePosition_Board(val){	
	for( i=1 ; i<=3 ; i++ ){
		if( i != val){
			$('#tab'+i).hide();
			$('#board'+i).hide();			
		}else{
			$('#tab'+val).show();
			$('#board'+val).show();			
		}
	}
} 
function tabHowto(val){
  for(hh=1;hh<=2;hh++){
		 if(hh!=val){
			document.getElementById("how"+hh).style.display='none';
			document.getElementById("active-how"+hh).style.backgroundColor='#F4A460';
			document.getElementById("active-how"+hh).style.color='#FFFFFF';
		 }else{
			document.getElementById("how"+hh).style.display='';
			document.getElementById("active-how"+hh).style.backgroundColor='#FFFFFF';
			document.getElementById("active-how"+hh).style.color='#005CA2';
		 }
	}
}
function viewvote(v){
	if(v==1){
		$('#view-score').show();				
		$('#view-vote').hide();
	}else{
		$('#view-vote').show();
		$('#view-score').hide();
	}
	return false;
}
var news_fade_interval;
function changeNewsTab(tab_index){
	//alert(tab_index);
	$('#tab_menu li').each(function(i){
		if( i != tab_index ){
			$(this).removeClass('active');
			$('div.tab_news_block').eq(i).hide();
		}else{
			$(this).addClass('active');
			$('div.tab_news_block').eq(i).show();
		}
		clearInterval(news_fade_interval);
	});
}
$(document).ready(function(){
	news_fade_interval = setInterval(rotate_news , 20000);
	function rotate_news() {
		var tabs = $('.tab_news_block');
		var menus = $('#tab_menu li');
		var current_tab = $('.tab_news_block:visible');
		var current_menu = $('#tab_menu li.active');
		
		var news_index = (tabs.index(current_tab[0]) + 1) % tabs.length;
		current_tab.css('display','none');
		current_menu.removeClass('active');
		tabs.eq(news_index).css('display','block');
		menus.eq(news_index).addClass('active');
	}
});

// fade 
var timer = 20000;
var hilight_interval = 0;
function nextHilight(){
	var next_hilight = 1;
	var current_hilight = 1;
	var iteration = 1;
	$('#hilight_block .nav div.small').each(function(d){
		if($(this).hasClass("active")){
			current_hilight = iteration;
		}	
		iteration++;
	});
	
	var quanlity = $('#hilight_block div.girl_hilight').length;

	
	if(current_hilight<quanlity){
		next_hilight = parseInt(current_hilight)+1;
	}else{
		next_hilight = 1;
	}
	$('#hilight_block .nav div.small').removeClass('active');
	$('#hilight_block .nav div.small').eq(parseInt(next_hilight)-1).addClass('active');	
	if($('#hilight_block div.girl_hilight').fadeOut(5000)){
	$('#hilight_block #hilight_'+next_hilight).fadeIn(4500);
	};
}
$(document).ready(function(){					
		hilight_interval = setInterval(nextHilight, timer);
		$('#hilight_block .nav div.small').mouseover(function(){
			clearInterval(hilight_interval);
			var iteration = 1;
			$('#hilight_block .nav div.small').removeClass('active');	
			$(this).addClass('active');			
			$('#hilight_block div.girl_hilight').hide();
			$('#hilight_block .nav div.small').each(function(d){
				if($(this).hasClass("active")){
					$('#hilight_block #hilight_'+iteration).show();
				}	
				iteration++;
			});		
		});
		$('#hilight_block .nav div.small').mouseout(function(){
			hilight_interval = setInterval(nextHilight, timer);
		});
		$('#hilight_block div.girl_hilight').mouseover(function(){
			clearInterval(hilight_interval);
		});
		$('#hilight_block div.girl_hilight').mouseout(function(){
			hilight_interval = setInterval(nextHilight, timer);
		});
});
