$(window).bind('load', function() {
    var preload = new Array();
    $("img.img_swap").each(function() {
		s = $(this).attr("src").replace(/\/(\w+)\.(.+)$/i, "\/over\/$1.$2");
        preload.push(s)
    });
    var img = document.createElement('img');
    $(img).bind('load', function() {
        if(preload[0]) {
            this.src = preload.shift();
        }
    }).trigger('load');
});

$(document).ready(function(){
	// hover swap class
	$(".img_swap").hover(function() {
        s = $(this).attr("src").replace(/\/(\w+)\.(.+)$/i, "\/over\/$1.$2");
        $(this).attr("src", s);
    }, function() {
        s = $(this).attr("src").replace(/\/over\//i, "\/");
        $(this).attr("src", s);
    });
	// swap sibling images -- trigger hover event on img_swap siblings
	$(".txt_sibling_img_hover").hover(function() {
		$(this).siblings(".img_swap").trigger('mouseover');
	}, function() {
		$(this).siblings(".img_swap").trigger('mouseout');
	});
	
	// hover tr for tables
	$("tr.tr_hover,	tr.tr_hover_link").hover(
      function () {
        $(this).addClass("tr_hover_in");
      }, 
      function () {
        $(this).removeClass("tr_hover_in");
      }
    );
	$("tr.tr_hover_link").click(
      function () {
        window.location = $(this).find("a").eq(0).attr("href");
     });
});
