//*** <Modal.js> ***
function clsVEGAModal()
{
 this.x=0;
 this.y=0;
 this.Move=false;
 if(!getE("VEGAModalSheetTransp"))
   {
 var div=document.createElement("DIV");
    div.id="VEGAModalSheetTransp";
    document.body.appendChild(div);
   }
//***
 if(!getE("VEGAMoveWin"))
   {
 var div=document.createElement("DIV");
    div.id="VEGAMoveWin";
    div.innerHTML="&nbsp;";
    document.body.appendChild(div);
   }
//***
 this.Window=new Array();
//***
 this.Add=function(Title,Url,Width,Height,Align,Full,Left,Top)
 {
  var cls=new clsVEGAModalWindow(Title,Url,Width,Height,Align,Full,Left,Top);
   this.Window.push(cls);
   cls.id="VEGAModal."+this.Window.length;
   return cls;
 }
//***
 this.Open=function(Title,Url,Width,Height,Align,Full,Left,Top)
 {
  var cls=this.Add(Title,Url,Width,Height,Align,Full,Left,Top);
   cls.Open();
//   top.document.body.style.overflow="hidden";
   return cls;
 }
//***
 this.Close=function()
 {
   if(this.Window.length == 0) return;
  var cls=this.Window[this.Window.length-1];
   cls.Div.parentNode.removeChild(cls.Div);
   cls.DivBackGround.parentNode.removeChild(cls.DivBackGround);
   this.Window.pop();
 }
//***
 this.Last=function()
 {
   return this.Window[this.Window.length-1];
 }
}
//***
function clsVEGAModalWindow(Title,Url,Width,Height,Align,IsFull,Left,Top)
{
 this.id;
 this.Url="";

 this.Width=300;
 this.Height=200;
 this.Left=0;
 this.Top=0;

 this.Self=null;

 this.IsFull=false;

 this.IconFull=true;
 this.IconReal=true;
 this.IconClose=true;
 this.IconSave=false;
 this.IconRefresh=true;

 this.Div;
 this.IFrame;
 this.Title="[no name]";
 this.Head;
 this.DivBackGround;
 this.Note;
 this.Parent=null;
//***
  if(Title) this.Title=Title;
  if(Url) this.Url=Url;
  if(Width) this.Width=Width;
  if(Height) this.Height=Height;
  if(Left) this.Left=Left;
  if(Top) this.Top=Top;
  if(IsFull) this.IsFull=IsFull;
//***
  this.Open=function()
  {
    if(this.Left == 0) this.Left=(document.body.offsetWidth-this.Width)/2+document.body.scrollLeft;
    if(this.Top == 0) this.Top=(document.body.clientHeight-this.Height)/2+document.body.scrollTop;
    this.Div=getE("VEGAModal").cloneNode(true);
//***
    this.DivBackGround=document.createElement("DIV");
    this.DivBackGround.className="VEGASheet";
    this.DivBackGround.innerHTML="&nbsp;";
    this.DivBackGround.style.zIndex=99+gvVEGAModal.Window.length*2;
    this.DivBackGround.style.width=document.body.clientWidth+document.body.scrollLeft;
    this.DivBackGround.style.height=document.body.clientHeight+document.body.scrollTop;
    this.DivBackGround.style.top=0;
    this.DivBackGround.style.left=0;
    this.DivBackGround.style.position="absolute";
    document.body.appendChild(this.DivBackGround);
//***
    this.Div.id=this.id;
    this.Div.style.zIndex=100+gvVEGAModal.Window.length*2;
//***
    document.body.appendChild(this.DivBackGround);
    document.body.appendChild(this.Div);
//***
    this.Div.style.display="block";
    this.DivBackGround.style.display="block";
//***
    this.SetID(this.Div,this.Div.id);
    this.IFrame=getE("IFrame."+this.Div.id);
    this.Head=getE("Head."+this.Div.id);
    getE("Head."+this.Div.id).innerHTML=this.Title;
    getE("Head."+this.Div.id).style.textAlign="center";
    if(this.IsFull) this.FullSize();
      else this.DefaultSize();
    this.IFrame.src=this.Url;
    if(!this.IconReal) getE("Real."+this.Div.id).style.display="none";
    if(!this.IconClose) getE("Close."+this.Div.id).style.display="none";
    if(!this.IconRefresh) getE("Refresh."+this.Div.id).style.display="none";
    if(!this.IconSave) getE("Save."+this.Div.id).style.display="none";
    if(!this.IconFull) getE("Full."+this.Div.id).style.display="none";
  }
//***
 this.SetID=function(el,id)
 {
   for(var i=0;i<el.childNodes.length;i++)
      {
       try
       {
        if(el.childNodes[i].getAttribute("Source"))
          {
           el.childNodes[i].id=el.childNodes[i].getAttribute("Source")+id;
           el.childNodes[i].setAttribute("Source",id);
          }
        if(el.childNodes[i].childNodes.length != 0) this.SetID(el.childNodes[i],id);
       }
       catch(e)
       {
       }
      }
 }
//***
 this.FullSize=function()
 {
   this.SetSize(document.body.clientWidth-20,document.body.clientHeight-20,document.body.scrollLeft+10,document.body.scrollTop+10);
 }
//***
 this.DefaultSize=function()
 {
   this.SetSize(this.Width,this.Height,this.Left,this.Top);
 }
//***
 this.SetSize=function(width,height,x,y)
 {
   if(y) this.Div.style.top=y;
   if(x) this.Div.style.left=x;
   this.Div.style.height=height;
   this.Div.style.width=width;
   this.Div.style.display="block";
 }
//******************************************************************************************************************************************
 this.StartMoveWin=function(e)
 {
  var el=getE("VEGAMoveWin");
  var div=this.Div;
   if(e.button == 2) return;
   gvVEGAModal.Move=true;
   el.style.top=div.style.top;
   el.style.left=div.style.left;
   el.style.width=div.style.width;
   el.style.height=div.style.height;
   gvVEGAModal.x=e.x-parseInt(el.style.left);
   gvVEGAModal.y=e.y-parseInt(el.style.top);
   el.style.display="block";
   getE("VEGAModalSheetTransp").style.display="block";
   document.body.attachEvent("onmousemove",this.MoveWin);
   document.body.attachEvent("onmouseup",this.EndMoveWin);
   document.body.style.cursor="move";
   cfgVEGAEndEvent(e);
 }
//***
 this.MoveWin=function(e)
 {
   if(!e) var e=self.event;
  var el=getE("VEGAMoveWin");
   if(gvVEGAModal.Move)
     {
      el.style.top=e.y-gvVEGAModal.y+document.body.scrollTop;
      el.style.left=e.x-gvVEGAModal.x+document.body.scrollLeft;
     }
   cfgVEGAEndEvent(e);
 }
//***
 this.EndMoveWin=function(e)
 {
  var el=getE("VEGAMoveWin");
  var cls=gvVEGAModal.Last();
  var div=cls.Div;
   gvVEGAModal.Move=false;
   document.body.detachEvent("onmousemove",cls.MoveWin);
   document.body.detachEvent("onmouseup",cls.EndMoveWin);
   document.body.style.cursor="default";
   if(parseInt(el.style.top) < 10) div.style.top="10px";
      else if(parseInt(el.style.top) > document.body.clientHeight-20) div.style.top=(document.body.clientHeight-20)+"px";
              else div.style.top=el.style.top;
   if(parseInt(el.style.left) < (parseInt(el.style.width)-90)*-1) div.style.left=((parseInt(el.style.width)-90)*-1)+"px";
      else if(parseInt(el.style.left) > document.body.clientWidth-50) div.style.left=(document.body.clientWidth-50)+"px";
              else div.style.left=el.style.left;
   cfgVEGAHideLayer("VEGAMoveWin");
   cfgVEGAHideLayer("VEGAModalSheetTransp");
   cfgVEGAEndEvent(e);
 }
//******************************************************************************************************************************************
 this.StartReSize=function(e)
 {
  var el=getE("VEGAMoveWin");
  var div=this.Div;
   if(e.button == 2) return;
   gvVEGAModal.Move=true;
   gvVEGAModal.x=e.x;
   gvVEGAModal.y=e.y;
   el.style.top=div.style.top;
   el.style.left=div.style.left;
   el.style.width=div.style.width;
   el.style.height=div.style.height;
   el.style.display="block";
   getE("VEGAModalSheetTransp").style.display="block";
   document.body.focus();
   document.body.attachEvent("onmousemove",this.ReSize);
   document.body.attachEvent("onmouseup",this.EndReSize);
   document.body.style.cursor="nw-resize";
   cfgVEGAEndEvent(e);
 }
//***
 this.ReSize=function(e)
 {
   if(!e) var e=self.event;
  var el=getE("VEGAMoveWin");
   if(gvVEGAModal.Move)
     {
      el.style.height=e.y-parseInt(el.style.top)+document.body.scrollTop;
      el.style.width=e.x-parseInt(el.style.left)+document.body.scrollLeft;
     }
   cfgVEGAEndEvent(e);
 }
//***
 this.EndReSize=function(e)
 {
  var el=getE("VEGAMoveWin");
  var cls=gvVEGAModal.Last();
   gvVEGAModal.Move=false;
   document.body.detachEvent("onmousemove",cls.ReSize);
   document.body.detachEvent("onmouseup",cls.EndReSize);
   document.body.style.cursor="default";
   cls.SetSize(el.style.width,el.style.height);
   cfgVEGAHideLayer(el.id);
   cfgVEGAHideLayer("VEGAModalSheetTransp");
   cfgVEGAEndEvent(e);
 }
//***
 this.Refresh=function()
 {
   this.Self.location.reload();
 }
//***
 this.Save=function()
 {
   this.Self.cfgSavePosition();
 }
}
//*** </Modal.js> ***