//ȥ����t�ӿ��
$(function(){$("a").focus(function(){$(this).blur()})});

//����Сͼ
var n;
function mouseover(n){
	var b = document.getElementById("picPos" + n);
	if(b){
		b.style.visibility = "visible";
	}
}
function mouseout(n){
	var b = document.getElementById("picPos" + n);
	if(b){
		b.style.visibility = "hidden";
	}
}

//bannerFlash
$(document).ready(function(){
	//���÷�ת��
	var inProgress=false;
	var current=0,old=0;
	var hiddenPosition=$('.imgWrapper > a').height();
	var count=$('.imgWrapper > a').length;
	var totalHeight=count*hiddenPosition;
	var movePosition;
	var timeout;
	var change;
	var inProgress=false;
	var nowon=false;
	//ִ�з�ת
	
	var autoPlay=function(){
		timeout=false;
		current= (old+1) % count;
		movePosition=current*hiddenPosition;
		$('.bannerL li> a').removeClass('current');
		$('.bannerL li> a:eq('+current+')').addClass('current');
		$('.imgWrapper')
		.animate({top:-movePosition},'normal',function(){
													   
				if(!timeout){
				timeout=setTimeout(autoPlay,6000);
				}
				
		});
		old=current;
	};
		timeout=setTimeout(autoPlay,6000);
//��ͣ �л�ͼƬ
//	$('.imgWrapper > a').click(function(){
//		return false;
//	}
//	);
	$('.imgWrapper > a').hover(
		function(){
			clearTimeout(timeout);
			timeout=false;
		},
		function(){
			if(!timeout){
			timeout=setTimeout(autoPlay,6000);
			}
		}
	);
	
	$('.bannerL  a').hover(function(){
			clearTimeout(timeout);
			timeout=false;
			var $this=$(this);
			$this.click(function(){
				if(!nowon){
					nowon=true;
					if(!inProgress){
						inProgresss=true;
						change=parseInt(this.name.slice(-1));
						movePosition=change*hiddenPosition;
						$('.imgWrapper')
						.animate({top:-movePosition},'fast',function(){
							nowon=false;
						});
						$('.bannerL li> a').removeClass('current');
						$('.bannerL li> a:eq('+change+')').addClass('current');
						clearTimeout(timeout);
						timeout=false;	
						old=change;
						inProgress=false;
					}
				}
				return false;
			}
			);
		},
		function(){
			var $this=$(this);
			$this.click(function(){
			}
			);
			if(!timeout){
			timeout=setTimeout(autoPlay,6000);
			}	
		}
	);
										
});
