window.onerror = function(){return true;}//屏蔽脚本错误

function el(id){
	if(document.getElementById){
		return document.getElementById(id);
	}else if(window[id]){
		return window[id];
	}
	return null;
}

function els(name){
	if(document.getElementsByName){
		return document.getElementsByName(name);
	}
	return null;
}

function theForms(name){
	if(document.forms[name]){
		return document.forms[name];
	}else if(document[name]){
		return document[name];
	}
	return null;
}

var b = window.navigator.userAgent.toLowerCase();
var ie = (b.indexOf("msie") != -1) ? true : false;
var opera = (b.indexOf("opera") != -1) ? true : false;
var v = ie ? parseFloat(b.substring(b.indexOf("msie")+5,b.indexOf("msie")+8)) : 0 ;//IE 版本

/* 在 IE 7.0 以下版本隐藏 <select> 和 <applet> 对象 */
function hideElement(elmID,overDiv){
	if(ie && v < 7){
		for( i = 0; i < document.all.tags( elmID ).length; i++ ){
			obj = document.all.tags( elmID )[i];
			if(!obj || !obj.offsetParent){
				continue;
			}    
			// Find the element's offsetTop and offsetLeft relative to the BODY tag.
			objLeft = obj.offsetLeft;
			objTop = obj.offsetTop;
			objParent = obj.offsetParent;				
			while(objParent.tagName.toUpperCase() != "BODY"){
				objLeft += objParent.offsetLeft;
				objTop += objParent.offsetTop;
				objParent = objParent.offsetParent;
			}			
			objHeight = obj.offsetHeight;
			objWidth = obj.offsetWidth;			
			if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft){
			}else if((overDiv.offsetTop + overDiv.offsetHeight) <= objTop ){
			}else if(overDiv.offsetTop >= ( objTop + objHeight)){
			}else if(overDiv.offsetLeft >= ( objLeft + objWidth)){
			}else{
				obj.style.visibility = "hidden";
			}
		}
	}
}
    
/* 在 IE 7.0 以下版本恢复隐藏的 <select> 和 <applet> 对象 */
function showElement(elmID){
	if(ie && v < 7){
		for (var i = 0;i < document.all.tags(elmID).length;i++){
			obj = document.all.tags(elmID)[i];        
			if(!obj || !obj.offsetParent){
				continue;
			}        
			obj.style.visibility = "";
		}
	}
}

/*------------屏蔽鼠标右键------------*/
function OnContext(e){
	try{
		e = (window.event) ? window.event : e;
		if (window.event){
			if (((window.event.srcElement.tagName.toLowerCase() == 'input') && ((window.event.srcElement.type.toLowerCase() == 'text') || (window.event.srcElement.type.toLowerCase() == 'password')) && (!window.event.srcElement.disabled))
				|| (window.event.srcElement.tagName.toLowerCase() == 'textarea'))
				return true;
		
		}else{
			if (((e.target.tagName.toLowerCase() == 'input') && ((e.target.getAttribute('type').toLowerCase() == 'text') || (e.target.getAttribute('type').toLowerCase() == 'password')))
				|| (e.target.tagName.toLowerCase() == 'textarea'))
				return true;
		}
		if(e.ctrlKey){//按 Ctrl 键恢复
			return true;
		}else{
			return false;
		}
	}catch(exp){
		return false;
	}
}
document.oncontextmenu = OnContext;
/*------------屏蔽鼠标右键------------*/


/* ------------- Event -------------- */
zhiwei = window.zhiwei || {};

