
document.write('<script src="\/manage\/js\/FormCheck.js"><\/script>')
document.write('<script src="\/manage\/js\/fckeditor\/fckeditor.js"><\/script>');
//document.write('<script src="\/Manage\/js/DatePicker\/WdatePicker.js"></script>');

document.write('<script language="vbscript">');
document.write('Function str2asc(strstr)');
document.write('    str2asc = hex(asc(strstr)) ');
document.write('End Function ');
document.write('<\/script>');
document.write('<script language="vbscript">');
document.write('Function asc2str(strstr)');
document.write('    asc2str = chr((strstr)) ');
document.write('End Function ');
document.write('<\/script>');

function UrlDecode(str){ 
    var ret=""; 
    for(var i=0;i<str.length;i++)
    { 
        var chr = str.charAt(i); 
        if(chr == "+")
        { 
            ret+=" "; 
        }
        else if(chr=="%")
        { 
            var asc = str.substring(i+1,i+3); 
            if(parseInt("0x"+asc)>0x7f)
            { 
                ret+=asc2str(parseInt("0x"+asc+str.substring(i+4,i+6))); 
                i+=5; 
            }
            else
            { 
                ret+=asc2str(parseInt("0x"+asc)); 
                i+=2; 
            } 
        }
        else
        { 
            ret+= chr; 
        } 
    } 
    return ret; 
}
function ReadCookie (CookieName) {
var CookieString = document.cookie;
var CookieSet = CookieString.split (';');
var SetSize = CookieSet.length;
var CookiePieces
var ReturnValue = "";
var x = 0;
for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++)
{
CookiePieces = CookieSet[x].split ('=');
if (CookiePieces[0].substring (0,1) == ' ') {
CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
}

if (CookiePieces[0] == CookieName) {
ReturnValue = CookiePieces[1];

}

}
if(ReturnValue==null)return("");
else{return(UrlDecode(ReturnValue));}

}

function CreateFCK(IDName,Tool){
var oFCKeditor = new FCKeditor(IDName.name) ;
oFCKeditor.BasePath = '/' ;
oFCKeditor.ToolbarSet = Tool;
oFCKeditor.Width = IDName.style.width ;
oFCKeditor.Height =IDName.style.height;
oFCKeditor.ReplaceTextarea() ;
}
Object.prototype.attachEvent=function(method,func)
{
 if(!this[method])
  this[method]=func;
 else
  this[method]=this[method].attach(func);
}


Function.prototype.attach=function(func){
 var f=this;
 return function(){
  f();
  func();
 }
}
//打开模式窗口-----------------------------------------------------------------------------------------
function OpenWindowM(Url,window,width,height)
{ 
	return(window.showModalDialog(Url,window,"status:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px"));
}
//打开非模式窗口-----------------------------------------------------------------------------------------
function OpenWindowNM(Url,window,width,height,resizeable)
{ 
	window.showModelessDialog(Url,window,"resizable: Yes;status:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px");
}
function OpenUploadFile(Width,Height)
{
	return(OpenWindowM("/manage/ui/uploadfile.html?W="+Width+"&H="+Height,window,290,100));
}
function ASelectBox(D)
{
	var T = new Object;
	T.L=new Array();
	T.RootID=null;
	T.Index=0;
	T.DataID=new Array();
	T.ParentID=new Array();
	T.Text=new Array();
	T.Count=0;
	T.Change=null;
	T.Add=function(parentid,id,text)
	{
		T.DataID[T.Index]=id;
		T.ParentID[T.Index]=parentid;
		T.Text[T.Index]=text;
		T.Index++;
	}
	T.Create=function(M,I)
	{
		for(var i=I;i<T.L.length;i++)
		{
			T.L[i].removeNode(true);
		}
		if(I!=null)T.L=(T.L.slice(0,I))
		if(I==null)I=0;
		if(M==null)M=T.RootID;
		var C2=document.createElement('select');
		for(var n=0;n<T.Index;n++)
		{
			if(T.ParentID[n]==M)
			{
				C2.options.add(new Option(T.Text[n],T.DataID[n]))
			}
		}
		if(C2.length>0)
		{
			D.appendChild(C2);
			C2.attachEvent("onchange",function(){T.Create(C2.value,I+1);})
			T.L[I]=C2;
			T.Create(C2.value,I+1)
		}
		if(T.Change!=null)T.Change();
	}
	return(T);
}