var loader = { 
  imgs: [],
  load: function(src) {img=this.imgs; var ct=img.length; img[ct]=new Image();img[ct].src=src;}
};
$(function() {

  /* roll over */
  $("a.ro").each(function() { loader.load($(this).children('img').attr('src').replace(/(\.[a-z]{3})$/i,"_on$1"));});
  $("a.ro").mouseover(function() {
    var src=$(this).children('img').attr('src');
    $(this).children('img').attr('src', src.replace(/(\.[a-z]{3})$/i,"_on$1"));
  });
  $("a.ro").mouseout(function() {
    var src=$(this).children('img').attr('src');
    $(this).children('img').attr('src', src.replace(/_on/,""));
  });
  
  /* lightbox */
  $('a[@rel*=lightbox]').lightBox({
		imageLoading:  '/images/lightbox-ico-loading.gif',
		imageBtnClose: '/images/lightbox-btn-close.gif',
		imageBtnPrev:  '/images/lightbox-btn-prev.gif',
		imageBtnNext:  '/images/lightbox-btn-next.gif'
  });

})

function navSelect(num) {
  if (!num) { return;}
	t = "#global-nav #nav"+num+" a";
  $(t).removeClass("ro");
	src = $(t).children('img').attr('src');
	$(t).children('img').attr('src', src.replace(/(\.[a-z]{3})$/i,"_on$1"));
	$(t).addClass('selected');
}