zhiwei.Event = {
	addEvent:function(obj,evType,fn){
		if(obj.addEventListener){
			obj.addEventListener(evType,fn,false);
			return true;
		}else if(obj.attachEvent){
			var r=obj.attachEvent("on"+evType,fn);
			zhiwei.EventCache.add(obj,evType,fn);
			return r;
		}else{
			return false;
		}
	},removeEvent:function(obj,evType,fn){
		if(obj.removeEventListener){
			obj.removeEventListener(evType,fn,false);
			return true;
		}else if(obj.detachEvent){
			var r = obj.detachEvent("on"+ evType,fn);
			return r;
		}else{
			return false;
		}
	},getEvent:function(e){
		e = window.event||e;
		e.leftButton = false;
		if(e.srcElement == null && e.target != null){
			e.srcElement = e.target;
			e.leftButton = (e.button == 1);
		}else if(e.target == null && e.srcElement != null){
			e.target = e.srcElement;
			e.leftButton = (e.button == 0);
		}else if(e.srcElement != null && e.target != null){
		}else{
			return null;
		}
		if(document.body && document.documentElement){
			e.mouseX = e.pageX || (e.clientX + Math.max(document.body.scrollLeft,document.documentElement.scrollLeft));
			e.mouseY = e.pageY || (e.clientY + Math.max(document.body.scrollTop,document.documentElement.scrollTop));
		}else{
			e.mouseX = -1;
			e.mouseY = -1;
		}
		return e;
	},stopEvent:function(e){
		if(e && e.cancelBubble != null){
			e.cancelBubble = true;
			e.returnValue = false;
		}
		if(e && e.stopPropagation && e.preventDefault){
			e.stopPropagation();
			e.preventDefault();
		}
		return false;
	}
};

zhiwei.EventCache = function(){
	var listEvents = [];
	return{
		listEvents:listEvents,add:function(node,sEventName,fHandler,bCapture){
			listEvents[listEvents.length] = arguments;
		},flush:function(){
			var i,item;
			for(i = listEvents.length-1;i >= 0;i = i-1){
				item = listEvents[i];
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1],item[2],item[3]);
				};
				if(item[1].substring(0,2) != "on"){
					item[1] = "on"+ item[1];
				};
				if(item[0].detachEvent){
					item[0].detachEvent(item[1],item[2]);
				};
				item[0][item[1]] = null;
			};
		}
	};
}();

zhiwei.Event.addEvent(window,"unload",zhiwei.EventCache.flush);

zhiwei.Event.addEvent(window,"load",function(){try{if(window.parent.frames["Main"] && window.parent.frames["fraTop"]){window.parent.fraTop.el('loading').style.display = 'none';}}catch(e){}});

zhiwei.Event.addEvent(window,"load",function(){
	var btns = document.getElementsByTagName('input');
	var sTarget, sType, sClass;
	for (var i=0;i<btns.length;i++){
		sTarget = btns[i];
		sClass = sTarget.className;
		sType = sTarget.getAttribute("type").toLowerCase();
		if(sClass && (sType == 'button' || sType == 'submit')){
			switch (sClass){
				case "Button":
					sTarget.onmouseover = function(){this.className = 'Button_Over'};
					sTarget.onmousedown = function(){this.className = 'Button_Down'};
					sTarget.onmouseout = function(){this.className = 'Button'};
					break;
				case "GoButton":
					sTarget.onmouseover = function(){this.className = 'GoButton_Over'};
					sTarget.onmousedown = function(){this.className = 'GoButton_Down'};
					sTarget.onmouseout = function(){this.className = 'GoButton'};
					break;
				case "ShortButton":
					sTarget.onmouseover = function(){this.className = 'ShortButton_Over'};
					sTarget.onmousedown = function(){this.className = 'ShortButton_Down'};
					sTarget.onmouseout = function(){this.className = 'ShortButton'};
					break;
				case "LarghButton":
					sTarget.onmouseover = function(){this.className = 'LarghButton_Over'};
					sTarget.onmousedown = function(){this.className = 'LarghButton_Down'};
					sTarget.onmouseout = function(){this.className = 'LarghButton'};
					break;
				case "BigButton":
					sTarget.onmouseover = function(){this.className = 'BigButton_Over'};
					sTarget.onmousedown = function(){this.className = 'BigButton_Down'};
					sTarget.onmouseout = function(){this.className = 'BigButton'};
					break;
				case "OutsizeButton":
					sTarget.onmouseover = function(){this.className = 'OutsizeButton_Over'};
					sTarget.onmousedown = function(){this.className = 'OutsizeButton_Down'};
					sTarget.onmouseout = function(){this.className = 'OutsizeButton'};
					break;
			}
		}
		var url = document.location.pathname;
		var name = url.substring(url.lastIndexOf("/")+1).toLowerCase();
		if (name != "register.aspx"){
			if (sType == 'text' || sType == 'password' || sType == 'file'){
				sTarget.onmouseover = function(){InputEvent('mouseover',this)};
				sTarget.onmouseout = function(){InputEvent('mouseout',this)};
				sTarget.onfocus = function(){InputEvent('focus',this)};
				sTarget.onblur = function(){InputEvent('blur',this)};
			}
		}
	}
	var texts = document.getElementsByTagName('textarea');
	for (var i=0;i<texts.length;i++){
		sTarget = texts[i];
		sTarget.onmouseover = function(){InputEvent('mouseover',this)};
		sTarget.onmouseout = function(){InputEvent('mouseout',this)};
		sTarget.onfocus = function(){InputEvent('focus',this)};
		sTarget.onblur = function(){InputEvent('blur',this)};
	}	
});

