window.onerror = function(){return true;}//屏蔽脚本错误

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 版本

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;
}


// 用正则表达式将前后空格
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

//返回字符串长度，一个中文字符相当于2英文字符
String.prototype.len = function() {
    return this.replace(/[^\x00-\xff]/g, '**').length;
} 


/*************** DotNet Post Back Function **************/
function __doPostBack(eventTarget, eventArgument){
	var theform = document.forms[0];
	if(!theform.__EVENTTARGET){            
		theform.appendChild(document.createElement("<input type=\"hidden\" name=\"__EVENTTARGET\">"));
	}	
	if(!theform.__EVENTARGUMENT){
		theform.appendChild(document.createElement("<input type=\"hidden\" name=\"__EVENTARGUMENT\">"));
	}
	theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
	theform.__EVENTARGUMENT.value = eventArgument;
	if ((typeof(theform.onsubmit) == "function")){
		if (!theForm.onsubmit || (theForm.onsubmit() != false)){
			theform.submit();
		}
	}else{
		theform.submit();
	}
}

/* 在 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.frames[0].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;
                case "login_btn":
                    sTarget.onmouseover = function() { this.className = 'login_btn_Over' };
                    sTarget.onmousedown = function() { this.className = 'login_btn_Down' };
                    sTarget.onmouseout = function() { this.className = 'login_btn' };
                    break;
                case "XpButton":
                    sTarget.onmouseover = function() { this.className = 'XpButton_Over' };
                    sTarget.onmousedown = function() { this.className = 'XpButton_Down' };
                    sTarget.onmouseout = function() { this.className = 'XpButton' };
                    break;
            }
        }
        var url = document.location.pathname;
        var name = url.substring(url.lastIndexOf("/") + 1).toLowerCase();
        if (name != "register.aspx" && name != "fck_image.aspx" && name != "fck_flash.aspx" && name != "fck_link.aspx") {
            if ((sType == 'text' || sType == 'password' || sType == 'file') && (sTarget.id != 'q')) {
                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++) {
        if (sTarget.id != 'top_content' && sTarget.id != 'bottom_content' && sTarget.id != 'reply_content') {
            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 __init(){
	var tmp = ['DataProgress'];
	for (var i=0;i<tmp.length;i++){
		if (el(tmp[i]) != null){
			var _width = (document.body.clientWidth)?document.body.clientWidth:(window.innerWidth)?window.innerWidth:document.body.offsetWidth;
			var _height = (document.body.clientHeight)?document.body.clientHeight:(window.innerHeight)?window.innerHeight:document.body.offsetHeight;
			var x, y;
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
			el(tmp[i]).style.left = ((_width - 160)/2 + x) +'px';
			el(tmp[i]).style.top = ((_height - 22)/2 + y) +'px';
		}
	}
}
zhiwei.Event.addEvent(window,"load",__init);
zhiwei.Event.addEvent(window,"resize",__init);
zhiwei.Event.addEvent(window,"scroll",__init);

function error_handler(a,b,c){
	window.status = (c+"\n"+ b +"\n\n"+a+"\n\n"+ error_handler.caller);
	return true;
}
/* ------------- Event -------------- */

//正常获取 URL 参数
function getQueryString(name) {
    var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
    if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " "));
    return "";
}; 

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 resizeWindow(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 openNewWindow(url, target) {
    var w = window.open(url, target);
    try {
        if (!w) {
            openNewBlank(url);
        }
        w.focus();
    } catch (exp) { }
}

function openNewBySize(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) {
            openNewBlank(url);
        }
        w.focus();
    } catch (exp) { }
}

function openNewByFixSize(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) {
            openNewBlank(url);
        } w.focus();
    } catch (exp) { }
}

function openNewBySizePos(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) {
            openNewBlank(url);
        }
        w.focus();
    } catch (exp) { }
}

function openNewByFull(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){
			openNewBlank(url);
		}
		w.focus();
	}catch(exp){}
}

function openNewFullScreen(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){
			openNewBlankAndCloseOpener(url);
		}else{
			window.close();
		}
		w.focus();
	}catch(exp){}
}

function openNewModalDialog(url, width, height) {
    return showModalDialog(url, window, 'dialogWidth:' + width + 'px; dialogHeight:' + height + 'px;help:0;status:0;resizeable:1;');
}

function openNewBlank(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('MessageBox_CloseMessageBox()'));
        } else {
            ShowCustomMessageBox(sHTML, '温馨提示', new Array('关 闭'), new Array('MessageBox_CloseMessageBox()'));
        }
    } catch (e) {
        ShowCustomMessageBox(sHTML, '温馨提示', new Array('关 闭'), new Array('MessageBox_CloseMessageBox()'));
    }
}

function openNewBlankAndCloseOpener(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:autoCloseWindow();' 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('MessageBox_CloseMessageBox()'));
        } else {
            ShowCustomMessageBox(sHTML, '温馨提示', new Array('关 闭'), new Array('MessageBox_CloseMessageBox()'));
        }
    } catch (e) {
        ShowCustomMessageBox(sHTML, '温馨提示', new Array('关 闭'), new Array('MessageBox_CloseMessageBox()'));
    }
}

