﻿@set @DEBUG=false;

function radioValue(aName,aDefValue){
	var telems = document.getElementsByName(aName);
	var tstr = "";
	for(var i=0;i<telems.length;i++){
		if (telems[i].checked){
			return telems[i].value;
		}
	}
	return isNULL(aDefValue,"");
}

function myRedirect(aURL,aMessageText,aIsTop,aNewWindow){
    if (!isUNEString(aMessageText)){
        if (!window.confirm(aMessageText)){
            event.returnValue = false;
            return;
        }
    }
    if (aNewWindow == true){
        window.open(aURL);
    } else {
        if (aIsTop == true){
            window.top.location.href=aURL;
        }else{
            window.location.href=aURL;
        }
     }
}

function enURL(aURL){
    if (typeof(aURL) != "string"){
        if (aURL == true){
            aURL = window.top.location.href;
        }else if (aURL == false){
            aURL = window.location.href;
        }
    }
    var turl = aURL.replace("?","~");
    turl = turl.replace("&","|");
    return turl;
}

function factURL(aURL){
    var turl = aURL.replace("~","?");
    turl = turl.replace("|","&");
    return turl;
}

function setBtnImg(aImgElem,aBorderColor,aBorderColor2,aSrc){
    if (typeof(aImgElem) == "string"){
        aImgElem = document.getElementById(aImgElem);
        if (aImgElem == null) return;
    }
    
    aImgElem.style.cursor = "hand";
    
    aImgElem.onmouseover = function(){
        aBorderColor = isNULL(aBorderColor,"#5FA6C9");
        event.srcElement.style.border = "solid 1px " + aBorderColor;
    }
    
    aBorderColor2 = isNULL(aBorderColor2,"#5FA6C9");
    aImgElem.onmouseout = function(){
        event.srcElement.style.border = "solid 1px " + aBorderColor2;
    }
    aImgElem.style.border = "solid 1px " + aBorderColor2;
    
    if (!isUNEString(aSrc)){
        aImgElem.src = aSrc;
    }
}

function setDocumentBtnImg(aBorderColor,aBorderColor2){
    var telems = document.getElementsByTagName("img");
    for(var i=0 ; i < telems.length ; i++){
        if (telems[i].imgType == "btn"){
            setBtnImg(telems[i],aBorderColor,aBorderColor2);
        }
    }
}

function refreshPage(aFormName){
	if (isUNEString(aFormName)){
		var telems = document.getElementsByTagName("form");
		for (var ti=0;ti<telems.length;ti++) {
			telems[ti].submit();
		}
	} else {
		var telem = document.getElementById(aFormName);
		if (telem != null){
			telem.submit();
		}
	}
}

function ddlbValue(aid){
	if (typeof(aid) == "string"){
		aid = document.getElementById(aid);
	}
	if (aid.selectedIndex < 0) return "";
	return aid.options[aid.selectedIndex].value;
}

function isError(aError,aErrMsg){
	if (aError != null && aError != undefined) {
		if (aError.constructor == Error){
			if ( ! isUNEString(aErrMsg)){
				window.alert("[Error:] " + aErrMsg);
			}
			return true;
		}
	}
	return false;
}

function addURLRand(aURL){
	var tURL = aURL;
	var tDate = new Date();
	if (tURL.indexOf("?") > -1){
		tURL += "&RefeshDT=" + tDate.toUTCString();
	} else {
		tURL += "&RefeshDT=" + tDate.toUTCString();
	}
	return tURL;
}

function reloadWindow(aTopWindow){
	if (aTopWindow){
		window.top.location.href = addURLRand(window.top.location.href);
	} else {
		window.location.href = addURLRand(window.location.href);
	}
}

function errObj(aArgs){
	var tError = new Error();;
	if (aArgs != null && aArgs != undefined) {
		if (aArgs.constructor == "Error"){
			return errObj;
		} else if (aArgs.constructor == "String") {
			tError.number = 0;
			tError.description = aArgs;
		} else{
			tError.number = 0;
			tError.description = "[errObj] 未知错误";
		}
	} else {
		tError.number = 0;
		tError.description = "[errObj] 未知错误";
	}
	return tError;
}

function showError(aError){
	var tErrText = "   [Error]                                \n\n";
	if (aError.constractor == "Error"){
		tErrText = " 错误代码: 　" + aError.number + "\n";
		tErrText = " 错误描述:   " + aError.description + "\n";
	} else {
		tErrText = aError;
	}
	window.alert(tErrText);
}

function tryc(aFun,aErrFun,aUseTry){
	if (aUseTry != true) {
		try{
			return aFun(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);
		}catch (ex) {
			if (typeof(aErrFun) == "function") {
				aErrFun(ex);
			}else{
				showError(ex);
			}
			return errObj(ex);
		}
	} else {
		return aFunaFun(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);
	}
}

var AZ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
function charCode(aStr){
	return AZ.indexOf(aStr.charAt(0)) + 65;
}

function m(){
	var tMsg = "m():";
	for(var i=0 ;i < arguments.length ;i++){
		if (arguments[i] == undefined || arguments[i] == null)
			continue;
		tMsg += "\n"; 
		tMsg += arguments[i] ;
	}
	window.alert(tMsg);
}
//20080118 Modify
function LTrim(aStr){
  var t = new RegExp(/^\s+/g)
  return aStr.replace(t,"")
}

function RTrim(aStr){
  var t = new RegExp(/\s+$/)
  return aStr.replace(t,"")
}

function ATrim(aStr){
  var t = new RegExp(/^\s+/g);
  tstr = aStr.replace(t,"");
  t = new RegExp(/\s+$/);
  return tstr.replace(t,"")
}

//20080118 Beforre

function isNULL(aObject,aDefValue) {
    if (aObject == undefined || aObject == null)
        return aDefValue;
    return aObject;
}

function debugAlert(aMsg){
	
	@if(@DEBUG)
	window.alert(aMsg);	
	@end
	
}

function isArray(obj){
	return obj.constructor.toString ().indexOf("Array")==-1?false:true;
}
function isUNEString(aStr){
	if(typeof(aStr)=="string"){
		return (aStr=="")?true:false;
	}
	return true;
}

function DES(aName){
	return DE("_sys"+aName);	
}

		
function addQString(aURL,aQSName,aQSValue){
	var tURL ;
	if(aURL.indexOf("?")==-1){
		tURL = aURL +"?"+aQSName +"="+ aQSValue;
	}else {
		tURL = aURL +"&"+aQSName +"="+ aQSValue;
	}
	return tURL;
}

function addQSRefresh(aURL){
	var tmpdate=new Date();	
	return addQString(aURL,"RefreshDT",tmpdate.getMilliseconds());
}

function DESNV(aName,aDefValue){
	var tret;
	try{
		tret=parseInt(DES(aName).value);
	}catch(ex){
		if(typeof(aDefValue)=="number")return aDefValue;		
		showError(ex);
		return errObj(ex);
	}
	return tret;
}
//获取元素的值（数值）

