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'
  });
  
  $("#nav-item .sub-cats").hide();
  $("#nav-item .parent").click(function(){
    $("#nav-item .sub-cats:visible").slideUp("normal");
    $(this).next().slideDown("normal");
    return false;
  });

});

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,"_sel$1"));
	//$(t).addClass('selected');
}

function bookmark() {
	window.sidebar.addPanel('Rosy Cheeks','http://www.rosy-cheeks.com/','');return false;
}


