/*---------------flash效果--------------------*/
$(function(){
	$(".index_flash_pro li:eq(0)").fadeIn(400);//图片初始化
	$("#index_flash_btn1").click(	  
		function(){
			left();
			return false;
		}
	);
	$("#index_flash_btn2").click(	  
		function(){
			right();
			return false;
		}
	);
	Time=window.setTimeout("right()",10000);
});

function right(){
	if(!$(".index_flash_pro li").is(":animated")){
		window.clearTimeout(Time);
		//控制图片 显示下一张
		$(".index_flash_pro li:eq(0)").fadeOut(400,function(){ 
			$(".index_flash_pro li:eq(0)").appendTo(".index_flash_pro");
			$(".index_flash_pro li:eq(0)").fadeIn(400);
		});
		//控制名称 向左移动
		var positionLeft=$(".index_flash_btn").position();
		var i=Math.abs((positionLeft.left-20)/320);
		var n=$(".index_flash_btn").find("li").length-1;
		var v_width=$(".index_flash_btn li").width();
		if(i==n){
			$(".index_flash_btn").animate({left:'20px'},"slow");
			i=0;
		}else{
			$(".index_flash_btn").animate({left:'-='+320},"slow");
			i++;
		}
		Time=window.setTimeout("right()",10000);
	}
};
function left(){
	if(!$(".index_flash_pro li").is(":animated")){
		window.clearTimeout(Time);
		//控制图片 显示上一张
		$(".index_flash_pro li:eq(0)").fadeOut(400,function(){
			$(".index_flash_pro li:last").prependTo(".index_flash_pro");
			$(".index_flash_pro li:eq(0)").fadeIn(400);	
		});
		//控制名称 向右移动
		var positionLeft=$(".index_flash_btn").position();
		var i=Math.abs((positionLeft.left-20)/320);
		var n=$(".index_flash_btn").find("li").length-1;
		if(i==0){
			$(".index_flash_btn").animate({left:'-='+320*n},"slow");
			i=n;
		}else{
			$(".index_flash_btn").animate({left:'+='+320},"slow");
			i--;
		}
		Time=window.setTimeout("right()",10000);
	}
};

function searchForm(strurl,strmsg)
{
	var keyword = document.searchform.Keyword.value;
	if (keyword =="" )
	{
		alert(strmsg);
		document.searchform.Keyword.focus();
		return false;
	}
	else
	{
		location.href =strurl+"?strKey="+escape(keyword.toLowerCase());
		//location.href ="productsearch.html?strKey="+(keyword);
	}
}