function error_handler(a,b,c){
	window.status = (c+"\n"+ b +"\n\n"+a+"\n\n"+ error_handler.caller);
	return true;
}
/* ------------- Event -------------- */

function InputEvent(attribute,obj){
	switch (attribute){
		case "focus":
			obj.isfocus = true;
		case "mouseover":
			obj.style.backgroundColor = '#FFFFDB';
			break;
		case "blur":
			obj.isfocus = false;
		case "mouseout":
			if(!obj.isfocus){
				obj.style.backgroundColor='#fff';
			}
			break;
	}
}

function jscomResizeWindow(width,height){
	var left,top;
	left = (screen.width - width)/2;
	if (left < 0){left = 0;}
	top = (screen.height - 60 - height)/2;
	if (top < 0){top = 0;}	
	window.resizeTo(width,height);
	window.moveTo(left,top);
}

function jscomNewOpenBlank( url ){
	var sHTML = "<span style='color:#000000;font-size:14px;'>您的上网工具拦截了软件的窗口，请点击下面的链接继续打开。<br /><br /></span>";
	sHTML += "<img src='../Images/hand.gif' border='0' /><span onclick='javascript:MessageBox_CloseMessageBox()'><a href='"+ url +"' title='点击打开新窗口' target='_blank'><font style='color:blue;font-size:15px;font-weight:bold'><u>在新窗口打开链接</u></font></a></span>";
	try{
		if(window.parent.frames["Main"]){
			window.parent.Main.ShowCustomMessageBox(sHTML,'温馨提示',new Array(),new Array());
		}else{
			ShowCustomMessageBox(sHTML,'温馨提示',new Array(),new Array());
		}
	}catch(e){
		ShowCustomMessageBox(sHTML,'温馨提示',new Array(),new Array());
	}
}

function jscomNewOpenBlankAndCloseOpener( url ){
	var sHTML = "<span style='color:#000000;font-size:14px'>您的上网工具拦截了软件的窗口，请点击下面的链接继续打开。<br /><br /></span>";
	sHTML += "<img src='../Images/hand.gif' border='0' /><span onclick='javascript:MessageBox_CloseMessageBox()'><a href='"+ url +"' onclick='javascript:jscomTimeCloseWindow();' title='点击打开新窗口' target='_blank'><font style='color:blue;font-size:15px;font-weight:bold'><u>在新窗口打开链接</u></font></a></span>";
	try{
		if(window.parent.frames["Main"]){
			window.parent.Main.ShowCustomMessageBox(sHTML,'温馨提示',new Array(),new Array());
		}else{
			ShowCustomMessageBox(sHTML,'温馨提示',new Array(),new Array());
		}
	}catch(e){
		ShowCustomMessageBox(sHTML,'温馨提示',new Array(),new Array());
	}
}

