$(document).ready(function(){
	//$("div.textdiv").click(function(){
		//if ($(this).parent().prev().prev().is(":visible")) {
			//moveback(this);
		//}
	//})
	$("div.textdiv").mouseover(function(){
		if ($(this).parent().prev().prev().is(":visible"))
			$(this).stop().animate({color: "#FF8800"}, 100);
	})
	$("div.textdiv").mouseout(function(){
		if ($(this).parent().prev().prev().is(":visible"))
			$(this).stop().animate({color: "#9E9E9E"}, 100);
	})
	$("div.subtextdiv").mouseover(function(){
		$(this).stop().animate({color: "#FF8800"}, 100);
	})
	$("div.subtextdiv").mouseout(function(){
		$(this).stop().animate({color: "#FFFFFF"}, 100);
	})
});
  
function moveback(){
  	var target = $("div.normaldiv").not($("div:visible"));
	
	target.next().stop().hide("slide", {direction: "right"}, 300,function(){
		target.stop().show();
	});
	target.next().next().children().stop().animate({color: "#9E9E9E"}, 300);
}

function linkTo(link){
	setTimeout(function(){
		window.location = link;
	}, 500);
	moveback();
}

function center(){
	var top=($(window).height()-505)/2;
	top = top>0?top:0;
	var left = ($(window).width()-940)/2;
	left = left>0?left:0;
	$("#frame").css("top", top);
	$("#frame").css("left", left);
}
center();
$(window).load(function(){
	center();
});
$(window).resize(function(){
	center();
});

function switchlang() {
  thishref = top.location.href;
  if (thishref.indexOf('/cn/')>0) 
    top.location.href=thishref.replace(/\/cn\//gi,"/en/");
  else {
  	top.location.href=thishref.replace(/\/en\//gi,"/cn/");
  }
}

function popVideo(link){
	window.open(link,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=320, height=310");
}
