// Use jQuery to highlight current page in left nav
jQuery(function($) {
  var path = location.pathname;
  $('#leftbot-nav a[@href$="' + path + '"]').addClass('active');
  $('#leftbot-nav a[@href$="' + path + 'index.asp"]').addClass('active');
});

// Load home banner randomly
function homebannerimage(){
  var images=new Array()
  images[0]="/images/homepage/banner/01.jpg"
  images[1]="/images/homepage/banner/02.jpg"
  images[2]="/images/homepage/banner/03.jpg"
  images[3]="/images/homepage/banner/04.jpg"
  images[4]="/images/homepage/banner/05.jpg"
  images[5]="/images/homepage/banner/06.jpg"
  images[6]="/images/homepage/banner/07.jpg"
  images[7]="/images/homepage/banner/08.jpg"
  images[8]="/images/homepage/banner/09.jpg"
  images[9]="/images/homepage/banner/10.jpg"
  images[10]="/images/homepage/banner/11.jpg"
  images[11]="/images/homepage/banner/12.jpg"
  images[12]="/images/homepage/banner/13.jpg"
  images[13]="/images/homepage/banner/14.jpg"
  images[14]="/images/homepage/banner/15.jpg"
  images[15]="/images/homepage/banner/16.jpg"
  images[16]="/images/homepage/banner/17.jpg"
  images[17]="/images/homepage/banner/18.jpg"
  images[18]="/images/homepage/banner/19.jpg"
  images[19]="/images/homepage/banner/20.jpg"

  var r = Math.round(Math.random()*(images.length-1));

  document.write('<img src="'+images[r]+'" alt="Homepage banner image" />');
}

function sectionbannerimage(){
  var images=new Array()
  images[0]="/images/SectionBanners/01.jpg"
  images[1]="/images/SectionBanners/02.jpg"
  images[2]="/images/SectionBanners/03.jpg"
  images[3]="/images/SectionBanners/04.jpg"
  images[4]="/images/SectionBanners/05.jpg"
  images[5]="/images/SectionBanners/06.jpg"
  images[6]="/images/SectionBanners/07.jpg"
  images[7]="/images/SectionBanners/08.jpg"
  images[8]="/images/SectionBanners/09.jpg"
  images[9]="/images/SectionBanners/10.jpg"
  images[10]="/images/SectionBanners/11.jpg"
  images[11]="/images/SectionBanners/12.jpg"
  images[11]="/images/SectionBanners/13.jpg"
  images[11]="/images/SectionBanners/14.jpg"
  images[11]="/images/SectionBanners/15.jpg"
  images[11]="/images/SectionBanners/16.jpg"
  images[11]="/images/SectionBanners/17.jpg"
  images[11]="/images/SectionBanners/18.jpg"

  var r = Math.round(Math.random()*(images.length-1));

  document.write('<img src="'+images[r]+'" alt="Section banner image" />');
}

function wopen(url, name, w, h)
{
  // Fudge factors for window decoration space.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=yes, resizable=no');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}

