// prints 
function printPage()
{
  if (window.print)
  {
    window.print()
  }
  return false;
}


function setUp()
{
  if (document.getElementById)
  {
    processLeftNav()
    processRightNav()
  }
}


// Detect current page and change style left nav accoringly
function processLeftNav()
{

  // this array holds pages to detect
  var arrLeftNavPages = new Array()
  arrLeftNavPages[0] = "index"
  arrLeftNavPages[1] = "2.1-what-is-stopping-power.htm"
  arrLeftNavPages[2] = "2.2-the-competition.htm"
  arrLeftNavPages[3] = "2.3-the-prizes.htm"
  arrLeftNavPages[4] = "2.4-how-to-enter.htm"
  arrLeftNavPages[5] = "2.4.1-entry-form.htm"
  arrLeftNavPages[6] = "2.5-where-to-enter.htm"
  arrLeftNavPages[7] = "2.6-the-casting.htm"
  arrLeftNavPages[8] = "2.7-the-stopping-power-short-film.htm"
  
  var strLocation = self.document.location.pathname
  var strLocation = strLocation.substring (strLocation.lastIndexOf("/")+1 , strLocation.length)
  
  if (strLocation == "")
  {
     // homepage default file
     document.getElementById("leftNavTr_1.0").style.background = "#27408F"
     document.getElementById("leftNavImage_1.0").src = "/images/stoppingpower/globals/leftNav_minus.gif"
  }
  

  for (var i=0;i<arrLeftNavPages.length;i++)
  {
    if (strLocation.indexOf(arrLeftNavPages[i]) != -1)
    {
      if (i == 0)
      {
        // homepage
         document.getElementById("leftNavTr_1.0").style.background = "#27408F"
         document.getElementById("leftNavImage_1.0").src = "/images/stoppingpower/globals/leftNav_minus.gif"
      }
      else
      {
        var strId = strLocation.substring( 0 , strLocation.indexOf("-") )
        
        if ((document.getElementById("leftNavImage_" + strId)) && (document.getElementById("leftNavTr_" + strId)))
        {
         document.getElementById("leftNavTr_" + strId).style.background = "#27408F"
         document.getElementById("leftNavImage_" + strId).src = "/images/stoppingpower/globals/leftNav_minus.gif"
        }
      }
    }
  }
}


// Detect current page and change style right nav accoringly
function processRightNav()
{

  // this array holds pages to detect
  var arrRightNavPages = new Array()
  arrRightNavPages[0] = "4.01-press-room-intro.htm"
  arrRightNavPages[1] = "4.1-press-releases.htm"
  arrRightNavPages[2] = "4.2-photos.htm"
  arrRightNavPages[3] = "4.3-contact-details.htm"

  
  var strLocation = self.document.location.pathname
  var strLocation = strLocation.substring (strLocation.lastIndexOf("/")+1 , strLocation.length)


  
  for (var i=0;i<arrRightNavPages.length;i++)
  {
    if (strLocation.indexOf(arrRightNavPages[i]) != -1)
    {
      var strId = strLocation.substring( 0 , strLocation.indexOf("-") )
    
       document.getElementById("rightNavTr_" + strId).style.background = "#33CC66"
       document.getElementById("rightNavImage_" + strId).src = "/images/stoppingpower/globals/rightNav_highlight_on.gif"


    }
  }
}
