String.prototype.trim=function(){
var reExtraSpace=/^\s*(.*?)\s+$/;
return this.replace(/(^\s*)|(\s*$)/g,"");
}

function IsInt(input){
var reg=/^(-|\+)?\d+$/ ;
return reg.test(input);
}

function IsFloat(input){
if(IsInt(input)){
return true;
}
var reg=/^(-|\+)?\d+\.\d*$/;
return reg.test(input);
}

function IsShorDate(input){
var r=input.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);  
if(r==null){
return false;
}
var d=new Date(r[1],r[3]-1,r[4]);  
return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]); 
}

function IsLongDate(input){
var reg=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;  
var r=input.match(reg);  
if(r==null){
return false;
}
var d=new Date(r[1],r[3]-1,r[4],r[5],r[6],r[7]);  
return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]); 
}

var System={};
var ua=navigator.userAgent.toLowerCase();
var s;
(s=ua.match(/msie ([\d.]+)/))?System.ie=s[1]:
(s=ua.match(/firefox\/([\d.]+)/))?System.firefox=s[1]:
(s=ua.match(/chrome\/([\d.]+)/))?System.chrome=s[1]:
(s=ua.match(/opera.([\d.]+)/))?System.opera=s[1]:
(s=ua.match(/version\/([\d.]+).*safari/))?System.safari=s[1]:0;

function $(id){
return document.getElementById(id);
}

function $N(name){
return document.getElementsByName(name);
}

function Go(url){
window.location=url+"&rn="+new Date();
}

var ajax;
var ajaxCompleted=false;
function AjaxRequest(url,data,s,err){
ajaxCompleted=false;
url+="&isajax=1&rn="+new Date();
if(ajax==null){
if(window.XMLHttpRequest){    
ajax = new XMLHttpRequest();
}
else if(window.ActiveXObject){
try{
ajax = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
alert("Ajax创建失败!");
}
}
}
}
ajax.open("POST",url,true);
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.onreadystatechange=function(){
if(ajax.readyState==3){
ajaxCompleted=true;
}
if(ajax.readyState==4){
if(System.firefox){
ajaxCompleted=navigator.onLine;
}
else if(!System.ie){
ajaxCompleted=true;
}
if(ajaxCompleted){
if(ajax.responseText=="0"){
return;
}
if(s){
s(ajax.responseText);
}
}
else{
ShowMessageDialog("提示","当前浏览器处于脱机状态,请设为正常状态");
}
}
}

try{
ajax.send(data);
}
catch(e){
}
}

