jQuery.fn.loadthumb = function(options) {
	options = $.extend({
		 src : ""
	},options);
	var _self = this;
	_self.hide();
	var img = new Image();
	$(img).load(function(){
		_self.attr("src", options.src);
		_self.fadeIn("slow");
	}).attr("src", options.src);  //.atte("src",options.src)要放在load后面，
	return _self;
}
$(document).ready(function(){
	 var len  = $(".num > li").length;
	 var index = 0;
	 var adTimer;
	 $(".num li").mouseover(function(){
		index  =   $(".num li").index(this);
		showImg(index);
	 }).eq(0).mouseover();	
	 //滑入 停止动画，滑出开始动画.
	 $('.ad').hover(function(){
			 clearInterval(adTimer);
		 },function(){
			 adTimer = setInterval(function(){
			    index++;
				if(index==len){index=0;}
				showImg(index);				
			  } , 5000);
	 }).trigger("mouseleave");
});
function showImg(index){
		//定义图片的src
		var src = ["/view/dmgvip/img/bar1.jpg","/view/dmgvip/img/bar2.jpg","./view/dmgvip/img/bar3.jpg"];
		//运用图片预加载插件
		$(".ad img").loadthumb({src:  src[index] });
		$(".num li").removeClass("on")
		.eq(index).addClass("on");
}


(function($){   
$.fn.extend({   
        Scroll:function(opt,callback){   
                //参数初始化   
                if(!opt) var opt={};   
                var _this=this.eq(0).find("ul:first");   
                var        lineH=_this.find("li:first").height(), //获取行高   
                        line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数，默认为一屏，即父容器高度   
                        speed=opt.speed?parseInt(opt.speed,10):700, //卷动速度，数值越大，速度越慢（毫秒）   
                        timer=opt.timer?parseInt(opt.timer,10):5000; //滚动的时间间隔（毫秒）   
                if(line==0) line=1;   
                var upHeight=0-line*lineH;   
                //滚动函数   
                scrollUp=function(){   
                        _this.animate({   
                                marginTop:upHeight   
                        },speed,function(){   
                                for(i=1;i<=line;i++){   
                                        _this.find("li:first").appendTo(_this);   
                                }   
                                _this.css({marginTop:0});   
                        });   
                }   
                //鼠标事件绑定   
                _this.hover(function(){   
                        clearInterval(timerID);   
                },function(){   
                        timerID=setInterval("scrollUp()",timer);   
                }).mouseout(); 
        }
})  
})(jQuery);   
$(document).ready(function(){
        $("#scrollDiv").Scroll({line:6,speed:700,timer:5000});   
});



function LoginForm(){
  uname = $("#uname")[0].value;
  upass = $("#upass")[0].value;
  num = $("#num")[0].value;
  if(uname==""){
  	$.weeboxs.open('请输入用户名或贵宾卡号！', {title: '信息提示',onclose:function(){
		document.lform.uname.focus();
	}});
    	return false;
  }
  if(upass==""){
  	$.weeboxs.open('请输入密码！', {title: '信息提示',onclose:function(){
		document.lform.upass.focus();
	}});
    	return false;
  }
  if(num==""){
  	$.weeboxs.open('请输入验证码！', {title: '信息提示',onclose:function(){
		document.lform.num.focus();
	}});
    	return false;
  }
}

function Form2(theForm){
  if (theForm.no.value==""){
    $.weeboxs.open('请输入合同编号！', {title: '信息提示'});
    cBaseInfo.no.focus();
    return false;
  }
   if (theForm.je.value==""){
    $.weeboxs.open('请输入合同金额！', {title: '信息提示'});
    cBaseInfo.je.focus();
    return false;
  }
}

function Search(){
	val=$("#word")[0].value;
	if(val==""){
		$.weeboxs.open('请输入搜索关键字！', {title: '信息提示'});
		document.soform.w.focus();
		return false;
	}
}
