
// MYVOID to replace void -- which some browsers (i.e., IE) do not like

function myVoid() {
// nothing here
}

// STATUSY/N - makes sure statusbar stays empty on pure mouseovers

function statusynw() { self.status='opens in new window'; return true }
function statusy() { self.status=''; return true }
function statusn() { self.status=''; return true }


/* ****** BEGIN RANDOM IMAGE CODE *********************  */
/* These are the functions for generating a random image */
/* and the accompanying text tags for the images         */

var imageIndex = 0;    // Initialize an index for the array

/* Define the structure of myImageDef */

function myImageDef (imageName, imageText) {
  this.imageName = imageName;
  this.imageText = imageText;
return this;
}

/* Set up the array using the index(imageIndex) */
/* and the array structure(myImageDef)          */



/*<br><br>A welcoming spot right at the entrance, <A href='javascript:myVoid()' onClick='alterContent(3,1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Step Inside</a><br><br><br><br></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fgcathtable.jpg", "<td><b>Step Inside</b>*/




var myImages = new Array();

/*IMAGE #0 study*/

myImages[imageIndex++] = new myImageDef("fgpix/fg-aptspruce.gif", "<td><b>Floor Plan</b>The Spruce is an upper-level apartment featuring two bedrooms and a shared bathroom. The very similar Evergreen has a third bedroom/den, bringing its area to 1298 sq. ft. <br><br><A href='javascript:myVoid()' onClick='alterContent(3,1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Step Inside</a><span style=\"color: #fff\"><br>.<br>.<br>.<br>.<!--<br>.<br>.<br>.<br>.<br>.--></span></td>");

/*IMAGE #1 Living Room*/
myImages[imageIndex++] = new myImageDef("fgpix/fg-spevergreen-lroom.jpg", "<td><b>The Spruce, The Evergreen</b>On entering these upper-level apartments, you find an airy living room with sliding glass doors that lead to the balcony. <br><br><A href='javascript:myVoid()' onClick='alterContent(3,2); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Balcony</a><span style=\"color: #fff\"><br>.<br>.<br>.<br>.</span></td>");

/*IMAGE #2 Balcony*/
myImages[imageIndex++] = new myImageDef("fgpix/fg-spruce-balcony.jpg", "<td><b>Balcony</b>Through the sliding doors, the generously-sized balcony has room to eat, cook, and enjoy the green parklike setting.<br><br><A href='javascript:myVoid()' onClick='alterContent(3,3); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>To the Dining Area</a><span style=\"color: #fff\"><br>.<br>.<br>.<!--<br>.<br>.<br>.<br>.<br>.--></span></td>");

/*IMAGE #3 Dining Area*/
myImages[imageIndex++] = new myImageDef("fgpix/fg-spevergreen-lroomd2.jpg", "<td><b>Dining Area</b>Returning inside, you can see the dining area (with room for a good-sized table), and view to the den beyond.<br><br><A href='javascript:myVoid()' onClick='alterContent(3,4); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>To the Kitchen</a></td>");

/*IMAGE #4 Kitchen*/
myImages[imageIndex++] = new myImageDef("fgpix/fg-spruce-kitchen.jpg", "<td><b>Kitchen</b>Opposite the dining area is a charming kitchen with plenty of counter tops and a mellow wood finish.<br><br><A href='javascript:myVoid()' onClick='alterContent(3,5); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Master Suite</a><span style=\"color: #fff\"><br>.<br>.<br>.<br>.<!--<br>.<br>.<br>.<br>.<br>.--></span></td>");

/*IMAGE #5 Master Suite*/
myImages[imageIndex++] = new myImageDef("fgpix/fg-spruce-bedroom2.jpg", "<td><b>Master Suite</b>In the two-bedroom apartment, the master bedroom is tucked away behind the stairs for privacy.<br><br><A href='javascript:myVoid()' onClick='alterContent(3,6); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Bathroom</a><br><br></td>");

/*IMAGE #6 Bath Room*/
myImages[imageIndex++] = new myImageDef("fgpix/fg-spruce-bedroom1.jpg", "<td><b>Bathroom</b>The master bedroom leads past a large walk-in closet (to the left) into the shared bathroom.  A clever system of doors ensures privacy. <br><br><A href='javascript:myVoid()' onClick='alterContent(3,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Sart Again</a><span style=\"color: #fff\"><br>.<br>.<br>.<br>.<!--<br>.<br>.<br>.<br>.<br>.--></span></td>");