function secondToText(aSecond){
	var v1;
	v1 = aSecond;
	var tstr ;
	tstr = v1 % 60 + "秒";
	v1 =Math.floor(v1 / 60);
	if (v1 == 0 ) return tstr;
	tstr = v1 % 60 + "分" + tstr;
	v1 =Math.floor(v1 / 60);
	if (v1 == 0 ) return tstr;
	tstr = v1 % 60 + "小时" + tstr;
	v1 =Math.floor(v1 / 24);
	if (v1 == 0 ) return tstr;
	tstr = v1 % 60 + "天" + tstr;
	return tstr;
}
function minuteToText(aMinute){
	var v1;
	var tstr = "";
	v1 = aMinute;
	tstr = v1 % 60 + "分";
	v1 =Math.floor(v1 / 60);
	if (v1 == 0 ) return tstr;
	tstr = v1 % 60 + "小时" + tstr;
	v1 =Math.floor(v1 / 24);
	if (v1 == 0 ) return tstr;
	tstr = v1 % 60 + "天" + tstr;
	return tstr;
}

function DESSV(aName,aDefValue){
	
	var tret="";	
	try{
		tret=DES(aName).value;
	}catch(ex){
		if(typeof(aDefValue)=="string")
			return aDefValue;
		throw ex;
	}
	return tret;	
	
}//获取元素的值（字符串）

function DESVS(aName,aValue){
	if(typeof(aValue)=="undefined"||aValue==null){
		window.alert("调用 DESVS 时，请指定值");	
		
	}
	DES(aName).value=aValue;
	
}// 设置无素的值


function DE(aName){
    if (typeof(aName) == "string") {
	    var getElem=document.getElementById(aName);	
	    if(getElem==null)
	    {
		    var tmsg="DE(aName)："+aName+" 不存在"
		    debugAlert(tmsg);		
		    throw tmsg;	
	    }
	    return getElem;	
	}
	return aName
}

function DENV(aName,aDefValue){
	var tret;	
	try{
		tret=parseInt(DE(aName).value);
	}catch(ex){
		if(typeof(aDefValue)=="number")return aDefValue;		
		throw ex; 
	}
	return tret;
}//获取元素的值（数值）

function DESV(aName,aDefValue){
	var tret="";	
	try{
		tret=DE(aName).value;
	}catch(ex){
		if(typeof(aDefValue)=="string")
			return aDefValue;		
		throw ex;
	}
	return tret;
}

//获取元素的值（字符串）
function DEVS(aName,aValue){
	if(typeof(aValue)=="undefined"||aValue==null){
		window.alert("调用 DESVS 时，请指定值");
	}
	DE(aName).value=aValue;
}

// 设置元素的值
function DEIT(aName){ return DE(aName).innerText;}
function DEITS(aName,aValue){DE(aName).innerText=aValue;}
function DEIH(aName){return DE(aName).innerHTML;}
function DEIHS(aName,aValue){DE(aName).innerHTML=aValue;}

function widthTest(aObj){
	var str="ID: "+aObj.id;	
	str+="  clientWidth:"+aObj.clientWidth;	
	str+="\\n width: "+aObj.width
	str+="\\n Offsetwidth: "+aObj.offsetWidth
	str+="\\n scrollWidth: "+aObj.scrollWidth
	window.alert(str);
}


function round(value,num)//四舍五入 
{
	
	var a_str=formatnumber(value,num);
	
	var a_int=parseFloat(a_str);
	
	if(value.toString ().length>a_str.length){
		
		var b_str=value.toString ().substring(a_str.length,a_str.length+1)
		var b_int=parseFloat(b_str);
		
		if(b_int<5){
			
			return a_str
			
		}else {
			
			var bonus_str,bonus_int;
			
			if(num==0){
				
				bonus_int=1;
				
				
			}
			else {
				
				bonus_str="0."
				for(var i=1;i<num;i++)
				bonus_str+="0";
				bonus_str+="1";
				bonus_int=parseFloat(bonus_str);
				
			}
			a_str=formatnumber(a_int+bonus_int,num)
			
		}
		
	}
	return a_str
	
}

function formatnumber(value,num)//直接去尾 
{
	
	var a,b,c,i
	a=value.toString ();
	
	b=a.indexOf(".");
	
	c=a.length;
	
	if(num==0){
		
		if(b!=-1)
		a=a.substring(0,b);		
		
	}else {
		
		if(b==-1){
			
			a=a+".";
			
			for(i=1;i<=num;i++)
			a=a+ "0";
			
		}else {
			
			a=a.substring(0,b+num+1);
			
			for(i=c;i<=b+num;i++)
			a=a+"0";
			
		}
		
	}
	return a
	
}






function fileTest(){
	
	window.alert(" File Test OK !!");	
	
}

function topTest(aObj){
	
	var str="clientTop:"+aObj.clientTop;	
	str+="\\n Top: "+aObj.top
	str+="\\n OffsetTop: "+aObj.offsetTop
	str+="\\n scrollTop: "+aObj.scrollTop
	window.alert(str);	
	
}


function createRect(aTitle){
	
	var str="<table class=\"title\">"
	str+="<thead style=\"height:25px\">";	
	str+="<td style=\"padding-left:10px; text-align:left;background-image:url(/images/title_bg.gif);background-position:0px; background-repeat:repeat\">"
	str+=aTitle;	
	str+="</td>"
	str+="<td style=\"background-image:url(/images/title_bg_r.gif);background-repeat:norepeat;width:60px;background-position:left\">"
	str+="</td>"
	str+="</thead>"
	str+="</table>"
	return str;	
	
}

function createProgress(aPos,aWidth,aHeight,aColor1,aColor2){
	
	var tpos,tw,th,tc1,tc2;	
	tpos=typeof(aPos)=="number"?aPos:0;	
	tw=typeof(aWidth)=="number"?aWidth:75;	
	th=typeof(aHeight)=="number"?aHeight:15;	
	tw=Math.max(tw,60);	
	th=Math.max(th,6);	
	tc1=typeof(aColor1)=="string"?aColor1:"#ff0000";
	//红
	tc2=typeof(aColor2)=="string"?aColor2:"#ffffff";
	//白
	var t1=document.createElement("div");	
	t1.style.border="solid 1px #B4B4B4";	
	t1.style.padding="0px";	
	t1.style.margin="0px";	
	t1.style.height=th;	
	t1.style.lineHeight=th;	
	t1.style.width=tw;	
	t1.style.backgroundColor=tc2;	
	t1.style.fontSize="2px";	
	t1.innerHTML=" ";	
	
	var t2=document.createElement("div");	
	t2.style.border="none";	
	t2.style.padding="0px";	
	t2.style.margin="0px";	
	t2.style.height=th;	
	t2.style.lineHeight=th;	
	t2.style.width=tpos*tw/100;	
	t2.style.backgroundColor=tc1;	
	t2.style.fontSize="2px";	
	t2.innerHTML=" ";	
	t1.appendChild(t2);	
	return t1;	
	
}


function closeIEWindow(){
	
	window.top.opener=null;	
	return window.top.close();	
	
}

