var adwidth=396;
var adheight=422;
var adwidth_test=396-120;	//面板数字：背景
var adheight_test=422-25;	//面板数字:背景
var adwidth_title=396-100;	//面板上的标题

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:16px "黑体",Verdana, Arial, Helvetica, sans-serif;}');
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></ul>');
document.write('</div>');
document.write('<div id="play_list">');
document.write('<a href="http://www.ethainan.com/adtransfer.aspx?ADID=84" target="_blank"><img src="http://124.172.245.164:999/FTPImage_AD/2010/3/16/20100316101327.jpg" alt="提前订房我就送！"></a><a href="http://www.ethainan.com/adtransfer.aspx?ADID=99" target="_blank"><img src="http://124.172.245.164:999/FTPImage_AD/2010/3/9/20100309180955.jpg" alt="E假四月“踏青游”特辑！"></a><a href="http://www.ethainan.com/adtransfer.aspx?ADID=81" target="_blank"><img src="http://124.172.245.164:999/FTPImage_AD/2010/1/5/20100105182421.jpg" alt="三亚海钰珍珠有限公司"></a><a href="http://www.ethainan.com/adtransfer.aspx?ADID=91" target="_blank"><img src="http://124.172.245.164:999/FTPImage_AD/2010/1/30/20100130153526.jpg" alt="“温泉季，泡汤最享受”！"></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":"16px","font-weight":"bold"}).siblings().css({"background":"#B3B3B3",'color':'#fff',"font-size":"12px"});
	});
	t = setInterval("showAuto()", 4000);
	$("#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');
}