//延时 0.25 秒关闭窗口
var Time = 0;
function jscomTimeCloseWindow(){
	if (Time >= 1000){
		Time = 0;
		clearTimeout(TimeID);
		if(opener == null){opener = "about:blank";}
		window.close();
	}else{
		Time += 200;
		var TimeID = window.setTimeout('jscomTimeCloseWindow()',50);
	}
}

//延时 10 秒关闭窗口
function jscomTimeCloseWindows(){
	if (Time >= 10000){
		Time = 0;
		clearTimeout(TimeID);
		if(opener == null){opener = "about:blank";}
		window.close();
	}else{
		Time += 1000;
		var TimeID = window.setTimeout('jscomTimeCloseWindows()',1000);
	}
}


function jscomNewOpenFullScreen(url,target){
	var w = window.open(url,target,"fullscreen=yes,toolbar=no,scrollbars=yes,resizable=yes,location=no,status=no,left=0,top=0,width="+screen.width+",height="+screen.height);
	try{
		if(!w){
			jscomNewOpenBlankAndCloseOpener(url);
		}else{
			window.close();
		}
		w.focus();
	}catch(exp){}
}

function jscomNewOpenByFull(url,target){
	var p,w,left,top;
	width = screen.width-10;
	height = screen.height-58;
	left = 0;
	top = 0;
	p = "toolbar=no, menubar=no, scrollbars=yes,resizable=yes,location=no, status=no,center=yes,";
	p += "width="+width+",height="+height+",left="+left+",top="+top;
	w = window.open(url,target,p);
	try{
		if(!w){
			jscomNewOpenBlank(url);
		}
		w.focus();
	}catch(exp){}
}

function jscomNewOpen(url,target){
    var w = window.open(url,target);
	try{
		if(!w){
			jscomNewOpenBlank(url);
		}
		w.focus();
	}catch(exp){}
}

function jscomNewOpenBySize(url,target,width,height){
    var p,w,left,top;
	if(!width){width = screen.width;}
	if(!height){height = screen.height - 60;}
	left = (screen.width - width) / 2;
	if(left<0){left = 0;}

	top = (screen.height - 60 - height) / 2;
	if(top<0){top = 0;}

    p = "toolbar=no, menubar=no, scrollbars=yes,resizable=yes,location=no, status=yes,";
    p += "width="+width+",height="+height+",left="+left+",top="+top;
	w = window.open(url,target,p);
	try{
		if(!w){
			jscomNewOpenBlank(url);
		}
		w.focus();
	}catch(exp){}
}

function jscomNewOpenByFixSize(url,target,width,height){
    var p,w,left,top;
	if(!width) {width = screen.width;}
	if(!height) {height = screen.height - 60;}
	left = (screen.width - width) / 2;
	if (left<0){ left=0;}

	top = (screen.height - 60 - height) / 2;
	if (top<0){top=0;}

    p = "toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=yes,";
    p += "width="+width+",height="+height+",left="+left+",top="+top;
	w = window.open(url,target,p);
	try{
		if(!w){
			jscomNewOpenBlank(url);
		}w.focus();
	}catch(exp){}
}

function jscomNewOpenBySizePos(url,target,width,height,left,top){
	var p;
	p = "toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=yes,";
	p += "width="+width+",height="+height;
	p += ",left="+left+",top="+top;
	w = window.open(url,target,p);
	try{
		if(!w){
			jscomNewOpenBlank(url);
		}
		w.focus();
	}catch(exp){}
}

function jscomNewOpenModalDialog(url,width,height){
	return showModalDialog(url,window,'dialogWidth:'+width+'px; dialogHeight:'+height+'px;help:0;status:0;resizeable:1;');
}

function jscomGetParentFromSrc(src,parTag){
	if(src && src.tagName!=parTag){
		src=getParentFromSrc(src.parentElement,parTag);
	}
	return src;
}

function disableSubmit(){//提交时设置按钮不可用,以防止重复提交
	var objs = document.getElementsByTagName('input');
	for(var i=0; i<objs.length; i++){
		if(objs[i].type.toLowerCase() == 'submit' || objs[i].type.toLowerCase() == 'button'){
			objs[i].disabled = true;
		}
	}
}

