<!--// MouseClick image swap, Oct 30, 2004 - John-Erik Omland - webmaster@exploringbalance.com

// ######################################################################
// In addition to a rollover effect on the square buttons above, the following code is used to swap out the large portrait images
// To change the number or order of portrait/images that get swapped, change the filenames in this array:
var imageFileNames = [
       "mapLocalStreet.jpg", 
       "mapMidRange.jpg", 
       "mapStateInsert.jpg", 
       "mapMultiState.jpg"];
// ######################################################################

var totalImages = imageFileNames.length; // Total images used
var imagePath = "../images/";
var imagesArray = new Array(totalImages);

 // ==========================================

var imagesPreloaded = false;
function changeMyImage(img, num){
   if(document.images){
      if(num >= totalImages) alert("ERROR: trying to display absent image #" +num);
      else {
//         if(portraitsPreloaded == false) {  //  use BODY tag onload() func to preload images
//            preloadPortraits();
//            portraitsPreloaded = true;
//         }
         document.images[img].src = imagesArray[num].src;
      }
   }

 }
 // ==========================================

 // NOTE: this function needs to be called by the BODY tag onLoad() method to preload all the portrait images
 //            or can be included as a call at end of this include???????
 function preloadMyImages() {
    if(document.images){   
      for(i = 0; i < imagesArray.length; i++){
         imagesArray[i] = new Image();
         imagesArray[i].src = imagePath +imageFileNames[i];
         }
      imagesPreloaded = true;
    }
 }
 // ==========================================

// ===================
// Swap contents of several DIVs into a "report" div display container
// Triggered by selectObj with values determined by array below
// ===================

 
 var myDivNames = new Array("northDiv", "easthDiv", "southDiv", "westDiv", "swDiv", "connDiv", "villiageDiv" );
 
 function buildDivSelectDropdownMenu( selectObjName, actionStr ) {
/* use
<script>
<!--   document.write( buildDivSelectDropdownMenu( "drivingFromDirection", "showDirections(this.options[this.selectedIndex].value)" ); -->
   document.write( buildDivSelectDropdownMenu( "drivingFromDirection", "test" ) );
   </script>
 */
    var selectStr = '<select name="' +selectObjName +'" onchange="' +actionStr +'">';
   
    for(i = 0; i < myDivNames.length; i++){
         selectStr += '<option value="' + myDivNames[i]+'" selected="selected">from South</option>';
    }
    selectStr += '</select>';
	 return selectStr;
 }
 // ============================

 function reportDiv(reportDivName, selected) {
//    alert("chose " +selected); //DEBUG
	 if( selected>=myDivNames.length || selected<0 ) alert("ERROR: chosen selection out of range. " +selected);
/*
for(var i=0; i<myDivNames.length; i++) {
	    var divObj = document.getElementById(myDivNames[i]);
	    divObj.style.visibility="hidden";
	 } 
	 */
	 
//	 alert("show div " +pricingDivNames[selected]);
	 document.getElementById(reportDivName).innerHTML = ( selected<(myDivNames.length-1) ) ?
	                 document.getElementById(myDivNames[selected]).innerHTML+ document.getElementById("villiageDiv").innerHTML :
	                 document.getElementById(myDivNames[selected]).innerHTML ;
 }
 // ============================
