document.onmousemove = myWindow_MouseMove;
document.onmouseup   = myWindow_MouseUp;

myWindow.Objects=new Array();
var myWindow_Objindex=0;


var myWindow_DragObject  = null;
var myWindow_ResizeObject=null;
var myWindow_Resizedir = null;


var myWindow_MouseOffset = null;
myWindow.focusPriority=2;

myWindow.minimumWidth=300;
myWindow.minimumHeight=150;
myWindow.defaultTop=20;
myWindow.defaultLeft=50;
myWindow.defaultTitle="New Window";
myWindow.MINIMIZE=1;
myWindow.MAXIMIZE=2;
myWindow.NORMAL=0;

function myWindow_MouseUp()
{
	myWindow_DragObject = null;	
        myWindow_ResizeObject=null;
}
function myWindow_mouseCoords(ev)
{
	if(ev.pageX || ev.pageY)
	{
		return {x:ev.pageX, y:ev.pageY};
	}
	else
	{
		return {
		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y:ev.clientY + document.body.scrollTop  - document.body.clientTop
		};
	}
}

function myWindow_getMouseOffset(target, ev)
{
	ev = ev || window.event;

	var docPos    = myWindow_getPosition(target);
	var mousePos  = myWindow_mouseCoords(ev);
	return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}