function jscomGetSubString(str,begin_pos,num){
	return str.toString().substring(begin_pos,begin_pos+num);
}

function jscomDoNothing(){
}

function add_bookmark(title,url){
	if(window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	}else if(ie){
		window.external.AddFavorite(url, title);
	}else if(window.opera){
		return true;
	}
}

//过滤特殊符号（如' "） 
function jscomFiltrateSomeKeyForKeyPress(){
	if(event.keyCode==39 || event.keyCode==34){
		event.keyCode=0;
	}
}

//只能输入数字
function jscomOnlyNumForKeypress(evt){
	evt = evt ? evt : (window.event ? window.event : null);
	if(evt.keyCode<48 || evt.keyCode>57){   //0=>48  9=>57
		if(evt.keyCode==13){
			return true;
		}else{
			evt.keyCode=0;
			return false;
		}
	}
	return true;
}

//设置焦点
function getFocus(obj){
	try{
		el(obj).focus();
	}catch(e){}
}

//设置焦点在文本框的文字最后			
function getFocusTextLast(obj){
	try{
		var ra = el(obj).createTextRange();
		ra.moveStart("character",el(obj).value.length);
		ra.collapse(true);
		ra.select();
	}catch(e){}
}

//判断是否有检查框被选中
//返回 true有  false 无
function jscomIsCheckBoxSelect(frm){
	var frm,src;

	flag=false;
	for(var i=0;i<frm.elements.length;i++){
		src=frm.elements[i];
		if(src.type=="checkbox" && src.checked){
			flag=true;
			break;
		}
    }
    return flag;
}

//判断是否数字
function jscomIsNumber(str){
	var i=0;
	for(i=0;i<str.length ;i++ ){
		if((str.charCodeAt(i) < 48 || str.charCodeAt(i) > 57)){
			return false;
		}
	}
	return true;
}

//判断是否为 double 型
function jscomIsDouble(str){
	var myReg = /^[-\+]?\d+(\.\d+)?$/;
	if(!myReg.test(str)){
		return false;
	}
	return true;
}

function jscomIsEmptyString(str){ 
	return ((!str)||(str.length == 0)); 
}

//检查日期是否正确  格式2002-09-11
function jscomIsValidDate(strDate){ 
	if(jscomIsEmptyString(strDate)){
		//alert("请输入日期!");
		return false;
	}
	var lthdatestr=strDate.length ;
	var tmpy="";
	var tmpm="";
	var tmpd="";
	var status=0;

	for(i=0;i<lthdatestr;i++){
		if(strDate.charAt(i)== '-'){
			status++;
		}
		if(status>2){
			//alert("请用'-'作为日期分隔符！");
			return false;
		}
		if((status==0) && (strDate.charAt(i)!='-')){
			tmpy=tmpy+strDate.charAt(i)
		}
		if((status==1) && (strDate.charAt(i)!='-')){
			tmpm=tmpm+strDate.charAt(i)
		}
		if((status==2) && (strDate.charAt(i)!='-')){
			tmpd=tmpd+strDate.charAt(i)
		}
	}

	year=new String(tmpy);
	month=new String(tmpm);
	day=new String(tmpd)

	if((tmpy.length!=4) || (tmpm.length>2) || (tmpd.length>2)){
		//alert("日期格式错误！");
		return false;
	}
	if(!((1<=month) && (12>=month) && (31>=day) && (1<=day)) ){
		//alert ("错误的月份或天数！");
		return false;
	}
	if(!((year % 4)==0) && (month==2) && (day==29)){
		//alert ("这一年不是闰年！");
		return false;
	}
	if((month<=7) && ((month % 2)==0) && (day>=31)){
		//alert ("这个月只有30天！");
		return false;
	}
	if((month>=8) && ((month % 2)==1) && (day>=31)){
		//alert ("这个月只有30天！");
		return false;
	}
	if((month==2) && (day==30)){
		//alert("2月永远没有这一天！");
		return false;
	}
	return true;
}