var scrollX;
var scrollY;
var isDisplayScroll=true;
var EasyMask={
    init:function(){
		isDisplayScroll=false;
		if(document.documentElement){
			if($("resourceMasks")==null){
				scrollX=document.documentElement.scrollLeft;
				scrollY=document.documentElement.scrollTop;
				scrollTo(0,0)
			}
			document.documentElement.style.overflowX="hidden";
			document.documentElement.style.overflowY="hidden";
		}
		else{
			if($("resourceMasks")==null){
				scrollX=document.body.scrollLeft;
				scrollY=document.body.scrollTop;
				scrollTo(0,0)
			}
			document.body.style.overflowX="hidden";
			document.body.style.overflowY="hidden";
		}
        var k = function(i, v) { return $(i) ? $(i) : v ? document.createElement("div") : document.createElement("iframe"); };
        var a = arguments.length ? arguments[0] : new Object;
        var h = window.innerHeight || self.innerHeight || (document.documentElement && document.documentElement.clientHeight && document.documentElement.offsetHeight) || document.body.clientHeight;
        var w = window.innerWidth || self.innerWidth || (document.documentElement && document.documentElement.clientWidth && document.documentElement.offsetWidth) || document.body.clientWidth;
        var t = 0;
        var l = 0;
        var o = a.opacity ? a.opacity : 7;
        var m = a.molor ? a.molor : '#FFFFFF';
        var e = a.width ? a.width < 100 ? 100 : a.width : 100;
        var f = a.height ? a.height < 50 ? 50 : a.height : 50;
        var b = a.bgcolor ? a.bgcolor : "#709CD2";
		var pa=a.padding ? a.padding : "6";
        var mo = a.mode ? a.mode : 1;
		var sign = a.sign ? a.sign : "";		
		var apppendindex= a.sign ? 10 : 0;	
        var c = k(sign+"resourceMasks", true);
        var z = k(sign+"resourceContents", true);
        var g = k(sign+"resourceShadows", true);
        var top = (h - f) / 2 + t;
        var left = (w - e) / 2;
        c.id = sign+"resourceMasks";
		if(mo==1){
        c.onclick=EasyMask.close;
		}
		c.tabIndex=-1;	
        c.onkeydown=EasyMask.enter;
        c.oncontextmenu = function(){ return false;};
        c.style.cssText = "display:none;position:absolute;left:0;top:" + t + "px;width:" + w + "px;height:" + h + "px;background:" + m + ";z-index:"+(999998+      apppendindex)+";filter:alpha(opacity=" + o + "0);opacity:0." + o + ";";
        z.id = sign+"resourceContents";
		z.tabIndex=-1;	
        z.onkeydown=EasyMask.enter;
        z.style.cssText = 'display:none;outline:none;background:#fff;border:1px solid ' + b + ';z-index:'+(999999+apppendindex)+';position:absolute;width:' + e + 'px;height:' + f + 'px;top:' + top + 'px;left:' + left + 'px;';
        var i = '<div style="text-align:left;height:25px;background:' + b + ';color:#fff;font:bold 15px/25px Arial;text-indent:6px;overflow:hidden;padding-right:8px;">' + (a.title ? a.title : "") + '<span style="position:absolute;right:0;top:0px;cursor:pointer;padding:0 6px 0 3px;" onmouseover="this.style.color=\'#000\';" onmouseout="this.style.color=\'#fff\';" title="关闭" onclick="EasyMask.close()">X</span></div>';
        i += '<div class="dialogcontent" style="height:'+(f-25-pa*2)+'px;overflow:hidden;padding:'+pa+'px;">' + (a.detail ? a.detail : "") + '</div>';
        z.innerHTML = i;
        g.id = sign+"resourceShadows";
        g.style.cssText = 'display:none;background:#000;z-index:'+(999996+apppendindex)+';position:absolute;width:' + e + 'px;height:' + f + 'px;top:' + (top + 6) + 'px;left:' + (left + 6) + 'px;filter:alpha(opacity=30);opacity:0.3;';
		EasyMask.app(c)(z)(g);
        $(sign+"resourceMasks").style.display="";
        $(sign+"resourceContents").style.display="";
        $(sign+"resourceShadows").style.display="";
		$(sign+"resourceContents").focus();
    },
    close:function(){
		if($("messageresourceMasks")){
			EasyMask.del('messageresourceMasks','messageresourceContents','messageresourceHideSelect','messageresourceShadows');
		}
		else if($("resourceMasks")){
			EasyMask.del('resourceMasks','resourceContents','resourceHideSelect','resourceShadows');
		}
		isDisplayScroll=true;
		Reset();
		if($("resourceMasks")==null){
			scrollTo(scrollX,scrollY);
		}
    },
    enter:function(e){
		var key=(document.all)?window.event.keyCode:e.which;
		if(key==13){
			var targ
			if(!e) var e = window.event
			if(e.target) targ = e.target
			else if (e.srcElement) targ = e.srcElement
			if(targ.nodeType == 3) // defeat Safari bug
			   targ = targ.parentNode
			var tname=targ.tagName.toLowerCase();
			if(tname!="button"){
				CancelEvent(e);
				if($("yes")){
					$("yes").click();
				}
				else{
					EasyMask.close();
				}
			}
		}
    },
    app:function(v){
        document.body.appendChild(v);
        return EasyMask.app;
    },
    del:function(){
        for(var i=0;i<arguments.length;i++){
            var id=$(arguments[i]);
            id&&id.parentNode.removeChild(id);
        }
    },
    hidden:function(){
    $("resourceMasks").style.display="none";
    $("resourceContents").style.display="none";
    $("resourceShadows").style.display="none";
	isDisplayScroll=true;
    }
}

function ShowUrlDialog(title,url){
EasyMask.close();
var content="<iframe src=\""+url+"\" frameborder=\"0\" scrolling=\"auto\" width=\"100%\" height=\"100%\"></iframe>";
EasyMask.init({mode:2,width:document.documentElement.clientWidth-20,height:document.documentElement.clientHeight-20,title:title,detail:content});
}

function ShowMessage(text){
if($("message")){	
if(text==""){
$("message").innerHTML="";
}
else{
$("message").innerHTML="操作提示:"+text.trim();
}
}
}

function ShowMessageDialog(title,text){
if(text!=""){
var content="<table style=\"width:345px;height:105px;\"><tr><td colspan=\"2\" vlign=\"top\" style=\"padding-left:10px;\">"+text.trim()+"</td></tr><tr><td></td><td align=\"right\" style=\"vertical-align:bottom;\"><button type=\"button\" id=\"yes\" onclick=\"EasyMask.close();\">确定</button></td></tr></table>";
EasyMask.init({width:360,height:150,title:title,detail:content,sign:"message"});
$("yes").focus();
}
}

