/*
+-----------------------------------------------
+	WeSpace Category Javascript
+-----------------------------------------------
+	Version:	5.x
+	Update: 	2011/04/20
+	Copyright:	wesofts.com
+-----------------------------------------------
+	zIndex
+-----------------------------------------------
+	覆盖层:			50
+	AJAX窗口:		91/92
+	错误输入提示:		101
+	下拉分类:			111
+	窗口分类:			121
+	鼠标提示条: 		300
+	加载提示条: 		301
*/
var categorys = [], isEnglish = false, WSCate = {
	Lang : {
		chosen : '==[请选择]==', 
		create : '新建文件夹',
		poptitle : '请从以下列表中选择', 
		popclose : '点击关闭', 
		popchosed : '已选中项:', 
		popbtnsub : '确定', 
		popbtnept : '清空', 
		popseparator : ' + ',					// 多选项间分隔符
		popmaxium : '最多可添加[x]项', 
		dater : {
			y : '年', 
			m : '月', 
			d : '日'
		}
	}, Conf : {
		lid : null, 															// 最近一次点击位置
		pid : 'wscate_element_poperid',											// 弹出窗口ID值
		sid : 'wscate_element_sliderid',										// 下拉窗口ID值
		cid : 'wscate_element_calandarid',										// 日历ID值
		second : 2000,															// 下拉项, 多少时间未操作自动关闭(1秒 = 1000)
		dblcloser : true, 														// 二级分类下, 当选中第二级时是否关闭窗口
		popmaxium : 5,															// 多选项, 最多可设置数量
		popdouble : ['departid', 'itable', 'jobstype', 'place'],				// 强制二级分类
		popoption : ['departid', 'itable', 'jobstype', 'place', 'industry'],	// 强制窗口模式
		Exts : {																// 隐藏项唯一值标记
			eiv : '_extend_slider',
			ipt : '_hider'
		}
	}, Func : {
		isobj : function(id){
			if (typeof id == 'object'){
				return id;
			} return document.getElementById(id) ? document.getElementById(id) : false;
		}, 
		inarr : function(k, v){
			for (var i = 0; i < v.length; i++){
				if (k == v[i]){
					return true;
				}
			} return false;
		}, 
		posxy : function(o){
			var XY = {w : parseInt(o.offsetWidth), h : parseInt(o.offsetHeight), x : parseInt(o.offsetLeft), y : parseInt(o.offsetTop)}; while ((o = o.offsetParent) != null){
				XY.x += parseInt(o.offsetLeft);
				XY.y += parseInt(o.offsetTop);
			} return XY;
		}, 
		mixes : function(s){
			var MX = []; if (!isNaN(s)){
				if (s > 0){
					MX.push(s);
				}
			} else {
				var str = s.split('|'); for (var i = 0; i < str.length; i++){
					MX.push(str[i]);
				}
			} return MX;
		}
	}, InitData : {
		MSIE : false, 
		Year : 0, 
		Month : 0, 
		Day : 0
	}, Initialize : function(){
		var UNIX = new Date();
		WSCate.InitData.Year = UNIX.getFullYear();
		WSCate.InitData.Month = UNIX.getMonth() + 1;
		WSCate.InitData.Day = UNIX.getDate();
	}, Reger : function(o){
		/*
		+---------------------------------------
		+	Object Description
		+---------------------------------------
		+	eid:		在哪里加载
		+	type:		数据类型
		+	name:		表单名称
		+	value:		表单默认值
		+	label:		提示项名称(默认: [请选择])
		+---------------------------------------
		+	islab:		是否为标签来源
		+	isnew:		是否添加新选项
		+	ismul:		是否多选(单选)
		+	ispop:		窗口模式(下拉)
		+	undef:		是否屏蔽提示项
		+	birth:		出生年份
		+---------------------------------------
		+	adder:		最近选中
		+	deler:		最近删除
		+	focus:		默认展开
		*/
		var xid = WSCate.Func.isobj('wsbasic_element_inputs'); if (xid && xid.style.display != 'none'){
			xid.style.display = 'none'
		} if (o.eid){
			var obj = WSCate.Func.isobj(o.eid); if (obj){
				o.obj = obj; o.eiv = o.eid + WSCate.Conf.Exts.eiv; if (typeof categorys[o.type] == 'undefined'){
					switch (o.type){
						case 'year' : return WSCate.Loader.Daters.Year(o); break;
						case 'month' : return WSCate.Loader.Daters.Month(o); break;
						case 'calandar' : return WSCate.Loader.Daters.Caland(o); break;
					} WSCate.Loaded = o.type;
				} else {
					WSCate.Loaded = categorys[o.type]; if (WSCate.Func.inarr(o.type, WSCate.Conf.popoption)){
						o.ispop = true;
					}
				} if (o.ispop){
					if (WSCate.Func.inarr(o.type, WSCate.Conf.popdouble)){
						WSCate.Loader.Popdbl(o);
					} else {
						WSCate.Loader.Popsim(o);
					}
				} else {
					WSCate.Loader.Slider(o);
				}
			}
		}
	}, Loaded : null, Loader : {
		FUNCER : {
			Clicks : function(o, v, l, a, d, f){
				var txt = 'WSCate.Reger({';
				txt += 'eid : \'' + o.eid + '\', ';
				txt += 'type : \'' + o.type + '\', ';
				txt += 'name : \'' + o.name + '\', ';
				txt += 'value : \'' + (v != '' ? v : 0) + '\', '; if (o.label && o.label != ''){
				txt += 'label : \'' + o.label + '\', '; }
				txt += 'islab : ' + (l ? true : false) + ', ';
				txt += 'isnew : ' + (o.isnew ? true : false) + ', ';
				txt += 'ismul : ' + (o.ismul ? true : false) + ', ';
				txt += 'ispop : ' + (o.ispop ? true : false) + ', ';
				txt += 'undef : ' + (o.undef ? true : false) + ', ';
				txt += 'birth : ' + (o.birth ? true : false) + ', ';
				txt += 'adder : ' + (a ? a : 0) + ', ';
				txt += 'deler : ' + (d ? d : 0) + ', ';
				txt += 'focus : ' + (f ? f : 0);
				txt += '}); return false'; return txt;
			}, 
			Parser : function(o, s){
				/*
				+-------------------------------
				+	s.Object
				+-------------------------------
				+	Name:		选中项名
				+	Value:		选中项值/数组/对象
				*/
				var txt = '', isimple = false;
				txt += '<div id="' + o.eiv + '" class="wsbase_select">';
				txt += '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, s.Value.toString(), true) + '">' + (s.Name == '' ? (o.label ? o.label : WSCate.Lang.chosen) : s.Name) + '</a>';
				txt += '</div>';
				/*
				+-------------------------------
				+	设置表单
				+-------------------------------
				*/
				if (o.ismul){
					/*
					+---------------------------
					+	多选项
					+---------------------------
					*/
					txt += '<div id="' + o.name + WSCate.Conf.Exts.ipt + '" class="wsbase_hidden">'; if (o.name){
						var Values = []; if (isNaN(s.Value)){
							var tmp = s.Value.toString().split(','); for (var i = 0; i < tmp.length; i++){
								Values.push(tmp[i]);
							}
						} else {
							Values.push(s.Value);
						} for (var i = 0; i < Values.length; i++){
							txt += '<input type="hidden" name="' + o.name + '[]" value="' + Values[i] + '" />';
						}
					} txt += '</div>';
				} else if (o.type == 'month' || WSCate.Func.inarr(o.type, WSCate.Conf.popdouble)){
					/*
					+---------------------------
					+	二级单选
					+---------------------------
					*/		
					var Name = []; if (isNaN(o.name)){
						var tmp = o.name.split('|'); 
						Name[0] = typeof tmp[0] == 'undefined' ? 0 : tmp[0];
						Name[1] = typeof tmp[1] == 'undefined' ? 0 : tmp[1]; tmp = '_tmp';
					} else {
						Name[0] = Name[1] = 0;
					} 
					txt += '<div id="' + Name[0] + WSCate.Conf.Exts.ipt + '" class="wsbase_hidden"><div id="' + Name[1] + WSCate.Conf.Exts.ipt + '" class="wsbase_hidden">';
					txt += '<input type="hidden" name="' + Name[0] + '" value="' + s.Value1 + '" /><input type="hidden" name="' + Name[1] + '" value="' + s.Value2 + '" />';
					txt += '</div></div>';
				} else {
					/*
					+---------------------------
					+	一级下级
					+---------------------------
					*/		
					txt += '<div id="' + o.name + WSCate.Conf.Exts.ipt + '" class="wsbase_hidden">';
					txt += '<input type="hidden" name="' + o.name + '" value="' + s.Value + '" />'; isimple = true;
					txt += '</div>';
				} if (isimple && o.isnew && (s.Value == -1 || s.Value == '-1') ){
					txt += '<div class="wsbase_select_option">';
					txt += '<input type="text" name="' + o.name + '_create" value="" />';
					txt += '</div>';
				} o.obj.innerHTML = txt; o = s = txt = null;
			}, 
			Maxium : function(){
				alert(WSCate.Lang.popmaxium.replace(/\[x\]/i, WSCate.Conf.popmaxium));
			}
		}, 
		Window : {
			Initer : function(o){
				var OBJS = {C : WSCate.Func.isobj(WSCate.Conf.cid), S : WSCate.Func.isobj(WSCate.Conf.sid), P : WSCate.Func.isobj(WSCate.Conf.pid)}; OBJS.C.innerHTML = OBJS.C.style.width = OBJS.C.style.height = null; OBJS.S.innerHTML = OBJS.S.style.width = OBJS.S.style.height = null; OBJS.P.innerHTML = OBJS.P.style.width = OBJS.P.style.height = null; if (o.hand == 'popbox'){
					OBJS.C.style.display = OBJS.S.style.display = 'none'; OBJS.P.style.display = ''; OBJS.P.innerHTML = o.text;
				} else if (o.hand == 'calandar') {
					OBJS.P.style.display = OBJS.S.style.display = 'none'; OBJS.C.style.display = ''; OBJS.C.innerHTML = o.text;
				} else if (o.hand == 'slide') {
					OBJS.C.style.display = OBJS.P.style.display = 'none'; OBJS.S.style.display = ''; OBJS.S.innerHTML = o.text;
				}
			}, Timer : {
				hand : null, init  : function(){
					var obj = WSCate.Func.isobj(WSCate.Conf.sid), obc = WSCate.Func.isobj(WSCate.Conf.cid); if (obj || obc){
						if (obj && obj.style.display != 'none'){
							obj.onmouseout = function(){
								try{
									WSCate.Loader.Window.Timer.seter();
								} catch(e){}
							}; obj.onmouseover = function(){
								try{
									WSCate.Loader.Window.Timer.unset();
								} catch(e){}
							}; 
						} if (obc && obc.style.display != 'none'){
							obc.onmouseout = function(){
								try{
									WSCate.Loader.Window.Timer.seter();
								} catch(e){}
							}; obc.onmouseover = function(){
								try{
									WSCate.Loader.Window.Timer.unset();
								} catch(e){}
							}; 
						} WSCate.Loader.Window.Timer.seter();
					} else {
						WSCate.Loader.Window.Timer.unset();
					}
				}, seter : function(){
					if (WSCate.Loader.Window.Timer.hand != null){
						clearInterval(WSCate.Loader.Window.Timer.hand); 
					} WSCate.Loader.Window.Timer.hand = setInterval('WSCate.Loader.Window.Slider.off()', WSCate.Conf.second);
				}, unset : function(){
					if (WSCate.Loader.Window.Timer.hand != null){
						clearInterval(WSCate.Loader.Window.Timer.hand); WSCate.Loader.Window.Timer.hand = null;
					}
				}
			}, Slider : {
				on : function(o, s){
					var obj = WSCate.Func.isobj(WSCate.Conf.sid), obv = WSCate.Func.isobj(o.eiv); if (obj){
						WSCate.Loader.Window.Initer({
								hand : 'slide', 
								text : '<ol>' + s.Slider + '</ol>'
							}
						); if (obv){
							var Point = WSCate.Func.posxy(obv), View = WSCate.Func.posxy(obj); obj.style.top = (Point.h + Point.y) + 'px'; obj.style.left = Point.x + 'px'; if (View.w < Point.w){
								obj.style.width = Point.w + 'px';
							}
						}
					} WSCate.Conf.lid = o.eid; WSCate.Loader.Window.Timer.init();
				}, off : function(){
					var obj = WSCate.Func.isobj(WSCate.Conf.sid), obc = WSCate.Func.isobj(WSCate.Conf.cid); if (obj && obj.style.display != 'none'){
						obj.style.display = 'none';
					} if (obc && obc.style.display != 'none'){
						obc.style.display = 'none';
					} WSCate.Conf.lid = null; WSCate.Loader.Window.Timer.unset();
				}
			}, Popbox : {
				on : function(o, s){
					var obj = WSCate.Func.isobj(WSCate.Conf.pid), obs = WSCate.Func.isobj(WSCate.Conf.sid); if (obj){ 
						var txt = '';
						txt += '<h1 id="' + WSCate.Conf.pid + '_draghandle"><a href="#" onclick="WSCate.Loader.Window.Popbox.off(); return false" title="' + WSCate.Lang.popclose + '"></a>' + WSCate.Lang.poptitle + '</h1>';
						txt += '<dl>';				
						txt += '<dt>';
						txt += '<u>'; if (s.Empty && s.Empty != ''){
						txt += '<input type="button" value="' + WSCate.Lang.popbtnept + '" onclick="' + s.Empty + '" class="e" />'; }
						txt += '<input type="button" value="' + WSCate.Lang.popbtnsub + '" onclick="WSCate.Loader.Window.Popbox.off()" class="s" />'; 
						txt += '</u>';
						txt += WSCate.Lang.popchosed;
						txt += '</dt>'; if (s.Delete != ''){
						txt += '<dd>' + s.Delete + '<p></p></dd>'; }
						txt += '</dl>';
						txt += '<div class="ls">';
						txt += s.Popbox.f.replace(/\<\!\-\-\{\}\-\-\>/ig, '<div class="sb">' + s.Popbox.s + '<p></p></div>');
						txt += '<p></p></div>';
						WSCate.Loader.Window.Initer({
								hand : 'popbox', 
								text : WSCate.Loader.Window.Border(txt)
							}
						); if (o.eid != WSCate.Conf.lid){
							var BS = {
								W : Math.max(document.body.clientWidth, document.documentElement.clientWidth), w : parseInt(obj.offsetWidth), 
								H : Math.max(document.body.clientHeight, document.documentElement.clientHeight), h : parseInt(obj.offsetHeight), 
								B : document.documentElement.clientHeight, t : Math.max(document.body.scrollTop, document.documentElement.scrollTop), x : 0, y : 0
							}; if (BS.W > BS.w){
								BS.x = Math.ceil((BS.W - BS.w) / 2); 
							} if (BS.B > BS.h){
								BS.y = BS.t + Math.ceil((BS.B - BS.h) / 2);
							} else {
								if ((BS.t + BS.h) > BS.H){
									BS.y = BS.H - BS.h;
								} else {
									BS.y = BS.t;
								}
							} obj.style.top = BS.y + 'px'; obj.style.left = BS.x + 'px'; WSBase._plugins.masker(); 
						}
					} WSCate.Conf.lid = o.eid; WSCate.Drager.Mover.Reger(WSCate.Conf.pid);
				}, off : function(){
					var obj = WSCate.Func.isobj(WSCate.Conf.pid); if (obj && obj.style.display != 'none'){
						obj.style.display = 'none'; WSBase._plugins.masker(true);
					} WSCate.Conf.lid = null;
				}
			}, Calandar : function(o, s){
				var obj = WSCate.Func.isobj(WSCate.Conf.cid), obv = WSCate.Func.isobj(o.eiv); if (obj){
					WSCate.Loader.Window.Initer({
							hand : 'calandar', 
							text : s
						}
					); if (obv){
						var Point = WSCate.Func.posxy(obv), View = WSCate.Func.posxy(obj); obj.style.top = (Point.h + Point.y) + 'px'; obj.style.left = Point.x + 'px'; if (View.w < Point.w){
							obj.style.width = Point.w + 'px';
						}
					}
				} WSCate.Loader.Window.Timer.init();
			}, Border : function(text){
				results  = '<table cellpadding="0" cellspacing="0" class="wsbase_border">';
				results += '<tr><td class="wsbd1 wsbase_opacity"></td><td class="wsbd2 wsbase_opacity"></td><td class="wsbd3 wsbase_opacity"></td></tr>';
				results += '<tr><td class="wsbd4 wsbase_opacity"></td><td class="wsbd5">'+ text +'</td><td class="wsbd6 wsbase_opacity"></td></tr>';
				results += '<tr><td class="wsbd7 wsbase_opacity"></td><td class="wsbd8 wsbase_opacity"></td><td class="wsbd9 wsbase_opacity"></td></tr></table>';
				return results;
			}
		},
		Slider : function(o){
			if (o.islab && o.eid == WSCate.Conf.lid){
				return WSCate.Loader.Window.Slider.off();
			} var Result = {Name : '', Value : 0, Slider : '<li class="n"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, 0) + '">' + (o.label ? o.label : WSCate.Lang.chosen) + '</a></li>'}, Config = WSCate.Loaded.split('^'); if (o.undef){
				Result.Slider = '';
			} for (var i = 0; i < Config.length; i++){
				var tmp = Config[i].split(','), cls = 'f'; if (tmp.length >= 2){
					if (o.value == tmp[0] || parseInt(o.value) == parseInt(tmp[0])){
						Result.Name = tmp[1]; Result.Value = tmp[0]; cls = 't';
					} if (o.islab){
						Result.Slider += '<li class="' + cls + '"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, tmp[0]) + '">' + tmp[1] + '</a></li>';
					}
				}
			} if (o.isnew){
				var cls = 'f'; if (o.value == -1 || o.value == '-1'){
					Result.Name = WSCate.Lang.create; Result.Value = -1; cls = 't';
				} if (o.islab){
					Result.Slider += '<li class="' + cls + '"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, -1) + '">' + WSCate.Lang.create + '</a></li>';
				}
			} WSCate.Loader.FUNCER.Parser(o, Result); if (o.islab){
				WSCate.Loader.Window.Slider.on(o, Result);
			} else {
				return WSCate.Loader.Window.Slider.off();
			} o = Result = Config = tmp = null;
		}, 
		Popsim : function(o){
			var Result = {
				Name : '', Value : o.ismul ? [] : '', Popbox : {f : '', s : ''}, Empty : '', Delete : ''
			}, Config = WSCate.Loaded.split('^'), comma = '', Values = [], Selects = 0; if (o.ismul){
				if (o.adder > 0){
					Values.push(o.adder); Selects++;
				} if (isNaN(o.value)){
					var seled = o.value.split(','); for (var i = 0; i < seled.length; i++){
						if (!isNaN(seled[i]) && seled[i] > 0 && seled[i] != o.adder && seled[i] != o.deler){
							Values.push(seled[i]); Selects++;
						}
					} seled = null;
				} else {
					if (o.value > 0 && o.value != o.adder && o.value != o.deler){
						Values.push(o.value); Selects++;
					}
				}
			} if (o.ismul && Selects > WSCate.Conf.popmaxium && !o.unmax){
				return WSCate.Loader.FUNCER.Maxium();
			} for (var i = 0; i < Config.length; i++){
				var tmp = Config[i].split(','), inarr = fordo = false, forid = 0, forname = ''; if (tmp.length >= 2){
					if (tmp.length >= 3){
						if (tmp[0] == 0){
							fordo = true;
							forid = tmp[1];
							forname = tmp[2];
						}
					} else {
						fordo = true;
						forid = tmp[0];
						forname = tmp[1];
					} if (fordo){
						if (o.ismul){
							inarr = WSCate.Func.inarr(forid, Values) ? true : false;
						} else {
							inarr = parseInt(o.value) == parseInt(forid) ? true : false;
						} if (inarr){
							if (o.ismul){
								Result.Name += comma + forname; comma = WSCate.Lang.popseparator;
								Result.Value.push(forid); if (o.islab){
									Result.Delete += '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, forid) + '">' + forname + '</a>';
									Result.Popbox.f += '<ol class="fft"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, forid) + '">' + forname + '</a></ol>';
								}
							} else {
								Result.Name = forname; 
								Result.Value = forid; if (o.islab){
									Result.Delete += '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, 0, true) + '">' + forname + '</a>';
									Result.Popbox.f += '<ol class="fft"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, forid) + '">' + forname + '</a></ol>';
								}
							}
						} else {
							if (o.islab){
								if (o.ismul){
									Result.Popbox.f += '<ol class="fff"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, '[V]', true, forid, 0) + '">' + forname + '</a></ol>';
								} else {
									Result.Popbox.f += '<ol class="fff"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, forid) + '">' + forname + '</a></ol>';
								}
							}
						}
					}

				}
			} WSCate.Loader.FUNCER.Parser(o, Result); if (o.islab){
				if (o.ismul){
					Result.Empty = WSCate.Loader.FUNCER.Clicks(o, 0, true);
					Result.Delete = Result.Delete.replace(/\[V\]/ig, Result.Value);
					Result.Popbox.f = Result.Popbox.f.replace(/\[V\]/ig, Result.Value);
				} WSCate.Loader.Window.Popbox.on(o, Result);
			} else {
				o.ismul ? '' : WSCate.Loader.Window.Popbox.off();
			} o = Result = Config = tmp = comma = Values = null;
		}, 
		Popdbl : function(o){
			var Result = {
				Name : '', Name1 : '', Name2 : '', 
				Value : [], Value1 : 0, Value2 : 0, 
				Popbox : {f : '', s : ''}, Empty : '', Delete : ''
			}, Config = WSCate.Loaded.split('^'), DVAL = [0, 0], MVAL = [], FILT = [0, 0, 0], Focus = tagi = 0, tagon = false, comma = ''; if (o.ismul){
				if (o.adder > 0){
					MVAL.push(o.adder); if (o.adder > 1000){
						Focus = parseInt(o.adder / 100); FILT[0] = Focus; 
					} else if (o.adder > 10 && o.adder < 100) {
						Focus = parseInt(o.adder); FILT[1] = Focus * 100; FILT[2] = FILT[1] + 100;
					}
				} else if (o.deler) {
					if (o.deler > 1000){
						Focus = parseInt(o.deler / 100);
					} else if (o.deler > 10 && o.deler < 100) {
						Focus = parseInt(o.deler);
					} FILT[0] = o.deler; 
				} if (isNaN(o.value)){
					var seled = o.value.split(','); for (var i = 0; i < seled.length; i++){
						if (!isNaN(seled[i]) && seled[i] > 0 && seled[i] != FILT[0]){
							if (seled[i] > FILT[1] && seled[i] < FILT[2]){}else{
								MVAL.push(seled[i]);
							}
						}
					}
				} else {
					if (o.value > 0 && o.value != FILT[0]){
						if (o.value > FILT[1] && o.value < FILT[2]){}else{
							MVAL.push(o.value);
						}
					}
				} if (Focus == 0 && o.focus > 0){
					Focus = o.focus;
				} if (MVAL.length > WSCate.Conf.popmaxium && !o.unmax){
					return WSCate.Loader.FUNCER.Maxium();
				}
			} else {
				if (isNaN(o.value)){
					var seled = o.value.split('|'); if (typeof seled[0] != 'undefined'){
						DVAL[0] = !isNaN(seled[0]) && seled[0] > 10 && seled[0] < 100 ? parseInt(seled[0]) : 0; if (DVAL[0] > 0){
							if (typeof seled[1] != 'undefined'){
								var vm = DVAL[0] * 100, vx = vm + 100; if (!isNaN(seled[1]) && parseInt(seled[1]) > vm && parseInt(seled[1]) < vx){
									DVAL[1] = parseInt(seled[1]);
								}
							}
						}
					} seled = vm = vx = null;
				} else {
					if (o.value > 10 && o.value < 100){
						DVAL[0] = parseInt(o.value);
					} else if (o.value > 1000 && o.value < 10000){
						DVAL[0] = parseInt(o.value / 100);
						DVAL[1] = parseInt(o.value);
					}
				} Focus = DVAL[0];
			} for (var i = 0; i < Config.length; i++){
				var tmp = Config[i].split(','), inarr = false; if (tmp.length >= 3){
					if (tmp[0] == 0){
						if (o.ismul){
							if (WSCate.Func.inarr(tmp[1], MVAL)){ inarr = true;
								Result.Name += comma + tmp[2]; comma = WSCate.Lang.popseparator;
								Result.Value.push(tmp[1]); if (o.islab){
									Result.Delete += '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, tmp[1]) + '">' + tmp[2] + '</a>';
								}
							} if (o.islab){
								Result.Popbox.f += '<ol class="f' + (Focus == tmp[1] ? 't' : 'f') + (inarr ? 't' : 'f') + '"><a href="#" onclick="' + (inarr ? WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, tmp[1]) : WSCate.Loader.FUNCER.Clicks(o, '[V]', true, tmp[1], 0)) + '">' +tmp[2]+ '</a><u onclick="' + (Focus == tmp[1] ? WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, 0, 0) : WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, 0, tmp[1])) + '"></u></ol>';
							}
						} else {
							if (tmp[1] == DVAL[0]){
								inarr = true;
								Result.Name1 = tmp[2];
								Result.Value1 = tmp[1];
							} if (o.islab){
								Result.Popbox.f += '<ol class="f' + (Focus == tmp[1] ? 't' : 'f') + (inarr ? 't' : 'f') + '"><a href="#" onclick="' + (inarr ? WSCate.Loader.FUNCER.Clicks(o, '0|0', true, 0, 0, tmp[1]) : WSCate.Loader.FUNCER.Clicks(o, tmp[1] + '|0', true)) + '">' +tmp[2]+ '</a><u onclick="' + (Focus == tmp[1] ? WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, 0, 0) : WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, 0, tmp[1])) + '"></u></ol>';
							}
						} if (o.islab){
							tagi++; if (Focus == tmp[1]){
								tagon = true;
							} if (tagi % 3 == 0 && tagon){
								Result.Popbox.f += '<!--{}-->'; tagon = false;
							}
						}
					} else {
						if (o.ismul){
							if (WSCate.Func.inarr(tmp[1], MVAL)){
								inarr = true;
								Result.Name += comma + tmp[2]; comma = WSCate.Lang.popseparator;
								Result.Value.push(tmp[1]); if (o.islab){
									Result.Delete += '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, tmp[1]) + '">' + tmp[2] + '</a>';
								}
							} if (o.islab && tmp[0] == Focus){
								Result.Popbox.s += '<ul class="s' + (inarr ? 't' : 'f') + '"><a href="#" onclick="' + (inarr ? WSCate.Loader.FUNCER.Clicks(o, '[V]', true, 0, tmp[1]) : WSCate.Loader.FUNCER.Clicks(o, '[V]', true, tmp[1], 0)) + '">' +tmp[2]+ '</a></ul>';
							}
						} else {
							if (tmp[1] == DVAL[1]){
								inarr = true;
								Result.Name2 = tmp[2];
								Result.Value2 = tmp[1];
							} if (o.islab && tmp[0] == Focus){
								Result.Popbox.s += '<ul class="s' + (inarr ? 't' : 'f') + '"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, tmp[0] + '|' + tmp[1]) + '">' +tmp[2]+ '</a></ul>';
							}
						}
					}
				}
			} if (o.ismul){} else {
				Result.Name = Result.Name1 + Result.Name2;
				Result.Value = Result.Value1 + '|' + Result.Value2; if (Result.Value1 > 0 || Result.Value2 > 0){
				Result.Delete = '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, '0|0', true) + '">' + Result.Name + '</a>'; }
			} WSCate.Loader.FUNCER.Parser(o, Result); if (o.islab){
				if (o.ismul){
					Result.Empty = WSCate.Loader.FUNCER.Clicks(o, 0, true); Result.Delete = Result.Delete.replace(/\[V\]/ig, Result.Value);
				} Result.Popbox.f = Result.Popbox.f.replace(/\[V\]/ig, Result.Value); Result.Popbox.s = Result.Popbox.s.replace(/\[V\]/ig, Result.Value); WSCate.Loader.Window.Popbox.on(o, Result);
			} else {
				o.ismul ? '' : WSCate.Loader.Window.Popbox.off();
			} o = Result = Config = tmp = comma = Values = null;
		}, 
		Daters : {
			Year : function(o){
				var Result = {Name : '', Value : 0, maxYear : 0, minYear : 0, Delete : '', Popbox : {f : '', s : ''}}; if (o.birth){
					Result.maxYear = WSCate.InitData.Year - 16;
					Result.minYear = WSCate.InitData.Year - 60 - 16;
				} else {
					Result.maxYear = WSCate.InitData.Year + 5;
					Result.minYear = WSCate.InitData.Year - 35;
				} o.value = parseInt(o.value); if (o.value >= Result.minYear && o.value <= Result.maxYear){
					Result.Name = o.value + WSCate.Lang.dater.y;
					Result.Value = o.value;
				} WSCate.Loader.FUNCER.Parser(o, Result); if (o.islab){
					if (Result.Value > 0){
						Result.Delete = '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, 0, true) + '" title="' + Result.Value + WSCate.Lang.dater.y + '">' + Result.Value + WSCate.Lang.dater.y + '</a>';
					} for (var i = Result.maxYear; i >= Result.minYear; i--){
						var inarr = i == Result.Value ? true : false;
						Result.Popbox.f += '<li class="' + (inarr ? 't' : 'f') + '"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, i) + '">' + i + '</a></li>';
					} Result.Popbox.f = '<div class="yr">' + Result.Popbox.f + '<p></p></y>'; WSCate.Loader.Window.Popbox.on(o, Result);
				} else {
					WSCate.Loader.Window.Popbox.off();
				}
			}, 
			Month : function(o){
				var Result = {
					Name : '', Year : 0, Month : 0, Value : 0, Value1 : 0, Value2 : 0, maxYear : WSCate.InitData.Year + 5, minYear : WSCate.InitData.Year - 60, Delete : '', Popbox : { f : '', s : '' }
				}; if (isNaN(o.value)){
					var tmp = o.value.split('|'); tmp[0] = typeof tmp[0] == 'undefined' ? 0 : parseInt(tmp[0]); tmp[1] = typeof tmp[1] == 'undefined' ? 0 : parseInt(tmp[1]); if (tmp[0] >= Result.minYear && tmp[0] <= Result.maxYear){
						Result.Year = tmp[0]; if (tmp[1] >= 1 && tmp[1] <= 12){
							Result.Month = tmp[1];
						}
					}
				} if (Result.Year > 0 && Result.Month > 0){
					Result.Name = Result.Year + WSCate.Lang.dater.y + Result.Month + WSCate.Lang.dater.m;
					Result.Value = Result.Year + '|' + Result.Month;
					Result.Value1 = Result.Year;
					Result.Value2 = Result.Month;
				} WSCate.Loader.FUNCER.Parser(o, Result); if (o.islab){
					if (Result.Year > 0 && Result.Month > 0){
						Result.Delete = '<a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, '0|0', true) + '">' + Result.Name + '</a>';
					} var tagi = 0, tagon = false; for (var i = Result.maxYear; i >= Result.minYear; i--){
						var inarr = i == Result.Year ? true : false; tagi++; if (inarr){
							tagon = true;
						} Result.Popbox.f += '<ol class="f' + (inarr ? 't' : 'f') + '"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, inarr ? 0 : i + '|0', true) + '">' + i + WSCate.Lang.dater.y + '</a></ol>'; if (tagi % 3 == 0 && tagon){
							tagon = false; Result.Popbox.f += '<!--{}-->';
						}
					} if (Result.Year > 0){
						for (var j = 1; j <= 12; j++){
							Result.Popbox.s += '<ul class="s' + (Result.Month == j ? 't' : 'f') + '"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, Result.Year + '|' + j) + '">' + j + WSCate.Lang.dater.m + '</a></ul>';
						}
					} WSCate.Loader.Window.Popbox.on(o, Result);
				} else {
					WSCate.Loader.Window.Popbox.off()
				}
			}, 
			Caland : function(o){
				var Result = {Name : '', Year : 0, Month : 0, Day : 0, Value : 0}, Config = parseInt(o.value), Box = {Year : 0, Month : 0, Day : 0, Prex : 0, Dmax : 31, Link : 0}; if (Config > 19000000 && Config < 21000000){
					Result.Year = parseInt(Config / 10000); Box.Year = Result.Year;
					Result.Month = parseInt(Config / 100) - Result.Year * 100; if (Result.Month >= 1 && Result.Month <= 12){ Box.Month = Result.Month; } else { Result.Month = 0; }
					Result.Day = Config - (Result.Year * 100 + Result.Month) * 100; if (Result.Day >= 1 && Result.Day <= 31){ Box.Day = Result.Day; } else { Result.Day = 0; }
				} if (Result.Year > 0 && Result.Month > 0 && Result.Day > 0){
					Result.Name = Result.Year + WSCate.Lang.dater.y + Result.Month + WSCate.Lang.dater.m + Result.Day + WSCate.Lang.dater.d;
					Result.Value = (Result.Year * 100 + Result.Month) * 100 + Result.Day;
				} WSCate.Loader.FUNCER.Parser(o, Result); if (o.islab){
					Box.Year = Box.Year == 0 ? WSCate.InitData.Year : Box.Year;
					Box.Month = Box.Month == 0 ? WSCate.InitData.Month : Box.Month;
					Box.Day = Box.Day == 0 ? WSCate.InitData.Day : Box.Day; 
					
					if (Box.Month == 2) {
						Box.Dmax = Box.Year % 4 == 0 && Box.Year % 100 != 0 ? 29 : 28; 
					} else if (Box.Month == 4 || Box.Month == 6 || Box.Month == 9 || Box.Month == 11){
						Box.Dmax = 30; 
					} 
					
					var timestamp = Date.UTC(Box.Year, Box.Month - 1, 1, 0, 0, 0);
					Box.Prex = new Date(timestamp).getDay();
					Box.Link = Box.Year * 10000 + Box.Month * 100; var py = (Box.Year - 1) * 10000 + Box.Month * 100 + 1, ny = (Box.Year + 1) * 10000 + Box.Month * 100 + 1, pm = Box.Year * 10000 + (Box.Month - 1) * 100 + 1, nm = Box.Year * 10000 + (Box.Month + 1) * 100 + 1; if (Box.Month == 1) {
					pm = (Box.Year - 1) * 10000 + 12 * 100 + 1; } else if (Box.Month == 12){
					nm = (Box.Year + 1) * 10000 + 1 * 100 + 1; }
					var txt = '<ul>';
					txt += '<dd><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, py, true) + '"></a></dd>';
					txt += '<dd><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, pm, true) + '"></a></dd>';
					txt += '<dt>' + Box.Year + WSCate.Lang.dater.y + Box.Month + WSCate.Lang.dater.m + '</dt>';
					txt += '<dd><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, nm, true) + '"></a></dd>';
					txt += '<dd><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, ny, true) + '"></a></dd>';
					txt += '<dl><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, 0) + '"></a></dl>';
					txt += '</ul><ol>'; for (var i = 0; i < Box.Prex; i++){
					txt += '<li></li>'; } for (var i = 1; i <= Box.Dmax; i++){ var cls = Result.Value == (Box.Link + i) ? 't' : 'f';
					txt += '<li class="' + cls + '"><a href="#" onclick="' + WSCate.Loader.FUNCER.Clicks(o, (Box.Link + i)) + '">' + i + '</a></li>'; }
					txt += '<p></p></ol>';
					WSCate.Loader.Window.Calandar(o, txt);
				} else {
					WSCate.Loader.Window.Slider.off();
				}
			}
		}
	}, Drager : {
		Mover : {
			POS : [], Reger : function(id){
				var obj = WSCate.Func.isobj(id), drag = WSCate.Func.isobj(id + '_draghandle'); if (obj && drag){
					drag.onmousedown = function(evt){
						try{
							WSCate.Drager.Mover.Init(evt, obj, drag);
						} catch(err){}
					};
				}
			}, Init : function(e, obj, drag){
				var evt = e ? e : window.event; WSCate.Drager.Mover.POS = [evt.clientX, evt.clientY, parseInt(obj.style.left), parseInt(obj.style.top)]; document.onmousemove = function(evt) {
					try{
						WSCate.Drager.Mover.Move(evt, obj);
					} catch(err) {}
				}; document.onmouseup = function(evt) {
					try{
						WSCate.Drager.Mover.Lock();
					} catch(err) {}
				}; WSCate.Drager.Mover.Evnt(evt);
			}, Move : function(e, obj){
				var evt = e ? e : window.event, NewXY = [
					evt.clientX, 
					evt.clientY
				], LmtXY = [
					document.body.clientWidth - parseInt(obj.offsetWidth), 
					Math.max(document.body.clientHeight, document.documentElement.clientHeight) - parseInt(obj.offsetHeight)
				], SetXY = [
					WSCate.Drager.Mover.POS[2] + NewXY[0] - WSCate.Drager.Mover.POS[0], 
					WSCate.Drager.Mover.POS[3] + NewXY[1] - WSCate.Drager.Mover.POS[1]
				]; if (SetXY[0] < 0){
					SetXY[0] = 0;
				} else if (SetXY[0] > LmtXY[0]) {
					SetXY[0] = LmtXY[0];
				} if (SetXY[1] < 0){
					SetXY[1] = 0;
				} obj.style.left = SetXY[0] + 'px'; obj.style.top = SetXY[1] + 'px'; WSCate.Drager.Mover.Evnt(evt);
			}, Lock : function(){
				WSCate.Drager.Mover.POS = []; 
				document.onmousemove = null;
				document.onmouseup = null;
			}, Evnt : function(e){
				var evt = e ? e : window.event; if(evt) {
					if(WSCate.InitData.MSIE) {
						evt.returnValue = false;
						evt.cancelBubble = true;
					} else if(evt) {
						evt.stopPropagation();
						evt.preventDefault();
					}
				}
			}
		}
	}
}, UAGENT = navigator.userAgent.toLowerCase(); if (window.ActiveXObject && UAGENT.indexOf('msie') != -1){
	WSCate.InitData.MSIE = true;
}; var category = {
	folder : function(id, val, folders, popid, inew){
		WSCate.Reger(
			{
				eid : id, 
				type : folders, 
				name : 'folderid', 
				value : val, 
				isnew : true 
			}
		);
	}, single : function(id, key, val, txt, popid){
		WSCate.Reger(
			{
				eid : id, 
				type : txt, 
				name : key, 
				value : val
			}
		);
	}, simple : function(id, cid, key, val, popid){
		WSCate.Reger(
			{
				eid : id, 
				type : cid, 
				name : key, 
				value : val
			}
		);
	}, double : function(id, cid, key, val, poper, handle){
		WSCate.Reger(
			{
				eid : id, 
				type : cid, 
				name : key, 
				value : val
			}
		);
	}, mulity : function(id, cid, key, val, single, adder, deler, poper){
		WSCate.Reger(
			{
				eid : id, 
				type : cid, 
				name : key, 
				value : val, 
				ismul : true
			}
		);
	}, year : function(id, num, type, slider, popid){
		WSCate.Reger(
			{
				eid : id, 
				type : 'year', 
				name : 'year', 
				value : num, 
				birth : type && type != '' ? true : false
			}
		);
	}, month : function(id, key, val, poper, type){
		WSCate.Reger(
			{
				eid : id, 
				type : 'month', 
				name : key, 
				value : val
			}
		);
	}, calandar : function(id, key, val, popid){
		WSCate.Reger(
			{
				eid : id, 
				type : 'calandar', 
				name : key, 
				value : val
			}
		);
	}
}; WSCate.Initialize();
