// JavaScript Document
var zyr = {};

zyr.view = {
	__V: [1, 0, 0, 1],
    scoll: function(o, w, n, s, next, dot){
        var T = this;
        if (T.__V[0] == 1 || T.__V[0] > n) {
            $('#' + o + '').animate({
                "marginLeft": "0px"
            }, s);
        }
        else {
            $('#' + o + '').animate({
                "marginLeft": "-" + ((T.__V[2] && !next) ? (T.__V[0] - 2) : (T.__V[0] - 1)) * w + "px"
            }, s);
        }
        if (T.__V[2] && !next) {
            T.__V[2] = 0;
            T.__V[0]--;
        }
        if (dot) {
            var a = (!next) ? T.__V[0] : T.__V[0] - 1;
            BK.Util.console("info", a);
            $('#' + o + '_dot a').attr("class", false);
            $('#' + o + '_dot a:eq(' + a + ')').attr("class", "select")
        }
    },
    moveR: function(o, w, n, s, dot){
        var T = this;
        if (!T.__V[1]) {
            T.__V[1] = 1;
            T.__V[2] = 1;
            T.__V[0] = 2;
        }
        if (T.__V[0] > n) 
            T.__V[0] = 1;
        T.scoll(o, w, n, s, 1, dot);
        T.__V[0]++;
    },
    init: function(o, w, n, s, dot, auto){
        var T = this;
        $('#' + o + '_next').click(function(){
            T.moveR(o, w, n, s, dot)
            return false;
        });
        $('#' + o + '_pre').click(function(){
            if (T.__V[0] == 1) 
                T.__V[0] = n + 1;
            T.__V[0]--;
            T.scoll(o, w, n, s, 0, dot);
            return false;
        });
        if (auto[0]) {
            setInterval(function(){
				if (T.__V[3]) {
					T.moveR(o, w, n, s, dot);
				}
            }, auto[1]);
            $('#' + o).mouseover(function(){
				T.__V[3]=0;
			}).mouseout(function(){
				T.__V[3]=1;
			})
        }
    }
};

zyr.reg={
	page:false,
	chg:function(o){
		if(o=='圆梦复读班'){$('#reg_file').show()}else{$('#reg_file').hide()}
	},
	img:function(s,a){
		if(a=='me'){
			$('#my').attr("src",s);
			$('#img').val(s);
		}else{
			$('#upfile').val(s);	
		}
	},
	banqi:function(arr){
		$("#banqi").empty();
		$("#banqi").append("<option value='0'>请选择班期</option>");
		try{	
			for(i=0;i<arr.length;i++){
				$("#banqi").append("<option value='"+arr[i][0]+"'>"+arr[i][1]+"</option>");	
			}
		}catch(e){
		
		}
	},
	getbanqi:function(s){
		$.getScript("/archive/getbanqi.asp?callback=zyr.reg.banqi&classid="+s);
	},
	init:function(){
			this.page=true;
			$('#formReg').submit(function(){
				//if(zyr.login.c[0]=='' || zyr.login.c[1]=='0'){alert("请先登录中影人论坛再进行在线报名!");Ajax_Win('/archive/login.htm');return false;}
				if($('#kecheng').val()=='0'){alert("请选择班次");_$('kecheng').focus();return false;}
				if($('#banqi').val()=='0'){alert("请选择班期\r\n（开课日期为班期）");_$('banqi').focus();return false;}
				if($('#uname').val()==''){alert("姓名不能为空");_$('uname').focus();return false;}
				if($('#tel').val()==""){alert("联系电话不能为空");_$('tel').focus();return false;}
				if($('#xuexiao').val()==""){alert("目标院校不能为空");_$('xuexiao').focus();return false;}
				//if($('#calD1').val()==''||$('#calD2').val()==''){alert("期望学习日期不能为空");_$('calD1').focus();return false;}
				//if($('#kecheng').val()=='圆梦复读班'&&$('#upfile').val()==''){alert("选择圆梦复读班的同学需上传参加选拔的作品");return false;}
				//if($('#shengao').val()==""){alert("身高不能为空");_$('shengao').focus();return false;}
				//if($('#tizhong').val()==""){alert("体重不能为空");_$('tizhong').focus();return false;}
				//if($('#chusheng').val()==""){alert("出生日期不能为空");_$('chusheng').focus();return false;}
				//if($('#jiguan').val()==""){alert("籍贯不能为空");_$('tizhong').focus();return false;}
				//if($('#addr').val()==""){alert("家庭地址不能为空");_$('addr').focus();return false;}
				//if($('#idno').val()==""){alert("身份证号码不能为空");_$('idno').focus();return false;}
				//if($('#school').val()==""){alert("就读的学校和班级不能为空");_$('school').focus();return false;}
				//if($('#email').val()=="" || ! isEmail($('#email').val())){alert("Email不能为空");_$('email').focus();return false;}
				//if($('#bbsid').val()==""){alert("中影人论坛ID不能为空");_$('bbsid').focus();return false;}
				//if($('#qq').val()==""){alert("QQ或MSN不能为空");_$('qq').focus();return false;}
				//if($('#diaocha').val()==""){alert("请选择网站调查");_$('diaocha').focus();return false;}
			});
			
	}
};

zyr.login={
	win:false,
	c:['',''],
	i:function(a,b){
		this.c=[a,b];
		if(a!=''&&b!='0'){
			$('#UserInfo').attr("class","topLogOk").html('欢迎回来!&nbsp;&nbsp;&nbsp;&nbsp;<b>'+a+'</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/bbs/">进入论坛</a>');
		}else if(a!=''&&b=='0'){
			$('#UserInfo').attr("class","topLogOk").html('<b>'+a+'</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" onclick="Ajax_Win(\'/archive/login.htm\')">激活</a>');
		}
		$('#UserInfo').show();
		//如果是注册页
		if($('#kecheng').val()){
			if(this.c[0]=='' || this.c[1]=='0'){alert("请先登录中影人论坛再进行在线报名!");Ajax_Win('/archive/login.htm');}
			$('#bbsid').val(this.c[0]);
		}
	}
};

$(function(){
	$('#UserInfo').hide();
	$('#nav li').mouseover(function(){
		$(this).addClass("down");
	}).mouseout(function(){
		$(this).removeClass("down");
	});
	//$.getScript("/bbs/__login.php?t="+new Date().getTime()+"");
	/*
	if(!!BK.Util.getCookie("cdb_loginuser")){//已经登录了
		$('#UserInfo').attr("class","topLogOk").html('欢迎回来!&nbsp;&nbsp;&nbsp;<b>'+BK.Util.getCookie("cdb_loginuser")+'</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/bbs/">进入论坛</a>');
	}*/
	Ajax_WinCreat();
});

