onerror = handleErr;
function handleErr(msg, url, l) {
	var txt = "";
	txt = "本页中存在错误。\n\n";
	txt += "错误：" + msg + "\n";
	txt += "URL: " + url + "\n";
	txt += "行：" + l + "\n\n";
	txt += "点击“确定”继续。\n\n";
	alert(txt);
	return true;
}
function formatEmptyLink(){
	var links = document.getElementsByTagName("a");
	for(var i = 0; i < links.length; i++){
		if(links[i].href == "" || links[i].href == document.URL + "#"){
			links[i].href = "javascript:void(0)";
		}
	}
}
function stopEvent(e) {
	try{
	var evt = (e) ? e : window.event;
	if (document.onclick != undefined) {
		document.onclick();
		_saveFn = null;
		if(clearIframeDocumentClick != null)
		clearIframeDocumentClick(e);
	}
	if (window.event) {
		window.event.cancelBubble = true;
	} else {
		evt.stopPropagation();
	}
	}catch(error){}
}
function stopDefault(e) {
	var evt = (e) ? e : window.event;
	if (document.onclick != undefined) {
		document.onclick();
		_saveFn = null;
		if(clearIframeDocumentClick != null)
		clearIframeDocumentClick(e);
	}
	if (evt && evt.preventDefault) {
		evt.preventDefault();
	} else {
		window.event.returnValue = false;
	}
	return false;
}
String.prototype.startWith = function(str) {
	if (str == null || str == "" || this.length == 0
			|| str.length > this.length)
		return false;
	if (this.substr(0, str.length) == str)
		return true;
	else
		return false;
	return true;
};
String.prototype.replaceall = function (s1, s2) {
	var str = this;
	while (str.indexOf(s1) !== -1) {
		str = str.replace(s1, s2);
	}
	return str;
};
String.prototype.trim = function () {
	return this .replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' );
};


(function(){
    window.brower = 0;
    //IE
    if (document.all) {
        brower = 0;
    }//FF
    else {
        brower = 1;
    }
})();
function inputNumber(oEvent){
    oEvent = oEvent || window.event;
    var code = 0;
    if (brower == 0) {
        code = oEvent.keyCode;
    }
    else {
        code = oEvent.which;
    }
    if (code == 8 || code == 9 || code == 13) {
        return true;
    }
    if (code == 32) {
        return false;
    }
    if (!isNaN(String.fromCharCode(code))) {
        return true;
    }
    return false;
}