//检查日期是否正确  格式2002-09-11 14:25:36
function  jscomIsValidLongDate(str){                            
       var reg = /^(\d+)-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
       var r = str.match(reg);    
       if(r == null){return false;}
       r[2] = r[2] - 1;    
       var d = new Date(r[1],r[2],r[3],r[4],r[5],r[6]);    
       if(d.getFullYear() != r[1]){return false;}
       if(d.getMonth() != r[2]){return false;}
       if(d.getDate() != r[3]){return false;}
       if(d.getHours() != r[4]){return false;}
       if(d.getMinutes() != r[5]){return false;}
       if(d.getSeconds() != r[6]){return false;}
       return  true;  
}  

/*格式化数字
	num  要格式化的数值
	decimal_num	小数位数 
	has_split 是否要千分为分割符 true or false
	
	返回 格式化的字符串
*/
function jscomFormatNumber(num,decimal_num,has_split){
	if(isNaN(num)){return num;} //非数值，直接返回	
	
	var tmp_num,tmp_decimal_num;
	
	tmp_decimal_num=decimal_num;
	if(isNaN(decimal_num)){tmp_decimal_num=0;} 
	
	tmp_num=num*Math.pow(10,tmp_decimal_num);
	tmp_num=Math.round(tmp_num);
	tmp_num=tmp_num / Math.pow(10,tmp_decimal_num);
	
	if(!has_split){ return tmp_num;}
	
	return tmp_num;	//千分为分割符 以后处理
}	

//获得指定其日的字符串
function jscomGetDateStr(ftype_name){
	var ret_str,objDate;
	var year,month,day;
	
	objDate=new Date();
	year=objDate.getFullYear();
	month=objDate.getMonth()+1;
	day=objDate.getDate();

	switch(ftype_name){
		case "now_date":	//本日
				ret_str=year+"-"+month+"-"+day;
				break;
		case "yestoday":	//昨天
				objDate.setDate(objDate.getDate()-1);
				year=objDate.getFullYear();
				month=objDate.getMonth()+1;
				day=objDate.getDate();
				ret_str=year+"-"+month+"-"+day;
				break;
		case "month_begin":	//本月初
				ret_str=year+"-"+month+"-1";
				break;
		case "month_end":	//本月末
				objDate.setMonth(month);
				objDate.setDate(0);
				ret_str=year+"-"+month+"-"+objDate.getDate();
				break;
		case "pre_month_begin":	//上月初
				objDate.setMonth(objDate.getMonth()-1);
				year=objDate.getFullYear();
				month=objDate.getMonth()+1;
				day=objDate.getDate();
				ret_str=year+"-"+month+"-1";
				break;
		case "pre_month_end":	//上月末
				objDate.setMonth(month-1);
				objDate.setDate(0);
				year=objDate.getFullYear();
				month=objDate.getMonth()+1;
				day=objDate.getDate();
				ret_str=year+"-"+month+"-"+day;
				break;
		case "year_begin":	//本年初
				ret_str=year+"-01-01";
				break;
		case "year_end":	//本年末
				objDate.setMonth(12);
				objDate.setDate(0);
				ret_str=year+"-12-"+objDate.getDate();
				break;
		case "pre_year_begin":	//上年初
				year=year-1;
				ret_str=year+"-01-01";
				break;
		case "pre_year_end":	//上年末
				objDate.setYear(objDate.getYear()-1);
				objDate.setMonth(12);
				objDate.setDate(0);
				year=objDate.getFullYear();
				month=objDate.getMonth()+1;
				day=objDate.getDate();
				ret_str=year+"-"+month+"-"+day;
				break;
		default:	//本日
				ret_str=year+"-"+month+"-"+day;
				break;
	}
	return ret_str;
}

//返回字符串长度
function jscomLength(str){ 
	var i = 0; var j = 0;
	for(i = 0; i< str.length; i++){
		if(str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94){
			j += 2;
		}else{
			j += 1;
		}
	}
	return j;	
} 

