// get handle to scrollable API
function goHere(a,b) {
	var api = $(".focusArea").data("scrollable");
	api.seekTo(a, b);

}
	


// slideShow Plug
$(function(){
		// slideShow Plug
		var c1 = '.focusArea';
		var c2 = '.items';
		var c3 = 'h1';
		var c4 = '.title';
		var ot = $(c1+' '+c2+' '+c3+':eq(0)').text(); 
		var ou = $(c1+' '+c2+' a:eq(0)').attr('href');
		$(c4+' '+c3+' a').text(ot).attr('href',ou);
		$(c1).scrollable({
					speed:0 			//滑动时间 0ms
					,vertical:true 		//垂直滚动
					,circular:true		//循环
					,onBeforeSeek: function() {this.getItems().fadeTo(0, 0.2); //滚动前透明度变化
											  } 
					,onSeek: function() {
							var n=this.getIndex()+1;
							var t=$(c1+' '+c2+' '+c3+':eq('+n+')').text();
							var u=$(c1+' '+c2+' a:eq('+n+')').attr('href');											
							$(c4+' '+c3+' a').text(t).attr('href',u);
							this.getItems().stop().fadeTo(300, 1);	  //滚动后透明度变化
							
							var index=n-1
							var track =index*64;
							$(".focusArea .pointer").stop().animate({top:track},300);
										} 
					}).navigator()
					.autoscroll({interval:5000});		//切换间隔 5秒
					
					var api;
					var playTimer;
					$(c1+" .navi a").mouseover(function(){
					api = $(c1).data("scrollable");
					api.stop();
					//clearTimeout(playTimer);
					//playTimer = setTimeout("startAuto()",5000);
					});
					
					//function startAuto() {
					//api.play();
					//}
					
										
		
		
		
		//创建滑动边框
		
		var pointerW = 103;
		var pointerH = 67;
		var borderColor ="#848484";
		var borderWidth = 3;
		$(c1).append("<div class='pointer'></div>")
		$(c1+' .pointer').css({	position:"absolute",
								width:pointerW,
								height:pointerH,
								right:0,
								top:0,
								"z-index":1	
				  			});
		for(i=0;i<5;i++)	
		{	$(c1+' .pointer').append("<b></b>");
			var h= 2*i+1; var t= (pointerH-h)/2;
			$(c1+' .pointer b:last-child').css({height:h,"margin-top":t});
		}
		$(c1+' .pointer b').css({   display:"block",
									float:"left",
									"font-size":"0px",
									"line-height":"0px",
									background:borderColor,
									width:1
								});
		$(c1+' .pointer').append("<div></div>");
		ww= pointerW-borderWidth*2-5; hh= pointerH-borderWidth*2;
		b= borderWidth+"px solid "+borderColor; 
		$(c1+' .pointer div').css({   width:ww,
									  height:hh,
									  float:"left",
									  border:b
								  });
});