// JavaScript Document

var currentlyShownElement = '';

//function to change the channel image when a person is clicked.
function changeChannel(elementToShow)
{
  //if the screen im trying to show is NOT already on the screen
  if (elementToShow != currentlyShownElement)
  {
    showElement(elementToShow);
    showElement(elementToShow + "_Info");
    showElement(elementToShow + "_webshopbutton");

    if (currentlyShownElement != '')
    {
      hideElement(currentlyShownElement);
      hideElement(currentlyShownElement + "_Info");
      hideElement(currentlyShownElement + "_webshopbutton");
    }	
    currentlyShownElement = elementToShow;
	
	//If the screen is the logo screen
	if (elementToShow == 'Logos')
    {
       hideElement('rightbuttons');
       hideElement('leftbuttons');
    }
	//if its another screen
	else
	{
	  //if the screen is the ImpactLogos screen 
	  if (elementToShow == 'ImpactLogos')
	  {
	    hideElement('rightbuttons');
	  }
	  //if its another screen
	  else
	  {
	     showElement('rightbuttons');
	  }

         showElement('leftbuttons');
	  } 	
  }  
}

function showElement(elementToShow)
{
    document.getElementById(elementToShow).style.display='block';
}

function hideElement(elementToHide)
{
    document.getElementById(elementToHide).style.display='none';
}

function buttonHover(buttonId, buttonImage)
{
	document.getElementById(buttonId).src=buttonImage;
}

//Pre load people to load faster
function preloadImage(imagePath)
{
  var newImage = new Image();
  newImage.src = imagePath;
}
