var arial="Tahoma,Arial,Helvetica,Geneva,Helv";

///////////////////////////////////////////////////////////////////Constructor
function Style(name, backgroundcolor, backgroundimage, font, fsize, fcolor, fstyle, border, h, w, x, y, v, z, pCursor)
// holds style properites for div tags...
//////////////////////////////////////////////////////////////////////////////
{

	this.name=name;
	this.backgroundcolor=backgroundcolor;
	this.backgroundimage=backgroundimage;  
	this.font=font;
	this.fsize=fsize;
	this.fcolor=fcolor;
	this.fstyle=fstyle;
	this.border=border;
	this.x=x;
	this.y=y;
	this.height=h;
	this.width=w;
	this.fontcss=name + "-font";
	this.zindex=z;
  this.cursor = pCursor;
	if(v==true)
		this.visibility="visible";
	else
		this.visibility="hidden";

	// this allows us to change the top and left on the fly
	this.SetXY=sSetXY;
	this.SetHW=sSetHW;
	this.WriteHeader=sWriteHeader;
	this.layerstyle=sLayerStyle;
	this.LayerStyle=sLayerStyle;
  this.Clone = sClone;
}
  //////////////////////////////////////////////////////////////////////method
  function sClone(name)
  //
  ////////////////////////////////////////////////////////////////////////////
  {
    var s;
  	if(this.visibility="visible")
  		v = true;
  	else
  		v = false;

    s = new Style(
      name,
      this.backgroundcolor,
      this.backgroundimage,
      this.font,
      this.fsize,
      this.fcolor,
      this.fstyle,
      this.border,
      this.height,
      this.width,
      this.x,
      this.y,
      v,
      this.zindex);
  
    return s;
  }
  //////////////////////////////////////////////////////////////////////method
	function sLayerStyle()
	// this sets the x and y of the css style string of the style object...
	////////////////////////////////////////////////////////////////////////////
	{
			if(this.backgroundcolor=="transparent")
				this.backgroundcolor="\"\"";
			ls="clip=\"0,0," + this.width + "," + this.height + "\" color=" + this.fcolor + " bgcolor=" + this.backgroundcolor + " font-family=" + this.font + " font-size=" + this.fsize + " text-decoration=" + this.fstyle + " border=" + this.border + " top=" + this.y + " left=" + this.x + " height=" + this.height + " width=" + this.width + " visibility=" + this.visibility + " z-index=" + this.zindex;
      if(this.backgroundimage && this.backgroundimage != "" )
        ls += " background = " + this.backgroundimage ;
			return ls;
	}
	//////////////////////////////////////////////////////////////////////method
	function sSetXY(x, y)
	// this sets the x and y of the css style string of the style object...
	////////////////////////////////////////////////////////////////////////////
	{
		this.x=x;
		this.y=y;
		
	}
	//////////////////////////////////////////////////////////////////////method
	function sSetHW(h, w)
	// this sets the x and y of the css style string of the style object...
	////////////////////////////////////////////////////////////////////////////
	{
		this.height=h;
		this.width=w;

	}
	//////////////////////////////////////////////////////////////////////method  
	function sWriteHeader(f)
	// 
	////////////////////////////////////////////////////////////////////////////
	{
		////////make header
		this.cssheader="." + this.name + "{position:absolute;clip:rect(0px," + this.width + "px," + this.height + "px,0px);color:" + this.fcolor + ";background-color:" + this.backgroundcolor + ";font-family:" + this.font + ";font-size:" + this.fsize + "px;text-decoration:" + this.fstyle + ";border:'" + this.border + "';top:" + this.y + "px;left:" + this.x + "px;height:" + this.height + "px;width:" + this.width + "px;visibility:" + this.visibility + ";z-index:" + this.zindex + ";cursor:"+this.cursor+";";
  if(this.backgroundimage && !this.backgroundimage == "")
    this.cssheader += ' background-image: url(' + this.backgroundimage + '); }';
  else    
    this.cssheader += '  }';    
		

		// we make this object because the font information in a style goes south when it is 
		// put inside a table..., so we need to set it again
  this.fontcssheader="." + this.fontcss + "{color:" + this.fcolor + ";background-color:" + this.backgroundcolor + ";font-family:" + this.font + ";font-size:" + this.fsize + "px;text-decoration:" + this.fstyle + ";;}";
		
    // for some reaosn IE will not let us write the <style> tag here!
		f.document.writeln(this.cssheader);
		f.document.writeln(this.fontcssheader);
	}
	

