function selectstart()
{
  try
  {
    selection.empty();
    event.cancelBubble=true;
    event.returnValue=false;
    return false;
  }
  catch(e){}
}
//
// shared variables
//
var id;
var origwidth;
var origheight;
var origleft;
var origright;
var clickx;
var clicky;
var currentwin;
var currentdiv;
//
// CONSTANTS
//
var SIZER_HEIGHT = 15;
var SIZER_WIDTH = 15;
var TITLE_HEIGHT = 20;
var ROLLUP_HEIGHT = 20;
var ROLLUP_WIDTH = 20;
var ROLLUP_X = 0;
var ROLLUP_Y = 0;

var DIALOG_ZINDEX = 5000;
var DEFAULT_ZSTART = 30
var DEFAULT_COLOR = "transparent";
//var DEFAULT_IMAGE = "'images/deer.jpg'";
var DEFAULT_IMAGE = "";
var DEFAULT_FONT = "ARIAL";
var DEFAULT_FONTCOLOR = "BLACK";
var DEFAULT_FONTSIZE = "14";
var HILITE_TITLECOLOR = "gold"
var DEFAULT_TITLECOLOR = "#2D404E";//"#233644";
//var DEFAULT_TITLEIMAGE = "'images/anmliz.gif'";
var DEFAULT_TITLEIMAGE = "";//"'images/titlebackground.gif'";
var SELECTED_TITLEIMAGE = "images/titlebackground.gif";
var DEFAULT_TITLEFONT = "ARIAL";
var DEFAULT_TITLEFONTCOLOR = "white";
var DEFAULT_TITLEFONTSIZE = "10";

var BORDERSIZE=3;
var BORDERCOLOR= DEFAULT_TITLECOLOR;

var DEFAULT_SIZERCOLOR = DEFAULT_TITLECOLOR;
//var DEFAULT_SIZERCOLOR = "yellow";
var DEFAULT_SIZERIMAGE = "images/sizer.gif";
var DEFAULT_HIDERCOLOR = DEFAULT_TITLECOLOR;
var DEFAULT_HIDERIMAGE = "images/closer.gif";


