﻿var adwidth=505;
var adheight=165;
var adwidth_test=505-120;	//面板数字：背景
var adheight_test=165-25;	//面板数字:背景
var adwidth_title=505-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:14px "黑体",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></ul>');
document.write('</div>');
document.write('<div id="play_list">');
document.write('<a href="Controller.cmd?action=businesscard" target="_blank"><img src="../cn/images/sp3.jpg" alt="企业订房专属“星悦卡”"></a><a href="Controller.cmd?action=personalcard" target="_blank"><img src="../cn/images/sp4.jpg" alt="个人“星雅卡”上市，订房特惠"></a>');
document.write('	</div>');
document.write('</div>');

var t = n = count = 0;
var $j = jQuery.noConflict();
$j(function(){
	count = $j("#play_list a").size();
	$j("#play_list a:not(:first-child)").hide();
	$j("#play_info").html($j("#play_list a:first-child").find("img").attr('alt'));
	$j("#play_text li:first-child").css({"background":"#f20",'color':'#fff',"font-size":"16px","font-weight":"bold"});
	$j("#play_info").click(function(){window.open($j("#play_list a:first-child").attr('href'), "_blank")});
	$j("#play_text li").click(function() {
		var i = $j(this).text() - 1;
		n = i;
		if (i >= count) return;
		$j("#play_info").html($j("#play_list a").eq(i).find("img").attr('alt'));
		$j("#play_info").unbind().click(function(){window.open($j("#play_list a").eq(i).attr('href'), "_blank")})
		$j("#play_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
		$j(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);
	$j("#play").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 4000);});
})

function showAuto(){
	n = n >= (count - 1) ? 0 : n + 1;
	$j("#play_text li").eq(n).trigger('click');
}
