$(document).ready(function () {
	
	/* 关闭广告 */
	 $("#sh_closead").bind("click", function(){this.parentNode.style.display = "none";})
	/* 焦点图 */
	var w = $("#sh_topicimgarea");
	
	var tps = $("#sh_topicimgarea li a .sh_topictitle");
	var len = tps.length;
	
	var curindx = 0;
	
	var fw = w.innerWidth() - (len - 1) * 30;
	for (var i = 0; i < len; i++) {
		var el = $(tps[i].parentNode);
		
		if (i == 0) {
			el.width(fw);
			el.attr("isShOpen", 1);
		} else {
			el.width(30);
			el.attr("isShOpen", 0);
		}
		el.attr("shIndex", i);
		
		$(tps[i]).bind("mouseover", function() {
			
			var e = $(this.parentNode);
			var idx = e.attr("isShOpen");
			
			if (idx != "1") {
				var le = $(tps[curindx].parentNode);
				var cidx = e.attr("shIndex") - 0;
				le.attr("isShOpen", 0);
				e.attr("isShOpen", 1);
				le.animate({width:"30px"}, 500);
				if (curindx > cidx) {
					tps[curindx].parentNode.className = "after";
				} else {
					tps[curindx].parentNode.className = "before";
				}
				
				curindx = cidx;
				
				this.parentNode.className = "on";
				e.animate({width:fw + "px"}, 500);
				
				
			}	
		});
	}
	
	/* 下载区域 */
	var dlwidth = $("#sh_downloadshow").innerWidth();
	$("#sh_downloadshow").scrollLeft(parseInt($("#sh_downloadshow img").length/2) * dlwidth);
	
	$("#sh_dlleftarrow").bind("click", function(){
		//alert("abc");
		
		$("#sh_downloadshow").animate({scrollLeft: $("#sh_downloadshow").scrollLeft() -dlwidth}, 500);
	});
	$("#sh_dlrightarrow").bind("click", function(){
        $("#sh_downloadshow").animate({scrollLeft: $("#sh_downloadshow").scrollLeft() + dlwidth }, 500);
    });
	
	
	
});
