var squareCount = 0;
var squares = new Array();
var RimagePrefix = "SL_";
var RonSuffix = "_ON.jpg";
var RoffSuffix = "_OFF.jpg";
var RimageSubdirectory = "images/";

createSquare(120, 190, "intfan", "Interior Lighting Ceiling Fans Sierra Lighting", "interior.html");
createSquare(120, 132, "extwall", "Exterior Wall Lanterns Sierra Lighting", "exterior.html");
createSquare(120, 190, "intother5", "Replacement Parts", "other.html");


function createSquare (height, width, name, infoText, link)
{
  squares[squareCount] = new SquareItem(height, width, name, infoText, link);
  squareCount++;
}

function SquareItem (height, width, name, infoText, link)
{
  this.height   = height;
  this.width    = width;
  this.name     = name;
  this.info     = infoText;
  this.link     = link;
  this.on       = new Image (width, height);
  this.on.src   = RimageSubdirectory + RimagePrefix + name + RonSuffix;
  this.off      = new Image (width, height);
  this.off.src  = RimageSubdirectory + RimagePrefix + name + RoffSuffix;
}

function doSquareOver(num)
{
  document.images[squares[num].name].src = squares[num].on.src;
  self.status = squares[num].info;
}

function doSquareOut(num)
{
  document.images[squares[num].name].src = squares[num].off.src;
  self.status = "";
}

function writeSquares()
{
  for(i = 0; i < squareCount; i++)
  {
    with(this.document)
    {
	write ('<a href="' + squares[i].link + '" onMouseOver="doSquareOver(' + i + '); return true" onMouseOut="doSquareOut(' + i + '); return true">');
	write ('<img name="' +squares[i].name + '" src="' + squares[i].off.src + '" alt="' + squares[i].name + '" width="' + squares[i].width + '" height="' + squares[i].height + '" border="0" hspace="8">');
	write ('</a>'); 
	if(i == 3) write("<br/>");
    }
  }
}

