
// 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();


//5  RIO ESCONDIDO
myImages[imageIndex++] = new myImageDef("bluepix/rioescondidos.jpg", "<div class='caption'><h3>Rio Escondido</h3><p class='fixed'>Photo: <a href='http://oil.iki.fi/Travel/2001/Nicaragua/Bluefields/' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>Pekka Oilinki</a>, from his travelogue photos</a>.</p><p><A href='javascript:myVoid()' onClick='alterContent(3,arrayNum+1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'><b>Next</b></a></div>");

//0  FOUR CHILDREN
myImages[imageIndex++] = new myImageDef("bluepix/FourchildreninBluefieldss2.jpg", "<div class='caption'><h3>Four Children in Bluefields, Nicaragua</h3><p class='fixed'><b>Photo:</b> <a href='http://www.stallardteam.com/PageLibrary/162/custom/morepersonalpictures.php' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>Bob Stallard</a>, who worked in Bluefields with the <a href='http://www.peaceandhope.org/what_we_do.php' target='bfWindow' onfocus='if(this.blur)this.blur()' onmouseover='return statusynw()' onmouseout='return statusn()' onclick='openWin()'>Peace and Hope Trust</a>.</p><p><A href='javascript:myVoid()' onClick='alterContent(3,arrayNum+1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'><b>Next</b></a></p></div>");

//1  POOR CHILDREN IN STREET
myImages[imageIndex++] = new myImageDef("bluepix/poorchildreninstreets2.jpg", "<div class='caption'><h3>Children in Street</h3><p class='fixed'><b>Photo:</b> &copy; <a href=' http://jones77.com' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>James Jones</a> 2002 (used with permission), whose <a href='http://www.geocities.com/nicajones2002/' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>blog</a> is interesting and informative about Bluefields (scroll down half way).</p><p><A href='javascript:myVoid()' onClick='alterContent(3,arrayNum+1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'><b>Next</b></a></div>");

//4  HOUSE IN BLUEFIELDS 
myImages[imageIndex++] = new myImageDef("bluepix/houseinbluefieldss.jpg", "<div class='caption'><h3>House in Bluefields</h3><p class='fixed'><b>Photo:</b> <a href='http://laebonylatina.tripod.com/id25.html' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>Alma Johnson</a>, whose site has more photos and gives useful information about Bluefields.</p><p><A href='javascript:myVoid()' onClick='alterContent(3,arrayNum+1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'><b>Next</b></a></div>");

//6  PORT IN BLUEFIELDS 
myImages[imageIndex++] = new myImageDef("bluepix/bluefieldsports.jpg", "<div class='caption'><h3>House in Bluefields</h3><p class='fixed'><b>Photo:</b> <a href='http://www.ak11.de/nica/en/?page=galery/index' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>Andrea Klingebiel</a>, whose travels in Nicaragua included Bluefields.</p><p><A href='javascript:myVoid()' onClick='alterContent(3,arrayNum+1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'><b>Next</b></a></div>");

//2  DOWNTOWN BLUEFIELDS
myImages[imageIndex++] = new myImageDef("bluepix/downtownbluefieldss.jpg", "<div class='caption'><h3>Street in Bluefields</h3><p class='fixed'><b>Photo:</b> &copy; <a href=' http://jones77.com' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>James Jones</a> 2002 (used with permission), whose <a href='http://www.geocities.com/nicajones2002/' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>blog</a> is interesting and informative about Bluefields (scroll down half way).</p><p><A href='javascript:myVoid()' onClick='alterContent(3,arrayNum+1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'><b>Next</b></a></div>");

//3  BLUEFIELDS COUNTRYSIDE
myImages[imageIndex++] = new myImageDef("bluepix/mobluefrs.jpg", "<div class='caption'><h3>Farms around Bluefields</h3><p class='fixed'><b>Photo:</b> <a href='http://www.jwsnet.com/gallery/bluefields?page=1' target='bfWindow' onMouseover='return statusynw()' onMouseout='return statusn()' onfocus='if(this.blur)this.blur()' onclick='openWin()'>Karla</a>, from her lovely collection of Bluefields photos</a>.</p><p><A href='javascript:myVoid()' onClick='alterContent(3,arrayNum+1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'><b>Next</b></a></div>");



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 = 0;
  }
  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);


//OPENWIN

function openWin() {
        myWin=open("","bfWindow","top=70,left=350,width=600,height=450,status=no,toolbar=no,menubar=no,location=yes,scrollbars=yes,resizable=yes"); }

// window for horizon roads = 719 x 583 smallest