///////////////////////////////////////////////////////////////////CONSTRUCTOR
function Window(n, on, smart, s, mstyle, rstyle, hstyle, isImage)
// this.is a resizable, draggable object that holds stuff
//////////////////////////////////////////////////////////////////////////////
{
	this.frame=self;
	this.objname=on;

	// utility vars...
  if( isImage )
  {
    this.isImage = true;  
    this.isTalkBalloon = true;  
  }
  this.talkBalloonPicture = "";  
	this.id;
	this.origwidth;
	this.origheight;
	this.origleft;
	this.origright;
	this.clickx;
	this.clicky;
	this.currentdiv;
	this.rolledup=false;
	this.text= " ";                  //contents, not just text
	this.mtext;
	this.rtext;
	this.smart=smart;
	this.name=n;
	this.hstyle;
  this.positionFixed   = false;
  this.imageUrl        = "";
  this.rawText         = "";
  this.extrasShown     = true;
  

  this.type="window";
	if(s)
  { 
		this.style=s;
  }
	else
		this.style=new Style("win", DEFAULT_COLOR, DEFAULT_IMAGE, DEFAULT_FONT, DEFAULT_FONTSIZE, DEFAULT_FONTCOLOR, "none", "none", 300,300,300,100, false, DEFAULT_ZSTART);

	// some defaults
	if(hstyle)
	{
		this.hstyle=hstyle;
		this.hstyle.SetHW(ROLLUP_HEIGHT, this.style.width); // rollup style is not allowed to set hieght
		this.hstyle.SetXY(0,0);
		this.hstyle.zindex=this.style.zindex + 3;//5;
	}
	else
	{
		//Style(name, backgroundcolor, font, fsize, fcolor, fstyle, border, h, w, x, y, v, z)
		this.hstyle=new Style(this.style.name + "h", DEFAULT_HIDERCOLOR, DEFAULT_HIDERIMAGE, arial, "14", "white", "none", "none", ROLLUP_HEIGHT, ROLLUP_WIDTH, ROLLUP_X, ROLLUP_Y, true, this.style.zindex+3, "hand");
	}
	if(mstyle)
	{
		this.mstyle=mstyle;
    //
    // title is not allowed to set its own width and height right now
    // 
		this.mstyle.SetHW(TITLE_HEIGHT, this.style.width);
		this.mstyle.SetXY(0,0);
		this.mstyle.zindex=this.style.zindex;//3;
	}
	else
	{
		// Style(name, backgroundcolor, font, fsize, fcolor, fstyle, border, h, w, x, y, v, z)
		this.mstyle=new Style(this.style.name + "m", DEFAULT_TITLECOLOR, DEFAULT_TITLEIMAGE, DEFAULT_TITLEFONT, DEFAULT_TITLEFONTSIZE, DEFAULT_TITLEFONTCOLOR, "none", "none", TITLE_HEIGHT, this.style.width, 0, 0, true, this.style.zindex, "hand");
	}
	if(rstyle)
	{
		this.rstyle=rstyle;
		this.rstyle.SetHW(SIZER_HEIGHT,SIZER_WIDTH);
		this.rstyle.SetXY(this.style.width-SIZER_WIDTH,this.style.height-SIZER_HEIGHT);
		this.rstyle.zindex=this.style.zindex+1//4;
	}
	else
	{
		this.rstyle=new Style(this.style.name + "r", DEFAULT_SIZERCOLOR, DEFAULT_SIZERIMAGE, arial, "14", "white", "none", "none", SIZER_HEIGHT, SIZER_WIDTH, this.style.width-SIZER_WIDTH, this.style.height-SIZER_HEIGHT, true, this.style.zindex+6, "hand");
	}
  if( this.isImage )
  {
  	this.cstyle=new Style(this.style.name + "c", this.style.bgcolor, this.style.backgroundimage, this.style.font, this.style.fsize, this.style.fcolor, this.style.fstyle, "none", this.style.height, this.style.width, 0, 0, true, this.style.zindex+1);
  }
  else
  {
    this.cstyle=new Style(this.style.name + "c", this.style.backgroundcolor, this.style.backgroundimage, this.style.font, this.style.fsize, this.style.fcolor, this.style.fstyle, "none", this.style.height-TITLE_HEIGHT, this.style.width, 0, TITLE_HEIGHT, true, this.style.zindex+1);
  }
	this.lbstyle=new Style(this.style.name + "lb", BORDERCOLOR, "", this.style.font, this.style.fsize, "blue", this.style.fstyle, this.style.border, this.style.height, BORDERSIZE, 0, 0, true, this.style.zindex+5);
	this.bbstyle=new Style(this.style.name + "bb", BORDERCOLOR, "", this.style.font, this.style.fsize, "red", this.style.fstyle, this.style.border, BORDERSIZE, this.style.width, 0, this.style.height-BORDERSIZE, true, this.style.zindex+5);
	this.rbstyle=new Style(this.style.name + "rb", BORDERCOLOR, "", this.style.font, this.style.fsize, "orange", this.style.fstyle, this.style.border, this.style.height, BORDERSIZE, this.style.width-BORDERSIZE, 0, true, this.style.zindex+5);
	this.tbstyle=new Style(this.style.name + "tb", BORDERCOLOR, "", this.style.font, this.style.fsize, "green", this.style.fstyle, this.style.border, BORDERSIZE, this.style.width, 0, 0, true, this.style.zindex+5);


  this.IsVisible = wIsVisible;
	this.StyleWrite=wStyleWrite;
	this.Draw=wDraw;            //puts the window on the page
	this.Setup=wSetup;
	this.SetText=wSetText;
	this.MSetText=wMSetText;
	this.GoMove=wGoMove;
	this.GoResize=wGoResize;
  this.mzClose=wmzClose;
  this.ieClose=wieClose;
  this.mzGoMove=wmzGoMove;
  this.ieGoMove=wieGoMove;
  this.sfGoMove=wsfGoMove;	// KRG
  this.ieGoResize=wieGoResize;
  this.mzGoResize=wmzGoResize;
  this.sfGoResize=wsfGoResize;	// KRG
  this.ieRollUp=wieRollUp;
  this.mzRollUp=wmzRollUp;
  this.GetHTML=wGetHTML;
  this.GetDiv = wGetDiv;
  this.GetProcessedImageURL = wGetProcessedImageURL;
  this.GetContentDiv = wGetContentDiv;
  this.GetSizerDiv = wGetSizerDiv;
  this.GetMoverDiv = wGetMoverDiv;  
  this.GetLBorderDiv = wGetLBorderDiv;    
  this.GetRBorderDiv = wGetRBorderDiv;      
  this.GetTBorderDiv = wGetTBorderDiv;        
  this.GetBBorderDiv = wGetBBorderDiv;          
  this.GetContentDivName = wGetContentDivName;
  this.GetHiderDivName = wGetHiderDivName;  
  this.GetSizerDivName = wGetSizerDivName;
  this.GetMoverDivName = wGetMoverDivName;  
  this.GetLBorderDivName = wGetLBorderDivName;    
  this.GetRBorderDivName = wGetRBorderDivName;      
  this.GetTBorderDivName = wGetTBorderDivName;        
  this.GetBBorderDivName = wGetBBorderDivName;          
  this.GetDivName = wGetDivName;            
  this.SetPositionFixed = wSetPositionFixed;
	this.Add=wAdd;
	this.ToTop=wToTop;
	this.Move=wMove;
	this.Resize=wResize;  
	this.Paint=wPaint;	
	this.Hide=wHide;
  this.ToggleExtras=wToggleExtras;
	this.HideExtras=wHideExtras;
	this.Show=wShow;
	this.ShowExtras=wShowExtras;
	this.RollUp=wRollUp;
	this.NSRollUp=wNSRollUp;
	this.SetIsImage=wSetIsImage;
	this.SetIsTalkBalloon=wSetIsTalkBalloon;
  this.handleContentMouseDown=wHandleContentMouseDown;
  this.handleMoverMouseDown=wHandleMoverMouseDown;
  this.handleEditorMouseDown=wHandleEditorMouseDown;
  this.getTalkBalloonTDX = wGetTalkBalloonTDX;
}
  function wGetTalkBalloonTDX()
  {
    if( this.isTalkBalloon )
    {
    }
    else
      return 0;
  }
  
  function wHandleEditorMouseDown(event)
{
    if( !event )
      event = window.event;
    id = this.id.substring(0, this.id.indexOf("editor"));
    top.photoWeb.goSetTalkBalloonText(id);
    event.cancelBubble = true;
    event.returnValue = false;
    return false;
}

  function wHandleContentMouseDown(event)
  {
    if( !event )
      event = window.event;

    if( browsertype == MOZILLA || browsertype == SAFARI ) // KRG
    {
      if( event.target.id.indexOf("he5") > -1 || event.target.id.indexOf("editor") > -1 )
      {
        return;
      }
      else if( event.target.id == "baseimagetd" )
      {
        if( photoWeb )
          photoWeb.deselectAll();
      }
    }

    if( event.srcElement )
    {
      if(event.srcElement.id.indexOf("he5")>-1)
        return;
      else if( event.srcElement.id == "baseimagetd" )
      {
        if( photoWeb )
          photoWeb.deselectAll();
      }
    }
    event.cancelBubble = true;
    event.returnValue = false;
    id = this.id.substring(0, this.id.indexOf("content"));
    var win = componentManager.FindComponent(id);
    if( !win ) 
      return;
    if( win.isTalkBalloon || win.isImage )
    {
      top.photoWeb.setSelectedWindow(win);
      if( win.extrasShown )
      {
        if( browsertype==MOZILLA)
          win.mzGoMove(event, false);
        else if( browsertype == SAFARI )	// KRG
          win.sfGoMove(event, false);		// KRG
        else
          win.ieGoMove(event, false);
      }
    return false;
    }
  }
  function wHandleMoverMouseDown(event)
  {
    id = this.id.substring(0, this.id.indexOf("mover"));
    var win = componentManager.FindComponent(id);
    if( win.isTalkBalloon || win.isImage )
    {
      //      top.photoWeb.toggleBorders(id);
    }
    else
    {
      if( browsertype==MOZILLA)
        win.mzGoMove(event, true);
      else if ( browsertype == SAFARI )		// KRG
        win.sfGoMove(event, true);		// KRG
      else
        win.ieGoMove(event, true);
    }
  }
  function wSetIsTalkBalloon(b, pic)
  {
    this.isTalkBalloon = b;
    this.talkBalloonPicture = pic;
  }
  function wSetIsImage(b)
  {
    this.isImage = b;
  }
  function wSetPositionFixed(b)
  {
    this.positionFixed = b;
  }
	//////////////////////////////////////////////////////////////////////METHOD
	function wStyleWrite(f)
	// writes out the css header for the label... sigh
	////////////////////////////////////////////////////////////////////////////
	{

		this.style.WriteHeader(f);
		this.mstyle.WriteHeader(f);
		this.cstyle.WriteHeader(f);
		this.rstyle.WriteHeader(f);
		this.hstyle.WriteHeader(f);
		this.lbstyle.WriteHeader(f);
		this.rbstyle.WriteHeader(f);
		this.bbstyle.WriteHeader(f);		
		this.tbstyle.WriteHeader(f);		    
    

	}
	//////////////////////////////////////////////////////////////////////METHOD  
	function wRollUp()
	// 
	////////////////////////////////////////////////////////////////////////////
	{
    // this version closes the windows!!!
		if(browsertype==NS)
			this.NSRollUp();
		else if(browsertype==MOZILLA || browsertype == SAFARI ) // KRG
			this.mzRollUp();
		else
			this.ieRollUp();
	}
	//////////////////////////////////////////////////////////////////////METHOD  
	function wNSRollUp(e)
	// 
	////////////////////////////////////////////////////////////////////////////
	{

		currentdiv=this.div;//eval("document." + this.name);
		currentwin=this;
		if(currentwin.rolledup)
		{
			this.ToTop();
			currentdiv.clip.height=currentwin.style.height;
			currentwin.rolledup=false;
		}
		else
		{
			currentdiv.clip.height=TITLE_HEIGHT;		
			currentwin.rolledup=true;			
		}
	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wToTop()
	// 
	////////////////////////////////////////////////////////////////////////////
	{
    componentManager.ToTop(this);
    return;
    var i;
		var maxz=0;
		// find out the topmost layer
    for(i=0;i<componentManager.components.length;i++)
    {
      if( componentManager.components[i].type == "window" )
        if(componentManager.components[i].style.zindex > maxz)
          maxz = componentManager.components[i].style.zindex;
    }
		this.style.zindex=maxz + 1;
		DivZ(self, this.name, this.style.zindex);
    
	}
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetContentDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetContentDivName() );
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetDivName() );
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetSizerDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetSizerDivName() );
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetMoverDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetMoverDivName() );  
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetLBorderDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetLBorderDivName() );  
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetRBorderDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetRBorderDivName() );  
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetTBorderDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetTBorderDivName() );  
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetBBorderDiv()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    return eval( this.GetBBorderDivName() );  
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetContentDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "content");
    else
      d = ("self." + this.name + "content");
  
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetHiderDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "content");
    else
      d = ("self." + this.name + "content");
  
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name);
    else
      d = ("self." + this.name);    
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetSizerDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "sizer");
    else
      d = ("self." + this.name + "sizer");    
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetMoverDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "mover");
    else
      d = ("self." + this.name + "mover");    
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetLBorderDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "lb");
    else
      d = ("self." + this.name + "lb");    
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetRBorderDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "rb");
    else
      d = ("self." + this.name + "rb");    
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetTBorderDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "tb");
    else
      d = ("self." + this.name + "tb");    
    return d;
  }
  //////////////////////////////////////////////////////////////////////METHOD  
  function wGetBBorderDivName()
	// 
	////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + ".document." + this.name + "bb");
    else
      d = ("self." + this.name + "bb");    
    return d;
  
  }
  //////////////////////////////////////////////////////////////////////METHOD
  function wResize(x, y)
  //
  ////////////////////////////////////////////////////////////////////////////
  {
    var d;
      // resize our div tag
    //content
    d = this.GetContentDiv();
    if( this.isImage || this.isTalkBalloon )
    {
      DivSize(self, this.GetContentDivName(), x, y); 
      DivClip(self, this.GetContentDivName(), 0,x,y,0);
      this.cstyle.height = y;
      this.cstyle.width = x;
    }
    else
    {
      this.cstyle.height = y - this.mstyle.height;
      this.cstyle.width = x;
      DivSize(self, this.GetContentDivName(), x, y-this.mstyle.height); 
      DivClip(self, this.GetContentDivName(), 0,x,y-this.mstyle.height,0);
    }
    //title
    try
    {
      d = this.GetMoverDiv();
      DivSize(self, this.GetMoverDivName(), x, this.mstyle.height); 
      DivClip(self, this.GetMoverDivName(), 0,x,this.mstyle.height,0);
    }
    catch(e){}
    //title clip
    // main
    d = this.GetDiv();
    DivSize(self, this.GetDivName(), x, y); 
    //main clip
    DivClip(self, this.GetDivName(), 0,x,y,0);
    // move the sizer block up
    d = this.GetSizerDivName();
    DivMove(d, y - this.rstyle.height, x - this.rstyle.width);
    // size the borders
    DivSize(self, this.GetRBorderDivName(), this.rbstyle.width, y);
    DivClip(self, this.GetRBorderDivName(), 0,this.rbstyle.width,y,0);    
    DivSize(self, this.GetLBorderDivName(), this.lbstyle.width, y);
    DivClip(self, this.GetLBorderDivName(), 0,this.lbstyle.width,y,0);    
    DivSize(self, this.GetTBorderDivName(), x, this.tbstyle.height);
    DivClip(self, this.GetTBorderDivName(), 0,x,this.tbstyle.height,0);    
    DivSize(self, this.GetBBorderDivName(), x, this.bbstyle.height);
    DivClip(self, this.GetBBorderDivName(), 0,x,this.bbstyle.height,0);    
    // move the borders
    d = this.GetRBorderDivName();
    DivMove(d, 0, x - this.rbstyle.width);
    d = this.GetBBorderDivName();
    
    DivMove(d, y - this.bbstyle.height, 0);
    
    // resize the current window
    this.style.height = y;
    this.style.width = x;
    this.mstyle.width = x;
    this.rbstyle.height = y;
    this.lbstyle.height = y;    
    this.tbstyle.width = x;
    this.bbstyle.width = x;    
    this.rbstyle.x = x - this.rbstyle.width;
    this.bbstyle.y = y;

    this.Paint();
  }
	//////////////////////////////////////////////////////////////////////METHOD
	function wMove(x, y)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		DivMove(this.GetDivName(), y, x)
    this.style.x = x;
    this.style.y = y;
	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wDraw(f)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		var d;
		
		d=f.document;
		d.write(this.GetHTML());

		if(browsertype==NS)
			this.div=eval("f.document." + this.name);
		else
			this.div=document.getElementById(this.name);//eval("f." + this.name);

		this.Setup();

	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wSetup(d)		
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		var d;
		
		if(browsertype==NS)
		{
			
			mover=eval("this.div.document." + this.name + "mover");
			mover.captureEvents(Event.MOUSEDOWN);
			mover.onmousedown=new Function("e", "{" + this.objname + ".GoMove(e); return false;}");;		
			sizer=eval("this.div.document." + this.name + "sizer");
			sizer.captureEvents(Event.MOUSEDOWN);
			sizer.onmousedown=new Function("e", "{" + this.objname + ".GoResize(e); return false;}");;		
			hider=eval("this.div.document." + this.name + "hider");
			hider.captureEvents(Event.MOUSEDOWN);
			hider.onmousedown=new Function("e", "{" + this.objname + ".RollUp(e); return false;}");;		
		}
		else if( browsertype == MOZILLA )
		{
			content=eval(this.name + "content");			
			content.onmousedown=this.handleContentMouseDown;
      try
      {
        if( !this.isTalkBalloon )
        {
    			mover=eval(this.name + "mover");			
    			mover.onmousedown=this.handleMoverMouseDown;
        }
	else
	{
	  editor = eval(this.name + "editor");
          editor.onmousedown=this.handleEditorMouseDown; 
	}
      }
      catch(e){}
			sizer=eval(this.name + "sizer");			
			sizer.onmousedown=this.mzGoResize;
			hider=eval(this.name + "hider");			
			hider.onmousedown=this.mzClose;
		}
