﻿var t = n = 0, count = $("#play_list a").size();
$(function() {
    $("#play_list a:not(:first-child)").hide();
    $("#play_info").html($("#play_list a:first-child").attr('title'));
    $("#play_text li:first-child").css({"background-position": "-160px -80px"});
	$("#play_text li:first-child img").css({"border-color": "#c30"});
    $("#play_info").click(function() { window.open($("#play_list a:first-child").attr('href'), "_blank") });
    $("#play_text li").click(function() {
        var i = $(this).index();
        n = i;
        if (i >= count) return;
        $("#play_info").html($("#play_list a").eq(i).attr('title'));
        $("#play_info").unbind().click(function() { window.open($("#play_list a").eq(i).attr('href'), "_blank") })
        $("#play_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
        $(this).css({"background-position": "-160px -80px"}).siblings().css({ "background-position": "300px -80px"});
		$(this).find("img").css({"border-color": "#c30"}).parent().siblings().find("img").css({ "border-color": "#fff"});
    });
    t = setInterval("showAuto()", 5000);
    $("#play").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 5000); });
})

function showAuto() {
    n = n >= (count - 1) ? 0 : ++n;
    $("#play_text li").eq(n).trigger('click');
}


$(function(){
	var roll_h=$("#roll_qp li").height();
	var size=$("#roll_qp li").size();
	var count=1;
	function roll_qp(){
		if(count>=size){
			count=1;
			$("#roll_qp ul").animate({top:"0"});
		}else{
			$("#roll_qp ul").animate({top:"-="+roll_h});
			++count;
			}
		}
	var loop=setInterval(roll_qp,5000);
})
