// JavaScript Document
var crystal={}
crystal.el={
	site:"http://www.85xue.com/",
	resSite:"http://res.85xue.com/",
	photoUrl:"http://res.85xue.com/upload/avatar/",
	adminSite:"http://admin.85xue.com/",
	verifyCodeUrl:"/index/get.check.code/",
	coursePicUrl:"http://res.85xue.com/upload/course/",
	$:function(obj) {
		if (typeof(obj)=="string" || typeof(obj)=="number")
			var _elm = document.getElementById(obj);
		else
			var _elm = obj;
		return _elm;
	},
	isIE:function() {
		if (document.all)
			return true;
		return false;
	},
	isIE6:function() {
		if (document.all && !window.XMLHttpRequest)
			return true;
		return false;
	},
	isIE7:function() {
		if (!el.isIE())
			return false;
		var browser = navigator.appName;
		var b_version = navigator.appVersion;
		var version = b_version.split(";");
		var trim_Version = version[1].replace(/[ ]/g,"");
		if (browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0")
			return true;
		else
			return false;
	},
	hideUpload:function(){
		var _e = window.event || evt;
		var _x = _e.clientX;
		var _y = _e.clientY;
		var _pos = el.element.position.getLT(el.$(''));
		var _w = el.$('image_IMG').clientWidth;
		var _h = el.$('').clientHeight;
	},
	enableFlash:function() {
		var _isIE = (navigator.appVersion.indexOf("MSIE") >= 0);
	    var _hasFlash = true;

	    if(_isIE) {
	        try{
	            var _objFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
	        } catch(e) {
	            _hasFlash = false;
	        }
	    } else {
	        if(!navigator.plugins["Shockwave Flash"]) {
	            _hasFlash = false;
	        }
	    }
	    return _hasFlash;
	},
	getMovie:function(name) {//获取flash Object实例
		if (navigator.appName.indexOf("Microsoft") != -1)
			return window[name];
		else
			return document[name];
	},
	flash:{
		id:'flash-isEnable',
		init:function(func) {
			var _html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="1" height="1" id="'+this.id+'" align="middle" onload="(function(){alert(111);})()">'+
							'<param name="allowScriptAccess" value="always" />'+
							'<param name="movie" value="'+el.resSite+'flash/checkFlash.swf" />'+
							'<param name="wmode" value="Opaque" />'+
							'<param name="quality" value="high" />'+
							'<embed width="1" height="1" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" allowfullscreen="false" swliveconnect="true" quality="high" name="'+this.id+'" src="'+el.resSite+'flash/checkFlash.swf" type="application/x-shockwave-flash" />'+
						'</object>';
			var _box = el.element.create('DIV',[{key:'style',value:'position:absolute; left:-1px; top:-1px;'}],'');
			_box.innerHTML = _html;

			//el.element.onLoad(_box.firstChild,func);

			document.body.appendChild(_box);
			if (func) {
				setTimeout(function(){
					func();
				},1000);
			}
		},
		isEnable:function() {
			var _flash = el.getMovie(this.id);
			//console.log(typeof(_flash),typeof(_flash.check));
			if (typeof(_flash)!='undefined' && typeof(_flash.check)!='undefined')
				return true;
			return false;
		}
	},
	disableScroll:function() {
		this.scrollHeight = document.body.scrollHeight;
		document.body.scrollHeight = 0;
	},
	enableScroll:function() {
		document.body.scrollHeight = this.scrollHeight;
	},
	//=======================
	//		停止事件冒泡
	//=======================
	stopBubble:function(e) {
		var _e = window.event || e;
		if (_e.preventDefault)
			_e.preventDefault();
		else
			_e.returnValue = false;
		if (_e.stopPropagation)
			_e.stopPropagation();
		else
			_e.cancelBubble = true;
	},
	clone:function(obj) {
		function f() {};
		f.prototype = obj;
		return new f;
	},
	getName:function(str) {
		//console.log(str);
		if (str.indexOf('<img')) {
			return str.substr(0,str.indexOf('<img'));
		}
		return str;
	},
	mouse:{
		checkLeftClick:function(e) {
			if (el.isIE()) {
				if (e.button == 1)
					return true;
				return false;
			} else {
				if (e.button == 0 )
					return true;
				return false;
			}
		},
		postion:function(ev){
			ev= ev || window.event;
			var mousePos = el.mouse.coords(ev);
			return {left:mousePos.x,top:mousePos.y};
		},
		coords:function(ev){
			if(ev.pageX || ev.pageY){
				return {x:ev.pageX, y:ev.pageY};
			}
			return {
				x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
				y:ev.clientY + document.body.scrollTop - document.body.clientTop
			};
		},
		flag:-1,
		hidePic:function(){
			var tpos = el.element.position.getLT(el.$('popSelectPic'))
			var _h = el.element.getAbsWidth(el.$('popSelectPic'));
			var _w = el.element.getAbsHeight(el.$('popSelectPic'));
			var a = parseInt(el.mouse.postion.left)<parseInt(tpos.left)||parseInt(el.mouse.postion.left)>parseInt(tpos.left)+parseInt(_w);
			var b = parseInt(el.mouse.postion.top)<parseInt(tpos.top)||parseInt(el.mouse.postion.top)>parseInt(tpos.top)+parseInt(_h);
			if(a && b&&this.flag==0){
				this.flag=-1;
			}else{
				el.$('popSelectPic').parentNode.className = "picEle fl pr";
			}
			this.flag = 0;
		}
	},
	time:{
		simpleMdhi:function(str,dateNow) {
			var _now  = dateNow || Math.round(new Date().getTime()/1000);
			var _D 	  = new Date(_now*1000);
			var _M 	  = _D.getMonth()+1;
			var _DAY  = _D.getDate();
			var _T	  = Math.round(_D.getTime()/1000);

			var _date = new Date(str*1000);
			var _m	  = _date.getMonth()+1;
			var _day  = _date.getDate();
			var _t	  = Math.round(_date.getTime()/1000);
			var _h	  = _date.getHours()<10 ? 0+""+_date.getHours() : _date.getHours();
			var _mi	  = _date.getMinutes()<10 ? 0+""+_date.getMinutes() : _date.getMinutes();


			var sc	  = _M - _m -1;
			sc		  = sc>0 ? sc : 0;

			var dTime = _T - _t;
			var dDay  = 0;
			if (_M == _m)
				dDay  = _DAY - _day;
			else
				dDay  = 30-_m+sc*30+_M;

			if( dTime < 1 ){
				return "刚刚";
			}else if(dTime>0 && dTime < 60){
				return dTime+"秒前";
			}else if(dTime < 3600){
				return Math.round(dTime/60)+"分钟前";
			}else if(dTime >= 3600 && dDay == 0){
				return Math.floor(dTime/3600)+"小时前";
			}else if(dDay==1) {
				return ""+_h+":"+_mi;
			}else{
				return (_date.getMonth()+1)+"月"+_date.getDate()+"日  "+_h+":"+_mi;
			}
		}
	},
	getColorOrder:function(type,mcount) {
		mcount = mcount>0 ? mcount : 0;
		var _color = "";
		switch(type) {
			case 'MoodCount':
				var _arrColor = ["#4FA4FD","#5C98EB","#678EDB","#7481C8","#8076B7","#8F69A2","#9C5C8E","#AA4F7A","#B74368","#C43755","#D32940","#E01C2C","#F00E16","#FE0102"];
				var _len = _arrColor.length-Math.round(mcount/10)-1;
				_len = _len>=0 ? _len : 0;
				_color = _arrColor[_len];
				break;
		}
		return _color;
	},
	element:{
		swapNode:function(node1,node2) {
			var parent = node1.parentNode;
			var t1 = node1.nextSibling;
			var t2 = node2.nextSibling;

			if(t1)
				parent.insertBefore(node2,t1);
			else
				parent.appendChild(node2);
			if(t2)
				parent.insertBefore(node1,t2);
			else
				parent.appendChild(node1);
		},
		onLoad:function(obj,func) {//类似于$.ready
			var _obj = el.$(obj);
			_obj.onload = _obj.onreadystatechange = function() {
				if (this.readyState && this.readyState == "loading")
					return;
				if (func)
					func();
			}
		},
		addClass:function(obj, cls) {
			var _elm = el.$(obj);
			var _className = _elm.className;
			if (!_className)
				_elm.className = cls;
			else if(_className.indexOf(cls) == -1)
				_elm.className += ' '+cls;
		},
		removeClass:function(obj,cls) {
			var _elm = el.$(obj);
			var _className = _elm.className;
			if (_className.indexOf(cls) == -1) return false;
			if (_className.indexOf(' ') != -1) {
				var _class = _className.split(' ');
				for (var _i=0; _i<_class.length; _i++) {
					if (_class[_i] == cls)
						_class[_i] = null;
				}
				_elm.className = _class.join(' ');
			} else {
				if (_className == cls)
					_elm.className = "";
			}
		},
		create:function(_type,_arr,_html) {
			var _e=document.createElement(_type);
			if (_arr!=null && _arr!='') {
				for (var j=0; j<_arr.length; j++) {
					if (_arr[j].key == 'style') {
						_e.style.cssText = _arr[j].value;
					} else if (_arr[j].key == 'class') {
						_e.className = _arr[j].value;
					} else {
						_e.setAttribute(_arr[j].key,_arr[j].value);
					}

					if(el.isIE6&&_arr[j].key.indexOf&&_arr[j].key.indexOf('on')==0){
						if(typeof(_arr[j].value)=='string'){
							_arr[j].value=new Function(_arr[j].value);
						}
						_e[_arr[j].key]=_arr[j].value;
					}


				  //$(_e).attr(_arr[j].key,_arr[j].value);
				}
			}
			if (_html)
				_e.innerHTML=_html;
			return _e;
		},
		position:{
			//_e: dom object
			getLT:function(_e) {
				var _l=_e.offsetLeft;
				var _h=_e.offsetTop;
				while(_e=_e.offsetParent) {
					_l+=_e.offsetLeft;
					_h+=_e.offsetTop;
				}
				return {left:_l,top:_h};
			}
		},
		addEvent:function(elm,evt,fun) {
			if (typeof(elm)=="string")
				var _elm = el.$(elm);
			else
				var _elm = elm;
			if (!_elm) return false;
			if (window.addEventListener)
				_elm.addEventListener(evt,fun,true);
			else
				_elm.attachEvent("on"+evt,fun);
		},
		removeEvent:function(elm,evt,fun) {
			var _elm = el.$(elm);
			if (window.removeEventListener)
				_elm.removeEventListener(evt,fun,true);
			else
				_elm.detachEvent('on'+evt,fun);
		},
		/**
		 * @desc 转化unix时间戳为指定的时间格式
		 * @param timestamp 要转化的unix时间戳
		 * @author wanghw
		 */
		transfertime:function(timestamp)
		{
			mydate = new Date(timestamp*1000);
			return mydate.getFullYear()+"年"+(mydate.getMonth()+1)+"月"+mydate.getDate()+"日  "+mydate.getHours()+":"+mydate.getMinutes()+":"+mydate.getSeconds();
		},
		transfertimestyle1:function(timestamp)
		{
			mydate = new Date(timestamp*1000);
			var _m = mydate.getMonth();
			var _d = mydate.getDate();
			var _h = mydate.getHours();
			var _i = mydate.getMinutes();
			var _s = mydate.getSeconds();
			_m+=1;
			if (_m<10)
				_m = '0'+_m;
			if (_d<10)
				_d = '0'+_d;
			if (_h<10)
				_h = '0'+_h;
			if (_i<10)
				_i = '0'+_i;
			if (_s<10)
				_s = '0'+_s;

			return mydate.getFullYear()+"-"+_m+"-"+_d+"  "+_h+":"+_i+":"+_s;
		},
		transfertimestyle2:function(timestamp)
		{
			mydate = new Date(timestamp*1000);
			return mydate.getFullYear()+"-"+(mydate.getMonth()+1)+"-"+mydate.getDate();
		},
		transfertimestyle3:function(timestamp)
		{
			mydate = new Date(timestamp*1000);
			var _m = mydate.getMonth();
			var _d = mydate.getDate();
			var _h = mydate.getHours();
			var _i = mydate.getMinutes();
			var _s = mydate.getSeconds();
			_m+=1;
			if (_m<10)
				_m = '0'+_m;
			if (_d<10)
				_d = '0'+_d;
			if (_h<10)
				_h = '0'+_h;
			if (_i<10)
				_i = '0'+_i;
			return _m+"月"+_d+"日  "+_h+":"+_i;
		},
		transfertimestyle4:function(timestamp)
		{
			mydate = new Date(timestamp*1000);
			var _h = mydate.getHours();
			var _i = mydate.getMinutes();
			var _s = mydate.getSeconds();
			if (_h<10)
				_h = '0'+_h;
			if (_i<10)
				_i = '0'+_i;
			if (_s<10)
				_s = '0'+_s;

			return _h+":"+_i+":"+_s;
		},
		testName:function(name)
		{
			if(name.length!='')
				alert("您的名字"+name+",长度为"+name.length);
		},
		getValue:function(obj) {
			if (obj.type=="radio" || obj.type=="checkbox")
				return this[obj.type].getValue(obj.name);
			else if (obj.type=="text")
				return el.$(obj).value;
			else
				return $(obj).val();
		},
		/**
		 * @desc 包装Js弹出框
		 * @author HXGANG BEGIN
		 */
		jsConfirm:function(msg)
		{
			return  confirm(msg);
		},
		getAbsHeight:function(a)
		{
			return a.offsetHeight;
		},
		getAbsWidth:function(a)
		{
			return a.offsetWidth;
		},
		getAbsLeft:function(a)
		{
			var b=0;
			e=a;
			while(e){
				b=b+e.offsetLeft;
				e=e.offsetParent
			}
			return b;
		},
		getAbsTop:function(a)
		{
			var b=0;
			e=a;
			while(e){
				b=b+e.offsetTop;
				e=e.offsetParent
			}
			return b;
		},
		//END


		radio:{
			/*
			 * @name		getValue	- function
			 * @param		name		- string; radio's name
			 * @return					- String or False; String is radio's checked value
			 */
			getValue:function(name) {
				var _radio=document.getElementsByName(name);
				for (var i=0; i<_radio.length; i++) {
					if (_radio[i].checked) {
						return _radio.item(i).value;
					}
				}
				return false;
			}
		},
		checkbox:{
			/*
			 * @name		getValue	- function
			 * @param		name 		- string; checkbox's name
			 * @return		_value		- Array or False; Array format as [{obj.id,obj.value},{obj.id,obj.value},...]
			 */
			getValue:function(name) {
				var _checkbox=document.getElementsByName(name);
				var _value=[];
				for (var i=0; i<_checkbox.length; i++) {
					if (_checkbox.item(i).checked) {
						var _v={id:_checkbox.item(i).id,value:_checkbox.item(i).value};
						_value.push(_v);
					}
				}
				if (!_value || _value.length==0) return false;
				return _value;
			},
			selectAll:function(name) {
				var _checkbox = document.getElementsByName(name);
				for (var _i=0; _i<_checkbox.length; _i++) {
					_checkbox.item(_i).checked = true;
				}
			},
			selectAnti:function(name) {
				var _checkbox = document.getElementsByName(name);
				for (var _i=0; _i<_checkbox.length; _i++) {
					if (_checkbox.item(_i).checked) {
						_checkbox.item(_i).checked = false;
					} else {
						_checkbox.item(_i).checked = true;
					}
				}
			},
			selectNone:function(name) {
				var _checkbox = document.getElementsByName(name);
				for (var _i=0; _i<_checkbox.length; _i++) {
					_checkbox.item(_i).checked = false;
				}
			}
		},
		selector:{
			appendData:function(url,did,defaultItem,falseItem) {
				$.post(url,function(data) {
					if (data && data != 'null') {
						var selectorHtml='<option value="0">'+defaultItem+'</option>';
						if(did.trim()=='institution'){
							selectorHtml += '<option value="0">我是独立讲师</option>';
						}
						$.each(data,function(k,v) {
							 var id = v.id;
							 var name = v.name;
							 selectorHtml += '<option value="'+id+'">'+name+'</option>';
						});
					} else {
						var selectorHtml = '<option value="0">'+falseItem+'</option>';
					}
					//alert(did.trim());

					$("#"+did).html(selectorHtml);
				 },"json");
			},
			setValue:function(id,value) {
				if (typeof(id)=="object" && id.length) {
					for (var _i=0; _i<id.length; _i++) {
						this.set(id[_i],value);
					}
				} else {
					this.set(id,value);
				}
			},
			set:function(id,value) {
				if (el.$(id))
					el.$(id).value = value;
			}
		},
		textarea:{
			autoHeight:function(obj) {//为textarea添加根据字数自动改变高度效果
				var _elm = el.$(obj);
				_elm.style.overflow = "hidden";
				var _oh = _elm.getAttribute('oh') ? parseInt(_elm.getAttribute('oh')) : _elm.clientHeight;

				_elm.setAttribute('oh',_oh);
				el.element.addEvent(obj,'keyup',function(){
					var _oh = parseInt(_elm.getAttribute('oh'));
					_oh -= 14;
					_elm.style.height = _oh+"px";
					var _h = _elm.clientHeight;
					var _sh = _elm.scrollHeight;
					_sh += 14;
					if (_h < _sh || _sh > _oh) {
						_elm.style.height = _sh+"px";
					}
				});
			}
		}
	},
	form:{
		checkElements:[],
		init:function(formid,msgShow,fun_dosubmit) {
			for(var i=0; i<el.$(formid).elements.length; i++) {
				if (el.$(formid).elements[i].type=="submit") {
					this.checkList=eval(el.$(formid).elements[i].getAttribute("validate"));
					break;
				}
			}
			if (!this.checkList) return false;

			for (var j=0; j<this.checkList.length; j++) {
				if (el.$(this.checkList[j])) {
					el.$(this.checkList[j]).msgShow=msgShow;
					el.$(this.checkList[j]).setAttribute("allcheck",0);
					var _tempObj={};
					_tempObj.id=this.checkList[j];
					_tempObj.type=el.$(this.checkList[j]).type;
					_tempObj.validate=eval(el.$(this.checkList[j]).getAttribute("validate"));
					_tempObj.msgElement=el.$(el.$(this.checkList[j]).getAttribute("msgid"));
					this.checkElements.push(_tempObj);
				}

			}

			this.addEventCheck();
			el.$(formid).onsubmit=fun_dosubmit;
		},
		addEventCheck:function() {

			for (var i=0; i<this.checkElements.length; i++) {
				var _obj=this.checkElements[i];
				var _validate=eval(el.$(_obj.id).getAttribute("validate"));
				if (!_validate) continue;


				var _str_events='';
				for (var _k=0; _k<_validate.length; _k++) {
					var _arr_events=_validate[_k].e.split(",");
					for (var _l=0; _l<_arr_events.length; _l++) {
						if (_arr_events[_l]!="" && _str_events.indexOf(_arr_events[_l])==-1)
							_str_events+=_arr_events[_l]+",";
					}
				}

				var _tempEvents=_str_events.split(",");

				for (var _m=0; _m<_tempEvents.length; _m++) {
					if (!_tempEvents[_m]) continue;
					//alert(this.checkElements[i].id+" | "+_tempEvents[_m]);
					this["_fun_"+_tempEvents[_m]]='var _value=el.element.getValue(this);$(this).attr("allcheck",0);';
					for (var _j=0; _j<_validate.length; _j++) {
						if (_obj.validate[_j].e.indexOf(_tempEvents[_m])!=-1) {

							if (_obj.validate[_j].type.indexOf("|")!=-1) {
								var _types=_obj.validate[_j].type.split("|");
								this["_fun_"+_tempEvents[_m]]+="if (";
								for (var _n=0; _n<_types.length; _n++) { //多条验证，type中以|分割 目前只支持 正常的正则validate项 不支持如 require等
									this["_fun_"+_tempEvents[_m]]+="!validate.check('"+_types[_n]+"',_value)&&";
								}
								this["_fun_"+_tempEvents[_m]]=this["_fun_"+_tempEvents[_m]].substring(0,this["_fun_"+_tempEvents[_m]].length-2);
								this["_fun_"+_tempEvents[_m]]+="){this.msgShow(this.getAttribute('msgid'),'"+_obj.validate[_j].msg+"','error');return false;}";
							} else {
								if (_obj.validate[_j].type=="msgShow")
									this["_fun_"+_tempEvents[_m]]+="this.msgShow(this.getAttribute('msgid'),'','display');return false;";
								else if (_obj.validate[_j].type=="require")
									this["_fun_"+_tempEvents[_m]]+="if (_value==''){this.msgShow(this.getAttribute('msgid'),'"+_obj.validate[_j].msg+"','normal');return false;}";
								else if (_obj.validate[_j].type=="ajax")
									this["_fun_"+_tempEvents[_m]]+="var _data={};_data[this.name]=_value;$.post('"+_obj.validate[_j].param.url+"',_data,"+_obj.validate[_j].param.callback+");return false;";
								else
									this["_fun_"+_tempEvents[_m]]+="if (!validate.check('"+_obj.validate[_j].type+"',_value)){this.msgShow(this.getAttribute('msgid'),'"+_obj.validate[_j].msg+"','error');return false;}";
							}
						}
					}
					this["_fun_"+_tempEvents[_m]]+='this.msgShow($(this).attr("msgid"),"","success");';
					//alert(_obj.id+" | "+_tempEvents[_m]+" | "+this["_fun_"+_tempEvents[_m]]);
					el.$(_obj.id)["on"+_tempEvents[_m]]=new Function(this["_fun_"+_tempEvents[_m]]);
					this["_fun_"+_tempEvents[_m]]=null;
				}
			}
		}
	},
	screen:{
		over:{
			show:function(color,alpha) {
				if(el.$("div_overscreen")) {
					var _size = el.screen.getBodySize();
					var _vsize = el.screen.getVisualSize();
					var _h = _size.h<_vsize.h ? _vsize.h : _size.h;

					el.$("div_overscreen").style.height = _h + "px";
					el.$("div_overscreen").style.width = _size.w + "px";
					$("#div_overscreen").fadeIn(200);
				} else {
					var _size=el.screen.getBodySize();
					var _vsize = el.screen.getVisualSize();
					var _h = _size.h<_vsize.h ? _vsize.h : _size.h;
					var _ffalpha=alpha/100;

					var _DIV=el.element.create("DIV",[{key:"id",value:"div_overscreen"},{key:"style",value:"background:"+color+";width:"+_size.w+"px; height:"+_h+"px; position:absolute; left:0; top:0;opacity:"+_ffalpha+";filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity="+alpha+",finishOpacity=100); z-index:19; display:none;"}],"");

					$(document.body).append(_DIV);
					$("#div_overscreen").fadeIn(200);
				}
			},
			hide:function() {
				if (!el.$("div_overscreen")) return;
				document.body.removeChild(el.$("div_overscreen"));
			}
		},
		getBodySize:function() {
			var _w=document.body.clientWidth;
			var _h=document.body.clientHeight;
			return {w:_w,h:_h};
		},
		getVisualSize:function() {
			var _w=document.documentElement.clientWidth;
			var _h=document.documentElement.clientHeight;
			return {w:_w,h:_h};
		}
	},
	validate:{
		effective:{
			rule:'',
			check:function(str) {
				if (typeof(str)=='string') {
					if (!str || str.trim()=='' || str=='0')
						return false;
				} else if (typeof(str)=='number') {
					if (!str || str == 0)
						return false;
				} else if (typeof(str) == 'object') {
					if (str.length < 1)
						return false;
				}
				return true;
			}
		},
		empty:{

		},
		mail:{
			rule:/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/,
			tvoid:function(){

			}
		},
		courseName:{
			rule:/^[a-zA-Z0-9_^\u4E00-\u9FA5 ：:《》\/]{1,50}$/,
			tvoid:function(){

			}
		},
		courseTime:{
			rule:/^[\d]{1,5}$/,
			tvoid:function(){

			}
		},
		price:{
			rule:/^[0-9]{1,9}.[0-9][0-9]|[0-9]{1,9}$/,
			check:function(str) {
				if (str.indexOf(".")!=-1) {
					var _arr = str.split(".");
					if (_arr.length != 2)
						return false;
					if (!validate.check('int',_arr[0]) || !validate.check('int',_arr[1]))
						return false;
					return true;
				} else {
					if (!validate.check('int',str)) {
						return false;
					}
					return true;
				}
			}
		},
		password:{
			rule:/^.{6,18}$/,
			tvoid:function(){

			}
		},
		cn:{
			rule:/^[a-zA-Z_^\u4E00-\u9FA5]+$/,
			tvoid:function(str) {
				if (str.length<2 || str.length>10) {
					return false;
				}
				return true;
			}
		},
		int:{
			rule:/^\d+$/,
			tvoid:function(){

			}
		},
		cnen:{
			rule:/^[a-zA-Z0-9_^\u4E00-\u9FA5]{2,20}$/,
			tvoid:function(){

			}
		},
		phone:{
			rule:/^[\d]{3,4}-[\d]{7,8}$/,
			tvoid:function(){

			}
		},
		tel:{
			rule:/^[\d]{11}$/,
			tvoid:function(){

			}
		},
		postcode:{
			rule:/^[\d]{6}$/,
			check:function(str) {
				if (parseInt(str)==0) {
					return false;
				}
				return true;
			}
		},
		verifyCode:{
			rule:'',
			check:function(str) {
				str=str.toLowerCase();
				var _str=el.cookie.get("verifyCode");
				_str=_str.toLowerCase();
				if (str==_str)
					return true;
				return false;
			}
		},
		ccDomain:{
			rule:'',
			check:function(str) {
				var _domain = "union.bokecc.com";
				if (str.indexOf(_domain) != -1)
					return true;
				return false;
			}
		},
		checkRule:function(str,rule) {
			if (!rule.exec(str))
					return false;
				return true;
		},
		check:function(f,str) {
			try {
				if (f.indexOf("sameto:")!=-1) {
					var _elm=f.replace("sameto:","");
					if (str==$("#"+_elm).val())
						return true;
					return false;
				}
				if (f=="effective" || f=="ccDomain") {
					return this[f].check(str);
				}
				if (typeof(this[f])=="object" && (typeof(this[f].rule)=="object" || typeof(this[f].rule)=="string" || typeof(this[f].rule)=="function")) {
					if (typeof(this[f].check)!='undefined') {
						if (f=="empty" || f=="verifyCode")
							return this[f].check(str);
						if (this[f].check(str))
							return this.checkRule(str,this[f].rule);
						return false
					} else {
						return this.checkRule(str,this[f].rule);
					}
					//return this[_f].check(str);
				}
			} catch(Err) {
				throw new Error(Err);
			}
		}
	},
	ChangeVerifyCode:function(id) {
		this.$(id).src=el.verifyCodeUrl+"?"+Math.random()+Math.random();
		return false;
	},
	cookie:{
		set:function(n,v){
			var Then = new Date();
			Then.setTime(Then.getTime() + 1*3600000 );
			document.cookie=n+"="+v+";expires="+ Then.toGMTString();
		},
		get:function(n){
			var arr = document.cookie.match(new RegExp("(^| )"+n+"=([^;]*)(;|$)"));
			if(arr != null) return unescape(arr[2]); return null;
		},
		del:function(n){
			document.cookie=cookiename+"=;expires=Fri, 02-Jan-1970 00:00:00 GMT";
		}
	},
	floatLayer:{
		layerID:"floatLayer",
		layerBodyID:"floatLayerBody",
		layerTitleID:"span_layerTitle",
		layerTitleClose:"a_layerTitle",
		layerMiddleBgID:"layerMiddleBg",
		layerContentID:"floatLayerContent",
		layerHeader:"floatLayerHeader",
		append:function(title,closeFlag,content,fun,str_cancelfun) {
			if (el.$(this.layerID)) return false;
			if ((!title || !content) && typeof(content)!="function")
				throw new Error("floatLayer Param error");
			document.body.appendChild(this.initLayer(title,closeFlag,content,str_cancelfun));
			el.$(el.floatLayer.layerID).style.display="block";
			el.floatLayer.formatPosition();
			if (fun && typeof(fun)=="function")
				setTimeout(fun,100);
		},
		initLayer:function(title,closeFlag,content,str_cancelfun) {
			var _body=el.element.create("DIV",[{key:"class",value:"layer_body"},{key:"id",value:this.layerBodyID}],"");
			if (closeFlag)
				if (str_cancelfun)
					var _content=el.element.create("DIV",[{key:"class",value:"layer_content"},{key:"id",value:this.layerContentID}],"<div class=\"layer_header\" id=\""+this.layerHeader+"\"><span id=\""+this.layerTitleID+"\">"+title+"</span><a href=\"javascript:void(0)\" id=\""+this.layerTitleClose+"\" onclick=\""+str_cancelfun+"()\"></a></div>");
				else
					var _content=el.element.create("DIV",[{key:"class",value:"layer_content"},{key:"id",value:this.layerContentID}],"<div class=\"layer_header\" id=\""+this.layerHeader+"\"><span id=\""+this.layerTitleID+"\">"+title+"</span><a href=\"javascript:void(0)\" id=\""+this.layerTitleClose+"\" onclick=\"el.floatLayer.remove()\"></a></div>");
			else
				var _content=el.element.create("DIV",[{key:"class",value:"layer_content"},{key:"id",value:this.layerContentID}],"<div class=\"layer_header\" id=\""+this.layerHeader+"\">"+title+"</div>");
			var _middle_bg=el.element.create("DIV",[{key:"class",value:"layer_middle_bg"},{key:"id",value:this.layerMiddleBgID}],"");
			var _middle=el.element.create("DIV",[{key:"class",value:"layer_middle"}],"");
			var _box=el.element.create("DIV",[{key:"class",value:"msgbox_layer"},{key:"id",value:this.layerID}],"<div class=\"layer_top\"></div><div class=\"layer_bottom\"></div>");

			_body.appendChild(content);
			_content.appendChild(_body);
			var _html = _content.innerHTML;
			while(_html.indexOf("id=")!=-1) {
				_html = _html.replace("id=","id_hidden=");
			}
			_middle_bg.innerHTML=_html;
			_middle.appendChild(_middle_bg);
			_middle.appendChild(_content);
			_box.appendChild(_middle);

			_box.style.position="absolute";
			_box.style.display="none";

			var _t = this;
			if (typeof(drag) != 'undefined') {
				setTimeout(function() {
					var _d = new drag(_t.layerID+'#'+_t.layerHeader);
					_d.init(1);
				},100);
			}

			return _box;

		},
		formatPosition:function() {
			var _screen=el.screen.getVisualSize();
			var _sl=document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
			var _st=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
			var _cw=el.$(this.layerID).clientWidth;
			var _ch=el.$(this.layerID).clientHeight;
			var _x=Math.round(_screen.w/2) - Math.round(_cw/2)+_sl;
			var _y=Math.round(_screen.h/2) - Math.round(_ch/2)-50+_st;

			el.$(this.layerID).style.left=_x+"px";
			el.$(this.layerID).style.top=_y+"px";
		},
		remove:function(fun){
			if (el.$(this.layerID));
				document.body.removeChild(el.$(this.layerID));
			if (this.Timeout) {
				clearTimeout(this.Timeout);
				this.Timeout=null;
			}
			if (el.$("div_overscreen"))
				el.screen.over.hide();
			if (fun && typeof(fun)=="function")
				setTimeout(fun,100);
		},
		show:function(fun) {
			el.$(this.layerID).style.display="block";
			if (fun && typeof(fun)=="function")
				setTimeout(fun,100);
		},
		hide:function(fun) {
			el.$(this.layerID).style.display="none";
			if (fun && typeof(fun)=="function")
				setTimeout(fun,100);
		},
		changeContent:function(title,content,closefun) {
			el.$(this.layerMiddleBgID).innerHTML="";
			el.$(this.layerBodyID).innerHTML="";
			el.$(this.layerTitleID).innerHTML=title;
			el.$(this.layerBodyID).appendChild(content);
			var _html = el.$(this.layerContentID).innerHTML;
			while(_html.indexOf("id=")!=-1) {
				_html = _html.replace("id=","id_hidden=");
			}
			if (el.$(this.layerTitleClose) && closefun) {
				el.$(this.layerTitleClose).setAttribute('onclick',closefun+'()');
			}
			el.$(this.layerMiddleBgID).innerHTML=_html;
			this.formatPosition();
		}
	},
	msgbox:{
		show:function(ftype,args) {
			if (typeof(this[ftype])=="object") {
				this[ftype].show(args);
			} else {
				throw new Error('type error');
			}
		},
		normal:{
			show:function(args) {
				if (args.title && args.msg) {
					if (el.$(el.floatLayer.layerID)){
						el.floatLayer.changeContent(args.title,this.initFrame(args.msg));
					}else {
						el.floatLayer.append(args.title,1,this.initFrame(args.msg),args.fun);
					}
				} else
					throw new Error("Params Error!");
				if (args.time)
					el.floatLayer.Timeout=setTimeout(function(){
						if (!el.$(el.floatLayer.layerID))
							return false;
						el.$('LayerCloseBtn').onclick=function() {
							return false;
						}
						$("#"+el.floatLayer.layerID).fadeOut(500,function(){
							el.floatLayer.remove();
						});
					},args.time*1000);
			},
			initFrame:function(msg) {
				var _div=el.element.create("DIV",[{key:"class",value:"layer_msg"}],msg);
				var _btn=el.element.create("DIV",[{key:"class",value:"btn_line"}],"<a class=\"button-manl\" href=\"javascript:void(0)\" id=\"LayerCloseBtn\" onclick=\"el.floatLayer.remove()\"><span>关闭</span></a>");
				var _box=el.element.create("DIV",null,"");
				_box.appendChild(_div);
				_box.appendChild(_btn);
				return _box;
			}
		},
		
		normalclose:{
			show:function(args) {
				if (args.title && args.msg) {
					if (el.$(el.floatLayer.layerID)){
						el.floatLayer.changeContent(args.title,this.initFrame(args.msg));
					}else {
						el.floatLayer.append(args.title,1,this.initFrame(args.msg),args.fun);
					}
				} else
					throw new Error("Params Error!");
				if (args.time)
					el.floatLayer.Timeout=setTimeout(function(){
						if (!el.$(el.floatLayer.layerID))
							return false;
						el.$('LayerCloseBtn').onclick=function() {
							return false;
						}
						$("#"+el.floatLayer.layerID).fadeOut(500,function(){
							el.floatLayer.remove();
						});
					},args.time*1000);
			},
			initFrame:function(msg) {
				var _div=el.element.create("DIV",[{key:"class",value:"layer_msg"}],msg);
				var _btn=el.element.create("DIV",[{key:"class",value:"btn_line"}],"<a  href=\"javascript:void(0)\" id=\"LayerCloseBtn\" onclick=\"el.floatLayer.remove()\"><span></span></a>");
				var _box=el.element.create("DIV",null,"");
				_box.appendChild(_div);
				_box.appendChild(_btn);
				return _box;
			}
		},
        
		floatNotice:{
			fnID:"msg_flatNoticeBOX",
			show:function(args) {
				if (!args.obj)
					return false;
				if (el.$(this.fnID))
					return false;

				var _elm = typeof(args.obj)=="string" ? el.$(args.obj) : args.obj;
				var _box = this.initFrame(args.msg,args.type);
				var _pos = el.element.position.getLT(_elm);
				var _h = _box.clientHeight;
				var _w = _box.clientWidth;

				_y = _pos.top+10;
				_x = _pos.left+_w-3;

				if (args.left)
					_x = _pos.left+args.left;
				if (args.top)
					_y = _pos.top+args.top;

				_box.style.position = "absolute";
				_box.style.zIndex = "30";
				_box.style.left = _x+"px";
				_box.style.top = _y+"px";

				document.body.appendChild(_box);

				var _t = this;
				if (args.time)
					setTimeout(function(){
						_t.hide();
					},args.time*1000);
			},
			hide:function() {
				if (el.$(this.fnID)) {
					var _t = this;
					$('#'+this.fnID).fadeOut(200,function() {
						document.body.removeChild(el.$(_t.fnID));
					});
				}
			},
			initFrame:function(msg,type) {
				var _BOX 	= el.element.create("DIV",[{key:"id",value:this.fnID},{key:"class",value:"msgbox_popNotice"}],"");
				var _I 		= el.element.create("I",[{key:"class",value:"popTop"}],"");
				var _EM 	= el.element.create("EM",[{key:"class",value:"popBtm"}],"");
				var _DIV 	= el.element.create("DIV",[{key:"class",value:"popContent"}],"");
				var _SPAN 	= el.element.create("SPAN",null,msg);

				switch(type) {
					case 'LB':
						_BOX.className = "msgbox_popNotice msgbox_pLB";
					default:
						_DIV.appendChild(_SPAN);
						_BOX.appendChild(_I);
						_BOX.appendChild(_EM);
						_BOX.appendChild(_DIV);
				}
				return _BOX;

			}

		},
		success:{
			id:'successBoxLayer',
			msgid:'successMsgBox',
			timeout:null,
			show:function(args) {
				if (el.$(this.id))
					this.change(args.msg);
				else {
					var _layer = this.initFrame(args.msg);
					document.body.appendChild(_layer);
					this.timeout = setTimeout(function(){
						el.msgbox.success.hide();
					},1000);
				}

			},
			hide:function() {
				$('#'+this.id).fadeOut(500,function() {
					clearTimeout(el.msgbox.success.timeout);
					document.body.removeChild(el.$(el.msgbox.success.id));
				});
			},
			change:function(msg) {
				el.$(this.msgid).innerHTML = msg;
				clearTimeout(this.timeout);
				this.msgid = setInterval(function() {
					el.msgbox.success.hide();
				},1000);
			},
			initFrame:function(msg) {
				var _BOX = el.element.create('DIV',[{key:'class',value:'successBoxLayer'},{key:'id',value:this.id}],'');
				var _BG = el.element.create('DIV',[{key:'class',value:'lbg'}],'');
				var _MSGBOX = el.element.create('DIV',[{key:'class',value:'msg'},{key:'id',value:this.msgid}],msg);

				_BOX.appendChild(_BG);
				_BOX.appendChild(_MSGBOX);

				var _screen = el.screen.getVisualSize();
				var _sl = document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
				var _st = document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
				var _cw = 192;
				var _ch = 72;
				var _x = Math.round(_screen.w/2) - Math.round(_cw/2)+_sl;
				var _y = Math.round(_screen.h/2) - Math.round(_ch/2)-50+_st;

				_BOX.style.position = "absolute";
				_BOX.style.left		= _x+"px";
				_BOX.style.top		= _y+"px";

				return _BOX;

			}
		},
		confirm:{
			show:function(args) {
				this.fun=args.fun;
				var _layer=this.initFrame();

				el.screen.over.show("#000",20);

				if (el.$(el.floatLayer.layerID)) {
					el.floatLayer.changeContent('确认提示',this.initFrame(args.msg));
				} else {
					el.floatLayer.append(args.title,1,this.initFrame(args.msg),'','el.msgbox.confirm.cancel');
				}

			},
			initFrame:function(msg) {
				var _div=el.element.create("DIV",[{key:"class",value:"layer_msg"}],msg);
				var _btn=el.element.create("DIV",[{key:"class",value:"btn_line"}],"<a class=\"button-man\" href=\"javascript:void(0)\" onclick=\"el.msgbox.confirm.sure()\"><span>确定</span></a>&nbsp;&nbsp;&nbsp;<a class=\"button-manl\" href=\"javascript:void(0)\" onclick=\"el.msgbox.confirm.cancel()\"><span>关闭</span></a>");
				var _box=el.element.create("DIV",null,"");
				_box.appendChild(_div);
				_box.appendChild(_btn);
				return _box;
			},
			sure:function() {
				el.screen.over.hide();
				el.floatLayer.remove();
				this.fun();
			},
			cancel:function() {
				el.screen.over.hide();
				el.floatLayer.remove();
			}
		},
		loading:{
			layer:{
				show:function(fun) {
					var _content=el.element.create("DIV",[{key:"class",value:"loading_line"}],"");
					if (el.$(el.floatLayer.layerID))
						el.floatLayer.changeContent('数据载入中...',_content);
					else
						el.floatLayer.append("数据载入中...","0",_content,fun);
				},
				hide:function(fun) {
					el.floatLayer.remove(fun);
				}
			},
			show:function(id,fun) {
				if (id=="@layer")
					this.layer.show(fun);
				else {
					//this.saveHtml=el.$(id).innerHTML;
					if(el.$(id)&&el.$(id).nodeName=="TABLE"){
						$("#"+id).html('<tr><td><div class="loading_line"></div></td></tr>');
					}else{
						el.$(id).innerHTML='<div class="loading_line"></div>';
					}
					if (fun && typeof(fun)=="function") fun();
				}
			},
			hide:function(id,fun) {
				if (id=="@layer")
					this.layer.hide(fun);
				else {
					//el.$(id).innerHTML=this.saveHtml;
					if (el.$(id))
						el.$(id).innerHTML="";
					if (fun && typeof(fun)=="function") fun();
				}
			}
		}
	},
	popLayer:{
		defaultID:"setListLayer",
		create:function(id,args,evt,cls) {
			if (!args || typeof(args)!="object") return false;
			if (cls)
				var _frame = el.element.create("DIV",[{key:"id",value:id},{key:"class",value:"pop_Layer "+cls}],"");
			else
				var _frame = el.element.create("DIV",[{key:"id",value:id},{key:"class",value:"pop_Layer"}],"");
			var _panel = el.element.create("DIV",[{key:"id",value:"popBody"},{key:"class",value:"popPanel"}],"");
			//var _bg = el.element.create("DIV",[{key:"id",value:"popBG"},{key:"class",value:"popPanelBG"}],"");
			for (var _i=0; _i<args.length; _i++) {
				var _arr=[];
				if (_i==0)
					_arr.push({key:"class",value:"first"});
				var _value = '';
				for (var _j=0; _j<args[_i].length; _j++) {
					if (args[_i][_j].key == "value") {
						_value = args[_i][_j].value;
						continue;
					}
					_arr.push({key:args[_i][_j].key,value:args[_i][_j].value});
				}
				var _a = el.element.create("A",_arr,_value);
				_panel.appendChild(_a);
			}
			//_frame.appendChild(_bg);
			_frame.appendChild(_panel);
			return _frame;
		},
		updatePosition:function(elm,obj,pos,flag) {
			var _pos = el.element.position.getLT(obj);
			var _h = obj.getAttribute("h");
			if (el.isIE6() || pos) {
				elm.style.position = "absolute";
			} else {
				elm.style.position = "fixed";
			}
			if (flag)
				elm.style.left = (_pos.left+2)+"px";
			else
				elm.style.left = (_pos.left-5)+"px";
			if(_h==null&&obj.parentNode.getAttribute('id')=='li_account'){
				_h=24;
			}else if(_h==null&&obj.parentNode.getAttribute('id')=='branchtitle'){
				_h=17;
			}
			elm.style.top = (_pos.top+parseInt(_h))+"px";
			elm.style.zIndex = "30";
		},
		show:function(evt,args,id,pos,cls,flag) {
			var _e = window.event ? window.event : evt;
			var _obj = _e.target ? _e.target : _e.srcElement;
			var _id = id ? id : this.defaultID;
			if (flag) {
				switch(flag) {
					case 'account':
						_obj = el.$('li_account');
						break;
				}
			}

			if (!flag) {
				var _func = "el.$('"+_id+"').setAttribute('over',1);";
				_obj.onmouseover = new Function(_func);
				_func = "el.$('"+_id+"').setAttribute('over',0);";
				_obj.onmouseout = new Function(_func);
			}
			if (el.$(_id))
				this.updatePosition(el.$(_id),_obj,pos,flag);
			else {
				var _panel = this.create(_id,args,_e,cls);
				this.updatePosition(_panel,_obj,pos,flag);
				document.body.appendChild(_panel);
			}
			el.$(_id).style.display = "block";
			//el.$("popBG").style.height = el.$("popBody").clientHeight+"px";

			el.$(_id).onmouseover=function() {
				this.setAttribute('over',1);
			}
			el.$(_id).onmouseout = function() {
				this.setAttribute('over',0);
			}

		},
		hide:function(id) {
			var _id = id ? id : this.defaultID;
			if (parseInt(el.$(_id).getAttribute('over')) == 0)
				el.$(_id).style.display = "none";
		},
		header:{
			elements:[[{key:"href",value:"/user.setting"},{key:"value",value:"修改头像"}],
			          [{key:"href",value:"/profile/profile"},{key:"value",value:"修改档案"}],
			          [{key:"href",value:"/user.setting/name"},{key:"value",value:"个人设置"}],
			          [{key:"href",value:"/user.setting/private"},{key:"value",value:"隐私设置"}],
			          [{key:"href",value:"/apps/applist/myapps"},{key:"value",value:"应用设置"}]],
			show:function(evt) {
				el.popLayer.show(evt,this.elements);
			},
			hide:function() {
				if (el.$(el.popLayer.defaultID))
					el.popLayer.hide();
			},
			addCancel:function() {
				if (el.isIE()) {
					document.attachEvent("onclick",this.hide);
				} else {
					document.addEventListener("click",this.hide,false);
				}
			}
		},
		homeUpload:{
			show:function(evt) {
				el.element.addClass(el.$("popSelectPic").parentNode,"pictures");
				el.$("popSelectPic").parentNode.onmouseover=function() {
					el.$("popSelectPic").parentNode.setAttribute('over',1);
				}
				el.$("popSelectPic").parentNode.onmouseout = function() {
					el.$("popSelectPic").parentNode.setAttribute('over',0);
				}
			},
			hide:function(){
				if (parseInt(el.$("popSelectPic").parentNode.getAttribute('over')) == 0)
				el.element.removeClass(el.$("popSelectPic").parentNode,"pictures");
			},
			addCancel:function() {
				if (el.isIE()){
					document.attachEvent("onclick",this.hide);
					el.$("popSelectPic").parentNode.attachEvent("onclick",this.show);
				}else{
					document.addEventListener("click",this.hide,false);
					el.$("popSelectPic").parentNode.addEventListener("click",this.show,false);
				}
			}
		},
		topFriend:{
			show:function(evt) {
				$("#friendlayer").parent().attr("class","mainnav_Drop_down mainnav_D_d_hover");
				$("#friendlayer").show();
				$(el.$("friendlayer").parentNode).bind('mouseover',function(){
					el.$("friendlayer").setAttribute('over',1);
				});
				$(el.$("friendlayer").parentNode).bind('mouseout',function() {
					el.$("friendlayer").setAttribute('over',0);
				});
			},
			hide:function(){
				if (parseInt(el.$("friendlayer").getAttribute('over')) == 0){
					$("#friendlayer").hide();
					$("#friendlayer").parent().attr("class","");
				}
			},
			addCancel:function() {
				if (el.isIE()){
					document.attachEvent("onmouseover",this.hide);
					el.$("friendlayer").parentNode.attachEvent("onmouseover",this.show);
				}else{
					document.addEventListener("mouseover",this.hide,false);
					el.$("friendlayer").parentNode.addEventListener("mouseover",this.show,false);
				}
			}
		},
		topAccount:{
			show:function(evt) {
				$("#accountlayer").parent().attr("class","mainnav_Drop_down mainnav_D_d_hover");
				$("#accountlayer").show();
				$(el.$("accountlayer").parentNode).bind('mouseover',function(){
					el.$("accountlayer").setAttribute('over',1);
				});
				$(el.$("accountlayer").parentNode).bind('mouseout',function(){
					el.$("accountlayer").setAttribute('over',0);
				});
			},
			hide:function(){
				if (parseInt(el.$("accountlayer").getAttribute('over')) == 0){
					$("#accountlayer").hide();
					$("#accountlayer").parent().attr("class","");
				}
			},
			addCancel:function() {
				if (el.isIE()){
					document.attachEvent("onmouseover",this.hide);
					el.$("accountlayer").parentNode.attachEvent("onmouseover",this.show);
				}else{
					document.addEventListener("mouseover",this.hide,false);
					el.$("accountlayer").parentNode.addEventListener("mouseover",this.show,false);
				}
			}
		},
		search:{
			elmID:"SearchType",
			selectID:"SearchTypeElm",
			childMenu:"SearchChildTab",
			childMenuCont:"SearchChildCont",
			domainID:"domain",
			simpleID:"searchNotice",
			simpleText:"textNotice",
			currIndex:1,
			currDomain:0,
			allHide:false,
			textElm:"headerSearchText",
			childOpen:false,
			show:function(evt) {
				if (el.$(this.elmID))
					this.allDisplay();
				else
					el.popLayer.show(evt,[[{key:"href",value:"javascript:void(0)"},{key:"value",value:"找好友"},{key:"class",value:"lock"},{key:"onclick",value:"el.popLayer.search.change(1,1)"},{key:"id",value:this.selectID+"1"}],
					                      [{key:"href",value:"javascript:void(0)"},{key:"value",value:"找课程 >>"},{key:"onclick",value:"el.popLayer.search.change(2,1)"},{key:"id",value:this.selectID+"2"}]],this.elmID,'','pop_Search');
				this.hideSimple();
				this.setAutoHide();
				el.$(this.elmID).onmousemove = function() {
					el.popLayer.search.setAutoHide();
				}

			},
			showSimple:function(evt) {
				var _str = "";
				if (this.currIndex == 1)
					_str = "好友";
				else
					_str = "课程";
				if (this.currIndex == 2 && this.childOpen)
					_str += " "+el.$(this.domainID+this.currDomain).innerHTML+" 领域";
				if (el.$(this.simpleID)) {
					el.$(this.simpleText).innerHTML = "搜索: "+_str;
					el.$(this.simpleID).style.display = "block";
				} else
					el.popLayer.show(evt,[[{key:"href",value:'javascript:void(0)'},{key:'id',value:this.simpleText},{key:'value',value:'搜索: '+_str},{key:'onclick',value:'el.popLayer.search.show(event)'},{key:'h',value:'0'}]],this.simpleID,'','pop_SearchSimple');
				if (el.$(this.elmID))
					this.allHideOnly();
			},
			hideSimple:function() {
				if (el.$(this.simpleID))
					setTimeout(function() {
						$(el.$(el.popLayer.search.simpleID)).fadeOut(200);
					},500);
			},
			hide:function() {
				if (el.$(el.pop.popLayer.search.elmID))
					el.popLayer.hide(el.popLayer.search.elmID);
			},
			change:function(fg,type) {
				if (this.currIndex == fg)
					return false;
				el.$(this.selectID+this.currIndex).className = "";
				el.$(this.selectID+fg).className = "lock";
				if (fg==1) {
					el.$('form_headerSearch').setAttribute('action','/friend/index/find');
					this.hideDomain();
				}
				this.currIndex = fg;
				if (fg==2) {
					if (type) {
						el.popLayer.search.showDomain();
					} else {
						setTimeout(function(){
							el.popLayer.search.showDomain();
						},500);
					}
				}
			},
			init:function(id,event) {
				this.textElm = id;
				el.$(id).setAttribute('autocomplete','off');
				el.$(id).setAttribute('on'+event,'el.popLayer.search.showSimple(event)');
				el.$(id).setAttribute('onblur','el.popLayer.search.hideSimple()');
			},
			showDomain:function() {
				//el.screen.over.show("#FFF",1);
				this.childOpen = true;
				if (el.$(this.childMenu)) {
					el.$(this.childMenu).style.display = "block";
				} else {
					var _t = this;
					document.body.appendChild(this.createChildMenu());
					el.$(this.childMenu).onmousemove = function() {
						el.popLayer.search.setAutoHide();
					}
					setTimeout(function(){
						_t.updateChildMenuPosition();
					},50);
					$.post('/utils/getalledudomain',function(data){
						if (data && parseInt(data)!=-1) {
							_t.initChildMenu(data);
							_t.changeAction();
						} else {
							_t.hide();
						}
					});
				}
			},
			createChildMenu:function() {
				var _frame = el.element.create("DIV",[{key:"id",value:this.childMenu},{key:"class",value:"pop_Layer pop_Search pop_SearchChild"}],"");
				var _panel = el.element.create("DIV",[{key:"id",value:"popBody"},{key:"class",value:"popPanel"}],'<div class="childTitle">选择课程领域</div><div class="" id="'+this.childMenuCont+'"><div class="loading_line"></div></div>');
				//var _bg = el.element.create("DIV",[{key:"id",value:"popBG"},{key:"class",value:"popPanelBG"}],"");

				//_frame.appendChild(_bg);
				_frame.appendChild(_panel);
				return _frame;
			},
			updateChildMenuPosition:function() {
				var _elm = el.$(this.childMenu);
				var _left = el.$(this.elmID).style.left || "0";
				_left = parseInt(_left.replace('px',''));
				var _top = el.$(this.elmID).style.top || "0";
				_top = parseInt(_top.replace('px',''));

				if (el.isIE6()) {
					_elm.style.position = "absolute";
				} else {
					_elm.style.position = "fixed";
				}
				_elm.style.left = (_left+125)+"px";
				_elm.style.top = _top+"px";
				_elm.style.zIndex = "30";
			},
			initChildMenu:function(data) {
				var _d = eval('('+data+')');
				el.$(this.childMenuCont).innerHTML = "";
				for (var _i=0; _i<_d.length; _i++) {
					if (_i==this.currDomain)
						el.$(this.childMenuCont).appendChild(el.element.create('a',[{key:'href',value:'javascript:void(0)'},{key:'onclick',value:'el.popLayer.search.changeDomain('+_i+')'},{key:'domainid',value:_d[_i].id},{key:'class',value:'lock'},{key:'id',value:this.domainID+_i}],_d[_i].name));
					else
						el.$(this.childMenuCont).appendChild(el.element.create('a',[{key:'href',value:'javascript:void(0)'},{key:'onclick',value:'el.popLayer.search.changeDomain('+_i+')'},{key:'domainid',value:_d[_i].id},{key:'id',value:this.domainID+_i}],_d[_i].name));
				}
			},
			changeDomain:function(index) {
				if (index == this.currDomain)
					return false;

				el.$(this.domainID+this.currDomain).className = "";
				el.$(this.domainID+index).className = "lock";
				this.currDomain = index;
				this.changeAction();
			},
			changeAction:function() {
				var _domain = el.$('domain'+this.currDomain).getAttribute('domainid');
				el.$('form_headerSearch').setAttribute('action','/app/courseshop/courselist?domainid='+_domain);
			},
			hideDomain:function() {
				this.childOpen = false;
				$(el.$(this.childMenu)).fadeOut(200);
			},
			allHideOnly:function() {
				if (el.$(this.elmID))
					$(el.$(this.elmID)).fadeOut(200);
				if (this.childOpen)
					$(el.$(this.childMenu)).fadeOut(200);
				el.$(this.textElm).focus();
			},
			allDisplay:function() {
				$(el.$(this.elmID)).fadeIn(200);
				if (this.childOpen)
					$(el.$(this.childMenu)).fadeIn(200);
			},
			setAutoHide:function() {
				clearTimeout(this.sint);
				this.sint = null;
				this.sint = setTimeout(function() {
					el.popLayer.search.allHideOnly();
				},1000);
			}
		},
		photo:{
			id:'photoPOPSelector',
			show:function(evt,aid,pos) {
				el.popLayer.show(evt,[[{key:'href',value:'javascript:photo.managePhoto(1,'+aid+')'},{key:'value',value:'编辑专辑'}],
									  [{key:'href',value:'javascript:photo.managePhoto(2,'+aid+')'},{key:'value',value:'删除专辑'}],
									  [{key:'href',value:'javascript:photo.managePhoto(3,'+aid+')'},{key:'value',value:'转移专辑'}]],this.id,pos);
			},
			hide:function() {
				if (el.$(el.popLayer.photo.id))
					el.popLayer.hide(el.popLayer.photo.id);
			},
			addCancel:function() {
				el.element.addEvent(document,'click',this.hide);
			}
		},
		account:{
			id:'accountPOPLayer',
			elm:'li_account',
			show:function(evt) {
				el.popLayer.show(evt,[[{key:'href',value:'/account'},{key:'value',value:'账户余额'}],
							           [{key:'href',value:'/account/orderlist'},{key:'value',value:'我的订单'}],
							           [{key:'href',value:'/account/review'},{key:'value',value:'我的评价'}]],this.id,'','','accunt');
				el.$(this.id).setAttribute('over',1);
				el.element.addClass(el.$(el.popLayer.account.elm).parentNode,'TechTabActive');
				el.$(this.id).onmouseout = function() {
					el.popLayer.account.hide();
				}
			},
			hide:function() {
				if (el.$(el.popLayer.account.id)) {
					el.$(el.popLayer.account.id).setAttribute('over',0);
					setTimeout(function() {
						if (parseInt(el.$(el.popLayer.account.id).getAttribute('over')) == 0) {
							el.element.removeClass(el.$(el.popLayer.account.elm).parentNode,'TechTabActive');
							el.$(el.popLayer.account.id).style.display = "none";
						}
					},500);
				}
			}
		}

	},
	QQLayer:{
		layerID:"QQFloatLayer",
		overFlag:0,
		width:0,
		height:0,
		txtID:"",
		show:function(txtid,eid,evt) {
			if (el.$(txtid) && el.$(eid)) {
				this.txtID = txtid;
				var _pos = el.element.position.getLT(el.$(eid));
				if (!el.$(this.layerID)) {
					document.body.appendChild(this.create());
					el.$(eid).onmouseover = function() {
						el.QQLayer.overFlag = 1;
					}
					el.$(eid).onmouseout = function() {
						el.QQLayer.overFlag = 0;
					}
					el.element.addEvent(document,'click',function(){
						//
						if (!el.QQLayer.overFlag) {
							el.$(el.QQLayer.layerID).style.display = "none";
							el.QQLayer.overFlag = 0;
						}
					});
				}
				this.formatPosition(eid);
				el.$(this.layerID).style.display = "block";
				this.overFlag = 1;
				return false;
			} else
				return false;
		},
		hide:function() {
			if (!el.$(this.layerID))
				return false;
			el.$(this.layerID).style.display = "none";
			this.overFlag = 0;
		},
		formatPosition:function(eid) {
			var _pos = el.element.position.getLT(el.$(eid));
			var _l = _pos.left-20;
			var _t = _pos.top-this.height+25;
			el.$(this.layerID).style.left = _l+"px";
			el.$(this.layerID).style.top = _t+"px";
		},
		create:function() {
			var _DIV = el.element.create('DIV',[{key:'id',value:this.layerID},{key:'class',value:'uploadImageLayer'}],'');
			var _FOOT = el.element.create('DIV',[{key:'class',value:'uploadBG'}],'');
			var _HEAD = el.element.create('DIV',[{key:'class',value:'uploadTab'}],'▲');
			var _MAIN = el.element.create('DIV',[{key:'class',value:'uploadContent'}],'');
			var _UL = el.element.create('UL',null,'');

			for (var _i=0; _i<55; _i++) {
				_UL.appendChild(el.element.create('LI',null,'<a onclick=\"return el.QQLayer.subQQ('+_i+')\" href=\"javascript:void(0)\"><img src=\"'+el.resSite+'emoticons/'+_i+'.gif\" value=\"'+_i+'.gif\" id=\"qqimg-'+_i+'\" /></a>'));

			}

			_MAIN.appendChild(_UL);
			_DIV.appendChild(_HEAD);
			_DIV.appendChild(_MAIN);
			_DIV.appendChild(_FOOT);

			_DIV.style.display = "none";
			_DIV.style.position = "absolute";
			_DIV.style.zIndex = 5;

			_DIV.onmouseover = function() {
				el.QQLayer.overFlag = 1;
			}
			_DIV.onmouseout = function() {
				el.QQLayer.overFlag = 0;
			}

			return _DIV;
		},
		subQQ:function(fg) {
			if (!this.txtID || !el.$(this.txtID))
				return false;
			el.$(this.txtID).value += '['+fg+']';
			this.hide();
			if (typeof(miniblog) != 'undefined' && typeof(miniblog.checkMood) != 'undefined' && el.$('Mood')) {
				miniblog.checkMood(140);
			}
			return false;
		}
	},
	popNotice:{
		showFlag:0,
		overFlag:0,
		popID:"noticePOPLayer",
		requestURL:"/notice/index/last.notice/",
		elmClass:"",
		newData:1,
		show:function(id,cls) {
			if (!el.$(id)) return false;
			this.elmID = id;
			this.elmClass = cls;
			if (!this.showFlag) {
				$('#'+id).addClass(cls);
				if (el.$(this.popID) && !this.newData) {
					el.$(this.popID).style.display = "block";
					var _t = this;
					setTimeout(function(){
						_t.showFlag = 1;
					},100);
				} else {
					if (this.newData)
						noticeObj.clearPP();
					this.getData();
				}
			} else {
				this.hide();
			}
		},
		hide:function() {
			if (el.$(this.elmID)) {
				$(el.$(this.elmID)).removeClass(this.elmClass);
				//el.$(this.elmID).removeAttribute('class');
			}
			el.$(this.popID).style.display = "none";
			this.showFlag = 0;
		},
		getData:function() {
			var _t = this;

			if (!el.$(this.popID)) {
				var _BOX	= el.element.create("DIV",[{key:"class",value:"popNotice_box"},{key:"id",value:this.popID}],"");
				var _CONT 	= el.element.create("DIV",[{key:"class",value:"popNotice_content"},{key:'id',value:'popNotice_content'}],"");
				var _DIV 	= el.element.create("DIV",[{key:'class',value:'popNotice_allBtn'}],'<a href="/notice">查看全部</a>');
				_BOX.appendChild(_CONT);
				_BOX.appendChild(_DIV);

				if (el.isIE6()) {
					_BOX.style.position = "absolute";
				} else {
					_BOX.style.position = "fixed";
				}

				_BOX.style.zIndex = "21";
				var _pos = el.element.position.getLT(el.$(this.elmID));
				var _h = el.$(this.elmID).clientHeight;
				_h = parseInt(_h+_pos.top)-1;
				_l = _pos.left - 1;
				_BOX.style.left = _l + "px";
				_BOX.style.top = _h + "px";
				_BOX.onmouseover = function() {
					el.popNotice.overFlag = 1;
				}
				_BOX.onmouseout = function() {
					el.popNotice.overFlag = 0;
				}
				document.body.appendChild(_BOX);

			} else {
				el.$(this.popID).style.display = "block";
			}
			setTimeout(function(){
				_t.showFlag = 1;
			},50);
			el.element.addEvent(document,'click',function() {
				//
				if (!el.popNotice.overFlag && el.popNotice.showFlag)
					el.popNotice.hide();
			});
			//setTimeout(function() {
				//
				el_loading.show('popNotice_content');
			//},10);

			$.post(this.requestURL,function(data) {
				//
				if (data && data != -1) {
					var _d = eval("("+data+")");
					_t.initFrame(_d);
				} else
					_t.initFrame([]);

				_t.newData = 0;
			});
		},
		initFrame:function(list) {
			var _CONT = el.$('popNotice_content');
			var _UL = el.element.create("UL",null,"");
			if (list.length) {
				for (var _i=0; _i<list.length; _i++) {
					_UL.appendChild(this.createBody(list[_i]));
				}
			} else {
				_UL.appendChild(el.element.create("LI",null,'<div class="noData">暂无数据</div>'));
			}
			_CONT.innerHTML = "";

			_CONT.appendChild(_UL);
		},
		createBody:function(obj) {
			var _LI = el.element.create("LI",null,"");
			var _I = el.element.create("I",null,'<img width="16" height="16" src="'+el.resSite+obj.small_icon+'" alt="" />');
			var _href = '/notice/';
			/*
			if (obj.action == 14)
				_href = '/notice/index/request/';
				*/
			var _EM = el.element.create("EM",null,obj.content+' '+obj.ndate);
			_LI.appendChild(_I);
			_LI.appendChild(_EM);
			return _LI;
		}
	},
	effect:{//非运动类效果
		hover:{//鼠标滑过变背景色效果
			add:function(rule,args) {
				if (rule.indexOf("=>") != -1) {
					elms = rule.split("=>");
					//console.log(elms);
					this.addevent(elms,args);
				} else
					return false;
			},
			addevent:function(elms,args) {
				if (!el.$(elms[0])) return false;
				var _parent = el.$(elms[0]);
				for (var _i=0; _i<_parent.childNodes.length; _i++) {

					if (_parent.childNodes[_i].nodeName.toUpperCase() == "TBODY") {
						for (var _k=1; _k<_parent.childNodes[_i].childNodes.length; _k++) {

							if (_parent.childNodes[_i].childNodes[_k].nodeType != 1) continue;
							if (_parent.childNodes[_i].childNodes[_k].nodeName.toUpperCase() != elms[1].toUpperCase()) continue;
							if (args.hoverClass)
								if (_parent.childNodes[_i].childNodes[_k].className.indexOf(args.hoverClass) != -1) continue;
							el.element.addEvent(_parent.childNodes[_i].childNodes[_k],'mouseover',this.hover(_parent.childNodes[_i].childNodes[_k],args));
							el.element.addEvent(_parent.childNodes[_i].childNodes[_k],'mouseout',this.hout(_parent.childNodes[_i].childNodes[_k],args));
						}
						continue;
					}


					//if (_i == 0) continue;
					if (_parent.childNodes[_i].nodeType != 1) continue;
					if (_parent.childNodes[_i].nodeName.toUpperCase() != elms[1].toUpperCase()) continue;
					if (args.hoverClass)
						if (_parent.childNodes[_i].className.indexOf(args.hoverClass) != -1) continue;
					el.element.addEvent(_parent.childNodes[_i],'mouseover',this.hover(_parent.childNodes[_i],args));
					el.element.addEvent(_parent.childNodes[_i],'mouseout',this.hout(_parent.childNodes[_i],args));
				}
			},
			hover:function(_t,args) {
				return function() {
					if (args.color) {
						if (!_t.getAttribute("backUpColor"))
							_t.setAttribute("backUpColor", _t.style.backgroundColor);
					}
					if (args.color)
						_t.style.backgroundColor = args.color;
					else
						$(_t).addClass(args.hoverClass);
				}
			},
			hout:function(_t,args) {
				return function() {
					if (args.color)
						_t.style.backgroundColor = _t.getAttribute("backUpColor");
					else
						$(_t).removeClass(args.hoverClass);
				}
			}
		},
		flicker:{
			show:function(obj,css,speed) {
				if (!obj) return false;
				var _f = obj.getAttribute('flicher');
				if (_f) return false;
				obj.setAttribute('flicker',1);
				setTimeout(function() {
					//
					$(obj).addClass(css);
					setTimeout(function() {
						//
						$(obj).removeClass(css);
						setTimeout(function() {
							//
							$(obj).addClass(css);
							setTimeout(function() {
								//
								$(obj).removeClass(css);
								obj.setAttribute('flicker',0);
							},speed*1000);
						},speed*1000);
					},speed*1000);
				},speed*1000);
			}
		},
		showTip:function(tipID) {
			if (el.$(tipID))
				el.$(tipID).style.display = "inline";
		},
		hideTip:function(tipID) {
			if (el.$(tipID))
				el.$(tipID).style.display = "none";
		}
	},
	action:{//运动类效果
		float:{//将指定元素设为浮动效果，目前支持 顶部 、底部
			show:function(obj,position,isFixed) {
				var _fix 	= isFixed || 0;
				var _top = 0;
				obj.style.cursor = "pointer";

				switch(position) {
					case 'top':
						if (!_fix || el.isIE6()) {
							obj.style.position = "absolute";
							obj.enterFrame = setInterval(function(){
								//
								var _posS 	= el.screen.getVisualSize();
								var _sTop = document.documentElement.scrollTop || document.body.scrollTop;
								var _sT = obj.style.top || "0";
								_sT = parseInt(_sT.replace('px', ''));
								var _newtop = Math.ceil(_sT+(_sTop+50-_sT)*0.1);
								//_top = _sTop+50;
								obj.style.top = _newtop+"px";
								if (_sTop < 100)
									$(obj).fadeOut(300);
								if (_sTop > 100)
									$(obj).fadeIn(300);
							},10);
						} else {
							obj.style.position = "fixed";
							obj.style.top = "50px";
							obj.enterFrame = setInterval(function() {
								var _sTop = document.documentElement.scrollTop || document.body.scrollTop;
								if (_sTop < 100)
									$(obj).fadeOut(300);
								if (_sTop > 100)
									$(obj).fadeIn(300);
							},100);
						}

						break;
					case 'bottom':
						if (!_fix || el.isIE6()) {
							obj.style.position = "absolute";
							obj.enterFrame = setInterval(function(){
								//
								var _posS = el.screen.getVisualSize();
								var _sTop = document.documentElement.scrollTop || document.body.scrollTop;

								var _sT = obj.style.top || "0";
								_sT = parseInt(_sT.replace('px', ''));
								var _newtop = Math.ceil(_sT+(_sTop+_posS.h-obj.clientHeight-50-_sT)*0.1);

								obj.style.top = _newtop+"px";
								if (_sTop < 100)
									$(obj).fadeOut(300);
								if (_sTop > 100)
									$(obj).fadeIn(300);
								//_top = _sTop+_posS.h-obj.clientHeight-50;
								//obj.style.top = _top+"px";
							},10);
						} else {
							obj.style.position = "fixed";
							obj.style.bottom = "50px";
							obj.enterFrame = setInterval(function() {
								var _sTop = document.documentElement.scrollTop || document.body.scrollTop;

								if (_sTop < 100)
									$(obj).fadeOut(300);
								if (_sTop > 100)
									$(obj).fadeIn(300);
							},100);
						}
						break;
				}
			}
		}
	},
	headerSearch:function() {
		var _elm = el.$('headerSearchText');
		var _value = _elm.value.trim() ? _elm.value.trim() : '';
		if (_value == '') {
			el.effect.flicker.show(_elm,'redBorder',0.1);
			_elm.focus();
			return false;
		}
		return true;
	}
}

var ajaxNotice = {
	hideID:'ajaxNoticeHdiv',
	get:function(fg) {
		var _elm = el.$(this.hideID);
		var _t=this;
		var _f = fg ? fg : 0;

		var _script = el.element.create('SCRIPT',[{key:'type',value:'text/javascript'},{key:'src',value:'/notice/index/ajax.get.num?f='+_f+'&func=ajaxNotice.callback'}],'');

		if (_elm) {
			_elm.innerHTML = '';
			_elm.appendChild(_script);
		} else {
			var _elm = el.element.create('DIV',[{key:'id',value:this.hideID},{key:'style',value:'display:none'}],'');
			document.body.appendChild(_elm);
			_elm.appendChild(_script);
		}
	},
	callback:function(d) {
		if (!d || d.length>20)
			return false;
		var _data = d.split('|');
		if (_data[0] && parseInt(_data[0])>0) {
			el.popNotice.newData = 1;
			if (noticeObj.noticebox.d!=parseInt(_data[0])) {
				noticeObj.noticebox.show(_data[0]);
				this.d=parseInt(noticeObj.noticebox.d);
			}
		} else {
			noticeObj.noticebox.hide();
		}
		ajaxNotice.get();
	}
}

var el=crystal.el;
var validate=crystal.el.validate;
var form=function(formid,msgShow,fun_dosubmit) {
	this.init(formid,msgShow,fun_dosubmit);
}
form.prototype=el.form;

var province=function() {}
province.prototype=el.element.province;
var msgBox=el.msgbox;

var el_loading=el.msgbox.loading;

//==================================================================
//		JS原对象扩展
//		by gaonch 2010-03-21
//==================================================================

//======================
//		事件绑定方法
//======================
Function.prototype.bind = function(obj) {
	var method = this;
	temp = function() {
		return method.apply(obj,arguments);
	}
	return temp;
}
//====================================
//		获取当前年份的每个月份天数数组 key 1-12 0为空站位符
//====================================
Date.prototype.getMonthArray = function() {
	var date = this;
	var _aM = [0,31,28,31,30,31,30,31,31,30,31,30,31];
	var _lM = [0,31,29,31,30,31,30,31,31,30,31,30,31];
	var _year = date.getFullYear();
	if (_year%4==0)
		return _lM;
	return _aM;
}
//====================================
//		获取月份第一天的星期数
//====================================
Date.prototype.getFirstDay = function(d,w) {
	var date = this;
	var _d = d || date.getDate();
	var _w = w || date.getDay();

	var _x = _d%7;
	var _s = _x-1;

	return _w-_s>0 ? _w-_s : 7-_s+_w;
}
//=================================
//		转化字符串的网站链接
//=================================
String.prototype.transSiteLink = function() {
	var str = this.toString();
	var _par = /http:\/\/[0-9a-zA-Z_?&\-=.%\/]+/;
	if (!_par.exec(str))
		return str;
	var _arr = str.split(_par);
	var _len = _arr.length;
	var _siteUrl = [];
	for (var _i=1; _i<_len; _i++) {
		var _index = 0;
		if (_arr[_i-1].length)
			_index = str.indexOf(_arr[_i-1]);
		var _nindex = _index + _arr[_i-1].length;

		var _end = 0;
		if (_arr[_i].length) {
			_end = str.indexOf(_arr[_i]);
			if (_end == _index) {
				_end = str.indexOf(_arr[_i],_nindex);
			}
		} else
			_end = str.length;
		var _url = str.substring(_nindex,_end);
		_siteUrl.push(_url);
	}
	var _tempUrl = "";
	for (var _j=0; _j<_siteUrl.length; _j++) {
		if (_tempUrl == _siteUrl[_j])
			continue;
		var _aStr = str.split(_siteUrl[_j]);
		var _nStr = '<a href="'+_siteUrl[_j]+'" class="Blue" target="_blank">'+_siteUrl[_j]+'</a>';
		var _sStr = _aStr.join('<{GNCH_URL}>');
		while(_sStr.indexOf('<{GNCH_URL}>') != -1) {
			_sStr = _sStr.replace('<{GNCH_URL}>',_nStr);
		}
		//str = str.replace(_siteUrl[_j],'<a href="'+_siteUrl[_j]+'" class="feedA" target="_blank">'+_siteUrl[_j]+'</a>');
		str = _sStr;
		_tempUrl = _siteUrl[_j];
	}
	return str;
}
//=========================================
//		清除字符串中所有HTML标签内容
//=========================================
String.prototype.ignoreHTML = function() {
	var str = this.toString();
	return str.replace(/<\/?[^>]*>/g,'');
}
//=================================
//		将字符串的[n]内容转换为图片标签(QQ表情转换)
//=================================
String.prototype.transQQ = function() {
	var str = this.toString();
	for (var _i=0; _i<55; _i++) {
		while(str.indexOf('['+_i+']')!=-1) {
			str = str.replace('['+_i+']','<img src=\"'+el.resSite+'emoticons/'+_i+'.gif\" />');
		}
	}
	return str;
}
//=================================
//		清除字符串中的空格
//=================================
String.prototype.trim = function() {
	var str = this.toString();
	if (!str || typeof(str)=="object") {
		return str;
		//return false;
	}
	return str.replace(/(^\s*)|(\s*$)/g, "");
}
//=========================
//		获取头像路径
//=========================
String.prototype.transAvatar = function() {
	var str = this.toString();
	if (!str || str == 'null')
		return el.resSite+'upload/avatar/default_s.gif';
	if (str.indexOf('upload')!=-1) {
		return el.resSite+str;
	} else {
		return el.photoUrl+str;
	}
}
//---------------------------
//  转换星星格式
//---------------------------
String.prototype.transStar = function(){
	var star_num = this.toString();
	var str = '';
	for(var i=1;i<=parseInt(star_num);i++){
		str+='★';
	}
	for(var j=parseInt(star_num)+1;j<6;j++){
		str+='☆';
	}
	return str;
}
//=======================================
//		获取字条串标准长度(汉字2,其他1)
//=======================================
String.prototype.getBytes = function() {
    var cArr = this.match(/[^\x00-\xff]/ig);
    return this.length + (cArr == null ? 0 : cArr.length); //汉字则返回2个字节 其他返回1个字节，结果为各种情况相加
}
//=======================================
//		转换@好友
//=======================================
String.prototype.transAtFriend = function(friends,subIds,obj) {
	var _str = this.toString();
	if (!friends.length)
		return _str;
	var _f = friends;
	var _newIds = ',';

	for (var i=0; i<_f.length; i++) {
		if (_str.indexOf('@'+_f[i].name.ignoreHTML()+' ')!=-1) {
			var _reg = new RegExp('@'+_f[i].name.ignoreHTML()+' ','g');
			_str = _str.replace(_reg, '<a class="Blue" target="_blank" href="/profile?u='+_f[i].id+'" title="'+_f[i].name+'">@'+_f[i].name+'</a> ');
			if (subIds.indexOf(','+_f[i].id+',')!=-1 && _newIds.indexOf(',',_f[i].id))
				continue;
			_newIds += _f[i].id+",";
		}
	}

	subIds = subIds + _newIds.substr(1,_newIds.length);
	obj.setSubIds(subIds);

	return _str;
}
//=======================================
//		查找指定字符串出现次数
//=======================================
String.prototype.findStr = function(str) {
	var _str = this.toString();
	var _reg = new RegExp(str,"g");
	var _n = _str.match(_reg);
	return _n ? _n.length : 0;
}

//========================================
//		动态载入JS方法
//========================================
crystal.el.jsLoader = function() {

	var ARR_LOAD = [];//通过jLoader载入的JS都会存入数组之中

	//载入主方法；载入指定URL的JS，fcb为回调方法
	var load = function(url,fcb) {
		var _s = document.createElement('SCRIPT');
		_s.type = "text/javascript";
		_s.src = url;
		ARR_LOAD.push({url:url,status:0});

		document.body.appendChild(_s);

		_s.onload = _s.onreadystatechange = function() {
			onLoad(this,fcb);
		};
		_s.onerror = function() {
			onError(this);
		};

	};
	//载入过程检测
	var onLoad = function(loader,fcb) {
		if (loader.readyState && loader.readyState == "loading")
			return;
		setLoaderSuc(loader.src);
		if (fcb)
			fcb();
	};
	//载入错误检测
	var onError = function(loader) {
		removeLoader(loader.src);
	};
	//移除载入
	var removeLoader = function(url) {
		for (var i in ARR_LOAD) {
			if (ARR_LOAD[i].url == url)
				ARR_LOAD[i] = null;
		}
	};
	//设置载入成功标识
	var setLoaderSuc = function(url) {
		for (var i in ARR_LOAD) {
			if (ARR_LOAD[i].url == url)
				ARR_LOAD[i].status = 1;
		}
	};
	//检测是否已载入这个JS
	var check = function(url){
		for (var i in ARR_LOAD) {
			if (ARR_LOAD[i].url == url)
				return false;
		}
		var _ss = document.getElementsByTagName('script');
		for (var j in _ss) {
			if (_ss[j].src && _ss[j].src.indexOf(url) != -1)
				return false;
		}
		return true;
	};
	//获取指定URL载入状态
	var getStatus = function(url) {
		for (var i in ARR_LOAD) {
			if (ARR_LOAD[i].url == url)
				return ARR_LOAD[i].status;
		}
		return -1;
	};

	return {
		load:function(url,fcb) {
			if (check(url))
				load(url,fcb);
		},
		getStatus:function(url) {
			return getStatus(url);
		}
	}
}
var headSearch = {
		init:function(){
			el.$('headerSearchText').setAttribute('autocomplete','off');
			
			
			if (el.isIE()) {
				el.$('headerSearchText').attachEvent("onfocus",function callback(){
					if($("#headerSearchText").val()=="搜索课程"){
						$("#headerSearchText").val("");
					}
				});
				el.$('headerSearchText').attachEvent("onpropertychange",function callback(){
					$("#scontainer").show();
					$("#scontainer").html('<div class="loading_line"></div>');
					$.post('/utils/getalledudomain',function(data){
						var str = '<dl><dd class="sou_title tc"><span class="Blue">在以下培训领域搜索</span></dd>';
						$.each(data,function(k,v){
							str +=' <dd class="NextDottedline" onclick="el.$(\'scontainer\').setAttribute(\'domain\','+v.id+');headSearch.dosearch();" id='+v.id+'><a class="Darkgray">'+v.name+'</a></dd>' ;
						});
						str +='</dl><div class="cb"></div>';
							$("#scontainer").html(str);
						},"json");
				});
			} else {
				el.$('headerSearchText').addEventListener('focus',function callback(){
					if($("#headerSearchText").val()=="搜索课程"){
						$("#headerSearchText").val("");
					}
				});
				el.$('headerSearchText').addEventListener('input',function callback(){
					$("#scontainer").show();
					$("#scontainer").html('<div class="loading_line"></div>');
					$.post('/utils/getalledudomain',function(data){
						var str = '<dl><dd class="sou_title tc"><span class="Blue">在以下培训领域搜索</span></dd>';
						$.each(data,function(k,v){
							str +=' <dd class="NextDottedline" onclick="el.$(\'scontainer\').setAttribute(\'domain\','+v.id+');headSearch.dosearch();" id='+v.id+'><a class="Darkgray">'+v.name+'</a></dd>' ;
						});
						str +='</dl><div class="cb"></div>';
							$("#scontainer").html(str);
						},"json");
				},false);
			}
		},
		dosearch:function(){
			var domain = el.$('scontainer').getAttribute("domain");
			if(parseInt(domain)>0){
				$("#scontainer").hide();
				el.$("headerSearch").setAttribute("action","/app/courseshop?domainid="+domain+"&keyword="+el.$('headerSearchText').value);
				el.$("headerSearch").submit();
			}else{
				$("#scontainer").show();
				return false;
			}
		}
	};