var number_of_images = myImages.length;  // Determine number of images in array

/* Set up the generalized random generator (x and y are inputs) */

function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}

/* Get the next image (it's either random or not) */
/* The random or not is based on the random_display */
/* variable set above in the initialize variables */

function getNextImage(random_display) {
  if (random_display) {
    imageIndex = generate(0, number_of_images-1);
  }
  else {
    if(imageIndex == (number_of_images)) {  // This extra if does a check to see if
      imageIndex = -1;                      // we're at the last image and resets the index
    }                                       // but only if we're NOT in random mode
    imageIndex = (imageIndex+1) % number_of_images;
  }
return(imageIndex);
}

/* This function replaces the image and the text.           */
/*                                                          */
/* The image id must be set to id="rImage" and have         */
/* some image defined as an initial image even              */
/* though the image will not be the image that displays.    */
/* For example: <IMG name="rImage" src="white.jpg">         */
/*                                                          */
/* To handle NS4+, IE4+ and NS6 you need to use both a      */
/* <DIV> or <SPAN> AND an <ILAYER><LAYER> (for NS4)         */
/* The <DIV> (or <SPAN>) must have an empty DIV tag         */
/* with an id="dtext", for example:                         */
/* <DIV id="dtext"></DIV>                                   */
/*                                                          */
/* The empty ilayer with a nested layer for NS4+ should     */
/* look something like the example below:                   */
/* <ILAYER id="ns4dtext" width="160" height="80">           */
/* <LAYER id="ns4dtext2"></LAYER></ILAYER>                  */
/*                                                          */
/* When you call the function from within the HTML,         */
/* you must specify a value for BOTH isRandom AND picNum    */
/* even though picNum is ignored except when isRandom=3.    */
/* Possible values for the isRandom parameter are:          */
/*  1=random, the picNum parameter is ignored but MUST be   */
/*    specified -- for example calling the following in the */
/*    BODY will generate a random image to put in the page  */
/*    <BODY onLoad="alterContent(1,1);">         */
/*  0=in order, the picNum parameter is ignored but MUST be */
/*    specified -- for example, calling the function as     */
/*    shown below will display the next picture (in order). */
/*    <A href="myVoid()" onClick="alterContent(0,0);return false;">click</a> */
/*  3=specific picture, the picNum parameter is actually    */
/*    used this time. The function will display the picture */
/*    specified in the picNum parameter.  For example:      */
/*    <BODY onLoad="alterContent(3,0);">                    */
/*    will force the first picture in the array to be loaded */
/* AT THE BOTTOM of this page -- after the CODE is a section */
/* of HTML that will work if you put this code in an external */
/* JavaScript document                                        */
//

function alterContent(isRandom,picNum){
  if(isRandom == 3 && picNum < 0) {
    alert("Picture number out of array range -- setting it to first picture in array!");
    arrayNum = 0;
  }
  else if(isRandom == 3 && picNum > (number_of_images - 1)) {
    alert("Picture number out of array range -- setting it to last picture in array!");
    arrayNum = number_of_images - 1;
  }
  else if(isRandom == 3) {
    arrayNum = picNum;
  }
  else {
    arrayNum = getNextImage(isRandom);
  }
  myImg = myImages[arrayNum].imageName;
  myText = myImages[arrayNum].imageText;
  document['rImage'].src=myImg;
  //if IE 4+
  if (document.all){
    dtext.innerHTML=myText;
  }
  //else if NS 4
  else if (document.layers){
    document.layers.ns4dtext.layers.ns4dtext2.document.write(myText);
    document.layers.ns4dtext.layers.ns4dtext2.document.close();
  }
  //else if NS 6 (supports new DOM)
  else if (document.getElementById){
    rng = document.createRange();
    el = document.getElementById("dtext");
    rng.setStartBefore(el);
    htmlFrag = rng.createContextualFragment(myText);
    while (el.hasChildNodes())
    el.removeChild(el.lastChild);
    el.appendChild(htmlFrag);
  }
}

//NETSCAPE 4.X RELOAD SCRIPT - TO PREVENT BROKEN CSS AND JSCRIPT

function MM_reloadPage(init) {  
/*reloads the window if Nav4 resized */
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4))
  {document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