// KRG BEGIN
		else if( browsertype == SAFARI )
		{
			content=eval(this.name + "content");			
			content.onmousedown=this.handleContentMouseDown;
			try
			{
				if( !this.isTalkBalloon )
				{
					mover=eval(this.name + "mover");			
					mover.onmousedown=this.handleMoverMouseDown;
				}
				else
				{
					editor = eval(this.name + "editor");
					editor.onmousedown=this.handleEditorMouseDown; 
				}
			}
			catch(e){}
			sizer=eval(this.name + "sizer");			
			sizer.onmousedown=this.sfGoResize;
			hider=eval(this.name + "hider");			
			hider.onmousedown=this.mzClose;
		}
// KRG END
		else
		{
			content=eval(this.name + "content");			
			content.onmousedown=this.handleContentMouseDown;
      try
      {
        if(!this.isTalkBalloon)
        {
  			mover=eval(this.name + "mover");			
  			mover.onmousedown=this.handleMoverMouseDown;
        }
      }
      catch(e){}
			sizer=eval(this.name + "sizer");			
			sizer.onmousedown=this.ieGoResize;
			hider=eval(this.name + "hider");			
			hider.onmousedown=this.ieClose;
		}
    if( this.positionFixed )
      DivHide(top, this.name+"sizer");
    if( this.positionFixed )
      DivHide(top, this.name+"hider");
    
	}
	//////////////////////////////////////////////////////////////////////METHOD  
	function wGetHTML()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		if( browsertype== NS)
		{
    
			t='<layer name="' + this.name + '"  ' + this.style.layerstyle() + '" >';
			t+='<layer name="' + this.name + 'content" ' + this.cstyle.layerstyle() + '" >';
			t+='</layer>';
			t+='<layer name="' + this.name + 'mover" ' + this.mstyle.layerstyle() + '" >';
			t+='</layer>';
			t+='<layer name="' + this.name + 'hider" ' + this.hstyle.layerstyle() + '" >';
			t+='</layer>';
			t+='<layer name="' + this.name + 'sizer" ' + this.rstyle.layerstyle() + '">';
			t+='</layer>';
			t+='<layer name="' + this.name + 'lb" ' + this.lbstyle.layerstyle() + '" >';
			t+='</layer>';
			t+='<layer name="' + this.name + 'rb" ' + this.rbstyle.layerstyle() + '" >';
			t+='</layer>';
		t+='<layer name="' + this.name + 'tb" ' + this.tbstyle.layerstyle() + '" >';
			t+='</layer>';
			t+='<layer name="' + this.name + 'bb" ' + this.bbstyle.layerstyle() + '" >';
			t+='</layer>';
			t+='</layer>';

		}
		else
		{
      var styleOverride = "";
			t='<div id="' + this.name + '"  class="' + this.style.name + '" >';
			t+='<div id="' + this.name + 'content" class="' + this.cstyle.name + '" >';
			t+='</div>';
      if( !this.isImage )
      {
			  t+='<div id="' + this.name + 'mover" class="' + this.mstyle.name + '" >';
			  t+='</div>';
      }
			t+='<div id="' + this.name + 'hider" class="' + this.hstyle.name + '"  >';
			t+='</div>';
			t+='<div id="' + this.name + 'sizer" class="' + this.rstyle.name + '">';
			t+='</div>';
			t+='<div id="' + this.name + 'lb" class="' + this.lbstyle.name + '" >';
			t+='</div>';
			t+='<div id="' + this.name + 'rb" class="' + this.rbstyle.name + '" >';
			t+='</div>';
  		t+='<div id="' + this.name + 'tb" class="' + this.tbstyle.name + '" >';
			t+='</div>';
			t+='<div id="' + this.name + 'bb" class="' + this.bbstyle.name + '" >';
			t+='</div>';
			t+='</div>';
		}

		return t;

	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wSetText(t)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		var d;

		if(!this.text)
			this.text="";
		if(typeof(t)=="object")
			this.text=t.GetHTML();
		else
    {
			this.rawText = t;
			this.text    =  FontWrap(t, this.cstyle);		
    }
	  this.Paint(); 
		if(typeof(t)=="object")
		{

			if(browsertype==NS)
				d=eval("this.div.document." + this.name + "content.document." + t.name);
			else
				d=eval(t.name);
			t.div=d;
			this.Components[this.Components.length]=t;
			this.Components[this.Components.length-1]=t;
			this.Components[this.Components.length-1].Paint();
			this.Components[this.Components.length-1].Setup();

		}
	}
  //////////////////////////////////////////////////////////////////////METHOD
	function wMSetText(t)
	// sets the text of the label
	////////////////////////////////////////////////////////////////////////////
	{
    if( !t )
      t = "";
		this.mtext=FontWrap(t, this.mstyle);
		this.Paint();
	}	
	////////////////////////////////////////////////////////////////////////////
	function wPaint()
	//
	////////////////////////////////////////////////////////////////////////////
	{
		var mt;
		//t=FontWrap(this.text, this.cstyle);
		t = this.text;
    
    if( !this.mtext )
     this.mtext = " ";

    if( this.isImage )
    {
      t = t.substring(0, t.length-1);
      t += (" id='"+this.name+"image' onselectstart='selectstart()' height = " + this.cstyle.height );
      t += (" width = "  + this.cstyle.width );
      t += (" > ");
      mt = "";
//   	  mt = "<table border=0 width=" +this.mstyle.width+ " height=" + this.mstyle.height + " cellpadding=" + BORDERSIZE + " cellspacing=0 width=" + this.mstyle.width + "><tr><td align=center valign=bottom height=" + this.mstyle.height + "><b>" + this.mtext + "</table>";
      //t = FontWrap(t, this.style);
    }
    else if( this.isTalkBalloon )
    { 
   	  mt = "<table id='he1' style='cursor:hand;' border=0 width=" +this.mstyle.width+ " height=" + this.mstyle.height + " cellpadding=" + BORDERSIZE + " cellspacing=0 width=" + this.mstyle.width + "><tr><td id='he2' align=right valign=bottom height=" + this.mstyle.height + "><b>" + this.mtext + "<span align=right  style='color:white;text-align:right;text-decoration:none;font-size:10px;'><b><a style='color:red;text-decoration:none;' id='he5' href='javascript:top.photoWeb.goSetTalkBalloonText(\""+this.name+"\");void(0);'>Edit</a></span></td></tr></table>";

			var imageURL = this.GetProcessedImageURL();

			t = "<div  id=background"+this.name+">";
			t += "<img id='"+this.name+"image'  src=" + imageURL + " width="+this.cstyle.width+" height="+this.cstyle.height+">";
			t += "<div style='position:absolute;top:0px;left:0px;' id=foreground"+this.name+">";
      //t += "<table border=0 cellpadding=10 cellspacing=0 width=" + this.cstyle.width + " height=" + this.cstyle.height + "><tr><td width=" + this.cstyle.width + " height=" + this.cstyle.height + " align=center valign=middle ><table border=0 cellpadding=10 cellspacing=0  width=90% height=80% ><tr><td width=100% height=100%  width=100% height=100%   align=center valign=middle id='" + this.name + "rawtext' ><span class='" + this.style.fontcss + "'>" + this.rawText + "&nbsp;</span></td></tr></table></td></tr></table></div>";

			EDITOR_WIDTH=30;
			t += "<div  id="+this.name+"editor style='background-color:"+DEFAULT_TITLECOLOR+";position:absolute;top:0px;left:"+(this.style.width - EDITOR_WIDTH)+"px;height:"+SIZER_HEIGHT+"px;z-index:"+(this.cstyle.zindex)+1+";width:"+EDITOR_WIDTH+"px;padding:2px;'><span align=right  style='color:white;text-align:right;text-decoration:none;font-size:10px;'><b><a style='color:white;text-decoration:none;' id='he5' href='javascript:top.photoWeb.goSetTalkBalloonText(\""+this.name+"\");void(0);'>Edit</a></span></div></div>";

    }
    else if( false )
    {
			t = "<div  id=background"+this.name+">";
//      t += "<table border=0  cellpadding=0 cellspacing=0 width=" + this.cstyle.width + " height=" + this.cstyle.height + "><tr>";
//      t += "<td onClick=top.photoWeb.toggleBorders('"+this.name+"') align=left>";
t += "<img id='"+this.name+"image'  src=" + this.talkBalloonPicture + " width="+this.cstyle.width+" height="+this.cstyle.height+">";
//t += "</td></tr></table></div>";
			t += "<div style='position:absolute;top:0px;left:0px;' id=foreground"+this.name+">";
      t += "<table border=0 cellpadding=10 cellspacing=0 width=" + this.cstyle.width + " height=" + this.cstyle.height + "><tr><td width=" + this.cstyle.width + " height=" + this.cstyle.height + " align=center valign=middle ><table border=0 cellpadding=10 cellspacing=0  width=90% height=80% ><tr><td width=100% height=100%  width=100% height=100%   align=center valign=middle id='" + this.name + "rawtext' ><span class='" + this.style.fontcss + "'>" + this.rawText + "&nbsp;</span></td></tr></table></td></tr></table></div>";

EDITOR_WIDTH=30;
			t += "<div  id="+this.name+"editor style='background-color:"+DEFAULT_TITLECOLOR+";position:absolute;top:0px;left:"+(this.style.width - EDITOR_WIDTH)+"px;height:"+SIZER_HEIGHT+"px;z-index:"+(this.cstyle.zindex)+1+";width:"+EDITOR_WIDTH+"px;padding:2px;'><span align=right  style='color:white;text-align:right;text-decoration:none;font-size:10px;'><b><a style='color:white;text-decoration:none;' id='he5' href='javascript:top.photoWeb.goSetTalkBalloonText(\""+this.name+"\");void(0);'>Edit</a></span></div></div>";

   	  mt = "<table id='he1' style='cursor:hand;' border=0 width=" +this.mstyle.width+ " height=" + this.mstyle.height + " cellpadding=" + BORDERSIZE + " cellspacing=0 width=" + this.mstyle.width + "><tr><td id='he2' align=right valign=bottom height=" + this.mstyle.height + "><b>" + this.mtext + "<span align=right  style='color:white;text-align:right;text-decoration:none;font-size:10px;'><b><a style='color:red;text-decoration:none;' id='he5' href='javascript:top.photoWeb.goSetTalkBalloonText(\""+this.name+"\");void(0);'>Edit</a></span></td></tr></table>";

    }
  	else if(this.smart)
    {
			t="<table id='"+this.name+"table' border=0 cellpadding=0 cellspacing=0 width=" + this.cstyle.width + " height=" + this.cstyle.height + "><tr  id='"+this.name+"tr' ><td align=left  id='"+this.name+"td' >" + t + "</table>";
   	  mt = "<table style='cursor:hand;' border=0 width=" +this.mstyle.width+ " height=" + this.mstyle.height + " cellpadding=" + BORDERSIZE + " cellspacing=0 width=" + this.mstyle.width + "><tr><td style='cursor:hand;' align=center valign=bottom height=" + this.mstyle.height + "><b>" + this.mtext + "</table>";
     // t = FontWrap(t, this.style);
    }


		if(browsertype==NS)
		{
			d=eval("this.div.document." + this.name + "content.document");
			d.open();
			d.write(t);
			d.close();
			d=eval("this.div.document." + this.name + "mover.document");
			d.open();
			d.write(mt);
			d.close();
		}
		else
		{
			DivWrite(eval( this.name + "content"), t);
      try
      {
  			DivWrite( eval(this.name + "mover"), mt);
      }
      catch(e){}
		}
		this.Setup();

	}
	
	function wGetProcessedImageURL()
	{
	  if( this.isTalkBalloon )
	  {
			return top.photoWeb.baseURL + "processimage.php?cmd=talkballoon"
					  	+ "&addOnImageURL=" + escape(this.imageUrl) 
					  	+ "&x=" 						+ escape(this.style.x) 
					  	+ "&y=" 						+ escape(this.style.y) 
					  	+ "&height=" 				+ escape(this.style.height) 
					  	+ "&width=" 				+ escape(this.style.width) 
					  	+ "&addOnText=" 		+ escape(this.text) ;
	  }
	  else
	  {
	    return this.imageUrl;
	  }
	}
	
	//////////////////////////////////////////////////////////////////////METHOD
	function wAdd(t)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		var d;

		if(!this.text)
			this.text="";

		if(typeof(t)=="object")
			this.text+=t.GetHTML();
		else
			this.text+=FontWrap(t, this.cstyle);		

		
		this.Paint();
	
		if(typeof(t)=="object")
		{
			if(browsertype==NS)
				d=eval("this.div.document." + this.name + "content.document." + t.name);
			else
				d=eval(t.name);

						
			t.div=d;

			this.Components[Components.length]=t;
			this.Components[this.Components.length-1]=t;
			this.Components[this.Components.length-1].Paint();
			this.Components[this.Components.length-1].Setup();

		}
		
	}	
  function wIsVisible()
  {
    return DivVisible(this.frame, this.name+"content");
  }
	//////////////////////////////////////////////////////////////////////METHOD
	function wHide()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
    this.HideExtras();
  	DivHide(this.frame, this.name+"content");
	}
  function wToggleExtras()
  {
		if(DivVisible(this.frame, this.name+"mover"))
		{
      this.HideExtras();
		}
    else
    {
      this.ShowExtras();
    }
    
  }
	//////////////////////////////////////////////////////////////////////METHOD
	function wHideExtras()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
    this.extrasShown = false;
    if( this.isImage || this.isTalkBalloon )
    {
    if( browsertype == SAFARI ) // KRG
      return;
    }
    else
    {
    	DivKillDisplay(this.frame, this.name);
    }
  	DivHide(this.frame, this.name);
  	DivHide(this.frame, this.name+"mover");
  	DivHide(this.frame, this.name+"hider");
  	DivHide(this.frame, this.name+"sizer");
  	DivHide(this.frame, this.name+"lb");
  	DivHide(this.frame, this.name+"tb");
  	DivHide(this.frame, this.name+"rb");
  	DivHide(this.frame, this.name+"bb");
    if( this.isTalkBalloon )
    	DivHide(this.frame, this.name+"editor");
	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wShow()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
    this.ShowExtras();
  	DivShow(this.frame, this.name+"content");
	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wShowExtras()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
    this.extrasShown = true;
    if( this.isImage || this.isTalkBalloon )
    {
    }
    else
    {
    	DivResurrectDisplay(this.frame, this.name);
    }
  	DivShow(this.frame, this.name);
    DivShow(this.frame, this.name+"mover");
    if( !this.positionFixed )
    {
      DivShow(this.frame, this.name+"sizer");
    	DivShow(this.frame, this.name+"hider");
    }
    
    DivShow(this.frame, this.name+"lb");
    DivShow(this.frame, this.name+"tb");
    DivShow(this.frame, this.name+"rb");
    DivShow(this.frame, this.name+"bb");
    if( this.isTalkBalloon )
    	DivShow(this.frame, this.name+"editor");
    
	}
	





