// 首页脚本	
	$(function(){
		var page = 1;
		//向后 按钮
		$('#next').click(function(){    //绑定click事件
			 var $parent = $(this).parents("#slider");//根据当前点击元素获取到父元素
			 var $v_show = $parent.find("#photo_list"); //寻找到“商品内容展示区域”
			 
			 if( !$v_show.is(":animated") ){    //判断“商品内容展示区域”是否正在处于动画
				  if( page == 5 ){  
					$v_show.animate({ left : '0px'},"fast"); //通过改变left值，跳转到第一个版面
					page = 1;
					
					}else{
						
					$v_show.animate({ left : '-=975px' }, "fast"); 
					page++;
				 }
			 }
			 $parent.find("span").eq(page-1).addClass("current").siblings().removeClass("current");
	   });
		//往前 按钮
		$("#prev").click(function(){
			 var $parent = $(this).parents("#slider");//根据当前点击元素获取到父元素
			 var $v_show = $parent.find("#photo_list"); //寻找到“商品内容展示区域”
			
			 if( !$v_show.is(":animated") ){    //判断“商品内容展示区域”是否正在处于动画
				 if( page == 1 ){  //已经到第一个版面了,如果再向前，必须跳转到最后一个版面。
					$v_show.animate({ left : '-=3900px' }, "fast");
					page = 5;
				}else{
					$v_show.animate({ left : '+=975px' }, "fast");
					page--;
				}
			}
			$parent.find("span").eq(page-1).addClass("current").siblings().removeClass("current");
		});
		
		$("#controll span").click(function(){
			var val=$(this).text();
			var $parent = $(this).parents("#slider");//根据当前点击元素获取到父元素
			var $v_show = $parent.find("#photo_list"); //寻找到“商品内容展示区域”
			
			if( !$v_show.is(":animated") ){    //判断“商品内容展示区域”是否正在处于动画
				if( val == "食品" ){  //第一个版面
					$v_show.animate({ left : 0 }, "fast");
					page=1;
				}else if(val=="非食品"){ //第二个版面
					$v_show.animate({ left :'-975px' }, "fast");
					page=2;
				}else if(val=="百货"){  //第三个版面
					$v_show.animate({ left : '-1950px' }, "fast");
					page=3;
				}else if(val=="化妆品"){
					$v_show.animate({ left : '-2925px' }, "fast");
					page=4;
				} else {
					$v_show.animate({ left : '-3900px' }, "fast");
					page=5;
				}
			}
			$(this).addClass("current").siblings().removeClass("current");
		});
		
	});
	
    function  hide(e){   
  		if(e.keyCode==9)   
  			return  false
    }
	
	function storesearch(){
		var txt=$('#storename').val();
		if(txt==""){
			$('#storeresult').text("输入不能为空！");
			$('#storename').focus();
		} else {
			$('#storeresult').text("正在帮您查询，请稍后");
			$.get('storeserch.asp',{storename:escape(txt)},function(data){
					if(data=="1"){
						$('#storeresult').text("您附近暂时没有我们的分店");	
					} else{
						$('#storeresult').text("我们为您找到：");	
						
						var strArray=new Array();   
						strArray=data.split("#");
						len=strArray.length;
						for (i = 0; i < len-1; i++){
							tmp=escape(strArray[i]);
							$('#storeresult').append("<a style='margin-right:15px; text_decoration:none; color=#ffffcc;' href='tmp.asp?m="+tmp+"'>"+strArray[i]+'</a>');
						}
					}
			});	
		}
	}
	
	function verify(){
		var cardno=$.trim($('#card').val());
		if(cardno==""){
			alert("卡号不能为空");
			$('#card').focus();
			return false;
		} else{
			if(isNaN(cardno)){
				alert("请输入数字");
				$('#card').focus();
				return false;
			}
			$('#clear').hide('fast');
			$('#submit').hide('fast');
			
			$('.text').text("查询中...");
			$.get('member/flcx.asp',{CDNO:cardno,M:"1"},function(data){
					if(data=="卡号不存在"){
						$('.text').text("");
						alert("您的卡号不存在！");
						$('#card').focus();
						$('#submit').show('fast');
						$('#clear').show('fast');
						return false;
					}
					if(data.substr(1,2)=="<f"){
						$('.text').text("");
						alert("服务器暂时停止服务，请稍后再试！");
						$('#submit').show('fast');
						$('#clear').show('fast');
						return false;
					}
					else {
						
						$('.text').text("");
						$('.text').text(data);
						$('#thickbox').attr('href','info.asp?height=300&width=300&CDNO='+cardno+'&jifen='+data);
						if(document.all) {
							document.getElementById("thickbox").click();	
						}
						else{
							var evt = document.createEvent("MouseEvents");   
    						evt.initEvent("click", true, true);   
    						document.getElementById("thickbox").dispatchEvent(evt);	
						}
					}
					$('#submit').show('fast');
					$('#clear').show('fast');
			});
		}
	}
	function clearTxt(){
		$('#card').attr('value','');
		$('.text').text("");
		$('#card').focus();
	}
	
	function flverify(){
		var flcardno=$.trim($('#flcardno').val());
		if(flcardno==""){
			$('.fltext').text("卡号不能为空！");
			$('#flcardno').focus();
			return false;
		} else{
			if(isNaN(flcardno)){
				$('.fltext').text("请输入数字");
				return false;
			}
			$('#flclear').hide('fast');
			$('#flsubmit').hide('fast');
			$('.fltext').text("查询中...");
			$.get('member/flcx.asp',{CDNO:flcardno,M:"2"},function(data){
					if(data=="卡号不存在"){
						
						$('.fltext').text(data);
					}
					if(data.substr(1,2)=="<f"){
						$('.fltext').text("");
						alert("服务器暂时停止服务，请稍后再试！");
					}
					else {
						
						$('.fltext').text(data);
					}
					$('#flsubmit').show('fast');
					$('#flclear').show('fast');
			});
		}
	}
	function flclearTxt(){
		$('#flcardno').attr('value','');
		$('.fltext').text("");
		$('#flcardno').focus();
	}
	