//去掉字符串前后空格
function jscomTrimString(str){
	var ts = "";
	if(str.length < 1) return "";
	for(var i = (str.length - 1); i!=-1; i--){
		if(str.charAt(i) != ' '){break;}
	}
	ts = str.substring(0, i+1); 

	for(var i = 0 ; i < ts.length ; i++){
		if(str.charAt(i) != ' '){break;}
	}
	return ts.substring(i, ts.length); 
}

//验证安全字符串
function jscomIsSafe(str){
	var i = 0;var j = 0;
	var myReg = "\"'&<>?%,;:()`~!@#$^*{}[]|\\/+-=";
	for(i=0;i<str.length;i++){
		for(j=0;j<myReg.length;j++){
			if(str.charAt(i) == myReg.charAt(j)) return false;
		}
	}
	return true;
}

function isUserString(str){
	var myReg=/^[0-9a-z][\w-.]*[0-9a-z]$/i;
	if(myReg.test(str)){
		return true;
	}else{
		return false;
	}
}

function jscomCancelClick(){
	var frms=document.forms;
	for(i=0;i<frms.length;i++){
		frms(i).reset();
	}
	return false;
}

//伸缩对象，点一下伸开，再点一下收回，并且还可以带图片显示伸缩的标至
function jscomFlexObject(obj,imageObj,onImagePath,offImagePath){
	if(obj.style.display=="none"){
		obj.style.display = "block";
		if(imageObj && onImagePath){
			imageObj.src = onImagePath;
		}
		//oElement.alt = "收缩";
	}else{
		obj.style.display = "none";
		if(imageObj && offImagePath){
			imageObj.src = offImagePath;
		}
		//oElement.alt = "展开";
	}
}

//客户端字符串编码
function ClientHtmlEncode(str){
	var strRtn="";
	if(!str){return strRtn;}
	for(var i=str.length-1;i>=0;i--){	
		strRtn+=str.charCodeAt(i);
		if(i){strRtn += "a";} //with a to split
	}
	return strRtn;
}

//客户端字符串解码
function ClientHtmlDecode(str){
	var strArr;
	var strRtn="";
	if(!str){return strRtn;}
	strArr=str.split("a");
	for(var i=strArr.length-1;i>=0;i--){
		if(strArr[i]!=''){strRtn+=String.fromCharCode(eval(strArr[i]));}
	}
	return strRtn;
}

//关闭窗体时检查有没有更新，如有则刷新父窗体
function jscomCloseAndRefreshOpener(IsRefreshOpener){
	if(!IsRefreshOpener){
		IsRefreshOpener=false;
		try{
			if(el("hidHasUpdate").value=="True"){
				IsRefreshOpener=true;
			}else{
				IsRefreshOpener=false;
			}
		}catch(e){}
	}
	if(!top){
		try{
			if(IsRefreshOpener==true){
				window.opener.RefreshForm();
			}
		}catch(e){}
		window.close();
	}
	else{
		try{
			if(IsRefreshOpener==true){
				window.opener.RefreshForm();
			}
		}catch(e){}
		window.close();
	}
}

//保存并关闭窗口时刷新父窗口
function jscomSaveAndCloseRefreshOpener(){
	try{
		if(!top){
			try{
				opener.RefreshForm();
			}catch(e){}
			window.close();
		}else{
			try{
				top.opener.RefreshForm();
			}catch(e){}
			top.close();
		}
	}catch(e){}
}


function CloseMe(){
	try{
		if(el("hidHasUpdate").value=="True"){
			opener.RefreshList();
		}
	}catch(e){}
	window.close();
}	


function jcomOpenCalender(sSourceControlName,nIndex){
	jcomOpenCalenderWithTime("no",sSourceControlName,nIndex);
}

function jcomSelectDateTime(sSourceControlName,nIndex){
	jcomOpenCalenderWithTime("yes",sSourceControlName,nIndex);
}

