
// 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)          */

var myImages = new Array();

myImages[imageIndex++] = new myImageDef("fgpix/fg2-pk-setting.jpg", "<td><b>This Is What We Offer</b>Quality building in a parklike setting with sound control features.  Link that pleasure to the convenience and sheer livability of ample parking, privacy, and security, and you have a great package!<br><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>As You Come Home</a><br><br><br><br></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fg2-parking.jpg", "<td><b>As You Come Home</b><ul><li>Ample resident/guest parking</li><li>Optional attached garage with remote-control door opener</li><li>private entrance has deadbolts and optional security system</li></ul><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>For Your Pleasure</a><br><br><br><br></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fg-balconies2.jpg", "<td><b>Balconies &amp;<br>Patios</b><br>One for every apartment<br><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Also Nice</a></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fgaptlroom.jpg", "<td><b>Also Nice</b>Spacious, functional floor plans with ample storage, central air conditioning, and energy efficient gas heat.  Wall-to-wall carpeting and cable-ready connections add a touch of luxury.<br><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>And For Your Convenience</a><br><br><br><br></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fg-spevergreen-kitchen.jpg", "<td><b>For Your Convenience</b>The energy-efficient kitchen has dishwasher, garbage disposal, and combo microwave/ovenhood.<br><br>There is also a full-sized washer and dryer, water softening system, and water and waste utilities are included!<br><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>For Your Security</a><br><br><br><br></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fgentrance.jpg", "<td><b>For Your Security</b>Our professional management ensures that all apartments are handicap-accessible and adaptable, that they include fire-protection and sprinklers, and that there is full-time on-site maintenance. Snow Removal is also included.<br><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>And For Your Leisuretime</a><br><br><br><br></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fgweightrm2.jpg", "<td><b>1. For The Grown-ups</b>A fitness room, tennis courts, and jogging path/nature trail<br><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>For the Children</a></td>");

myImages[imageIndex++] = new myImageDef("fgpix/nfswings.jpg", "<td><b>2. For The Children</b><img src='fgpix/fg-playground2a.jpg' style='margin-top:-15px;'><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>And For the Family</a><br><br><br><br></td>");

myImages[imageIndex++] = new myImageDef("fgpix/fg-pool2a.jpg", "<td><b>3. For The Family</b>An L-shaped pool with separated racing lanes and family area, plus a generous pool side with tables and loungers<br><br><A href='javascript:myVoid()' onClick='alterContent(0,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Begin Again</a><br><br><br><br></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, callint 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);