function myWindow_getPosition(e)
{
	var left = 0;
	var top  = 0;

	while (e.offsetParent)
	{
		left += e.offsetLeft;
		top  += e.offsetTop;
		e     = e.offsetParent;
	}

	left += e.offsetLeft;
	top  += e.offsetTop;

	return {x:left, y:top};
}
function myWindow_MouseMove(ev)
{
  ev = ev || window.event;
  var mousePos = myWindow_mouseCoords(ev);
  if(myWindow_DragObject)
  {
    myWindow_DragObject.style.position = 'absolute';
    var top=(mousePos.y - myWindow_MouseOffset.y)>=0?(mousePos.y - myWindow_MouseOffset.y):0;
    var left=(mousePos.x - myWindow_MouseOffset.x)>=0?(mousePos.x - myWindow_MouseOffset.x):0;
    myWindow_DragObject.style.top      = top+"px";
    myWindow_DragObject.style.left     = left+"px";
    var index=myWindow_DragObject.id.substr(3);
    myWindow.Objects[index].top=top;
    myWindow.Objects[index].left=left;
  }
  if(myWindow_ResizeObject)
      {
  if(document.getElementById(myWindow_ResizeObject.id))
  {    
    var reobw=document.getElementById(myWindow_ResizeObject.id).style.width;
    reobw=reobw.substring(0,reobw.length-2)-1+1;	   

    var reobh=document.getElementById(myWindow_ResizeObject.id).style.height;	       
    reobh=reobh.substring(0,reobh.length-2)-1+1;

    var reobt=document.getElementById(myWindow_ResizeObject.id).style.top;
    reobt=reobt.substring(0,reobt.length-2)-1+1;
    var reobl=document.getElementById(myWindow_ResizeObject.id).style.left;
    reobl=reobl.substring(0,reobl.length-2)-1+1;   
    var newtop=0;       
    var newleft=0;
    var newwidth=0;
    var newheight=0;
    if(myWindow_Resizedir=="tl")
    {
      newtop=(mousePos.y - myWindow_MouseOffset.y)>=0?(mousePos.y - myWindow_MouseOffset.y):0;
      newleft=(mousePos.x - myWindow_MouseOffset.x)>=0?(mousePos.x - myWindow_MouseOffset.x):0;
    		
      newwidth=((reobl-newleft)+reobw)>myWindow.minimumWidth?((reobl-newleft)+reobw):myWindow.minimumWidth;
      if(newwidth<=myWindow.minimumWidth)
        newleft=reobl;
      newheight=((reobt-newtop)+reobh)>myWindow.minimumHeight?((reobt-newtop)+reobh):myWindow.minimumHeight;
      if(newheight<=myWindow.minimumHeight)
	newtop=reobt;
    
        //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);
    }
    else if(myWindow_Resizedir=="tt")
    {
      newtop=(mousePos.y - myWindow_MouseOffset.y)>=0?(mousePos.y - myWindow_MouseOffset.y):0;
      newleft=reobl;
      newwidth=reobw;
      newheight=((reobt-newtop)+reobh)>myWindow.minimumHeight?((reobt-newtop)+reobh):myWindow.minimumHeight;
      if(newheight<=myWindow.minimumHeight)
        newtop=reobt;
        
        //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);        
    }
    else if(myWindow_Resizedir=="tr")
    {
      newtop=(mousePos.y - myWindow_MouseOffset.y)>=0?(mousePos.y - myWindow_MouseOffset.y):0;
      nnewleft=(mousePos.x - myWindow_MouseOffset.x)>=0?(mousePos.x - myWindow_MouseOffset.x):0;
    
      newwidth=((mousePos.x-reobl)+3)>myWindow.minimumWidth?((mousePos.x-reobl)+3):myWindow.minimumWidth;
      newleft=reobl;
      newheight=((reobt-newtop)+reobh)>myWindow.minimumHeight?((reobt-newtop)+reobh):myWindow.minimumHeight;
      if(newheight<=myWindow.minimumHeight)
	newtop=reobt;
            
      //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);     
    }
    else if(myWindow_Resizedir=="ll")
    {
      newtop=reobt;
      newleft=(mousePos.x - myWindow_MouseOffset.x)>=0?(mousePos.x - myWindow_MouseOffset.x):0;
      newwidth=((reobl-newleft)+reobw)>myWindow.minimumWidth?((reobl-newleft)+reobw):myWindow.minimumWidth;
      newheight=reobh;
      if(newwidth<=myWindow.minimumWidth)
        newleft=reobl;
    
      //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);    	
    }
    else if(myWindow_Resizedir=="rr")
    {
      newtop=reobt;
      newleft=reobl;
      newwidth=((mousePos.x-reobl)+3)>myWindow.minimumWidth?((mousePos.x-reobl)+3):myWindow.minimumWidth;
      newheight=reobh;	       
 
      //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);    	
    }
    else if(myWindow_Resizedir=="bl")
    {
      newtop=reobt;
      newleft=(mousePos.x - myWindow_MouseOffset.x)>=0?(mousePos.x - myWindow_MouseOffset.x):0;
      newwidth=((reobl-newleft)+reobw)>myWindow.minimumWidth?((reobl-newleft)+reobw):myWindow.minimumWidth;	       
      if(newwidth<=myWindow.minimumWidth)
	newleft=reobl;                  
      newheight=((mousePos.y-reobt)+3)>myWindow.minimumHeight?((mousePos.y-reobt)+3):myWindow.minimumHeight;
      
      //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);    	
    }
    else if(myWindow_Resizedir=="bb")
    {
      newtop=reobt;
      newleft=reobl;
      newwidth=reobw;      
      newheight=((mousePos.y-reobt)+3)>myWindow.minimumHeight?((mousePos.y-reobt)+3):myWindow.minimumHeight;
	
      //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);    	
    }
    else if(myWindow_Resizedir=="br")
    {
      newtop=reobt;
      newleft=reobl;
      newwidth=((mousePos.x-reobl)+3)>myWindow.minimumWidth?((mousePos.x-reobl)+3):myWindow.minimumWidth;
      newheight=((mousePos.y-reobt)+3)>myWindow.minimumHeight?((mousePos.y-reobt)+3):myWindow.minimumHeight;
      
      //myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);    	
      
    }
    myWindow_ResizeObject.top=newtop;
    myWindow_ResizeObject.left=newleft;
    myWindow_ResizeObject.height=newheight;
    myWindow_ResizeObject.width=newwidth;
    myWindow_resizeWindow(myWindow_ResizeObject.id,newtop,newleft,newwidth,newheight);  
  }
  }
}
function myWindow_resizedrag(index,rdir,ev)
{      
    if(!document.getElementById(myWindow.Objects[index].id)) 
    {
		return;
    } 
    else
    {	
                myWindow_ResizeObject=myWindow.Objects[index];
		myWindow_MouseOffset = myWindow_getMouseOffset(document.getElementById(myWindow.Objects[index].id), ev);
		myWindow_Resizedir=rdir;		
    } 
}
function myWindow_drag(index,ev)
{
	var itemObject=document.getElementById(myWindow.Objects[index].id);
	if(!itemObject) 
	{
		return;
	}
	/*else if(document.getElementById(myWindow.Objects[index].id+"top").style.cursor=="default")
	{
		return;
	}*/
    else if(myWindow.Objects[index].ismaximize)
        {
            return;
        }
	else
	{
		
		myWindow_DragObject=itemObject;
		myWindow_MouseOffset = myWindow_getMouseOffset(myWindow_DragObject, ev);		
	}
}
function myWindow(parent)
{   
	this.parent=document.getElementById(parent);
	this.frame=document.createElement("div");
	this.id="win"+myWindow_Objindex;
	this.frame.setAttribute("id",this.id);
	this.width=myWindow.minimumWidth;
	this.height=myWindow.minimumHeight;
    this.top=myWindow.defaultTop;
	this.left=myWindow.defaultLeft;	
	this.title=myWindow.defaultTitle;
	this.body="";
	this.index=myWindow_Objindex;        
        this.ismaximize=false;
        this.isminimize=false;
        
        this.mouseDown=mouseDown;
        this.onMouseDown=null;
        
        this.onClose=null;
        this.close=close;
        
        this.maximize=maximize;
        this.onMaximize=null;        
        
        //this.show=show;
        this.minimize=minimize;
        this.onMinimize=null;
        
        
        this.restore=restore;
        
        this.normal=normal;
        this.onNormal=null;
        
        this.getTop=getTop;
        this.setTop=setTop;	
        
	this.getLeft=getLeft;
        this.setLeft=setLeft;	
        
        this.getWidth=getWidth;
        this.setWidth=setWidth;	
        
        this.getHeight=getHeight;
        this.setHeight=setHeight;
        
        this.getTitle=getTitle;
        this.setTitle=setTitle;
        
        this.getBody=getBody;
        this.setBody=setBody;
        
        this.getState=getState;
        this.setState=setState;
        
        this.setLocation=setLocation;        
        this.getLocation=getLocation;
        
        this.setBounds=setBounds;
        this.getBOunds=getBounds;
        
        this.setSize=setSize;
        this.getSize=getSize;
        	
	
    var bcolor="#99BBE8"; 
       
    //var bcolor="#000000";
    
		var styletext="position:absolute; left:"+this.left+"px; top:"+this.top+"px; width:"+this.width+"px; height:"+this.height+"px;background-color:#E6E6FF;z-index:"+myWindow.focusPriority;
	
	this.frame.setAttribute("style",styletext);	
	//this.frame.setAttribute("onMouseDown","myWindow_mouseDownWindow("+myWindow_Objindex+")");
	
	var innertext="";
	innertext=innertext+"<div id='"+this.id+"tl' style='position:absolute; top:0px; left:0px; height:3px; width:3px; background-color:"+bcolor+";cursor:nw-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'tl',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"tt' style='position:absolute; top:0px; left:3px; height:3px; width:"+(this.width-6)+"px; background-color:"+bcolor+";cursor:n-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'tt',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"tr' style='position:absolute; top:0px; left:"+(this.width-3)+"px; height:3px; width:3px; background-color:"+bcolor+";cursor:ne-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'tr',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"ll' style='position:absolute; top:3px; left:0px; height:"+(this.height-6)+"px; width:3px; background-color:"+bcolor+";cursor:e-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'ll',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"rr' style='position:absolute; top:3px; left:"+(this.width-3)+"px; height:"+(this.height-6)+"px; width:3px; background-color:"+bcolor+";cursor:e-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'rr',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"bl' style='position:absolute; top:"+(this.height-3)+"px; left:0px; height:3px; width:3px; background-color:"+bcolor+";cursor:ne-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'bl',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"bb' style='position:absolute; top:"+(this.height-3)+"px; left:3px; height:3px; width:"+(this.width-6)+"px; background-color:"+bcolor+";cursor:n-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'bb',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"br' style='position:absolute; top:"+(this.height-3)+"px; left:"+(this.width-3)+"px; height:3px; width:3px; background-color:"+bcolor+";cursor:nw-resize;' onMouseDown=\"myWindow_resizedrag("+myWindow_Objindex+",'br',event);\"></div>";
	
	innertext=innertext+"<div id='"+this.id+"top' style='position:absolute; top:3px; left:3px; height:25px; width:"+(this.width-6)+"px; background-color:"+bcolor+"; cursor:move;'onMouseDown=\"myWindow_drag("+myWindow_Objindex+",event);\" >";
	innertext=innertext+"<div id='"+this.id+"title' style='position:absolute; top:0px; left:0px; height:25px; width:"+(this.width-70)+"px;'>"+this.title+"</div>";
	innertext=innertext+"</div>";
        
        innertext=innertext+"<img src='close.gif' style='position:absolute;right:5px;top:5px; height:15px;width:15px;cursor:pointer;' onClick=\"myWindow_closeWindow("+myWindow_Objindex+");\" />";	
        innertext=innertext+"<img id='"+this.id+"size' src='expand.gif' style='position:absolute;right:25px;top:5px; height:15px;width:15px;cursor:pointer;' onClick=\"myWindow_maximizeWindow("+myWindow_Objindex+");\" />";
        innertext=innertext+"<img src='collapse.gif' style='position:absolute;right:45px;top:5px; height:15px;width:15px;cursor:pointer;' onClick=\"myWindow_minimizeWindow("+myWindow_Objindex+");\" />";
	/*innertext=innertext+"<img src='close.gif' style='position:absolute;right:5px;top:5px; height:15px;width:15px;' /><div  style='position:absolute;right:5px;top:5px; height:15px;width:15px; cursor:pointer;' onClick=\"myWindow_closeWindow("+myWindow_Objindex+");\"></div>";	
	
	innertext=innertext+"<img id='"+this.id+"size' src='expand.gif' style='position:absolute;right:25px;top:5px; height:15px;width:15px;' /><div id='"+this.id+"sizediv'  style='position:absolute;right:25px;top:5px; height:15px;width:15px; cursor:pointer;' onClick=\"myWindow_maximizeWindow("+myWindow_Objindex+");\"></div>";
	
	innertext=innertext+"<img src='collapse.gif' style='position:absolute;right:45px;top:5px; height:15px;width:15px;' /><div style='position:absolute;right:45px;top:5px; height:15px;width:15px; cursor:pointer;' onClick=\"myWindow_minimizeWindow("+myWindow_Objindex+");\"></div>";*/
	
	
	
	innertext=innertext+"<div id='"+this.id+"bottom' style='position:absolute; top:28px; left:3px; height:"+(this.height-31)+"px; width:"+(this.width-6)+"px; background-color:#FFFFFF; overflow:auto;'>"+this.body+"</div>";
	
	this.frame.innerHTML=innertext;
    	
	this.parent.appendChild(this.frame);	
	myWindow.Objects[myWindow_Objindex]=this;	
	//clickWindow(myWindow_Objindex);
	//myWindow_mouseDownWindow("+myWindow_Objindex+")
	document.getElementById(this.id).onmousedown=Function("myWindow_mouseDownWindow('"+myWindow_Objindex+"');");
    this.mouseDown();
	myWindow_Objindex=myWindow_Objindex+1;
	
}
function myWindow_mouseDownWindow(count)
{   
    if(myWindow.Objects[count].onMouseDown)
    {
            myWindow.Objects[count].onMouseDown();
    }
    //alert(myWindow.Objects[count].onMouseDown);
    var obj=document.getElementById(myWindow.Objects[count].id);    
    myWindow.focusPriority=myWindow.focusPriority+1;
    if(obj)
    {
        obj.style.zIndex=myWindow.focusPriority;          
    }
    
}
function mouseDown()
{    
   myWindow_mouseDownWindow(this.index);
}
function myWindow_resizeWindow(id,t,l,w,h)
{
    var itemObject=document.getElementById(id);	
    itemObject.style.position='absolute';
	itemObject.style.top=t+"px";	
	itemObject.style.left=l+"px";
	itemObject.style.width=w+"px";	
	itemObject.style.height=h+"px";
	
    document.getElementById(id+"tt").style.width=(w-6)+"px";
    document.getElementById(id+"tr").style.left=(w-3)+"px";
    
    document.getElementById(id+"ll").style.height=(h-6)+"px";
    
    document.getElementById(id+"rr").style.left=(w-3)+"px";
    document.getElementById(id+"rr").style.height=(h-6)+"px";
    
    document.getElementById(id+"bl").style.top=(h-3)+"px";
    
    document.getElementById(id+"bb").style.top=(h-3)+"px";
    document.getElementById(id+"bb").style.width=(w-6)+"px";
    
    document.getElementById(id+"br").style.top=(h-3)+"px";
    document.getElementById(id+"br").style.left=(w-3)+"px";
    
    document.getElementById(id+"top").style.width=(w-6)+"px";
    document.getElementById(id+"bottom").style.width=(w-6)+"px";	
    document.getElementById(id+"bottom").style.height=(h-31)+"px";
	
}
function close()
{
    var parent=this.parent;	
    var child=document.getElementById(this.id);	
    parent.removeChild(child);	
}
function myWindow_closeWindow(index)
{
    if(myWindow.Objects[index].onClose)
    {
      myWindow.Objects[index].onClose();
    }
    else
    {
        myWindow.Objects[index].close();    
    }
}
function getTop()
{
    /*if(document.getElementById(this.id))
    {
        var t=document.getElementById(this.id).style.top;
        return t.substring(0,t.length-2);        
    }
    return -1;*/
    return thsi.top;
}
function getLeft()
{
    /*if(document.getElementById(this.id))
    {
        var l=document.getElementById(this.id).style.left;
        return l.substring(0,l.length-2);        
    }
    return -1;*/
    return this.left;
}
function getHeight()
{
    /*if(document.getElementById(this.id))
    {
        var h=document.getElementById(this.id).style.height;
        return h.substring(0,h.length-2);        
    }
    return -1;*/
    return this.height;
}
function getWidth()
{
    /*if(document.getElementById(this.id))
    {
        var w=document.getElementById(this.id).style.width;
        return w.substring(0,w.length-2);        
    }
    return -1;*/
    return this.height;
}
function maximize()
{
    document.getElementById(this.id+"size").src="restore.gif";
    document.getElementById(this.id+"size").onclick=Function("myWindow_normalWindow('"+this.index+"');");
    var itemObject=document.getElementById(this.id);
    
    itemObject.style.top="0px";
    itemObject.style.left="0px";
    //var parent=document.getElementById(this.parent);	
    //var nWidth=this.parent.style.width;
    var nWidth=winWidth()+"px";
    //var nHeight=this.parent.style.height;
    var nHeight=winHeight()+"px";
    itemObject.style.width=nWidth;
    itemObject.style.height=nHeight;
    document.getElementById(this.id+"top").style.top="0px";
    document.getElementById(this.id+"top").style.left="0px";
    document.getElementById(this.id+"top").style.width=nWidth;
    
    document.getElementById(this.id+"bottom").style.left="0px";
    document.getElementById(this.id+"bottom").style.top="25px";
    document.getElementById(this.id+"bottom").style.width=nWidth;
	
    document.getElementById(this.id+"bottom").style.height=(nHeight.substring(0,nHeight.length-2)-25)+"px";
    document.getElementById(this.id+"top").style.cursor="default";
    document.getElementById(this.id).style.visibility="visible";
    
    myWindow.focusPriority=myWindow.focusPriority+1;
    document.getElementById(this.id).style.zIndex=myWindow.focusPriority;    
    this.ismaximize=true;    
}
function myWindow_maximizeWindow(index)
{
    if(myWindow.Objects[index].onMaximize)
    {
      myWindow.Objects[index].onMaximize();
    }
    else
    {
        myWindow.Objects[index].maximize();    
    }    
}
function normal()
{
    document.getElementById(this.id+"size").src="expand.gif";
    document.getElementById(this.id+"size").onclick=Function("myWindow_maximizeWindow('"+this.index+"');");
    myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
    document.getElementById(this.id+"top").style.top="3px";
    document.getElementById(this.id+"top").style.left="3px";    
    document.getElementById(this.id+"bottom").style.left="3px";
    document.getElementById(this.id+"bottom").style.top="28px";
    
    document.getElementById(this.id+"top").style.cursor="move";
    this.ismaximize=false;
    this.isminimize=false;  
    //this.show();    
    document.getElementById(this.id).style.visibility="visible";
    myWindow.focusPriority=myWindow.focusPriority+1;
    document.getElementById(this.id).style.zIndex=myWindow.focusPriority;    
}
function myWindow_normalWindow(index)
{
    if(myWindow.Objects[index].onNormal)
    {
      myWindow.Objects[index].onNormal();
    }
    else
    {
        myWindow.Objects[index].normal();    
    }
}
function myWindow_minimizeWindow(index)
{
    if(myWindow.Objects[index].onMinimize)
    {
      myWindow.Objects[index].onMinimize();
    }
    else
    {
        myWindow.Objects[index].minimize();            
    }    
}
function minimize()
{
      document.getElementById(this.id).style.visibility="hidden";
      this.isminimize=true;
      /*/this.isvisible=false;   
      this.isminimize=true;
      this.maximize=false;*/
    
}
function restore()
{
    if(document.getElementById(this.id))
    {
	   document.getElementById(this.id).style.visibility="visible";           
           this.isminimize=false;
           myWindow.focusPriority=myWindow.focusPriority+1;
           document.getElementById(this.id).style.zIndex=myWindow.focusPriority;          
    
	   return true;
    }
    return false;
}
function getTitle()
{
    /*if(document.getElementById(this.id+"title"))
    {
        
        return (document.getElementById(this.id+"title")).innerHTML;
    }
    return null;*/
    return this.title;
}
function getBody()
{
    if(document.getElementById(this.id+"bottom"))
    {
        
        return (document.getElementById(this.id+"bottom")).innerHTML;
    }
    return null;
}
function getState()
{    
    if(this.ismaximize)
        return myWindow.MAXIMIZE;
    else if(this.isminimize)
        return myWindow.MINIMIZE;
    else
        return myWindow.NORMAL;
}
function setState(state)
{
    if(state==0)
    {
        this.normal();
    }
    else if(state==2)
    {
      this.maximize();
    }
    else if(state==1)
    {
      this.minimize();
    }
}
function setBounds(l,t,w,h)
{
    if(document.getElementById(this.id))
    {
        if(h<myWindow.minimumHeight)
            h=myWindow.minimumHeight;
        if(w<myWindow.minimumWidth)
            w=myWindow.minimumWidth;
            
        if(t<0)
            t=0;
        if(l<0)
            l=0;
        this.top=t;
        this.left=l;
        this.width=w;
        this.height=h;
        if(!this.ismaximize)    
          myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
        return true;
    }
    return false;
}
function setLocation(l,t)
{
    if(document.getElementById(this.id))
    {
            
        if(t<0)
            t=0;
        if(l<0)
            l=0;
        this.top=t;
        this.left=l;        
        if(!this.ismaximize)    
          myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
        return true;
    }
    return false;
}
function setTitle(title)
{
    if(document.getElementById(this.id+"title"))
    {
        this.title=title;
        document.getElementById(this.id+"title").innerHTML=title;
        return true;
    }
    return false;
}
function setSize(w,h)
{
    if(document.getElementById(this.id))
    {
        if(h<myWindow.minimumHeight)
            h=myWindow.minimumHeight;
        if(w<myWindow.minimumWidth)
            w=myWindow.minimumWidth;
            
        this.width=w;
        this.height=h;
        if(!this.ismaximize)    
          myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
        return true;
    }
    return false;
}
function setWidth(w)
{
    if(document.getElementById(this.id))
    {        
        if(w<myWindow.minimumWidth)
            w=myWindow.minimumWidth;
            
        this.width=w;        
        if(!this.ismaximize)    
          myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
        return true;
    }
    return false;
}
function setHeight(h)
{
    if(document.getElementById(this.id))
    {
        if(h<myWindow.minimumHeight)
            h=myWindow.minimumHeight;      
        this.height=h;
        if(!this.ismaximize)    
          myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
        return true;
    }
    return false;
}
function setTop(t)
{
    if(document.getElementById(this.id))
    {
            
        if(t<0)
            t=0;        
        this.top=t;
        
        if(!this.ismaximize)    
          myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
        return true;
    }
    return false;
}
function setLeft(l)
{
    if(document.getElementById(this.id))
    {
        if(l<0)
            l=0;        
        this.left=l;        
        if(!this.ismaximize)    
          myWindow_resizeWindow(this.id,this.top,this.left,this.width,this.height);
        return true;
    }
    return false;
}
function setBody(body)
{
    if(document.getElementById(this.id+"bottom"))
    {
        
        document.getElementById(this.id+"bottom").innerHTML=body;
        this.body=body;
        return true;
    }
    return false;
}
function getLocation()
{	
  return {left:this.left,top:this.top};	
}
function getBounds()
{
    return {left:this.left,top:this.top,width:this.width,height:this.height};	
}
function getSize()
{
    return {width:this.width,height:this.height};	
}
