﻿// JScript 文件

var WinStatus={
    Normal:-1,
    Max:1,
    Min:0
};
var DragDirect={
    Both:0,
    East:1,
    South:2,
    West:3
};
var CurrentWindowSupport=0;//已加载窗口数
var WindowLoadCount=1;//单次窗口加载数
var TotalWindowSupport=10;//最多窗口数
var TopMostWindows=[];
var WindowsArray=[];//加载窗口对象仓库
var WindowNameTag="WindowObj";
var CurrentActiveWindowName="";
var WinImageButton=Class.create();
var TabStrip1=null;
WinImageButton.prototype={
    initialize:function(){
    },
    Size:{w:16,h:16},
    ImgUrl:"",
    HoverImgUrl:"",
    ActiveImgUrl:"",
    SwapImgUrl:""
};
var GhostDiv=null;
var vvDeskClass=Class.create();
vvDeskClass.prototype={
    initialize:function(DeskName){
        this.Name=DeskName;
    },
    Name:"",
    MaxTop:5,MaxRight:5,MaxBottom:35,MaxLeft:5//
    
};
var vvDesk=new vvDeskClass();
var WindowClass=Class.create();
 
 WindowClass.prototype={
    initialize:function(winName){
        this.Name=winName;
    },
    Id:"",
    Name:"",
    Index:0,
    Model:null,
    Tag:"",
    Text:"属性",
    x:100,y:50,w:300,h:300,
    MaxWidth:1600,MaxHeight:1024,
    MinWidth:220,MinHeight:200,
    RestoreX:0,RestoreY:0,RestoreW:0,RestoreH:0,
    MaxLiveNum:0,//
    AvailableW:function(){
        return dd.getWndW()-vvDesk.MaxLeft-vvDesk.MaxRight;
    },
    AvailableH:function(){
        return dd.getWndH()-vvDesk.MaxTop-vvDesk.MaxBottom;
    },
    URL:"",
    IconUrl:"/images/UI/window/icon.gif",
        LogoImg:new WinImageButton(),
        MaxImg:new WinImageButton(),
        MaxSwapImg:new WinImageButton(),
        MinImg:new WinImageButton(),
        ExpandImg:new WinImageButton(),
        CollapseImg:new WinImageButton(),
        CloseImg:new WinImageButton(),

        ShadowSize:13,
        ShadowLeft:5,
        ShadowTop:6,
        ShadowRight:6,
        ShadowBottom:6,
        CornerMargin:5,
        StatusBarH:16,
        ToolBarH:2,
        TitleBarH:20,
        FramePadding:0,
        TitleControlW:60,

    z:0,
    TopMost:false,
    Status:WinStatus.Normal,
    Visible:function(){
        return this.MainFrame.visible;
    },
    Maxable:true,
    Minable:true,
    Closeable:true,
    Expandable:true,
    Dragable:true,
    Resizeable:true,
    IsShowMask:false,
    IsExpand:true,
    IsCreated:false,
    IsLoaded:false,
    IsClosed:true,
    IsDeskWin:false,
        WindowBase:null,Icon:null,Shadow:null,MainFrame:null,TitleContent:null,TitleControl:null,TitleDrager:null,ContentBody:null,StatusBar:null,ToolBar:null,
        Drag_e:null,Drag_s:null,Drag_w:null,Drag_Corner:null,
    Children:[],
    AddChild:function(curWindow){
        this.Children[this.Children.length]=curWindow;
    },
    SetTopMost:function(){
        TopMostWindows[TopMostWindows.length]=this;
    
    },
    Init:function(){

        
        var x=this.x;
        var y=this.y;
        var w=this.w;
        var h=this.h;
        var ShadowMargin=this.ShadowMargin;
        var TitleBarH=this.TitleBarH;
        var ToolBarH=this.ToolBarH;
        var StatusBarH=this.StatusBarH;
        var ShadowSize=this.ShadowSize;
        var CornerMargin=this.CornerMargin;
        this.WindowBase.moveTo(this.x,this.y);

        this.MainFrame.moveTo(this.x,this.y);
        this.MainFrame.resizeTo(this.w,this.h);
        this.Shadow.moveTo(this.x-this.ShadowLeft,this.y-this.ShadowTop);
        this.Shadow.resizeTo(this.w+this.ShadowLeft+this.ShadowRight,this.MainFrame.h+this.ShadowTop+this.ShadowBottom);
        this.TitleDrager.moveTo(this.x,this.y);
        this.TitleDrager.resizeTo(this.w-this.TitleControlW-this.CornerMargin,this.TitleBarH+this.CornerMargin);
        this.Drag_e.resizeTo(this.CornerMargin,this.h-3*CornerMargin-StatusBarH);
        this.Drag_e.moveTo(this.x+this.w-this.Drag_e.w,this.y+this.CornerMargin);
        this.Drag_w.resizeTo(this.CornerMargin,this.h-3*CornerMargin-StatusBarH);
        this.Drag_w.moveTo(this.x-this.Drag_w.w,this.y+this.CornerMargin);
        this.Drag_s.moveTo(this.x+this.CornerMargin,this.y+this.h-this.CornerMargin);
        this.Drag_s.resizeTo(this.w-6*this.CornerMargin,this.CornerMargin);
        this.Drag_Corner.moveTo(this.x+this.w-5*this.CornerMargin,this.y+this.h-5*this.CornerMargin);
        this.Drag_Corner.resizeTo(5*this.CornerMargin,5*this.CornerMargin);
        
        if(this.Icon)this.Icon.src=this.IconUrl;
            if(this.IsShowMask)this.ShowMask(true);
            
    },
    Create:function(){
        if(this.Name=="")return;
        this.IsCreated=true;
        
        
        ADD_DHTML("MainFrame"+this.Name+NO_DRAG);
        ADD_DHTML("TitleDrager"+this.Name+CURSOR_MOVE);
        ADD_DHTML("Drag_s"+this.Name+CURSOR_S_RESIZE+VERTICAL);
        ADD_DHTML("Drag_e"+this.Name+CURSOR_E_RESIZE+HORIZONTAL);
        ADD_DHTML("Drag_w"+this.Name+CURSOR_E_RESIZE+HORIZONTAL);
        ADD_DHTML("Drag_Corner"+this.Name+CURSOR_NW_RESIZE);
        ADD_DHTML("WindowBase"+this.Name+NO_DRAG);
        ADD_DHTML("Shadow"+this.Name+NO_DRAG);
        this.WindowBase=dd.elements["WindowBase"+this.Name];
        this.MainFrame=dd.elements["MainFrame"+this.Name];
        this.Shadow=dd.elements["Shadow"+this.Name];
        this.Drag_e=dd.elements["Drag_e"+this.Name];
        this.Drag_s=dd.elements["Drag_s"+this.Name];
        this.Drag_w=dd.elements["Drag_w"+this.Name];
        this.Drag_Corner=dd.elements["Drag_Corner"+this.Name];
        this.TitleDrager=dd.elements["TitleDrager"+this.Name];
         
        this.TitleContent=$("TitleContent"+this.Name);
        this.TitleControl=$("TitleControl"+this.Name);
        this.ToolBar=$("ToolBar"+this.Name);
        this.StatusBar=$("StatusBar"+this.Name);
        this.ContentBody=$("ContentBody"+this.Name);
        this.Icon=$("Icon"+this.Name);
        
        
        this.Init();

this.Drag_w.setOpacity(0);
this.Drag_e.setOpacity(0);
this.Drag_s.setOpacity(0);
this.Drag_Corner.setOpacity(0);
this.TitleDrager.setOpacity(0);

            
 
            this.AddControls();
            this.Index=WindowsArray.length;
            
 
            
    },
    
    LoadUrl:function(text,url){
        this.Text=text;
        this.URL=url;
        if(this.Icon)this.Icon.src=this.IconUrl;
        if(this.TitleContent!=null)this.TitleContent.innerHTML=text;
        //if(this.ContentBody!=null)this.ContentBody.innerHTML=" <iframe id='Frame"+this.Name+"' name='Frame"+this.Name+"'  src=''   frameborder='0' width='100%' height='100%' marginwidth='0' marginheight='0' ></iframe>";
        if($("Frame"+this.Name)!=null)$("Frame"+this.Name).src=url;
        this.IsLoaded=true;
     
    },
    LoadContent:function(content){
            this.ContentBody.innerHTML(content);

    },
    Show:function(){
        if(this.Name=="")return;
        if(!this.IsCreated)
        {
            this.Create();
            
        }
        
        WindowsArray[this.Index]=this;
        WindowsArray[this.Name]=this;
        this.Init();
        this.SetActive();
        this.WindowBase.show();
        
        //if(!this.IsLoaded||this.IsClosed){
        	this.LoadUrl(this.Text,this.URL);
		//}
        if(this.IsDeskWin)
        {
            CreateTabByName("Tab_"+this.Name);
        }
         this.IsClosed=false;
    },
    Hide:function(){
        this.WindowBase.hide();
        if(this.IsShowMask)this.ShowMask(false);
        
    },
    Close:function(){
        if(this.Status!=WinStatus.Normal)
        {
            this.Restore();
        }
        
        $("Frame"+this.Name).src="";
        this.Hide();
        if(this.IsDeskWin)
        {
            ShowTabByName("Tab_"+this.Name);
        }
        if(this.IsShowMask)this.ShowMask(false);
         this.IsClosed=true;
    },
    ShowMask:function(t)
    {
        var maskObj=dd.elements["WindowMaskDiv"];
        if(!maskObj)return;
        alert("")
        if(t)
        {
        maskObj.moveTo(0,0);
        maskObj.resizeTo(dd.getWndW(),dd.getWndH());
        maskObj.maximizeZ();
        maskObj.show()
        }
        else
        maskObj.hide();
    },
    Min:function(){
    this.Status=WinStatus.Min
    this.Hide();
    },
    Max:function(){

        this.RestoreX=this.x;
        this.RestoreY=this.y;
        if(this.w<this.AvailableW()){this.RestoreW=this.w;}
        if(this.h<this.AvailableH()){this.RestoreH=this.h;}
        this.MoveTo(vvDesk.MaxLeft,vvDesk.MaxTop);
        this.Drag_Corner.setDraggable(false);
        this.Drag_s.setDraggable(false);
        this.Drag_e.setDraggable(false);
        this.Drag_w.setDraggable(false);
        this.TitleDrager.setDraggable(false);
        this.ResizeBy(DragDirect.Both,this.AvailableW()-this.w,this.AvailableH()-this.h);
        $("maxImg"+this.Name).style.display="none";
        $("RestoreImg"+this.Name).style.display="inline";
        this.Status=WinStatus.Max;
        this.SetActive();

    },
    AddControls:function(){
    
        this.WindowBase.addChild("Shadow"+this.Name);
        this.Shadow.addChild("MainFrame"+this.Name);
        this.MainFrame.addChild("TitleDrager"+this.Name);
        this.MainFrame.addChild("Drag_e"+this.Name);
        this.MainFrame.addChild("Drag_w"+this.Name);
        this.MainFrame.addChild("Drag_s"+this.Name);
        this.MainFrame.addChild("Drag_Corner"+this.Name);
    },
    AttachChild:function(){
        
        this.MainFrame.attachChild("TitleDrager"+this.Name);
        this.MainFrame.attachChild("Drag_e"+this.Name);
        this.MainFrame.attachChild("Drag_w"+this.Name);
        this.MainFrame.attachChild("Drag_s"+this.Name);
        this.MainFrame.attachChild("Drag_Corner"+this.Name);
    },
    DetachChild:function(){
       
        this.MainFrame.detachChild("TitleDrager"+this.Name);
        this.MainFrame.detachChild("Drag_e"+this.Name);
        this.MainFrame.detachChild("Drag_w"+this.Name);
        this.MainFrame.detachChild("Drag_s"+this.Name);
        this.MainFrame.detachChild("Drag_Corner"+this.Name);
    },
    SetActive:function(){
   
    if(!this.WindowBase.visible)this.WindowBase.show();
        if(this.Name==CurrentActiveWindowName)return;
        if(this.Name!=CurrentActiveWindowName&&CurrentActiveWindowName!="")
        if(!WindowsArray[CurrentActiveWindowName].IsClosed)WindowsArray[CurrentActiveWindowName].SetInactive();
           //this.TitleContent.innerText=this.Text;
        CurrentActiveWindowName=this.Name;
        this.ChangeStyle("");
 
        this.WindowBase.setZ(dd.z+1);
        this.Shadow.setZ(this.WindowBase.z+1);
        this.MainFrame.setZ(this.Shadow.z+1);
 
        this.Drag_e.setZ(this.MainFrame.z+1);
        this.Drag_w.setZ(this.MainFrame.z+1);
        this.Drag_s.setZ(this.MainFrame.z+1);
        this.Drag_Corner.setZ(this.MainFrame.z+1);
        this.TitleDrager.setZ(this.MainFrame.z+1);

        for(var i=0;i<TopMostWindows.length;i++)
        {
            TopMostWindows[i].Shadow.setZ(dd.z+1);
            TopMostWindows[i].MainFrame.setZ(TopMostWindows[i].Shadow.z+1);
            TopMostWindows[i].Drag_e.setZ(TopMostWindows[i].MainFrame.z+1);
            TopMostWindows[i].Drag_w.setZ(TopMostWindows[i].MainFrame.z+1);
            TopMostWindows[i].Drag_s.setZ(TopMostWindows[i].MainFrame.z+1);
            TopMostWindows[i].Drag_Corner.setZ(TopMostWindows[i].MainFrame.z+1);
            TopMostWindows[i].TitleDrager.setZ(TopMostWindows[i].MainFrame.z+1);
        }
        SelectTabByName("Tab_"+this.Name);
        
    },
    SetInactive:function(){
        this.ChangeStyle("gray");
   },
    ChangeStyle:function(StyleName){
        if(StyleName!="")StyleName="_"+StyleName;
//        else
//        StyleName="_"+"purple";
   if($("Corner_nw"+this.Name)==null)return;
        $("Corner_nw"+this.Name).className="Corner_nw"+StyleName;
        $("Corner_ne"+this.Name).className="Corner_ne"+StyleName;
        $("Corner_n"+this.Name).className="Corner_n"+StyleName;
        $("Corner_w_titleBar"+this.Name).className="Corner_w_titleBar"+StyleName;
        $("Corner_e_titleBar"+this.Name).className="Corner_e_titleBar"+StyleName;
        $("TitleBar"+this.Name).className="TitleBar"+StyleName;
    },
    MoveTo:function(x,y){
    
        this.DetachChild();
            this.WindowBase.moveTo(x,y);
            this.Drag_e.moveBy(x-this.x,y-this.y);
            this.Drag_w.moveBy(x-this.x,y-this.y);
            this.Drag_s.moveBy(x-this.x,y-this.y);
            this.Drag_Corner.moveBy(x-this.x,y-this.y);
            this.x=x;
            this.y=y;
            this.TitleDrager.moveTo(this.x,this.y);
        this.AttachChild();
    },
    ResizeBy:function(direct,w,h){
        try
        {
           this.DetachChild();
                this.MainFrame.resizeBy(w,h);
                this.Shadow.resizeBy(w,h);
                switch(direct)
                {
                    case DragDirect.Both:
                        this.Drag_e.moveBy(w,0);
                        this.Drag_s.moveBy(0,h);
                        this.Drag_e.resizeBy(0,h);
                        this.Drag_w.resizeBy(0,h);
                        this.Drag_s.resizeBy(w,0);
                        this.TitleDrager.resizeBy(w,0);
                        this.Drag_Corner.moveTo(this.MainFrame.x+this.MainFrame.w-5*this.CornerMargin,this.MainFrame.y+this.MainFrame.h-5*this.CornerMargin);

                    break;
                    case DragDirect.East:
     
                        this.TitleDrager.resizeBy(w,0);
                        this.Drag_s.resizeBy(w,0);
                        this.Drag_Corner.moveBy(w,0);
                       
                        this.Drag_e.moveTo(this.x+this.w+w-this.Drag_e.w,this.MainFrame.y+this.CornerMargin+this.TitleBarH );
                    break;
                    case DragDirect.West:
                        this.MoveTo(this.x-w,this.y);
     
                        this.TitleDrager.resizeBy(w,0);
                        this.Drag_s.resizeBy(w,0);
                        this.Drag_Corner.moveBy(w,0);
                        this.Drag_e.moveBy(w,0);
                        this.Drag_w.moveTo(this.x-this.Drag_w.w,this.MainFrame.y+this.CornerMargin+this.TitleBarH );
                    break;
                    case DragDirect.South:
                        this.Drag_e.resizeBy(0,h);
                        this.Drag_w.resizeBy(0,h);
                        this.Drag_Corner.moveBy(0,h);
                         this.Drag_s.moveTo(this.MainFrame.x+this.CornerMargin,this.MainFrame.y+this.MainFrame.h-this.CornerMargin);
                        
                    break;
                }
                this.SetActive();
                this.w=this.w+w;
                this.h=this.h+h;
            this.AttachChild();
            return {w:this.w,h:this.h};
        }
        catch(ex)
        {
            this.SetActive();
            return {w:this.w,h:this.h};
        }
        

    },
    FixSize:function(w,h){

	    w=w<this.MinWidth?this.MinWidth:w;
	    h=h<this.MinHeight?this.MinHeight:h;
	    w=w>this.MaxWidth?this.MaxWidth:w;
	    h=h>this.MaxHeight?this.MaxHeight:h;
	    w=w>dd.getWndW()-vvDesk.MaxRight-this.x?dd.getWndW()-vvDesk.MaxRight-this.x:w;
	    h=h>dd.getWndH()-vvDesk.MaxBottom-this.y?dd.getWndH()-vvDesk.MaxBottom-this.y:h;
    	
	    return {w:w,h:h};
    },
    FixPosition:function(x,y){
    
    var maxX=dd.getWndW()-vvDesk.MaxRight-this.w;
    var maxY=dd.getWndH()-vvDesk.MaxBottom-this.h;
        x=x<vvDesk.MaxLeft?vvDesk.MaxLeft:x;
        y=y<vvDesk.MaxTop?vvDesk.MaxTop:y;
        x=x>maxX?maxX:x;
        y=y>maxY?maxY:y;
        x=x<0?0:x;
        y=y<0?0:y;
        
        return {x:x,y:y};
    },
    Restore:function(){
        this.MoveTo(this.RestoreX,this.RestoreY);
        
        this.ResizeBy(DragDirect.Both,this.RestoreW-this.w,this.RestoreH-this.h);
        this.Drag_Corner.setDraggable(true);
        this.Drag_s.setDraggable(true);
        this.Drag_e.setDraggable(true);
        this.Drag_w.setDraggable(true);
        this.TitleDrager.setDraggable(true);
        $("maxImg"+this.Name).style.display="inline";
        $("RestoreImg"+this.Name).style.display="none";
         this.Status=WinStatus.Normal;
         this.SetActive();
    },
    SetOpacity:function(v){
        this.MainFrame.setOpacity(v);
    }

 };