//有时间，但要用户自已选择
function jcomSelectDateOrTime(sSourceControlName,nIndex){
	jcomOpenCalenderWithTime("select",sSourceControlName,nIndex);
}

function jcomOpenCalenderWithTime(HasTime,sSourceControlName,nIndex){
	if(nIndex==null){nIndex=0;}
	var sOldDate;

	if(typeof(el(sSourceControlName)[nIndex])!='undefined'){
		sOldDate=el(sSourceControlName)[nIndex].value;
	}else{
		sOldDate=el(sSourceControlName).value;
	}
	var parameter=new Object();
	parameter.hasTime=HasTime;
	parameter.oldValue=sOldDate;
	
	var height=240;
	if(HasTime=="no"){height=220;}
	
	var strNode=showModalDialog('../Modules/Calendar.aspx',parameter,"dialogWidth:380px;dialogHeight:"+height+"px;help:no;status:no;scrollbars=no");
	//var strNode=jscomNewOpenByFixSize('../Modules/Calendar.aspx',0,380,240);
	if(strNode!=-1 && typeof(strNode)!='undefined'){
		if(typeof(el(sSourceControlName)[nIndex])!='undefined'){
			el(sSourceControlName)[nIndex].value=strNode;
		}else{
			el(sSourceControlName).value=strNode;
		}
	}
}

function jcomSelectTime(sSourceControlName,nIndex){
	var sOldTime;
	if(!nIndex){
		sOldTime=el(sSourceControlName).value;
	}else{
		if(typeof(el(sSourceControlName)[nIndex])!='undefined'){
			sOldTime=el(sSourceControlName)[nIndex].value;
		}else{
			sOldTime=el(sSourceControlName).value;
		}
	}
	var strNode=showModalDialog('../Modules/SelectTime.aspx',sOldTime,"dialogWidth:380px;dialogHeight:150px;help:no;status:no;scrollbars=no");
	if(strNode!=-1 && typeof(strNode)!='undefined'){
		if(!nIndex){
			el(sSourceControlName).value=strNode;
		}else{
			if(typeof(el(sSourceControlName)[nIndex])!='undefined'){
				el(sSourceControlName)[nIndex].value=strNode;
			}else{
				el(sSourceControlName).value=strNode;
			}
		}
	}
}

function jcomOpenHtmlEditor(style,toolbar){
	var url;
	try{
		if((style == null) || (toolbar == null)){
			url = "../HtmlEditor/HtmlEditor.aspx";
		}else{
			url = "../HtmlEditor/HtmlEditor.aspx?style="+ style +"&toolbar="+ toolbar;
		}
	}catch(e){
		url = "../HtmlEditor/HtmlEditor.aspx";
	}
	jscomNewOpenByFixSize(url,"RicherHtmlEditor",750,540);
}


function value_up(id){//文本框数值递增
	var old_val, new_val;
	var obj = el(id);
	if(obj == null) return;
	if(obj.value == "" || isNaN(obj.value)){
		obj.value = 1;
	}else{
		obj.value = parseInt(obj.value) + 1;
	}
}

function value_down(id){//文本框数值递减
	var old_val, new_val;
	var obj = el(id);
	if(obj == null) return;
	if(obj.value == "" || isNaN(obj.value)){
		obj.value = 1;
	}else{
		if(parseInt(obj.value) <= 1){
			obj.value = 1;
		}else{
			obj.value = parseInt(obj.value) - 1;
		}
	}
}

function WinClose(){
	if(window.opener == null){
		window.opener = "about:blank";
	}	
	try{
		window.parent.close();
	}catch(e){
		window.close();
	}
}

try{
	var url = document.location.pathname;
	var name = url.substring(url.lastIndexOf("/")+1).toLowerCase();
	var root = ["","default.aspx","index.aspx","register.aspx","errorpage.aspx"];
	var path = "../";
	for(i=0;i<root.length;i++){
		if(name == root[i]){
			path = "";
			break;
		}
	}
	document.write('<link type="image/x-icon" rel="shortcut icon" href="'+ path +'favicon.ico" />');
}catch(e){}
