function ArrowToggle(toggleButton, itemBoxId) {

  var itemBox = document.getElementById(itemBoxId);
  
  if(typeof toggleButton == 'object' &&  itemBox != null ) {

  var buttonClasses = new Array();
  buttonClasses = toggleButton.className.split(" ");
  var classNum = buttonClasses.length;
    if(itemBox.style.display == 'none' ) {
      itemBox.style.display = 'block';
      for(i = 0; i< classNum; i++) {
        if(buttonClasses[i] == 'arrowbullet-side' ) 
          { buttonClasses[i] = 'arrowbullet-down' }
      }
      
    } else {
        itemBox.style.display = 'none';
        for(i = 0; i< classNum; i++) {
        if(buttonClasses[i] == 'arrowbullet-down' ) 
          { buttonClasses[i] = 'arrowbullet-side' }
      }
      
    }
  toggleButton.className = buttonClasses.join(' ');
  
  }
}


/*
function FauxMenu(toggleButton, itemBoxId) {
//toggleButton should be "this" if function is used on the actual button.
  var itemBox = document.getElementById(itemBoxId);
  if(typeof toggleButton == 'object' && typeof itemBox == 'object') {
  
    if(itemBox.style.display == 'none' ) {
      itemBox.style.display = 'block';
      toggleButton.className = 'arrowbullet-down';
      
    } else {
        itemBox.style.display = 'none';
      toggleButton.className = 'arrowbullet-side';
    }
  }

}
*/
function GetCleanID() {
     return ( location.hash.substr(1,location.hash.length) );
}

function ToggleAllTechSpecs() {
  //get all divs with the id 'tobblebox'
  var allDivs = document.getElementsByTagName('div');
  var allBoxes = '';
  for(i = 0; i<allDivs.length; i++) {
  
    if(allDivs[i].className == 'togglebox') {
      //alert(allDivs[i].id);
  //and put their id's to one string
      allBoxes = allBoxes +','+allDivs[i].id;
    }
  }
  
  //allBoxes = allBoxes.substr(1, allBoxes.length); //remove extra , from the beginning
   
  //MultiBoxToggle(allBoxes,'',1);
  }

function MultiBoxToggle(idlist,  exceptionList, dirNum ) {

//hides the elements defined in "idlist" string list;
//exceptions defined in exceptionList
// example: HideBox('me,oh,my','me') would hide id's 'oh' and 'my' and show id 'me'
// no spaces are allowed in the id list ('id1, id2, id3 , id4 ') will not work
// if an id is requested using has url hash (www.blaah.net/index.html#myid)
//that id is included in th exceptionlist

var dispValues = new Array('none', 'block');
var requestID = GetCleanID();
var exceptions = exceptionList.split(',')

//if an id was requested, add it to the exception list
if(requestID.length > 0 ) {
var temp = exceptions.join(',');
temp = temp + ',' + requestID;
exceptions = temp.split(',');
}

  var allBoxes = idlist.split(',')
  var box = '';
  var numOfBoxes = allBoxes.length;
  for (i = 0; i < numOfBoxes; i++) { //lets loop throught all the boxes we want to hide
      //alert(allBoxes[i])
      var showthis = false; //exception marker is reset for each iteration
          for( x in exceptions) { //lets see if this id is in the exception list
          if(exceptions[x] == allBoxes[i]) {
            
            if(exceptions[x] == requestID && requestID.length > 0) { //double check the requestID (otherwise errors occur) 
              var rqbox = document.getElementById(exceptions[x]);
              if(rqbox != null) {
              rqbox.previousSibling.previousSibling.className ='arrowbullet-down arrowbullet';
              }
              //alert(rqbox.innerHTML);
              //alert(rqbox.previousSibling.previousSibling.innerHTML);
            }
            
            var showthis = true;//if this id is in exception list exception marker becomes true;
            break; // and we can quit the inner loop since ID's are unique.
            
          } 
        }
      if(showthis !== true) {
        //if this id was not in exception list, lets hide it...
        var box = document.getElementById(allBoxes[i]);
        if(box !== null ) {
        //error resistance check, in case given id does not exist in the document;
          box.style.display = dispValues[dirNum];
        }
      }
  }
  
}


function BoxToggle(toggleButton, itemBoxId) {
//toggleButton should be "this" if function is used on the actual button.
  var itemBox = document.getElementById(itemBoxId);
  if(typeof toggleButton == 'object' && typeof itemBox == 'object') {
    
    if(itemBox.style.display == 'none' ) {
      itemBox.style.display = 'block';
      toggleButton.className = 'boxOpen';
      toggleButton.innerHTML = 'Close'
      
    } else {
      itemBox.style.display = 'none';
      toggleButton.className = 'boxClosed';
      toggleButton.innerHTML = 'View'
  
    }
  }

}


function ScrollUp() {
  window.scrollBy(0,-150);
}