function UrlActionConfirm(action,url){
var content="<table style=\"width:215px;\"><tr><td colspan=\"2\"><br>&nbsp;&nbsp;&nbsp;确实要"+action+"吗?<br><br><br></td></tr><tr><td></td><td align=\"right\"><button type=\"button\" id=\"yes\" onclick=\"EasyMask.close();UrlActionConfirmOK('"+url+"');\">&nbsp;是&nbsp;</button>&nbsp;<button type=\"button\" onclick=\"EasyMask.close();\">&nbsp;否&nbsp;</button></td></tr></table>";
EasyMask.init({width:230,height:131,title:"确认"+action,detail:content});
$("yes").focus();
}

function UrlActionConfirmOK(url){
window.location=url;
}

function FormActionConfirm(action,name){
var formName="list";
if(name){
formName=name;
}
var content="<table style=\"width:215px;\"><tr><td colspan=\"2\"><br>&nbsp;&nbsp;&nbsp;确实要"+action+"吗?<br><br><br></td></tr><tr><td></td><td align=\"right\"><button type=\"button\" id=\"yes\" onclick=\"EasyMask.close();FormActionConfirmOK('"+formName+"');\">&nbsp;是&nbsp;</button>&nbsp;<button type=\"button\" onclick=\"EasyMask.close();\">&nbsp;否&nbsp;</button></td></tr></table>";
EasyMask.init({width:230,height:131,title:"确认"+action,detail:content});
$("yes").focus();
}

function FormActionConfirmOK(formName){
if($("promptdata")){
document.forms[formName].action+="&promptdata=" + escape($("promptdata").value);
}
document.forms[formName].submit();
}

function UrlActionPrompt(action,url,defaultValue){
var content="<table style=\"width:315px;\"><tr><td colspan=\"2\"><textarea id=\"promptdata\" style=\"width:100%;height:100px;\">"+defaultValue+"</textarea></td></tr><tr><td></td><td align=\"right\"><button type=\"button\" id=\"yes\" onclick=\"UrlActionPromptOK('"+url+"');\">确定</button>&nbsp;<button type=\"button\" onclick=\"EasyMask.close();\">取消</button></td></tr></table>";
EasyMask.init({width:330,height:180,title:action,detail:content});
$("promptdata").focus();
}

function UrlActionPromptOK(url){
$("promptdata").value=$("promptdata").value.trim();
$("promptdata").focus();
if($("promptdata").value.length>50){
ShowMessageDialog("提示","不能超过50个字符");
return;
}
if($("promptdata").value != ""){
url+="&promptdata=" + escape($("promptdata").value);
EasyMask.close();
window.location=url;
}
}

function FormActionPrompt(action,name,defaultValue){
var formName="list";
if(name){
formName=name;
}
var content="<table style=\"width:315px;\"><tr><td colspan=\"2\"><textarea id=\"promptdata\" style=\"width:100%;height:100px;\">"+defaultValue+"</textarea></td></tr><tr><td></td><td align=\"right\"><button type=\"button\" id=\"yes\" onclick=\"FormActionPromptOK('"+formName+"');\">确定</button>&nbsp;<button type=\"button\" onclick=\"EasyMask.close();\">取消</button></td></tr></table>";
EasyMask.init({width:330,height:180,title:action,detail:content});
$("promptdata").focus();
}

function FormActionPromptOK(formName){
$("promptdata").value=$("promptdata").value.trim();
$("promptdata").focus();
if($("promptdata").value.length>50){
ShowMessageDialog("提示","不能超过50个字符");
return;
}
if($("promptdata").value != ""){
document.forms[formName].action+="&promptdata=" + escape($("promptdata").value);
EasyMask.close();
document.forms[formName].submit();
}
}

function SelectAll(o,n){
var arr=document.getElementsByName(n);
for(var i=0;i<arr.length;i++){
if(arr[i].disabled==false){
arr[i].checked=o.checked;
}
}
}

function Reset(){
if(isDisplayScroll){
if(document.documentElement){
if(System.ie&&document.documentElement.scrollWidth>document.documentElement.clientWidth){
document.documentElement.style.overflowX="scroll";
}
else{
document.documentElement.style.overflowX="auto";
}
if(System.ie&&document.documentElement.scrollHeight>document.documentElement.clientHeight){
document.documentElement.style.overflowY="scroll";
}
else{
document.documentElement.style.overflowY="auto";
}
}
else{
if(System.ie&&document.body.scrollWidth>document.body.clientWidth){
document.body.style.overflowX="scroll";
}
else{
document.body.style.overflowX="auto";
}
if(System.ie&&document.body.scrollHeight>document.body.clientHeight){
document.body.style.overflowY="scroll";
}
else{
document.body.style.overflowY="auto";
}
}
}
else{
if(document.documentElement){
document.documentElement.style.overflowX="hidden";
document.documentElement.style.overflowY="hidden";
}
else{
document.body.style.overflowX="hidden";
document.body.style.overflowY="hidden";
}
}
}
window.onload=Reset;
window.onresize=Reset;