var adwidth=263;
var adheight=198;
var adwidth_test=262-120;	//面板数字：背景
var adheight_test=198-25;	//面板数字:背景
var adwidth_title=250-80;	//面板上的标题

document.write('<style type="text/css">');
document.write('#play {font-size:12px; font-family:Verdana;margin:0;padding:0}');
document.write('#play img {border:0px}');
document.write('#play {width:'+adwidth+'px;height:'+adheight+'px;overflow:hidden;margin:0;}');
document.write('#play_bg {position:absolute;background-color:#000;margin-top:'+adheight_test+'px;height:25px;width:'+adwidth+'px;filter: Alpha(Opacity=50);opacity:0.5;z-index:10}');
document.write('#play_info{position:absolute;margin-top:'+adheight_test+'px;padding:4px 0 0 5px;height:22px;width:'+adwidth_title+'px;color:#fff; z-index:11;cursor:pointer; font:12px ; Arial;}');
document.write('#play_text {position:absolute;margin:'+adheight_test+'px 0 0 '+adwidth_test+'px;height:25px;width:120px; z-index:12;}');
document.write('#play_text ul {list-style-type:none; display:block; padding:3px 3px 0 0; filter: Alpha(Opacity=80);opacity:0.8; text-align:right;}');
document.write('#play_text ul li {margin:0; padding:0 3px; width:14px;height:14px; background:#B3B3B3; display:inline;color:#FFF; text-align:center; margin:1px; cursor:pointer;font:12px "Courier New",Verdana, Arial, Helvetica, sans-seri;}');
document.write('#play_list a{display:block;width:'+adwidth+'px;height:'+adheight+'px;position:absolute;overflow:hidden}');
document.write('</style>');

document.write('<div id="play">	');
document.write('<div id="play_bg"></div><div id="play_info"></div>');
document.write('	<div id="play_text">');
document.write('<ul><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li></ul>');
document.write('</div>');
document.write('<div id="play_list">');
for(var i = 0;i<mylinks.length;i++){
document.write('<a href="'+mylinks[i]+'" target="_blank"><img src="'+pics[i]+'" alt="'+texts[i]+'"></a>');
}
//document.write('<a href="#" target="_blank"><img src="images/01.jpg" alt="文字1"></a><a href="#" target="_blank"><img src="images/02.jpg" alt="文字2"></a><a href="#" target="_blank"><img src="images/03.jpg" alt="文字3"></a><a href="#" target="_blank"><img src="images/04.jpg" alt="文字4"></a><a href="#" target="_blank"><img src="images/05.jpg" alt="文字5"></a>');
document.write('	</div>');
document.write('</div>');

var t = n = count = 0;
$(function(){
	count = $("#play_list a").size();
	$("#play_list a:not(:first-child)").hide();
	$("#play_info").html($("#play_list a:first-child").find("img").attr('alt'));
	$("#play_text li:first-child").css({"background":"#f20",'color':'#fff',"font-size":"16px","font-weight":"bold"});
	$("#play_info").click(function(){window.open($("#play_list a:first-child").attr('href'), "_blank")});
	$("#play_text li").click(function() {
		var i = $(this).text() - 1;
		n = i;
		if (i >= count) return;
		$("#play_info").html($("#play_list a").eq(i).find("img").attr('alt'));
		$("#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":"#f20",'color':'#fff',"font-size":"12px","font-weight":"bold"}).siblings().css({"background":"#B3B3B3",'color':'#fff',"font-size":"12px"});
	});
	t = setInterval("showAuto()", 5000);
	$("#play").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 4000);});
})

function showAuto(){
	n = n >= (count - 1) ? 0 : n + 1;
	$("#play_text li").eq(n).trigger('click');
}
