var __timeDefine 	= 12;
var __time				= __timeDefine * 1000;
var __arr					= 1;
var __doFlash			= true;
var output  = '<div class="HintGo" style="display:none;float:left;position:relative;top:-169px;left:118px;"><img class="HintGo" align="absmiddle" src="img/GoGoGo.gif" />&nbsp;<img id="Arr_L" class="HintGo"align="absmiddle" src="img/L01.gif" /></div><div class="HintGo" style="display:none;float:right;position:relative;top:-169px;left:-118px;"><img id="Arr_R" class="HintGo" align="absmiddle" src="img/R01.gif" />&nbsp;<img class="HintGo" align="absmiddle" src="img/GoGoGo.gif" /></div>';

$(document).ready(function(){
	$("#container").html( $("#container").html() + output );
	DoFadeIn();
	
	var $news = $('#news-ticker');//we'll re use it a lot, so better save it to a var.
	$news.serialScroll({
		items:'div',
		duration:700,
		force:true,
		axis:'y',
		cycle:true,
		lazy:true,//NOTE: it's set to true, meaning you can add/remove/reorder items and the changes are taken into account.
		interval:5000, //yeah! I now added auto-scrolling
		step:1 //scroll 2 news each time
	});
	
});


function ShowEventInfo(name, picSrc, urlLink) {
	$("#main_pic").attr("src", picSrc);
	$("#info").html(name);
	$("#toLink").attr("href", urlLink);
	$("#index_main_pic_link").attr("href", urlLink);
	$("#normal_btn").hide();
	$("#event_btn").show();
}


function DoFadeIn() {
	window.setTimeout("DoClickHint();", 1500);	
}

function DoClickHint() {	
	$(".HintGo").fadeIn("slow");
	DoFlashArr();
	window.setTimeout("DoHintFadeOut();", __time);
}

function DoHintFadeOut() {
	__doFlash = false;
	$(".HintGo").fadeOut("slow");
}

function DoFlashArr() {

	if(__doFlash) {
		var arr_r = "img/R0" + __arr + ".gif";
		var arr_l = "img/L0" + __arr + ".gif";
		$("#Arr_R").attr("src", arr_r);
		$("#Arr_L").attr("src", arr_l);
		if(__arr >= 3) {
			__arr = 1;
		} else {
			__arr++;
		}
		window.setTimeout("DoFlashArr();", 150);	
	}
}

/*
 * onkeyup="SendAnswer(event);"
 */
function SendAnswer(e, url01, url02) {
	var key = (window.event)? e.keyCode : e.which;
		switch (key) {
			case 97:
			case 49:
				window.location.href = url01;
			break;
			case 98:
			case 50:
				window.location.href = url02;
			break;			
		}
	
}