// Button Rollover Code
function rollOverNew(imgID, imgName) {
	document.getElementById(imgID).setAttribute('src', imgName);
}

// Toggle photos for photo gallery
function togglePhoto(newClassName) {
  document.getElementById('photoGalleryToggle').className = 'gio_' + newClassName;
}

function toggleNextPhoto(direction) {
  var minGI = 1;
  var maxGI = 8;
  var getClassName = document.getElementById('photoGalleryToggle').className;
  var getVisibleNum = getClassName.substring(getClassName.lastIndexOf('_') + 1, getClassName.length);
  
  if (direction == 'next') {
    if (getVisibleNum == maxGI) {
      getVisibleNum = minGI - 1;
    }
    document.getElementById('photoGalleryToggle').className = 'gio_' + (Number(getVisibleNum) + 1);
  } else {
    if (getVisibleNum == minGI) {
      getVisibleNum = maxGI + 1;
    }
    document.getElementById('photoGalleryToggle').className = 'gio_' + (Number(getVisibleNum) - 1);
  }
}

// Toggle blanket for enlarged floorplans
function toggleBlanket() {
  var blanket = document.getElementById('leavingBlanket');
  var lbDisplay = blanket.className;
  
  if (lbDisplay == 'displayNone') {
    blanket.className = 'displayBlock';
  } else {
    blanket.className = 'displayNone';
  }
}

// Toggle blanket for Golub content
function toggleGolubBlanket() {
  var blanket = document.getElementById('golubBlanket');
  var lbDisplay = blanket.className;
  
  if (lbDisplay == 'displayNone') {
    blanket.className = 'displayBlock';
  } else {
    blanket.className = 'displayNone';
  }
}

function hidePromo() {
  document.getElementById('promoBanner').className = 'displayNone';
}

// Toggle map guide info
function toggleMapGuide(id) {
  var turnOn = document.getElementById(id);
  var turnOnClass = turnOn.className;
  
  if (turnOnClass == 'sectionMG displayNone') {
    visibleMapGuide();
    turnOn.className = 'sectionMG displayBlock';
  } else {
    //turnOn.className = 'sectionMG displayNone';
  }
}

function visibleMapGuide() {
  var findVisMapGuide = getElementsByClassName('sectionMG displayBlock', 'div');

  for (var i = 0, j = findVisMapGuide.length; i < j; i++) {
    var turnOff = document.getElementById(findVisMapGuide[i].getAttribute('id'));
    turnOff.className = 'sectionMG displayNone';
  }
}

/*
v1.03 Copyright (c) 2006 Stuart Colville
http://muffinresearch.co.uk/archives/2006/04/29/getelementsbyclassname-deluxe-edition/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
  
function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;    
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
  var arr = new Array();                              
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';   
  var arrClass = strClass.split(delim);    
  for (var i = 0, j = objColl.length; i < j; i++) {                         
    var arrObjClass = objColl[i].className.split(' ');   
    if (delim == ' ' && arrClass.length > arrObjClass.length)
      continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k])
          c++;
        if ((delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]); 
          break comparisonLoop;
        }
      }
    }
  }
  return arr; 
}