$(document).ready(function(){
	setLanguage();
	$('.hover img').hover(function(){
		var src = $(this).attr('src');
		$(this).attr('src',src.replace(/(\.\w+)$/,'_o$1'));
	},function(){
		var src = $(this).attr('src');
		$(this).attr('src',src.replace(/_o(\.\w+)$/,'$1'));
	});
	$('#searchbtn').hover(function(){
		$('#search_bg').show();
	},function(){
		$('#search_bg').hide();
	});
});
function setLanguage() {
	var src;
	if (location.pathname.match(/^\/zh-CN/)) {
		$('#lang3 a').removeClass('hover');
		src = $('#lang3 a img').attr('src');
		$('#lang3 a img').attr('src',src.replace(/(\.\w+)$/,'_s$1'));
	} else if (location.pathname.match(/^\/en/)) {
		$('#lang2 a').removeClass('hover');
		src = $('#lang2 a img').attr('src');
		$('#lang2 a img').attr('src',src.replace(/(\.\w+)$/,'_s$1'));
	} else {
		$('#lang1 a').removeClass('hover');
		src = $('#lang1 a img').attr('src');
		$('#lang1 a img').attr('src',src.replace(/(\.\w+)$/,'_s$1'));
	}
	var href = location.pathname.replace(/^\/zh-CN/,'').replace(/^\/en/,'');
	$('#lang1 a').attr('href',href);
	$('#lang2 a').attr('href','/en'+href);
	$('#lang3 a').attr('href','/zh-CN'+href);
}
var iconanim = 0;
var icontimeline = [1,8,11,11,12,12,12,12,11,10,9,6,4,3,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,2,1,0,1];
function animateNewIcon() {
	iconanim++;
	if (iconanim==icontimeline.length) {
		iconanim = 0;
		setTimeout(animateNewIcon,2000);
	} else {
		$('.topicnew img').css({top:(-68*icontimeline[iconanim])+'px'});
		setTimeout(animateNewIcon,67);
	}
}