/* IE specific functions */
	//////////////////////////////////////////////////////////////////////METHOD
	function wieRollUp()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		if(event.srcElement)
			id=event.srcElement.id.substring(0, event.srcElement.id.indexOf("hider"));
		else
			id=this.name;
		for(x=0;x<Components.length;x++)
		{
			if(Components[x].name==id)
				currentwin=Components[x];
		}
		if(currentwin.rolledup)
		{
			eval(id + ".style.clip='rect(0px  " + currentwin.style.width + "px " + currentwin.style.height + "px 0px)';");
			currentwin.rolledup=false;
		}
		else	
		{
			eval(id + ".style.clip='rect(0px  " + currentwin.style.width + "px " + TITLE_HEIGHT + "px 0px)';");
			currentwin.rolledup=true;
		} 
	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wieClose()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		if(event.srcElement)
			id=event.srcElement.id.substring(0, event.srcElement.id.indexOf("hider"));
		else
			id=this.name;

   	currentWin=componentManager.FindComponent(id);
    if( currentWin.positionFixed )
      return;
    currentWin.Hide();
    if( photoWeb )
      photoWeb.releaseAddWindow(id);
    if( photoWeb && (currentWin.isImage || currentWin.isTalkBalloon ) )
      photoWeb.findNewSelectedWindow();

	}
  
  var sizerDiv;
  var contentDiv;
  var mainDiv;
  var oldText;
  var img;
  var originalOffsetX;
  var originalOffsetY;
 	/////////////////////////////.////////////////////////////////////////method
	function wieGoResize()
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		id = event.srcElement.id.substring(0, event.srcElement.id.indexOf("sizer"));
    currentwin  = componentManager.FindComponent(id);
    top.photoWeb.setSelectedWindow(currentwin);
    currentwin.ToTop();
    contentDiv  = eval(id + "content");
    sizerDiv    = eval(id + "sizer");
    mainDiv     = eval(id);
    if( currentwin.isImage || currentwin.isTalkBalloon )
    {
      //DivHide(self, id + "mover");	
      DivHide(self, id + "hider");	
      DivHide(self, id + "rb");	
      DivHide(self, id + "lb");	
      DivHide(self, id + "tb");
      DivHide(self, id + "bb");		
      DivClip(self, currentwin.GetDivName(), 0, 5000, 5000, 0);     
  		contentDiv.style.clip='rect(0px ' + '5000' + 'px ' + '5000' + 'px 0px)';
      img = document.getElementById(currentwin.name+"image");
      if( currentwin.isTalkBalloon )
        DivHide(self, id + "editor");	
    }
    
    var div = eval(id);    
		if( div )
		{
      origwidth = div.offsetLeft;
      origheight = div.offsetTop;
		}
    document.onmousemove = wieResizeIt;
		document.onmouseup   = wieStopResize;
    originalOffsetX = event.offsetX;
    originalOffsetY = event.offsetY;
      
	}
  ////////////////////////////////////////////////////////////////////////////ie
  function wieResizeIt()
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    document.selection.empty();
  	if(id!="" && event.clientX - origwidth > 10 && event.clientY - origheight > 10)
  	{
    
      ieLastX = event.clientX ;
      ieLastY = event.clientY ;
      newWidth = event.clientX - origwidth;
      newHeight = event.clientY - origheight;
      
/*      if( event.shiftKey )
      {
        if( newWidth - origwidth > newHeight - origheight )
        {
          newHeight = ( origwidth / origheight ) * newWidth;
        }
      }*/

      if( currentwin.isImage || currentwin.isTalkBalloon )
      {
        // moving outer div and title here make this r eally slow in ie
        // moved to stopresize
        //	
        //
        //
    		//
        img.width = newWidth;
        img.height = newHeight;
      }
      else
      {
    	  //
        DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
    		contentDiv.style.width = newWidth; 
    		contentDiv.style.height = newHeight;
  		  contentDiv.style.clip='rect(0px ' + (newWidth) + 'px ' + (newHeight) + 'px 0px)';
         
        // borders
    		eval(id + "rb.style.left=event.clientX - BORDERSIZE - " + currentwin.style.x ); 
    		eval(id + "bb.style.top=event.clientY - BORDERSIZE - " + currentwin.style.y );    
    		eval(id + "lb.style.height=event.clientY;");
    		eval(id + "rb.style.height=(event.clientY" + " + " +currentwin.style.height+");");    
    		eval(id + "bb.style.width=(event.clientX" + " + " +currentwin.style.width+");");    
    		eval(id + "tb.style.width=event.clientX;");        
        
        // ie is top, right, bottom , left
    		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (event.clientY) + "px 0px )';");
    		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (event.clientY + currentwin.style.height) + "px 0px )';");      
    		eval(id + "bb.style.clip='rect(0px " + (event.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
    		eval(id + "tb.style.clip='rect(0px " + event.clientX + "px " + BORDERSIZE + "px 0px )';");            
      }
 		// we must move our sizer to the new bottom left of the guy
  		sizerDiv.style.left = newWidth  - SIZER_WIDTH/2;
  		sizerDiv.style.top  = newHeight - SIZER_HEIGHT/2;
      event.cancelBubble = true;
  	}
  	return false;
  }
  ////////////////////////////////////////////////////////////////////////////ie
  function wieStopResize()
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    top.photoWeb.setSelectedWindow( currentwin);
    if( currentwin.isImage || currentwin.isTalkBalloon )
    {
  		sizerDiv.style.top   = img.height  - SIZER_HEIGHT;
  		sizerDiv.style.left  = img.width - SIZER_WIDTH;

      DivSize(self, currentwin.GetDivName(), img.width, img.height );
      DivClip(self, currentwin.GetDivName(), 0, img.width, img.height , 0);     
      //DivClip(self, currentwin.GetMoverDivName(), 0, img.width, currentwin.mstyle.height, 0); 
      //DivSize(self, currentwin.GetMoverDivName(), img.width, currentwin.mstyle.height);
  		eval(id + "rb.style.left=event.clientX - BORDERSIZE - " + currentwin.style.x ); 
      var newTop = (img.height  - BORDERSIZE);
  		eval(id + "bb.style.top=" + newTop );
    	eval(id + "lb.style.height=event.clientY;");
  		eval(id + "rb.style.height=(event.clientY" + " + " +currentwin.style.height+");");    
  		eval(id + "bb.style.width=(event.clientX" + " + " +currentwin.style.width+");");    
  		eval(id + "tb.style.width=event.clientX;");        
      
      // ie is top, right, bottom , left
  		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (event.clientY) + "px 0px )';");
  		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (event.clientY + currentwin.style.height) + "px 0px )';");      
  		eval(id + "bb.style.clip='rect(0px " + (event.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
  		eval(id + "tb.style.clip='rect(0px " + event.clientX + "px " + BORDERSIZE + "px 0px )';");            
      currentwin.cstyle.height=event.clientY - origheight;
      if( currentwin.isTalkBalloon )
        DivShow(self, id + "editor");	
    }
    else
    {
  		sizerDiv.style.left = (event.clientX - origwidth)  - SIZER_WIDTH;
  		sizerDiv.style.top  = (event.clientY - origheight) - SIZER_HEIGHT;
      DivSize(self, currentwin.GetDivName(), ieLastX - origwidth, ieLastY - origheight);
      DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
      DivClip(self, currentwin.GetMoverDivName(), 0, ieLastX, currentwin.mstyle.height, 0); 
      DivSize(self, currentwin.GetMoverDivName(), ieLastX, currentwin.mstyle.height);
  		eval(id + "rb.style.left=event.clientX - BORDERSIZE - " + currentwin.style.x ); 
  		eval(id + "bb.style.top=event.clientY - BORDERSIZE - " + currentwin.style.y );    
  		eval(id + "lb.style.height=event.clientY;");
  		eval(id + "rb.style.height=(event.clientY" + " + " +currentwin.style.height+");");    
  		eval(id + "bb.style.width=(event.clientX" + " + " +currentwin.style.width+");");    
  		eval(id + "tb.style.width=event.clientX;");        
      
      // ie is top, right, bottom , left
  		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (event.clientY) + "px 0px )';");
  		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (event.clientY + currentwin.style.height) + "px 0px )';");      
  		eval(id + "bb.style.clip='rect(0px " + (event.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
  		eval(id + "tb.style.clip='rect(0px " + event.clientX + "px " + BORDERSIZE + "px 0px )';");            
    currentwin.cstyle.height=event.clientY - origheight-currentwin.rstyle.height;
    }  
    DivShow(self, currentwin.name + "hider");	
    DivShow(self, currentwin.name + "mover");	
    DivShow(self, id + "rb");	
    DivShow(self, id + "lb");	
    DivShow(self, id + "tb");
    DivShow(self, id + "bb");		
    //resset styles
    currentwin.mstyle.width=event.clientX - origwidth;
    currentwin.style.width=event.clientX - origwidth;
    currentwin.style.height=event.clientY - origheight;
    currentwin.cstyle.width=event.clientX - origwidth;
    
    document.onmousemove=null;
    document.onmouseup=null;
    currentwin.Paint();
  }
  fromMover = false;
	//////////////////////////////////////////////////////////////////////METHOD
	function wieGoMove(e, fm)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
    id          = this.name;
   	currentwin  = this;
    top.photoWeb.setSelectedWindow(currentwin);
    if( currentwin.positionFixed )
      return;
    fromMover = fm;
    currentwin.ToTop();
		document.onmousemove=wieMoveIt;
		document.onmouseup=wieStopMove;
		clickx=event.offsetX;
		clicky=event.offsetY;

    event.cancelBubble = true;
    event.returnValue=false;
    
    if( currentwin.isTalkBalloon )
      DivHide(self, id + "editor");	
    if( currentwin.isImage || currentwin.isTalkBalloon )
    {
      DivHide(self, id + "sizer");	
      DivHide(self, id + "hider");	
      DivHide(self, id + "mover");	
      DivHide(self, id + "rb");	
      DivHide(self, id + "lb");	
      DivHide(self, id + "tb");
      DivHide(self, id + "bb");		
    }
      

    return false;
	}
  ////////////////////////////////////////////////////////////////////////////ie
  function wieMoveIt()
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    document.selection.empty();

  	if(id!="" )
  	{
      if( fromMover )
      {
    		eval(id + ".style.left=Math.round(event.clientX - clickx);");
    		eval(id + ".style.top=Math.round(event.clientY - clicky);");
       	currentwin.style.y = Math.round(event.clientY - clicky);
      }
      else
      {
    		eval(id + ".style.left=Math.round(event.clientX - clickx);");
    		eval(id + ".style.top=Math.round(event.clientY - clicky);");
      	currentwin.style.y=Math.round(event.clientY - clicky);
      }
    	currentwin.style.x=Math.round(event.clientX - clickx);
  	}
    event.cancelBubble = true;
    event.returnValue=false;

  	return true;
  }
  ////////////////////////////////////////////////////////////////////////////ie
  function wieStopMove()
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    if( currentwin.isImage || currentwin.isTalkBalloon )
    {
      if( currentwin.isTalkBalloon )
        DivShow(self, id + "editor");	
      DivShow(self, id + "sizer");	
      DivShow(self, id + "hider");	
      DivShow(self, id + "mover");	
      DivShow(self, id + "rb");	
      DivShow(self, id + "lb");	
      DivShow(self, id + "tb");
      DivShow(self, id + "bb");		
    }
  	document.onmousemove=null;
  	document.onmouseup=null;
  }
