// Button Rollover Code
function rollOver(imgID, imgName) {
	document.getElementById(imgID).setAttribute('src', imgName);
}

// toggleTab for Production Detail pages
var prevTabID = 'Overview';

function toggleTab(TabID) {
  document.getElementById('tab' + prevTabID).className = 'prodDetailOption';
  document.getElementById('prodDetail' + prevTabID).className = 'displayNone';


  //APPLY THE ACTIVE STYLE TO THE SELECTED TAB
  document.getElementById('tab' + TabID).className = 'prodDetailOptionOn';
  document.getElementById('prodDetail' + TabID).className = 'displayBlock';

  prevTabID = TabID;

  doReplace();
}

function toggleVideo(baseStr, showHide) {
	if (showHide) {
		//$("content_" + baseStr).slideDown();
		$("content_" + baseStr).style.display = "block";
		$("btnOn_" + baseStr).style.display = "none";
		$("btnOff_" + baseStr).style.display = "block";
	} else {
		//$("content_" + baseStr).slideUp();
		$("content_" + baseStr).style.display = "none";
		$("btnOn_" + baseStr).style.display = "block";
		$("btnOff_" + baseStr).style.display = "none";
	}
}




function toggleBlanket(type, theimage) {
  var blanket = document.getElementById(type + 'Blanket');
  var msgWrprObj = document.getElementById(type + 'MsgWrpr');

  
  if (blanket.className == 'displayNone') {
    // If IE6, hide all selection boxes.
    if (usingIE6()) {
      toggleAllSelects('hide');
    }

    if (theimage != '' && theimage.length > 0) {
      var getTheATag = document.getElementById('thePopup');
      getTheATag.setAttribute('src', theimage);
    }

    blanket.className = 'displayBlock';
    msgWrprObj.className = 'displayBlock';
  } else {
    // If IE6, show all selection boxes.
    if (usingIE6()) {
      toggleAllSelects('show');
    }

    blanket.className = 'displayNone';
    msgWrprObj.className = 'displayNone';
  }
}

function toggleBlanketFloorplan(type, theimage) {
  var blanket = document.getElementById(type + 'Blanket');
  var msgWrprObj = document.getElementById(type + 'MsgWrpr');

  
  if (blanket.className == 'displayNone') {
    // If IE6, hide all selection boxes.
    if (usingIE6()) {
      toggleAllSelects('hide');
    }

    if (theimage != '' && theimage.length > 0) {
      var getTheATag = document.getElementById('theFloorplanPopup');
      getTheATag.setAttribute('src', theimage);
    }

    blanket.className = 'displayBlock';
    msgWrprObj.className = 'displayBlock';
  } else {
    // If IE6, show all selection boxes.
    if (usingIE6()) {
      toggleAllSelects('show');
    }

    blanket.className = 'displayNone';
    msgWrprObj.className = 'displayNone';
  }
}

function usingIE6() {
  if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
    var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
    if (ieversion>=6 && ieversion<7 )
      return true;
    else
      return false;
  }
}

function toggleAllSelects(action) {
  var x = document.getElementsByTagName("select");

  for (i = 0; i < x.length; i++) {
    if (action == 'hide') {
      x[i].style.display = "none";
    } else {
       x[i].style.display = "block";
    }
  }
}

function toggleSeriesDetail(positionId) {
  var getTogglerObj = document.getElementById('s' + positionId + 'Toggle');
  var getDetailObj = document.getElementById('sd_' + positionId);

  if (getDetailObj.style.display == 'none') {
    getTogglerObj.innerHTML = '-';
    getDetailObj.style.display = 'block';
  } else {
    getTogglerObj.innerHTML = '+';
    getDetailObj.style.display = 'none';
  }
}

function toggleSubSeriesDetail(positionId) {
  var getTogglerObj = document.getElementById('s' + positionId + 'Toggle');
  var getDetailObj = document.getElementById('sd_' + positionId);

  if (getDetailObj.style.display == 'none') {
    getTogglerObj.innerHTML = 'Show Performances <img src="img/minus.gif" alt=""/>';
    getDetailObj.style.display = 'block';
  } else {
    getTogglerObj.innerHTML = 'Show Performances <img src="img/plus.gif" alt=""/>';
    getDetailObj.style.display = 'none';
  }
}


function expandAllSeriesDetail() {
  var getAllDetailObj = getElementsByClassName('seriesDetail', 'div');

  for (i = 0, j = getAllDetailObj.length; i < j; i++) {
    getAllDetailObj[i].style.display = 'block';
  }
}

function collapseAllSeriesDetail() {
  var getAllDetailObj = getElementsByClassName('seriesDetail', 'div');

  for (i = 0, j = getAllDetailObj.length; i < j; i++) {
    getAllDetailObj[i].style.display = 'none';
  }
}

/*
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; 
}