function GetWindowByName(curName){
var curWindowName=curName;
    curWindowName=curWindowName.replace("TitleDrager","");
    curWindowName=curWindowName.replace("Drag_Corner","");
    curWindowName=curWindowName.replace("Drag_s","");
    curWindowName=curWindowName.replace("Drag_e","");
    curWindowName=curWindowName.replace("Drag_w","");
    if(curWindowName!=curName)
	{
		return curWindowName;
	}
    else
	{
    	return "";
	}
}
function CloseVvWindow(curWindowName){
    var curWindow=document.getElementById(curWindowName);
    if(curWindow) {curWindow.Close();}
}
function DoubleClickWindow(curWindowName){

    var curWindow=document.getElementById(curWindowName);
    if(curWindow)
    {
        if(curWindow.Status==WinStatus.Max){curWindow.Restore();}
        else{curWindow.Max();}
    } 
}
function getArgVal(args,m_n)
{
args=args.toLowerCase();
m_n=m_n.toLowerCase();
    if(args.indexOf(",")==-1){return "";}
    var arr_arg=args.split(",");
    for(var i=0;i<arr_arg.length;i++)
    {
        if(arr_arg[i].indexOf("=")>-1&&arr_arg[i].indexOf(m_n)>-1)
        {
            var arr_nv=arr_arg[i].split("=");
            
            return isNaN(arr_nv[1] = parseInt(arr_nv[1],10))? 0 : arr_nv[1];
            
        
        }
    }
    return 0;
}
function CreateSingleWindow(tag)
{
    for(var i=0;i<WindowsArray.length;i++)
    {
        if(WindowsArray[i]&&WindowsArray[i].Tag==tag&&tag!="")
        {
            return WindowsArray[i];
        }
    }
    var win=null;
    win=CreateWindow();
    win.Tag=tag;
    return win;
}
function CreateWindow(Id)
{
    var curName="";
    if(!WindowLoadCount)WindowLoadCount=-1;
     
    if(WindowsArray.length>=CurrentWindowSupport-1)
    {
        for(var i=0;i<WindowsArray.length;i++)
        {
            if(!!Id)
            {
                if(!!WindowsArray[i]&&WindowsArray[i].Id==Id&&!WindowsArray[i].IsClosed)
                {
                    curName=WindowsArray[i].Name;
                    break;
                }
            } 
            if(!!WindowsArray[i]&&WindowsArray[i].IsClosed)
            {
            
                curName=WindowsArray[i].Name;
                break;
            }
        }
        if(curName=="")
        {
            if(CurrentWindowSupport==TotalWindowSupport)
            {
                alert("已开窗口数超过限制,请先关闭闲置的窗口!");
                return null;
            }
            else
            {
                for (var i = 0; i < WindowLoadCount; i++)
                {
                var tstr="";
                    var WinDiv=document.createElement("div");
                    WinDiv.id="WinPlaceHolder"+CurrentWindowSupport;
                    document.body.appendChild(WinDiv);
                    tstr=WindowHTMLBuilder.join(WindowNameTag +(CurrentWindowSupport+i).toString());
                    WinDiv.innerHTML=tstr;
                }

                CurrentWindowSupport+=WindowLoadCount;
            }
        }
    }
    var _Window=null;
    if(curName=="")
    {
        curName=WindowNameTag+WindowsArray.length;
    }

    if(!WindowsArray[curName])
    {
        _Window=new WindowClass(curName);
        _Window.Create();
         
    }
    else
    {
            _Window=WindowsArray[curName];
            _Window.SetActive();
    }
    if(!!Id)
        _Window.Id=Id
    else
        _Window.Id="";
    return _Window;
}