/* end IE specific functions */

/* MZ specific functions */
  //////////////////////////////////////////////////////////////////////METHOD
  function wmzClose(e)
  //
  ////////////////////////////////////////////////////////////////////////////
  {
    if(e.target)
    	id=e.target.id.substring(0, e.target.id.indexOf("hider"));
    else
    	id=this.name;
  
   	currentWin=componentManager.FindComponent(id);
    if( currentWin.positionFixed )
      return;
    currentWin.Hide();
    if( photoWeb )
      photoWeb.releaseAddWindow(id);

    if( photoWeb && (currentWin.isImage || currentWin.isTalkBalloon ) )
      photoWeb.findNewSelectedWindow();

  }
	//////////////////////////////////////////////////////////////////////METHOD
	function wmzRollUp(e)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		if(e.target)
			id=event.target.id.substring(0, event.srcElement.id.indexOf("hider"));
		else
			id=this.name;
    
		for(x=0;x<Components.length;x++)
		{
			if(Components[x].name==id)
				currentwin=Components[x];
		}
		if(currentwin.rolledup)
		{
			eval(id + ".style.clip='rect(0px  " + currentwin.style.width + "px " + currentwin.style.height + "px 0px)';");
			currentwin.rolledup=false;
		}
		else	
		{
			eval(id + ".style.clip='rect(0px  " + currentwin.style.width + "px " + TITLE_HEIGHT + "px 0px)';");
			currentwin.rolledup=true;
		} 
	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wmzGoMove(e, fm)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
    id          = this.name;
   	currentwin  = this;
    top.photoWeb.setSelectedWindow(currentwin);
    if( currentwin.positionFixed )
      return;
      
    fromMover = fm;

   // currentwin.ToTop();
    e.cancelBubble = true;
    e.returnValue = false;
		document.onmousemove=wmzMoveIt;
		document.onmouseup=wieStopMove;
		clickx=e.pageX - currentwin.style.x;
		clicky=e.pageY - currentwin.style.y;
    if( currentwin.isImage || currentwin.isTalkBalloon )
    {
      if( currentwin.isTalkBalloon )
        DivHide(self, id + "editor");	
      DivHide(self, id + "sizer");	
      DivHide(self, id + "hider");	
      DivHide(self, id + "mover");	
      DivHide(self, id + "rb");	
      DivHide(self, id + "lb");	
      DivHide(self, id + "tb");
      DivHide(self, id + "bb");		
    }
    return false;
	}
  ////////////////////////////////////////////////////////////////////////////ie
  function wmzMoveIt(e)
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    top.getSelection().removeAllRanges();
  	if(id!="" )
  	{
  		eval(id + ".style.left = Math.round(e.clientX - clickx);");
  		eval(id + ".style.top  = Math.round(e.clientY - clicky);");
    	currentwin.style.x = Math.round(e.clientX - clickx);
    	currentwin.style.y = Math.round(e.clientY - clicky);
  	}
  	return false;
  } 
	/////////////////////////////.////////////////////////////////////////method
	function wmzGoResize(e)
  //
  ////////////////////////////////////////////////////////////////////////////
	{

		id = e.target.id.substring(0, e.target.id.indexOf("sizer"));
    if( id.indexOf("image") > -1 )
      return false;
    DivHide(self, id + "mover");	
    
    contentDiv  = eval(id + "content");
    sizerDiv    = eval(id + "sizer");
    mainDiv     = eval(id);

		if(id!="")
		{
			eval("origwidth=" + id + ".offsetLeft;");
			eval("origheight=" + id + ".offsetTop;");
		}
		else
			top.status=e.srcElement.className;

		///////find out which object we are working with
    currentwin = componentManager.FindComponent(id);
    if( currentwin.positionFixed )
      return false;
    top.photoWeb.setSelectedWindow(currentwin);
    if( currentwin.positionFixed )
      return;
    currentwin.ToTop();
    if( currentwin.isImage || currentwin.isTalkBalloon )
    {
      img = document.getElementById(currentwin.name+"image");
      DivHide(self, id + "rb");	
      DivHide(self, id + "lb");	
      DivHide(self, id + "tb");
      DivHide(self, id + "bb");		
      if( currentwin.isTalkBalloon )
      	DivHide(currentwin.frame, currentwin.name+"editor");
      DivClip(self, currentwin.GetDivName(), 0, 5000, 5000, 0);     
  		contentDiv.style.clip='rect(0px ' + '5000' + 'px ' + '5000' + 'px 0px)';
    }
		document.onmousemove=wmzResizeIt;
		document.onmouseup=wmzStopResize;
	}
  ////////////////////////////////////////////////////////////////////////////ie
  function wmzResizeIt(e)
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    if( id.indexOf("image") > -1 )
      return false;
    top.getSelection().removeAllRanges();
    if( currentwin.positionFixed )
      return false;
  	if(id!="" && e.clientX - origwidth > 10 && e.clientY - origheight > 10)
  	{
    
      ieLastX = e.clientX ;
      ieLastY = e.clientY ;
      newWidth = e.clientX - origwidth;
      newHeight = e.clientY - origheight;

      if( currentwin.isImage || currentwin.isTalkBalloon )
      {
        // moving outer div and title here make this r eally slow in ie
        // moved to stopresize
        //	
        //
        //
    		//
        img = document.getElementById(currentwin.name+"image");
        img.width = newWidth;
        img.height = newHeight;
      }
      else
      {
    	  //
        DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
    		contentDiv.style.width = newWidth; 
    		contentDiv.style.height = newHeight;
  		  contentDiv.style.clip='rect(0px ' + (newWidth) + 'px ' + (newHeight) + 'px 0px)';
         
        // borders
    		eval(id + "rb.style.left=e.clientX - BORDERSIZE - " + currentwin.style.x ); 
    		eval(id + "bb.style.top=e.clientY - BORDERSIZE - " + currentwin.style.y );    
    		eval(id + "lb.style.height=e.clientY;");
    		eval(id + "rb.style.height=(e.clientY" + " + " +currentwin.style.height+");");    
    		eval(id + "bb.style.width=(e.clientX" + " + " +currentwin.style.width+");");    
    		eval(id + "tb.style.width=e.clientX;");        
        
        // ie is top, right, bottom , left
    		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY) + "px 0px )';");
    		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY + currentwin.style.height) + "px 0px )';");      
    		eval(id + "bb.style.clip='rect(0px " + (e.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
    		eval(id + "tb.style.clip='rect(0px " + e.clientX + "px " + BORDERSIZE + "px 0px )';");            
      }
 		// we must move our sizer to the new bottom left of the guy
  		sizerDiv.style.left = newWidth  - SIZER_WIDTH;
  		sizerDiv.style.top  = newHeight - SIZER_HEIGHT;
      e.cancelBubble = true;
  	}
  	return false;
  }
  
  ////////////////////////////////////////////////////////////////////////////ie
  function wmzResizeIt1(e)
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    if( id.indexOf("image") > -1 )
      return false;
  	if(id!="" && e.clientX - origwidth > 10 && e.clientY - origheight > 10)
  	{
  	  //
      // moving outer div and title here make this really slow in ie
      // moved to stopresize
      //	
      ieLastX = e.clientX;
      ieLastY = e.clientY;    
      DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
      
  		// content
  		eval(id + "content.style.clip='rect(0px  " + (e.clientX - origwidth) + "px " + (e.clientY - origheight - SIZER_HEIGHT) + "px 0px)';");
  		eval(id + "content.style.width=e.clientX - origwidth;");
  		eval(id + "content.style.height=e.clientY - origheight-SIZER_HEIGHT;");
       
      if( currentwin.isImage || currentwin.isTalkBalloon )
      {
        newWidth = e.clientX - origwidth;
        newHeight = e.clientY - origheight;
        img.width = newWidth;
        img.height = newHeight - SIZER_HEIGHT;
      }
      // borders
  		eval(id + "rb.style.left=e.clientX - BORDERSIZE - " + currentwin.style.x ); 
  		eval(id + "bb.style.top=e.clientY - BORDERSIZE - " + currentwin.style.y );    
  		eval(id + "lb.style.height=e.clientY;");
  		eval(id + "rb.style.height=(e.clientY" + " + " +currentwin.style.height+");");    
  		eval(id + "bb.style.width=(e.clientX" + " + " +currentwin.style.width+");");    
  		eval(id + "tb.style.width=e.clientX;");        
      
      // ie is top, right, bottom , left
  		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY) + "px 0px )';");
  		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY + currentwin.style.height) + "px 0px )';");      
  		eval(id + "bb.style.clip='rect(0px " + (e.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
  		eval(id + "tb.style.clip='rect(0px " + e.clientX + "px " + BORDERSIZE + "px 0px )';");            
     			
  		// we must move our sizer to the new bottom left of the guy
  		eval(id + "sizer.style.left=e.clientX-origwidth-SIZER_WIDTH");
  		eval(id + "sizer.style.top=e.clientY-origheight-SIZER_HEIGHT");
    }
  	return false;
  }
  ////////////////////////////////////////////////////////////////////////////ie
  function wmzStopResize(e)
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    if( id.indexOf("image") > -1 )
      return false;
    if( currentwin.positionFixed )
      return false;
    if( currentwin.isImage || currentwin.isTalkBalloon )
    {
  		sizerDiv.style.top  = img.height - SIZER_HEIGHT;
      DivSize(self, currentwin.GetDivName(), img.width, img.height );
      DivClip(self, currentwin.GetDivName(), 0, img.width, img.height, 0);     
  		eval(id + "rb.style.left=e.clientX - BORDERSIZE - " + currentwin.style.x ); 
      var newTop = (img.height + - BORDERSIZE);
  		eval(id + "bb.style.top=" + newTop );
    	eval(id + "lb.style.height=e.clientY;");
  		eval(id + "rb.style.height=(e.clientY" + " + " +currentwin.style.height+");");    
  		eval(id + "bb.style.width=(e.clientX" + " + " +currentwin.style.width+");");    
  		eval(id + "tb.style.width=e.clientX;");        
      
      // ie is top, right, bottom , left
  		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY) + "px 0px )';");
  		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY + currentwin.style.height) + "px 0px )';");      
  		eval(id + "bb.style.clip='rect(0px " + (e.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
  		eval(id + "tb.style.clip='rect(0px " + e.clientX + "px " + BORDERSIZE + "px 0px )';");            
    currentwin.cstyle.height=e.clientY - origheight;
    }
    else
    {
      DivSize(self, currentwin.GetDivName(), ieLastX - origwidth, ieLastY - origheight);
      DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
      DivClip(self, currentwin.GetMoverDivName(), 0, ieLastX, currentwin.mstyle.height, 0); 
      DivSize(self, currentwin.GetMoverDivName(), ieLastX, currentwin.mstyle.height);
  		eval(id + "rb.style.left=e.clientX - BORDERSIZE - " + currentwin.style.x ); 
  		eval(id + "bb.style.top=e.clientY - BORDERSIZE - " + currentwin.style.y );    
  		eval(id + "lb.style.height=e.clientY;");
  		eval(id + "rb.style.height=(e.clientY" + " + " +currentwin.style.height+");");    
  		eval(id + "bb.style.width=(e.clientX" + " + " +currentwin.style.width+");");    
  		eval(id + "tb.style.width=e.clientX;");        
      
      // ie is top, right, bottom , left
  		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY) + "px 0px )';");
  		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY + currentwin.style.height) + "px 0px )';");      
  		eval(id + "bb.style.clip='rect(0px " + (e.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
  		eval(id + "tb.style.clip='rect(0px " + e.clientX + "px " + BORDERSIZE + "px 0px )';");            
    currentwin.cstyle.height=e.clientY - origheight-currentwin.rstyle.height;
    }  
    DivShow(self, currentwin.name + "mover");	
    DivShow(self, id + "rb");	
    DivShow(self, id + "lb");	
    DivShow(self, id + "tb");
    DivShow(self, id + "bb");		
    if( currentwin.isTalkBalloon )
    	DivShow(currentwin.frame, currentwin.name+"editor");
    //resset styles
    currentwin.mstyle.width=e.clientX - origwidth;
    currentwin.style.width=e.clientX - origwidth;
    currentwin.style.height=e.clientY - origheight;
    currentwin.cstyle.width=e.clientX - origwidth;
    
    document.onmousemove=null;
    document.onmouseup=null;
    currentwin.Paint();
  }
  ////////////////////////////////////////////////////////////////////////////ie
  function wmzStopResize1(e)
  //
  //////////////////////////////////////////////////////////////////////////////
  {
    DivSize(self, currentwin.GetDivName(), ieLastX - origwidth, ieLastY - origheight);
    DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
    DivSize(self, currentwin.GetMoverDivName(), ieLastX, currentwin.mstyle.height);
    DivClip(self, currentwin.GetMoverDivName(), 0, ieLastX, currentwin.mstyle.height, 0); 
    DivShow(self, currentwin.name + "mover");	
    
    //resset styles
    currentwin.mstyle.width=e.clientX - origwidth;
    currentwin.style.width=e.clientX - origwidth;
    currentwin.style.height=e.clientY - origheight;
    currentwin.cstyle.width=e.clientX - origwidth;
    currentwin.cstyle.height=e.clientY - origheight-currentwin.rstyle.height;
    document.onmousemove=null;
    document.onmouseup=null;
    currentwin.Paint();
  }