function backToParent(){
	
	window.opener.location.reload();	
	window.top.close();	
	
}

function checkAll(aCheck){
	
	var boxs=document.form1.getElementsByTagName("input");	
	for(var i=0;i<boxs.length;i++){
		
		if(boxs[i].type=="checkbox"&&boxs[i].disabled==false)
		boxs[i].checked=aCheck;		
		
	}
	
}

function disableKeys(aWindow){
	var tWindow;
	if(typeof(aWindow)=="object"&&(aWindow.tagName=="FRAME"||aWindow.tagName=="IFRAME")){
		tWindow=aWindow.contentWindow;
	}else {
		tWindow=window
	}
	
	tWindow.document.oncontextmenu=function (){
		tWindow.event.returnValue=false;
		
	}//屏蔽鼠标右键 
	tWindow.document.onselectstart=function (){
		tWindow.event.returnValue=false;
		
	}//屏蔽鼠标选择
	tWindow.onhelp=function (){
		return false
	}//屏蔽F1帮助 
	tWindow.document.onmousewheel=function ()//屏蔽Shift+滚轮,Ctrl+滚轮
	{
		if(tWindow.event.shiftKey||tWindow.event.ctrlKey)
		{
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
		}
	}
	tWindow.document.onkeydown=function ()
	{
		
		if((tWindow.event.altKey)&&
		((tWindow.event.keyCode==37)||//屏蔽 Alt+ 方向键 ← 
		(tWindow.event.keyCode==39)))//屏蔽 Alt+ 方向键 → 
		{
			
			tWindow.event.returnValue=false;			
			
		}
		if((tWindow.event.keyCode==116)||//屏蔽 F5 刷新键
		(tWindow.event.ctrlKey&&tWindow.event.keyCode==82)){
			//Ctrl + R 
			tWindow.event.keyCode=0;
			
			tWindow.event.returnValue=false;
			
			
		}
		if(tWindow.event.keyCode==32||tWindow.event.keyCode==8)//屏弊空格键,后退键
		{
			
			if(!(tWindow.event.srcElement.tagName=="INPUT"&&tWindow.event.srcElement.type=="text")&&tWindow.event.srcElement.tagName!="TEXTAREA")
			{
				
				tWindow.event.keyCode=0;
				
				tWindow.event.returnValue=false;
				
				
			}
			
		}
		if(tWindow.event.keyCode==27){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽ESC
		
		if(tWindow.event.keyCode==114){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽F3
		if(tWindow.event.keyCode==122){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽F11
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==67){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+c
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==86){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+v
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==70){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+f
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==87){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+w
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==69){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+e
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==72){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+h
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==73){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+i
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==79){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+o
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==76){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+l
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==80){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+p
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==66){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+b
		if(tWindow.event.ctrlKey&&tWindow.event.keyCode==78){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 Ctrl+n
		if(tWindow.event.shiftKey&&tWindow.event.keyCode==121){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 shift+F10 
		if(tWindow.event.srcElement.tagName=="A"&&tWindow.event.shiftKey){
			tWindow.event.keyCode=0;
			tWindow.event.returnValue=false;
			
		}//屏蔽 shift 加鼠标左键新开一网页 
		
	}
	
}

function preClose(aMessage){
	
	var tmsg;	
	if(typeof(aMessage)!="string"){
		
		tmsg="";		
		
	}else {
		
		tmsg=aMessage;		
		
	}
	window.onbeforeunload=function(){
		
		if(event.clientY<0||event.altKey){
			
			window.event.returnValue=tmsg
			
		}
		
	}
	
}

function showDialog(u,w,h,aParam){
	var s="dialogHeight:"+h+"px;dialogWidth:"+w+"px;"
	s+="center:yes;dialogHide:no;edge:raised;help:no;resizable:no;scroll:no; unadorned: no";	
	return window.showModalDialog(u,aParam,s);
}

function showWindow(u,w,h,s,aWinName){
	var tWinName;
	if (typeof (aWinName) == "string" && aWinName != ""){
		tWinName = aWinName
	} else {
		tWinName = "_blank";
	}
	
	var tw,th;	
	var taw=screen.availWidth-10
	var tah=screen.availHeight-28;	
	var ts;	
	if(typeof(s)!="boolean"){ts=true;}else {ts=s;}
	if(typeof(w)=="number"){
		if(w>taw){tw=taw}else {tw=w;}
	}else {
		tw=taw;
	}
	if(typeof(h)=="number"){
		if(h>tah){
			th=tah
		}else {
			th=h;
		}
	}else {
		th=tah;
	}
	var ttop=(tah-th)/2*0.68;	
	var tleft=(taw-tw)/2
	var tfeature="channelmode=no,directories=no,fullscreen=no, "
	tfeature+="titlebar=yes,toolbar=no,location=no,menubar=no,resizable=no,status=no,";	
	if(ts){
		tfeature+="scrollbars=yes,";
	}else {
		tfeature+="scrollbars=no,";
	}
	tfeature+="top="+ttop+"px,left="+tleft+"px,width="+tw+"px,height="+th+"px";	
	var twin=window.open(u,tWinName,tfeature);
	return twin;
}



function showWindowF(u,ts,aWinName){
	try{
		var tWinName;
		if (typeof (aWinName) == "string" && aWinName != ""){
			tWinName = aWinName
		} else {
			tWinName = "_blank";
		}
		var as ;
		var taw=screen.availWidth-10
		var tah=screen.availHeight-28;
		var tfeature="directories=no,fullscreen=no, "
		tfeature+="titlebar=yes,toolbar=no,location=no,menubar=no,resizable=no,status=no,";	
		if(typeof(ts) != "boolean" || ts){
			tfeature+="scrollbars=1,";
		}else {
			tfeature+="scrollbars=0,";
		}
		tfeature+="top=0px,left=0px,width="+taw+"px,height="+tah+"px";	
		var twin=window.open(u,tWinName,tfeature);
	}catch(ex){}
	return twin;
}


function showDialogF(u,as,aWinName){
	try{
		var tWinName;
		if (typeof (aWinName) == "string" && aWinName != ""){
			tWinName = aWinName
		} else {
			tWinName = "_blank";
		}
		var tfeature
		if (typeof(as) != "boolean" || as ) {
			tfeature ="toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,fullscreen=yes"
		} else {
			tfeature ="toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,fullscreen=yes"
		}
		var twin=window.open(u,tWinName,tfeature);
	}catch(ex){}
	return twin;
}

function linkToURL(linkURL){
	
	window.navigate(linkURL);	
	
}
// Image opterator

function zoomInImage(aObj){
	
	var wh=getObjWH(aObj)
	if(wh.w>aObj.parentElement.clientWidth||wh.h>aObj.parentElement.clientHeight){
		
		var w=wh.w/1.2;		
		var h=wh.h/1.2;		
		aObj.width=w;		
		aObj.height=h;		
		
	}
	
}

function zoomOutImage(aObj){
	
	var wh=getObjWH(aObj)
	if(wh.w<aObj.parentElement.clientWidth*4){
		
		var w=wh.w*1.2;		
		var h=wh.h*1.2;		
		aObj.width=w;		
		aObj.height=h;		
		
	}
	
}

function getObjWH(aObj){
	
	var w,h
	w=aObj.width
	if(w==undefined){
		
		w=aObj.clientWidth;		
		h=aObj.clientHeight
		
	}else {
		
		h=aObj.height;		
		if(h==undefined){
			
			h=aObj.clientHeight*w/aObj.clientWidth
			
		}
		
	}
	var ret=new Object();	
	ret.w=w;	
	ret.h=h;	
	return ret;	
	
}

function getSubStr(aStr,aStartSign,aEndSign,aStartPos){
	var tstartpos;
	var pos1,pos2;
	if (typeof(aStartPos) == "number"){
		tstartpos = aStartPos;
	}else{
		tstartpos = 0;
	}
	if(aStartSign ==undefined ||aStartSign==null || aStartSign==""){
		pos1=tstartpos;
	}else{
		pos1=aStr.indexOf(aStartSign,tstartpos);		
		pos1++;
	}
	if(aEndSign==undefined || aEndSign==null || aEndSign=="" ){
		pos2=aStr.length;
	}else {
		pos2=aStr.indexOf(aEndSign,pos1);
	}
	return aStr.substring(pos1,pos2);
}

function isArray(obj){
	
	if(obj.constructor .toString ().indexOf("Array")==-1)
	return false;	
	else 
	return true;	
	
}

function fixToParent(aObj){
	
	var wr,hr,w,h,pw,ph
	w=aObj.clientWidth
	h=aObj.clientHeight
	pw=aObj.parentElement.clientWidth
	ph=aObj.parentElement.clientHeight
	if(pw>w||ph>h){
		
		wr=pw/w
		hr=ph/h
		if(wr>hr){
			
			aObj.height=ph;			
			aObj.width=pw;			
			
		}else {
			
			aObj.width=pw;			
			aObj.height=h*wr;			
			
		}
		
	}
	else {
		
		wr=w/pw
		hr=h/ph
		if(wr>hr){
			
			aObj.width=pw;			
			aObj.height=h/wr
			
		}else {
			
			aObj.height=ph;			
			aObj.width=w/hr
			
		}
		
	}
	
}

function zoomInToParent(aObj){
	
	var w=aObj.clientWidth;	
	var h=aObj.clientHeight;	
	var pw=aObj.parentElement.clientWidth;	
	var ph=aObj.parentElement.clientHeight;	
	var wr=w/pw;	
	var hr=h/pw;	
	
	if(wr>1||hr>1){
		
		if(wr>hr){
			
			aObj.width=pw;			
			aObj.height=pw*h/w
			
		}
		else {
			
			aObj.height=ph;			
			aObj.width=ph*w/h;			
			
		}
		
	}
	
}

function zoomOutToParent(aObj){
	
	var w=aObj.clientWidth;	
	var h=aObj.clientHeight;	
	var pw=aObj.parentElement.clientWidth;	
	var ph=aObj.parentElement.clientHeight;	
	var wr=w/pw;	
	var hr=h/pw;	
	
	if(wr<1&&hr<1){
		
		if(wr>hr){
			
			aObj.width=pw;			
			aObj.height=pw*h/w
			
		}
		else {
			
			aObj.height=ph;			
			aObj.width=ph*w/h;			
			
		}
		
	}
}

function openImageWindow(aObj){
	
	if(aObj.tagName!="IMG")
	return ;	
	
	var picsrc=aObj.src
	if(picsrc==""||picsrc==undefined)
	return ;	
	var linkurl="showImage.aspx?ip="+picsrc;	
	var param="width=640px,height=480px;titlebar=1,toolbar=0,resizable=0,statusbar=0,menubar=0,scrollbars=0";	
	window.open(linkurl,"_blank",param,false);	
	
}

/* hover image 对旬函数 */


function MM_swapImgRestore(){
	//v3.0
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;
	
}

function MM_preloadImages(){
	//v3.0
	var d=document;
	if(d.images){
		if(!d.MM_p)d.MM_p=new Array();		
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for(i=0;i<a.length;i++)
		if(a[i].indexOf("#")!=0){
			d.MM_p[j]=new Image;
			d.MM_p[j++].src=a[i];
			
		}
	}
	
}

function MM_findObj(n,d){
	//v4.01
	var p,i,x;
	if(!d)d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length){
		
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
		
	}
	if(!(x=d[n])&&d.all)x=d.all[n];
	for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);
	if(!x&&d.getElementById)x=d.getElementById(n);return x;
	
}

function MM_swapImage(){
	//v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
	if((x=MM_findObj(a[i]))!=null){
		document.MM_sr[j++]=x;
		if(!x.oSrc)x.oSrc=x.src;
		x.src=a[i+2];
		
	}
	
}

function fullScreen(){
	if(window.screen)
	{
		var aw=screen.width;		
		var ah=screen.height-20;		
		var win = window.top;
		win.moveTo(0,0);
		win.resizeTo(aw,ah);
	}
}
 
// 将IFrame显示为指定大小.
function fullIFrame(aIFrame,aWidth,aHeight,aExtWidth,aExtHeight){
    try{
		if (typeof(aIFrame) == "string"){
			aIFrame = document.getElementById(aIFrame);
		}
        if (aIFrame.tagName.toLowerCase() != "iframe") throw new Error("请指定窗口对象");
    }catch(ex){return;}
    aWidth = isNULL(aWidth,0);
    aHeight = isNULL(aHeight,0);
    aExtWidth = isNULL(aExtWidth , 20);
    aExtHeight = isNULL(aExtHeight,4);
    aIFrame.width = isNULL(window.document.documentElement.offsetWidth , aWidth )  - aWidth -aExtWidth ;
    aIFrame.height = isNULL(window.document.documentElement.offsetHeight,aHeight) - aHeight -aExtHeight ;
}

// 将IFrame显为整个窗口大小
function extendIFrame(aIFrame){
    try{
        if (typeof(aIFrame) == "String"){
            aIFrame = document.getElementById(aIFrame);
        }
        var twidth,theight;
        twidth = isNULL(aIFrame.document.documentElement.scrollWidth,0);
        theight =isNULL(aIFrame.document.documentElement.scrollHeight,0);
        aIFrame.width = twidth;
        aIFrame.height = theight;
    }catch(ex) { return;}
}

/* ########################## 文件下载 ####################### */
function dlFile(aFileURL,aCallbackFunctionPointer){
	
	if(typeof(aFileURL)=="undefined"||aFileURL==""){
		throw "请设置要下载的文件路径。";
	}
	if(typeof(aCallbackFunctionPointer)!="function"){
		throw "请设置下载文件回调函数。例如 function funName(aDownloadFileContent){}";
	}
	var tobj=window.document.all[0];	
	if(tobj==null){
		throw "无法下载，请检查...";
		
	}
	var _tbehaviorid;	
	_tbehaviorid=tobj.addBehavior("#default#download");	
	tobj.startDownload(aFileURL,aCallbackFunctionPointer)
	tobj.removeBehavior(_tbehaviorid);
}
function dlFile2(aFileURL,aCallBackFunction,aCallBackFunction2){
	
	if(isUNEString(aFileURL))throw "请输入要下载的文件URL";	
	var _tdlfileajax=false;	
	try{
		
		_tdlfileajax=new XMLHttpResponse()
		
	}catch(IEXMLHttp2){
		
		try{
			
			_tdlfileajax=new ActiveXObject("Msxml2.XMLHTTP");			
			
		}
		catch(IEXMLHttp){
			
			try{
				
				_tdlfileajax=new ActiveXObject("Microsoft.XMLHTTP");				
				
			}catch(ajaxError){
				
				_tdlfileajax=null;				
				throw "对不起，系统检测到您的浏览器暂不能使用Ajax，因此某此功能无法实现,建议您使用 Internet Explorer 6.0 浏览器。";	
			}
		}
		
	}
	
	var tmpdate=new Date();	
	_refreshDT="RefreshDT="+tmpdate.getMilliseconds();	
	if(aFileURL.indexOf("?")==-1){
		
		aFileURL+="?"+_refreshDT;		
		
	}else {
		
		aFileURL+="&"+_refreshDT;		
		
	}
	_tdlfileajax.open("get",aFileURL,false);	
	_tdlfileajax.onreadystatechange=function (){
		
		if(_tdlfileajax.readyState==2){
			
			if(typeof(aCallBackFunction2)=="function"){
				
				aCallBackFunction2(_tdlfileajax.responseText,_tdlfileajax);				
				return ;				
				
			}
			
		}else if(_tdlfileajax.readyState==4){
			
			if(typeof(aCallBackFunction)=="function"){
				
				aCallBackFunction(_tdlfileajax.responseText,_tdlfileajax);				
				return ;				
				
			}
			
		}
		
	}
	_tdlfileajax.send();	
	return _tdlfileajax.responseText;	
	
}

/*##############################################33 */

function setCookie(name,value)
{
	
	var Days=7;
	
	var exp=new Date();	
	exp.setTime(exp.getTime()+Days*24*60*60*1000);	
	document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString();	
	
}
function getCookie(name)
{
	
	var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));	
	if(arr!=null)return unescape(arr[2]);
	throw "读取 Cookie 错误，请检查 ... ";	
	
}

function delCookie(name)
{
	
	var exp=new Date();	
	exp.setTime(exp.getTime()-1);	
	var cval=getCookie(name);	
	if(cval!=null)document.cookie=name+"="+cval+";expires="+exp.toGMTString();	
	
}


function sAlert(str,aType,aWidth,aHeight){
	
	var msgw,msgh,bordercolor;
	
	if(typeof(aWidth)=="number"){
		
		msgw=aWidth
		if(msgw<100)msgw=190
		
	}else {
		
		msgw=190;
		//提示窗口的宽度 
		
	}
	if(typeof(aHeight)=="number"){
		
		msgh=aHeight;		
		if(msgh<180)msgh=180
		
	}else {
		
		msgh=msgw*3/4;
		//提示窗口的高度 
		
	}
	titleheight=30//提示窗口标题高度 
	bordercolor="#336699";
	//提示窗口的边框颜色 
	titlecolor="#99CCFF";
	//提示窗口的标题颜色 
	
	var sWidth=window.screen.width;	
	var sHeight=window.screen.height;
	
	var bgObj=document.createElement("div");
	
	bgObj.setAttribute("id","bgDiv");
	
	bgObj.style.position="absolute";
	
	bgObj.style.top="0";
	
	bgObj.style.background="#777";
	
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
	
	bgObj.style.opacity="0.6";
	
	bgObj.style.left="0";
	
	bgObj.style.width=sWidth+"px";
	
	bgObj.style.height=sHeight+"px";
	
	bgObj.style.zIndex="10000";
	
	document.body.appendChild(bgObj);
	
	var msgObj=document.createElement("div")
	msgObj.setAttribute("id","msgDiv");
	
	msgObj.setAttribute("align","center");
	msgObj.style.background="white";
	msgObj.style.border="1px solid "+bordercolor;
	msgObj.style.position="absolute";
	msgObj.style.left="50%";
	msgObj.style.top="30%";
	msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	
	msgObj.style.marginLeft="-225px";
	
	msgObj.style.marginTop=-75+document.documentElement.scrollTop+"px";
	
	msgObj.style.width=msgw+"px";
	
	msgObj.style.height=msgh+"px";
	
	msgObj.style.textAlign="center";
	
	msgObj.style.lineHeight="25px";
	
	msgObj.style.zIndex="10001";
	
	
	var title=document.createElement("h4");	
	title.setAttribute("id","msgTitle");
	
	title.setAttribute("align","left");
	
	title.style.margin="0";
	
	title.style.padding="3px";
	
	title.style.background=bordercolor;
	
	title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
	
	
	title.style.opacity="0.75";
	
	title.style.border="1px solid "+bordercolor;
	
	title.style.height="18px";
	
	title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";	
	
	title.style.color="white";
	
	title.style.cursor="pointer";
	
	title.innerText="系统提示";	
	title.style.paddingLeft="10px";	
	
	if(typeof(aType)=="undefined"){
		
		title.innerHTML="关闭窗口";
		
		title.onclick=function (){
			
			document.body.removeChild(bgObj);
			
			document.getElementById("msgDiv").removeChild(title);
			
			document.body.removeChild(msgObj);
			
			
		}
		
	}
	document.body.appendChild(msgObj);
	
	document.getElementById("msgDiv").appendChild(title);
	
	
	var tt=document.createElement("table");	
	msgObj.appendChild(tt);	
	tt.id="msgDivTable";	
	tt.style.width="100%";	
	tt.style.borderCollapse="collapse";	
	
	var tb=document.createElement("tbody");	
	tt.appendChild(tb);	
	var tr=document.createElement("tr");	
	tr.style.height="30px";	
	tb.appendChild(tr);	
	var td=document.createElement("td");	
	td.style.height="30px";	
	td.style.textAlign="left";	
	td.style.paddingLeft="10px";	
	tr.appendChild(td);	
	
	tr=document.createElement("tr");	
	tb.appendChild(tr);	
	td=document.createElement("td");	
	td.style.textAlign="center";	
	td.innerText=" ";	
	td.style.height=(msgh-120)
	tr.appendChild(td);	
	
	tr=document.createElement("tr");	
	tr.style.height="60px";	
	tb.appendChild(tr);	
	td=document.createElement("td");	
	td.style.textAlign="center";	
	td.style.height="60px";	
	tr.appendChild(td);	
	
	var txt=document.createElement("p");
	
	txt.style.margin="1em 0"
	txt.setAttribute("id","msgTxt");
	
	txt.innerHTML=str
	tt.rows[0].cells[0].appendChild(txt);	
	
	if(typeof(aType)!="undefined"){
		
		var tloading=document.createElement("img");		
		tloading.src="/WebSite/images/skin/13221810.gif";		
		tloading.style.width="180px";		
		tloading.style.height="14px";		
		document.getElementById("msgDivTable").rows(1).cells(0).appendChild(tloading);		
		
	}
	
}

function sAlertText(aStr){
	
	var tt=document.getElementById("msgDivTable");	
	tt.rows(0).cells(0).innerText=aStr;	
	
}

function xsAlert(){
	
	var tobj=document.getElementById("bgDiv")
	if(tobj!=null&&typeof(tobj)=="object")
	document.body.removeChild(tobj);	
	tobj=document.getElementById("msgDiv");	
	if(tobj!=null&&typeof(tobj)=="object")
	document.body.removeChild(tobj);	
	
}

function osAlert(aStr,aBtnText){
	
	var tt=document.getElementById("msgDivTable");	
	if(tt!=null){
		
		tt.rows(0).cells(0).innerText="";		
		tt.rows(1).cells(0).innerHTML=aStr;		
		var tbtnclose=document.createElement("input");		
		
		tbtnclose.type="button";		
		if(typeof(aBtnText)=="string"){
			
			tbtnclose.value=aBtnTtext;
			
			
		}else {
			
			tbtnclose.value="关闭窗口";
			
			
		}
		tbtnclose.onclick=xsAlert;		
		tt.rows(2).cells(0).appendChild(tbtnclose);		
		
	}
	
}

function centerDIV(aDivName){
	
	alert(window.dialogWidth);	
	
}

/*         -------------------------  测试函数区 ------------------------- */


function getValuesByName(aName,alinkchar){
	
	if(isUNEString(alinkchar))alinkchar="";	
	var _getElems=window.document.getElementsByName(aName);	
	var telem=_getElems.item(0);	
	var tvalue="";	
	switch(telem.tagName){
		
		case "INPUT":{
			
			if(telem.type=="text"||telem.type=="hidden"){
				
				for(var ti=0;ti<_getElems.length;ti++){
					
					if(_getElems[ti].value!=null){
						
						if(tvalue==""){
							
							tvalue=_getElems[ti].value;							
							
						}else {
							
							tvalue+=alinkchar+_getElems[ti].value;							
							
						}
						
					}
					
				}
				
			}else if(telem.type=="checkbox"){
				
				for(var ti=0;ti<_getElems.length;ti++){
					
					if(_getElems[ti].checked){
						
						if(tvalue==""){
							
							tvalue=_getElems[ti].value;							
							
						}else {
							
							tvalue+=alinkchar+_getElems[ti].value;							
							
						}
						
					}
					
				}
				
			}else if(telem.type=="radio"){
				
				for(var ti=0;ti<_getElems.length;ti++){
					
					if(_getElems[ti].checked){
						
						tvalue=_getElems[ti].value;						
						break;						
						
					}
					
				}
				
			}else {
				
				return "";				
				
			}
			break;			
			
		}
		case "SELECT":{
			
			for(var ti=0;ti<_getElems.length;ti++){
				
				if(_getElems[ti].value!=""){
					
					if(tvalue==""){
						
						tvalue=_getElems[ti].value;						
						
					}else {
						
						tvalue+=alinkchar+_getElems[ti].value;						
						
					}
					
				}
				
			}
			break;			
			
		}
		case "TEXTAREA":{
			
			for(var ti=0;ti<_getElems.length;ti++){
				
				if(_getElems[ti].value!=""){
					
					if(tvalue==""){
						
						tvalue=_getElems[ti].value;						
						
					}else {
						
						tvalue+=alinkchar+_getElems[ti].value;						
						
					}
					
				}
				
			}
			break;			
			
		}
		default:{
			
			return "";			
			
		}
		
	}
	return tvalue;	
	
}


function writeToFile(aContent){
	
	var fso=new ActiveXObject("Scripting.FileSystemObject");	
	var a=fso.CreateTextFile("c:\\tmp.txt",true);	
	a.WriteLine(aContent);	
	a.Close();	
	
}



var __webQString=null;
function getQString(aQSName,aDefStr){
	
	if(isUNEString(aQSName)){
		
		throw "请指定 QString 的名称";		
		
	}
	if(__webQString==null){
		
		var tpos=document.URL.indexOf("?");
		if(tpos<0){
			
			if(isUNEString(aDefStr))throw "URL 中没有查询字符串";			
			return aDefStr;			
			
		}
		var tqstring=document.URL.substr(tpos+1);		
		var tarr1=tqstring.split("&");		
		__webQString=new Object;		
		for(var ti=0;ti<tarr1.length;ti++){
			
			var tarr2=tarr1[ti].split("=");			
			if(tarr2[0]=="")continue;			
			__webQString[tarr2[0].toUpperCase()]=tarr2[1];			
			
		}
		
	}
	var tret=__webQString[aQSName];	
	if(isUNEString(tret)){
		if(typeof(aDefStr) != "string") return "";		
		return aDefStr;	
	}
	return tret;	
	
}

function objAttrs(aobj){
	
	var tobj
	if(typeof(aobj)=="string"){
		
		tobj=document.getEementById(aName);		
		
	}else if(typeof(aobj)=="object"){
		
		tobj=aobj
		
	}else {
		
		window.alert("error");		
		return ;		
		
	}
	if(typeof(tobj)!="object"){
		
		window.alert(aName+"不存在");		
		return ;		
		
	}
	var tstr="";	
	var txstr="";	
	for(var item in tobj){
		
		tstr+=item+":"+tobj[item]+" ; ";		
		if(item.indexOf("offset")!=-1||item.indexOf("scroll")!=-1||item.indexOf("client")!=-1){
			
			txstr+=item+":"+tobj[item]+"\n";			
			
		}
		
	}
	window.alert(tstr+'\n'+txstr);	
	
}

/*************************************************************/
function bodyNoSpace(){
	document.body.style.padding="0px";	
	document.body.style.margin="0px";
}
/*####################################  MovableDiv xWin ############################## */

function DefNValue(aValue,aDefaultValue){
	
	if(typeof(aValue)!="number"){
		
		return aDefaultValue;		
		
	}
	return Math.max(aValue,aDefaultValue);	
	
}

function DefValue(aValue,aDefaultValue){
	
	if(typeof(aValue)=="undefined"||(aValue==null)){
		
		return aDefaultValue;		
		
	}
	return aValue;	
	
}

//可以打包为js文件;
var x0=0,y0=0,x1=0,y1=0;
var offx=6,offy=6;
var moveable=false;
var hover='orange',normal='#336699';
//color;
var index=10000;
//z-index;
//开始拖动;
function startDrag(obj)
{
	
	if(event.button==1)
	{
		
		//锁定标题栏;
		obj.setCapture();		
		//定义对象;
		var win=obj.parentNode;		
		var sha=win.nextSibling;		
		//记录鼠标和层位置;
		x0=event.clientX;		
		y0=event.clientY;		
		x1=parseInt(win.style.left);		
		y1=parseInt(win.style.top);		
		//记录颜色;
		normal=obj.style.backgroundColor;		
		//改变风格;
		obj.style.backgroundColor=hover;		
		win.style.borderColor=hover;		
		obj.nextSibling.style.color=hover;		
		sha.style.left=x1+offx;		
		sha.style.top=y1+offy;		
		moveable=true;		
		
	}
	
}

//拖动;
function drag(obj)
{
	
	if(moveable)
	{
		
		var win=obj.parentNode;		
		var sha=win.nextSibling;		
		win.style.left=x1+event.clientX-x0;		
		win.style.top=y1+event.clientY-y0;		
		sha.style.left=parseInt(win.style.left)+offx;		
		sha.style.top=parseInt(win.style.top)+offy;		
		
	}
	
}
//停止拖动;
function stopDrag(obj)
{
	
	if(moveable)
	{
		
		var win=obj.parentNode;		
		var sha=win.nextSibling;		
		var msg=obj.nextSibling;		
		win.style.borderColor=normal;		
		obj.style.backgroundColor=normal;		
		msg.style.color=normal;		
		sha.style.left=obj.parentNode.style.left;		
		sha.style.top=obj.parentNode.style.top;		
		obj.releaseCapture();		
		moveable=false;		
		
	}
	
}
//获得焦点;
function getFocus(obj)
{
	
	if(obj.style.zIndex!=index)
	{
		
		index=index+2;		
		var idx=index;		
		obj.style.zIndex=idx;		
		obj.nextSibling.style.zIndex=idx-1;		
		
	}
	
}
//最小化;
function min(obj)
{
	
	var win=obj.parentNode.parentNode;	
	var sha=win.nextSibling;	
	var tit=obj.parentNode;	
	var msg=tit.nextSibling;	
	var flg=msg.style.display=="none";	
	if(flg)
	{
		
		win.style.height=parseInt(msg.style.height)+parseInt(tit.style.height)+2*2;		
		sha.style.height=win.style.height;		
		msg.style.display="block";		
		obj.innerHTML="0";		
		
	}
	else 
	{
		
		win.style.height=parseInt(tit.style.height)+2*2;		
		sha.style.height=win.style.height;		
		obj.innerHTML="2";		
		msg.style.display="none";		
		
	}
	
}
//创建一个对象;
function xWin(id,l,t,w,h,tit,aFileURL)
{
	
	index=index+2;	
	this.id=id;	
	this.width=w;	
	this.height=h;	
	this.left=l;	
	this.top=t;	
	this.zIndex=index;	
	this.title=tit;	
	this.message=dlFile2(aFileURL);	
	this.obj=null;	
	this.bulid=bulid;	
	this.bulid();	
	
}
//初始化;

function createMovableDiv(id,aFileURL,aLeft,aTop,aWidth,aHeight,aShow,aScroll){
	
	var tid=DefValue(id,"noid");	
	var turl=DefValue(aFileURL,"about:blank");	
	var tcontent="测试";	
	var tl=DefNValue(aLeft,0);	
	var tt=DefNValue(aTop,0);	
	var tw=DefNValue(aWidth,60);	
	var th=DefNValue(aHeight,200);	
	var ts=DefValue(aShow,true);	
	var tsc=DefValue(aScroll,false);	
	
	
	var te1=document.createElement("div");	
	te1.id="xMsg"+tid
	te1.style.width=tw+"px";	
	te1.style.heigt=th+"px";
	
	
}

function bulid()
{
	
	var str=""
	+"<div id='xMsg"+this.id+"' "
	+"style='"
	+"z-index:"+this.zIndex+";"
	+"width:"+this.width+";"
	+"height:"+this.height+";"
	+"left:"+this.left+";"
	+"top:"+this.top+";"
	+"background-color:"+normal+";"
	+"color:"+normal+";"
	+"font-size:8pt;"
	+"font-family:Tahoma;"
	+"position:absolute;"
	+"cursor:default;"
	+"border:2px solid "+normal+";"
	+"' "
	+"onmousedown='getFocus(this)'>"
	+"<div "
	+"style='"
	+"background-color:"+normal+";"
	+"width:"+(this.width-2*2)+";"
	+"height:20;"
	+"color:white;"
	+"' "
	+"onmousedown='startDrag(this)' "
	+"onmouseup='stopDrag(this)' "
	+"onmousemove='drag(this)' "
	//+ "ondblclick='min(this.childNodes[1])'"
	+">"
	+"<span style='width:"+(this.width-2*12-4)+";padding-left:3px;'>"+this.title+"</span>"
	//+ "<span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='min(this)'>0</span>"
	//+ "<span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='ShowHide(\""+this.id+"\",null)'>r</span>"
	+"</div>"
	+"<div style='"
	+"width:100%;"
	+"height:"+(this.height-20-4)+";"
	+"background-color:white;"
	+"line-height:14px;"
	+"word-break:break-all;"
	+"padding:3px;"
	+"'>"+this.message+"</div>"
	+"</div>"
	+"<div id=xMsg"+this.id+"bg style='"
	+"width:"+this.width+";"
	+"height:"+this.height+";"
	+"top:"+this.top+";"
	+"left:"+this.left+";"
	+"z-index:"+(this.zIndex-1)+";"
	+"position:absolute;"
	+"background-color:black;"
	+"filter:alpha(opacity=40);"
	+"'></div>";	
	document.body.insertAdjacentHTML("beforeEnd",str);
}

//显示隐藏窗口
function ShowHide(id,dis){
	
	var bdisplay=(dis==null)?((document.getElementById("xMsg"+id).style.display=="")?"none":""):dis
	document.getElementById("xMsg"+id).style.display=bdisplay;	
	document.getElementById("xMsg"+id+"bg").style.display=bdisplay;	
	
}
function ScrollObj(obj)
{
	var x;	
	x=x.y.z
}

/*###################################################################### ####################################### */
function IAlert(aPath){
	
	var msgw,msgh;
	

     msgw=31;
     msgh=31;

	
//	var sWidth=window.screen.width;	
//	var sHeight=window.screen.height;

    var sWidth=50;	
	var sHeight=50;
	
	var bgObj=document.createElement("div");
	
	bgObj.setAttribute("id","bgDiv");
	
	bgObj.style.position="absolute";
	
	bgObj.style.top="0";
	
	
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
	
	bgObj.style.opacity="0.6";
	
	bgObj.style.left="0";
	
	bgObj.style.width=sWidth+"px";
	
	bgObj.style.height=sHeight+"px";
	
	bgObj.style.zIndex="10000";
	
	document.body.appendChild(bgObj);
	
	var msgObj=document.createElement("div")
	msgObj.setAttribute("id","msgDiv");
	msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	msgObj.setAttribute("align","center");
	msgObj.style.background="";
	msgObj.style.border="0px";
	msgObj.style.position="absolute";
	msgObj.style.left="95%";
	msgObj.style.top="1";
	
	msgObj.style.marginLeft="-125px";
	
	msgObj.style.marginTop=document.documentElement.scrollTop+"px";
	
	msgObj.style.width="200px";
	
	msgObj.style.height=msgh+"px";
	
	msgObj.style.textAlign="center";
	
	msgObj.style.lineHeight="25px";
	
	msgObj.style.zIndex="10001";

	document.body.appendChild(msgObj);

	
	var tt=document.createElement("table");	
	msgObj.appendChild(tt);	
	tt.id="msgDivTable";	
	tt.style.width="100%";	
	tt.style.borderCollapse="collapse";	
	
	var tb=document.createElement("tbody");	
	tt.appendChild(tb);	
	var tr=document.createElement("tr");	
	tr.style.height=msgh+"px";	
	tb.appendChild(tr);	
	
	var td=document.createElement("td");	
	td.style.height=msgh+"px";	
	td.style.width=msgw+"px";
	td.style.textAlign="center";	
	td.style.paddingLeft="0px";	
	tr.appendChild(td);	
		
	td=document.createElement("td");
	td.style.height=msgh+"px";	
	td.style.textAlign="left";
	td.style.paddingLeft="0px";	
	td.style.color="darkgray";
	td.innerText="数据加载，请稍后......";
	tr.appendChild(td);
	
	var tloading=document.createElement("img");		
	tloading.src=""+aPath+"/images/Skin/loading.gif";	
	tloading.style.width=msgw;		
	tloading.style.height=msgh;		
	document.getElementById("msgDivTable").rows(0).cells(0).appendChild(tloading);
}
//显示百分百图示
function PercImage(aWidth,aWebPath)
{
   var str="";
   if(aWidth=="")
   {
      aWidth="0";
   }
   str+="<div style='width:"+aWidth+";height:14px; background:url("+aWebPath+"/images/Skin/tongji_back.gif);' align=center></div>";
   document.writeln(str);
}

/* GridView1 当鼠标移动到每一行时显示*/


function GVOnMouseOver(){
	var telem = event.srcElement;
	while(telem != null && telem.tagName != "TR") {
		telem = telem.parentElement;
	}
	if (telem == null) return;
	telem.style.backgroundColor = "#FAFAFA";
}

function GVOnMouseOut(){
	var telem = event.srcElement;
	while(telem != null && telem.tagName != "TR") {
		telem = telem.parentElement;
	}
	if (telem == null) return;
	telem.style.backgroundColor = telem.oldColor;
}
function initGVOnMouse(){
	var ttable = document.getElementById("GridView1");
	var ttr;
	if (ttable == null) return;
	var ti;
	for(ti=1;ti<ttable.rows.length;ti++){
		ttr = ttable.rows.item(ti);
		if(ttr.id=='GridView1_GVNoSelectStyle')return;
		ttr.oldColor = ttr.style.backgroundColor;
		ttr.onmouseover = GVOnMouseOver;
		ttr.onmouseout = GVOnMouseOut;
//		ttr.style.cursor = "hand";
	}
	
}

/*               window init          */

	window.onloadx = function (){
		initInputValidateFunction();
		
		if (typeof(onloadex) == "function") {
			onloadex();
		}
	}
 
	
	function initInputValidateFunction() {
		var telems = document.getElementsByTagName("input");
		for(var ti=0;ti < telems.length;ti++) {
			var ielem = telems.item(ti);
			if (ielem.type=="text"){
				if ( ielem.vType == "int") {
					var _eventhandler = ielem.onkeydown;
					if (typeof(_eventhandler) == "function"){
						ielem.onkeydown_old = _eventhandler;
						ielem.onkeydown = function(){
							if (!(event.keyCode >= 48 && event.keyCode <= 57)) {
								return false;
							}
							event.srcElement.onkeydown_old();
						}
						
					} else {
						ielem.onkeydown = function(){
							if (!(event.keyCode >= 48 && event.keyCode <= 57)) {
								return false;
							}
						}
					}
					
				} else if (ielem.vType=="dec") {
					var _eventhandler = ielem.onkeydown;
					if (typeof(_eventhandler) == "function"){
						ielem.onkeydown_old = _eventhandler;
						ielem.onkeydown = function(){
							if (!((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode == 190))  ) {
								return false;
							}
							event.srcElement.onkeydown_old();
						}
						
					} else {
						ielem.onkeydown = function(){
							if (!((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode == 190))  ) {
								return false;
							}
						}
					}
				} else {
				
				}
			}
		}
	}

/*-------------------------------用户菜单----------------------------------*/

	var ShowID;
	var MenuCount;
	function SetMenuCount(aCount)
	{ 
	   MenuCount=aCount;
	}
function ShowMenu1(MenuID,aImagePath) {
   
   if(MenuID.indexOf(".")>0){
      Menu1=MenuID.substring(0,MenuID.indexOf("."));  //取“2.1"的前面部分

      Menu2=MenuID.substring(MenuID.indexOf(".")+1,MenuID.length);
   }
   else{
	   Menu1=MenuID;
	   Menu2="0";
   }
   
   if(ShowID == Menu1){Menu1 = 0;ShowID = 0;}
   
   for(var i=1; i<=MenuCount; i++){
     // if((i==Menu1)||(i==1)){   //如果是当前大类

	 if(i==Menu1)
	 {   //如果是当前大类

         if(eval("pad"+i).length == null)
         {   //如果只有一个子类

		    eval("document.all.pad"+i+".style.display='block'")
	     }
         else
         {    //如果多个子类
		    for(var j=0; j<eval("pad"+i).length; j++)
		    {
			   eval("document.all.pad"+i+"[j].style.display='block'");  //用下标的方式
			}
		 }
		 MM_swapImage('image'+i,'',""+aImagePath+"/images/sec_32.gif",0);  //替换箭头图标
		ShowID = Menu1
        
      }
      else{   //如果不是当前大类
         if(eval("pad"+i).length == null){
		    eval("document.all.pad"+i+".style.display='none'")
	     }
         else{
		    for(var j=0; j<eval("pad"+i).length; j++){
			   eval("document.all.pad"+i+"[j].style.display='none'");
			}
	     }
        MM_swapImage('image'+i,'',""+aImagePath+"/images/sec_26.gif",0);   //替换箭头图标
      }
   }
}

function MM_findObj(n, d) {
   var p,i,x;  
   if(!d) d=document; 
   if((p=n.indexOf("?"))>0&&parent.frames.length){
      d=parent.frames[n.substring(p+1)].document; 
	  n=n.substring(0,p);
   }
   if(!(x=d[n])&&d.all) x=d.all[n]; 
   for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
   if(!x && d.getElementById) x=d.getElementById(n); 
   return x;
}

function MM_swapImage() {
   var i,j=0,x,a=MM_swapImage.arguments; 
   document.MM_sr=new Array; 
   for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
      document.MM_sr[j++]=x; 
	  if(!x.oSrc) x.oSrc=x.src;
	  x.src=a[i+2];
   }
}

function tryFun(processFun,ErrProcessFun)
{
	try{
		if (typeof(processFun) != "function") throw new "Fun 参数不正确";
		return processFun(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);
	}catch (ex) {
		if (typeof(ErrProcessFun) == "function"){
			return ErrProcessFun(ex);
		}
		showError(ex);
		return "Error";
	}
	return "OK";
}
/*-----------------------------------------------------------------*/