var WindowHTMLBuilder  = [];

WindowHTMLBuilder.push("<div id=\"Shadow");
WindowHTMLBuilder.push("\" class=\"ShadowDiv\"><table width=\"100%\"  height=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"Shadow_nw\"></td><td class=\"Shadow_n\" >&nbsp;</td><td class=\"Shadow_ne\" ></td></tr><tr><td class=\"Shadow_w\" ></td><td></td><td class=\"Shadow_e\"></td></tr><tr><td class=\"Shadow_sw\"></td><td class=\"Shadow_s\"></td><td class=\"Shadow_se\"></td></tr></table></div><div id=\"MainFrame");
WindowHTMLBuilder.push("\" class=\"MainFrameDiv\"><table width=\"100%\"  height=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"Corner_nw\" id=\"Corner_nw");
WindowHTMLBuilder.push("\"></td><td class=\"Corner_n\" id=\"Corner_n");
WindowHTMLBuilder.push("\"></td><td class=\"Corner_ne\" id=\"Corner_ne");
WindowHTMLBuilder.push("\"></td></tr><tr ><td  class=\"Corner_w_titleBar\"  id=\"Corner_w_titleBar");
WindowHTMLBuilder.push("\"></td><td class=\"TitleBar\" id=\"TitleBar");
WindowHTMLBuilder.push("\"><table width=\"100%\"  height=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr ><td class=\"TitleBar_Icon\"><img id=\"Icon");
WindowHTMLBuilder.push("\" src=\"/images/UI/window/icon.gif\"   border=\"0\"></td><td nowrap ><div class=\"TitleContent\" id=\"TitleContent");
WindowHTMLBuilder.push("\" ></div></td><td class=\"TitleBar_Control\" ><div id=\"TitleControl" );
//WindowHTMLBuilder.push("\"><img src=\"/images/UI/window/min.gif\" alt='最小化' onclick=\"javascript:WindowsArray['");
//WindowHTMLBuilder.push("'].Min();\" onmouseover=\"this.src='/images/UI/window/minHover.gif'\" onmouseout=\"this.src='/images/UI/window/min.gif'\"><img id=\"maxImg");
WindowHTMLBuilder.push("\"><img id=\"maxImg");
WindowHTMLBuilder.push("\" alt='最大化'  src=\"/images/UI/window/max.gif\" onmouseover=\"this.src='/images/UI/window/maxHover.gif'\" onmouseout=\"this.src='/images/UI/window/max.gif'\" onclick=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].Max();\"    ><img id=\"RestoreImg");
WindowHTMLBuilder.push("\" alt='还原'  style=\"display:none\" src=\"/images/UI/window/restore.gif\" onmouseover=\"this.src='/images/UI/window/restoreHover.gif'\" onmouseout=\"this.src='/images/UI/window/restore.gif'\" onclick=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].Restore();\"    ><img src=\"/images/UI/window/close.gif\" alt='关闭'  onmouseover=\"this.src='/images/UI/window/closeHover.gif'\" onmouseout=\"this.src='/images/UI/window/close.gif'\" onclick=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].Close();\"    ></div></td></tr></table></td><td  class=\"Corner_e_titleBar\" id=\"Corner_e_titleBar");
WindowHTMLBuilder.push("\"></td></tr><tr ><td class=\"Corner_w\" ></td><td ><table   width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td id=\"ToolBar");
WindowHTMLBuilder.push("\" class=\"ToolBar\"></td></tr><tr><td id=\"ContentBody");
WindowHTMLBuilder.push("\" class=\"ContentBody\"><iframe id='Frame");
WindowHTMLBuilder.push("' name='Frame");
WindowHTMLBuilder.push("'  src=''   frameborder='0' width='100%' height='100%' marginwidth='0' marginheight='0' ></iframe></td></tr><tr><td id=\"StatusBar");
WindowHTMLBuilder.push("\" class=\"StatusBar\" onmousedown=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].SetActive();\"></td></tr></table></td><td class=\"Corner_e\"></td></tr><tr><td class=\"Corner_sw\"></td><td class=\"Corner_s\"></td><td class=\"Corner_se\"></td></tr></table></div> <div id=\"Drag_e");
WindowHTMLBuilder.push("\"  class=\"Drag_e\" onmousedown=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].SetActive();\">&nbsp;</div><div id=\"Drag_Corner");
WindowHTMLBuilder.push("\"  class=\"Drag_Corner\" onmousedown=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].SetActive();\">&nbsp;</div><div id=\"Drag_s");
WindowHTMLBuilder.push("\"  class=\"Drag_s\" onmousedown=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].SetActive();\">&nbsp;</div><div id=\"Drag_w");
WindowHTMLBuilder.push("\" class=\"Drag_e\" onmousedown=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].SetActive();\">&nbsp;</div><div id=\"TitleDrager");
WindowHTMLBuilder.push("\" class=\"TitleDrager\" onmousedown=\"javascript:WindowsArray['");
WindowHTMLBuilder.push("'].SetActive();\" ondblclick=\"javascript:DoubleClickWindow('");
WindowHTMLBuilder.push("');\">如果你看到这个文字，请将本站加为可信站点，详情请查看帮助</div><div id=\"WindowBase");
WindowHTMLBuilder.push("\" class=\"WindowBase\"></div>");


function SelectTabByName(name)
{

    if(TabStrip1==null)return;
    var curTab = TabStrip1.Tabs(name);
    TabStrip1.SetSelectedTab(curTab);
    TabStrip1.Render();
 
}

function ShowTabByName(name)
{
    if(TabStrip1==null)return;
    var curTab = TabStrip1.Tabs(name);
    curTab.SetProperty('Visible',false);
    TabStrip1.Render();
 
}

function CreateTabByName(name)
{
    if(TabStrip1==null)return;

    if(NeddCreate)
    {
        var newTab=null;
        newTab=TabStrip1.FindTabById(name);

        if(!newTab)
        {
            newTab = new ComponentArt_TabStripTab();
            newTab.SetProperty('Text',this.Text);
            newTab.SetProperty('ID',"Tab_"+this.Name);
            newTab.SetProperty('Look-LeftIconUrl',this.IconUrl);
            newTab.SetProperty('SelectedLook-LeftIconUrl',this.IconUrl);

            TabStrip1.AddTab(newTab);
        }
        else
        {
            newTab.SetProperty('Visible',true);
        }

        TabStrip1.SetSelectedTab(newTab);
        TabStrip1.Render();
    }

}