/* end MZ specific functions */

// KRG BEGIN
/* SF specific functions */
//////////////////////////////////////////////////////////////////////METHOD
function wsfGoMove(e, fm)
//
////////////////////////////////////////////////////////////////////////////
{
	id = this.name;
	currentwin = this;
	top.photoWeb.setSelectedWindow(currentwin);
	if ( currentwin.positionFixed )
	{
		return;
	}

	fromMover = fm;

	// currentwin.ToTop();
	e.cancelBubble = true;
	e.returnValue = false;
	document.onmousemove=wsfMoveIt; // KRG
	document.onmouseup=wieStopMove;
	clickx=e.pageX - currentwin.style.x;
	clicky=e.pageY - currentwin.style.y;
	if( currentwin.isImage || currentwin.isTalkBalloon )
	{
		if( currentwin.isTalkBalloon )
		{
			DivHide(self, id + "editor");
		}	
		DivHide(self, id + "sizer");	
		DivHide(self, id + "hider");	
		DivHide(self, id + "mover");	
		DivHide(self, id + "rb");	
		DivHide(self, id + "lb");	
		DivHide(self, id + "tb");
		DivHide(self, id + "bb");		
	}
	return false;
}

//////////////////////////////////////////////////////////////////////METHOD
function wsfMoveIt(e)
//
////////////////////////////////////////////////////////////////////////////
{
	//top.getSelection().removeAllRanges(); // KRG
	if(id!="" )
	{
		eval(id + ".style.left = Math.round(e.clientX - clickx);");
		eval(id + ".style.top  = Math.round(e.clientY - clicky);");
		currentwin.style.x = Math.round(e.clientX - clickx);
		currentwin.style.y = Math.round(e.clientY - clicky);
	}
	return false;
}