//延时 0.25 秒关闭窗口
var Time = 0;
function autoCloseWindow() {
    if (Time >= 1000) {
        Time = 0;
        clearTimeout(TimeID);
        if (opener == null) { opener = "about:blank"; }
        window.close();
    } else {
        Time += 200;
        var TimeID = window.setTimeout('autoCloseWindow()', 50);
    }
}

//延时 10 秒关闭窗口
function autoCloseWindows() {
    if (Time >= 10000) {
        Time = 0;
        clearTimeout(TimeID);
        if (opener == null) { opener = "about:blank"; }
        window.close();
    } else {
        Time += 1000;
        var TimeID = window.setTimeout('autoCloseWindows()', 1000);
    }
}


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;
		}
	}
}

//获取客户端 Flash 版本
function getFlashVer() {
    var n = navigator;
    var flash_version = 0;
    if (n.plugins && n.plugins.length) {
        for (var i = 0; i < n.plugins.length; i++) {
            if (n.plugins[i].name.indexOf('Shockwave Flash') != -1) {
                //flash_version = n.plugins[i].description.split('Shockwave Flash ')[1].split(' ')[0];
                flash_version = n.plugins[i].description.split('Shockwave Flash ')[1].split('.')[0];
                break;
            }
        }
    } else if (window.ActiveXObject) {
        for (var i = 10; i >= 2; i--) {
            try {
                var fl = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + i + "');");
                if (fl) { flash_version = i; break; }
            }
            catch (e) { }
        }
    }
    return flash_version;
}


function getSubstring(str,begin,num){
	return str.toString().substring(begin,begin + num);
}

function add_bookmark(title, url) {
    if (ie) {
        window.external.AddFavorite(url, title);
    } else if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    } else if (window.opera) {
        return false;
    }
}

//设置焦点
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){}
}

//获取元素绝对位置，返回数组
function getAbsoluteLocationEx(element) {
    if (arguments.length != 1 || element == null) {
        return null;
    }
    var element = (typeof element == "object") ? element : el(element);
    var offsetTop = element.offsetTop;
    var offsetLeft = element.offsetLeft;
    var offsetWidth = element.offsetWidth;
    var offsetHeight = element.offsetHeight;
    do {
        element = element.offsetParent;
        offsetTop += element.offsetTop;
        offsetLeft += element.offsetLeft;
    } while (element.tagName.toLowerCase() != "body");

    return { Top: offsetTop, Left: offsetLeft, Width: offsetWidth, Height: offsetHeight };
}

//判断是否有检查框被选中
//返回 true有  false 无
function checkBoxSelect(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 filtrateSomeKeyForKeyPress() {
    if (event.keyCode == 39 || event.keyCode == 34) {
        event.keyCode = 0;
    }
}

//只能输入数字
function onlyNumForKeypress(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 isSafeString(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;
}

//验证 Email 格式是否正确
function isEmail(str) {
    var myReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
    if (!myReg.test(str)) {
        return false;
    }
    return true;
}

//验证用户名字符串是否正确
function isUserString(str) {
    var myReg = /^[0-9a-z][\w-.]*[0-9a-z]$/i;
    if (!myReg.test(str)) {
        return false;
    }
    return true;
}

//判断是否数字
function isNumber(str){
    var myReg = /^(\-?)(\d+)$/;
    if (!myReg.test(str)) {
        return false;
    }
    return true;
}

//判断是否为 double 型
function isDouble(str){
	var myReg = /^[-\+]?\d+(\.\d+)?$/;
	if(!myReg.test(str)){
		return false;
	}
	return true;
}

function isEmptyString(str){ 
	return ((!str)||(str.trim().length == 0));
}

//检查日期是否正确  格式2002-09-11
function isDate(strDate){
    if (isEmptyString(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  isLongDate(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;  
}  

function txtCounter(o,s,m){
    el(s).innerHTML = m - o.value.trim().len();
    if (o.value.trim().len() > m) {
		el(s).style.color = '#FF0000';
	}
}

//取消按钮
function cancelClick(){
	var frms=document.forms;
	for(i=0;i<frms.length;i++){
		frms(i).reset();
	}
	return false;
}

//客户端字符串编码
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 closeAndRefreshOpener(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 saveAndCloseRefreshOpener(){
	try{
		if(!top){
			try{
				opener.RefreshForm();
			}catch(e){}
			window.close();
		}else{
			try{
				top.opener.RefreshForm();
			}catch(e){}
			top.close();
		}
	}catch(e){}
}

function closeWindow() {
    if (window.opener == null) {
        window.opener = "about:blank";
    }
    try {
        window.parent.close();
    } catch (e) {
        window.close();
    }
}

function openHtmlEditor(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";
	}
	openNewByFixSize(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;
		}
	}
}

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;
		}
	}
	var strIcon = '<link rel="icon" href="'+ path +'favicon.ico" type="image/ico" />';
	strIcon += '<link type="image/x-icon" rel="shortcut icon" href="'+ path +'favicon.ico" />';
	strIcon += '<link type="image/x-icon" rel="bookmark icon" href="'+ path +'favicon.ico" />';
	document.getElementsByTagName('head')[0].appendChild(strIcon);
}catch(e){}