//////////////////////////////////////////////////////////////////////METHOD
function wsfGoResize(e)
//
////////////////////////////////////////////////////////////////////////////
{
	id = e.target.id.substring(0, e.target.id.indexOf("sizer"));
	if( id.indexOf("image") > -1 )
	{
		return false;
	}
	DivHide(self, id + "mover");	

	contentDiv  = eval(id + "content");
	sizerDiv    = eval(id + "sizer");
	mainDiv     = eval(id);

	if(id!="")
	{
		eval("origwidth=" + id + ".offsetLeft;");
		eval("origheight=" + id + ".offsetTop;");
	}
	else
	{
		top.status=e.srcElement.className;
	}

	///////find out which object we are working with
	currentwin = componentManager.FindComponent(id);
	if( currentwin.positionFixed )
	{
		return false;
	}
	top.photoWeb.setSelectedWindow(currentwin);
	if( currentwin.positionFixed )
	{
		return;
	}
	currentwin.ToTop();
	if( currentwin.isImage || currentwin.isTalkBalloon )
	{
		img = document.getElementById(currentwin.name+"image");
		DivHide(self, id + "rb");	
		DivHide(self, id + "lb");	
		DivHide(self, id + "tb");
		DivHide(self, id + "bb");		
		if( currentwin.isTalkBalloon )
		{
		      	DivHide(currentwin.frame, currentwin.name+"editor");
		}
		DivClip(self, currentwin.GetDivName(), 0, 5000, 5000, 0);     
		contentDiv.style.clip='rect(0px ' + '5000' + 'px ' + '5000' + 'px 0px)';
	}
	document.onmousemove=wsfResizeIt; // KRG
	document.onmouseup=wsfStopResize; // KRG
}

//////////////////////////////////////////////////////////////////////METHOD
function wsfResizeIt(e)
//
////////////////////////////////////////////////////////////////////////////
{
	if( id.indexOf("image") > -1 )
	{
		return false;
	}
	//top.getSelection().removeAllRanges(); // KRG
	if( currentwin.positionFixed )
	{
		return false;
	}
  	if(id!="" && e.clientX - origwidth > 10 && e.clientY - origheight > 10)
  	{
		ieLastX = e.clientX ;
		ieLastY = e.clientY ;
		newWidth = e.clientX - origwidth;
		newHeight = e.clientY - origheight;

		if( currentwin.isImage || currentwin.isTalkBalloon )
		{
		// moving outer div and title here make this r eally slow in ie
		// moved to stopresize
		//	
		//	
		//	
		//	
		img = document.getElementById(currentwin.name+"image");
		img.width = newWidth;
		img.height = newHeight;
		}
		else
		{
			DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
			contentDiv.style.width = newWidth; 
			contentDiv.style.height = newHeight;
			contentDiv.style.clip='rect(0px ' + (newWidth) + 'px ' + (newHeight) + 'px 0px)';

			// borders
			eval(id + "rb.style.left=e.clientX - BORDERSIZE - " + currentwin.style.x ); 
			eval(id + "bb.style.top=e.clientY - BORDERSIZE - " + currentwin.style.y );    
			eval(id + "lb.style.height=e.clientY;");
			eval(id + "rb.style.height=(e.clientY" + " + " +currentwin.style.height+");");    
			eval(id + "bb.style.width=(e.clientX" + " + " +currentwin.style.width+");");    
			eval(id + "tb.style.width=e.clientX;");        

			// ie is top, right, bottom , left
			eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY) + "px 0px )';");
			eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY + currentwin.style.height) + "px 0px )';");      
			eval(id + "bb.style.clip='rect(0px " + (e.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
			eval(id + "tb.style.clip='rect(0px " + e.clientX + "px " + BORDERSIZE + "px 0px )';");            
		}
		// we must move our sizer to the new bottom left of the guy
		sizerDiv.style.left = newWidth  - SIZER_WIDTH;
		sizerDiv.style.top  = newHeight - SIZER_HEIGHT;
		e.cancelBubble = true;
	}
	return false;
}

//////////////////////////////////////////////////////////////////////METHOD
function wsfStopResize(e)
//
////////////////////////////////////////////////////////////////////////////
{
	if( id.indexOf("image") > -1 )
	{
		return false;
	}
	if( currentwin.positionFixed )
	{
		return false;
	}
	if( currentwin.isImage || currentwin.isTalkBalloon )
	{
		sizerDiv.style.top  = img.height - SIZER_HEIGHT;
		DivSize(self, currentwin.GetDivName(), img.width, img.height );
		DivClip(self, currentwin.GetDivName(), 0, img.width, img.height, 0);     
		eval(id + "rb.style.left=e.clientX - BORDERSIZE - " + currentwin.style.x ); 
		var newTop = (img.height + - BORDERSIZE);
		eval(id + "bb.style.top=" + newTop );

		eval(id + "lb.style.height=img.height;");
		eval(id + "rb.style.height=img.height;");
		eval(id + "tb.style.width=img.width;");
		eval(id + "bb.style.width=img.width;");

		//eval(id + "lb.style.height=e.clientY;");
		//eval(id + "rb.style.height=(e.clientY" + " + " +currentwin.style.height+");");    
		//eval(id + "bb.style.width=(e.clientX" + " + " +currentwin.style.width+");");    
		//eval(id + "tb.style.width=e.clientX;");        

		// ie is top, right, bottom , left
		//eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY) + "px 0px )';");
		//eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY + currentwin.style.height) + "px 0px )';");      
		//eval(id + "bb.style.clip='rect(0px " + (e.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
		//eval(id + "tb.style.clip='rect(0px " + e.clientX + "px " + BORDERSIZE + "px 0px )';");            
		currentwin.cstyle.height=e.clientY - origheight;
	}
	else
	{
		DivSize(self, currentwin.GetDivName(), ieLastX - origwidth, ieLastY - origheight);
		DivClip(self, currentwin.GetDivName(), 0, ieLastX-origwidth, ieLastY - origheight, 0);     
		DivClip(self, currentwin.GetMoverDivName(), 0, ieLastX, currentwin.mstyle.height, 0); 
		DivSize(self, currentwin.GetMoverDivName(), ieLastX, currentwin.mstyle.height);
		eval(id + "rb.style.left=e.clientX - BORDERSIZE - " + currentwin.style.x ); 
		eval(id + "bb.style.top=e.clientY - BORDERSIZE - " + currentwin.style.y );    
		eval(id + "lb.style.height=e.clientY;");
		eval(id + "rb.style.height=(e.clientY" + " + " +currentwin.style.height+");");    
		eval(id + "bb.style.width=(e.clientX" + " + " +currentwin.style.width+");");    
		eval(id + "tb.style.width=e.clientX;");        

		// ie is top, right, bottom , left
		eval(id + "lb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY) + "px 0px )';");
		eval(id + "rb.style.clip='rect(0px " + BORDERSIZE + "px " + (e.clientY + currentwin.style.height) + "px 0px )';");      
		eval(id + "bb.style.clip='rect(0px " + (e.clientX + currentwin.style.width) + "px " + BORDERSIZE + "px 0px )';");            
		eval(id + "tb.style.clip='rect(0px " + e.clientX + "px " + BORDERSIZE + "px 0px )';");            
		currentwin.cstyle.height=e.clientY - origheight-currentwin.rstyle.height;
	}
	DivShow(self, currentwin.name + "mover");	
	DivShow(self, id + "rb");	
	DivShow(self, id + "lb");	
	DivShow(self, id + "tb");
	DivShow(self, id + "bb");		
	if( currentwin.isTalkBalloon )
	{
		DivShow(currentwin.frame, currentwin.name+"editor");
	}
	//reset styles
	currentwin.mstyle.width=e.clientX - origwidth;
	currentwin.style.width=e.clientX - origwidth;
	currentwin.style.height=e.clientY - origheight;
	currentwin.cstyle.width=e.clientX - origwidth;

	document.onmousemove=null;
	document.onmouseup=null;
	currentwin.Paint();
}

/* end SF specific functions */
// KRG END

/* NS specific functions */
	//////////////////////////////////////////////////////////////////////METHOD
 	function wGoMove(e)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		this.ToTop();	
		if(e.which==1)
		{
			currentdiv=this.div;//eval("document." + this.name);
			top.status=e.target;
			document.captureEvents(Event.MOUSEUP|Event.MOUSEMOVE);
			clickX=e.pageX-currentdiv.left;
			clickY=e.pageY-currentdiv.top;		
	
			document.onmousemove=wMoveIt;
			document.onmouseup=wStopMove;
		}
	
	}
	//////////////////////////////////////////////////////////////////////METHOD
	function wGoResize(e)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		currentdiv=eval("document." + this.name);
		currentwin=this;
    this.ToTop();
		if(e.which==1)
		{
			document.captureEvents(Event.MOUSEUP|Event.MOUSEMOVE);
			document.onmousemove=wResizeIt;
			document.onmouseup=wStopResize;
		}
	}
////////////////////////////////////////////////////////////////////////////ns
function wStopMove()
//
//////////////////////////////////////////////////////////////////////////////
{
	document.releaseEvents(Event.MOUSEUP|Event.MOUSEMOVE);
}
//////////////////////////////////////////////////////////////////////////////
function wMoveIt(e)
//
//////////////////////////////////////////////////////////////////////////////
{
		x=x+1;
		wBufferMoveIt(e);
}
//////////////////////////////////////////////////////////////////////////////
function wBufferMoveIt(e)
//
//////////////////////////////////////////////////////////////////////////////
{
  DivMove(currentdiv, e.pageY-clickY, e.pageX-clickX);	
}

//////////////////////////////////////////////////////////////////////////////
function wStopResize()
// called after resize is done
//////////////////////////////////////////////////////////////////////////////
{
	document.releaseEvents(Event.MOUSEUP|Event.MOUSEMOVE);
	currentwin.Paint();
}
//////////////////////////////////////////////////////////////////////////////
function wResizeIt(e)
// resize code for NS
//////////////////////////////////////////////////////////////////////////////
{

  if(e.pageX-currentdiv.left < 100 || e.pageY-currentdiv.top < 100)
  {
  	
  }
  else
  {
  
  	currentdiv.width=e.pageX-currentdiv.left;
  	currentdiv.clip.width=e.pageX-currentdiv.left;
  	currentdiv.height=e.pageY-currentdiv.top;	
  	currentdiv.clip.height=e.pageY-currentdiv.top;	
  
  	eval("currentdiv.document." + currentdiv.id + "content.width=e.pageX-currentdiv.left;");
  	eval("currentdiv.document." + currentdiv.id + "content.clip.width=e.pageX-currentdiv.left;");
  	eval("currentdiv.document." + currentdiv.id + "content.height=e.pageY-currentdiv.top-SIZER_HEIGHT;");		
  	eval("currentdiv.document." + currentdiv.id + "content.clip.height=e.pageY-currentdiv.top-SIZER_HEIGHT;");
  
  	eval("currentdiv.document." + currentdiv.id + "rb.height=e.pageY + currentdiv.top;");
  	eval("currentdiv.document." + currentdiv.id + "rb.clip.height=e.pageY + currentdiv.top;");  
  	eval("currentdiv.document." + currentdiv.id + "lb.height=e.pageY + currentdiv.top;");
  	eval("currentdiv.document." + currentdiv.id + "lb.clip.height=e.pageY + currentdiv.top;");  
  	eval("currentdiv.document." + currentdiv.id + "tb.width=e.pageX+currentdiv.left;");
  	eval("currentdiv.document." + currentdiv.id + "tb.clip.width=e.pageX+currentdiv.left;");  
  	eval("currentdiv.document." + currentdiv.id + "bb.width=e.pageX+currentdiv.left;");
  	eval("currentdiv.document." + currentdiv.id + "bb.clip.width=e.pageX+currentdiv.left;");  
  	eval("currentdiv.document." + currentdiv.id + "mover.width=e.pageX;");
  	eval("currentdiv.document." + currentdiv.id + "mover.height=e.pageY;");
  	eval("currentdiv.document." + currentdiv.id + "mover.clip.width=e.pageX;");
  
  	eval("currentdiv.document." + currentdiv.id + "rb.left=currentdiv.width-BORDERSIZE");  	
  	eval("currentdiv.document." + currentdiv.id + "bb.top=currentdiv.height-BORDERSIZE");  	  
  	///////set teh styles since we have moved this stuff
  	currentwin.mstyle.width=e.pageX-currentdiv.left;
  	currentwin.style.width=e.pageX-currentdiv.left;
  	currentwin.style.height=e.pageY-currentdiv.top;
    currentwin.lbstyle.height=e.pageY;
    currentwin.rbstyle.height=e.pageY;
    currentwin.bbstyle.width=e.pageX;
    currentwin.tbstyle.width=e.pageX;
    
  	currentwin.cstyle.width=e.pageX-currentdiv.left;
  	currentwin.cstyle.height=e.pageY-currentdiv.top-SIZER_HEIGHT;
  	
  	///////move our "sizer" guy to his appropriate place...
  	eval("currentdiv.document." + currentdiv.id + "sizer.left=e.pageX-SIZER_WIDTH-document." + currentdiv.id + ".left;");
  	eval("currentdiv.document." + currentdiv.id + "sizer.top=e.pageY-SIZER_HEIGHT-document."  + currentdiv.id + ".top;");
  }	
	return false;

}
/* end NS specific functions */

 

