/**
 * @author delcastillo
 */

//image rollover script utilizing jQuery
$(function() {
// Preload all rollovers
		$("#background_box_sub > #nav img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/_off.png$/ig,"_on.png");
			$("<img>").attr("src", rollON);
		});

    $('#background_box_sub > #nav a').mouseover(function() {
        var imgsrc = $(this).children("img").attr('src');
		matches = imgsrc.match(/_on/);
		if (!matches)
			imgsrcON = imgsrc.replace(/_off.png$/ig,"_on.png");
			$(this).children("img").attr("src", imgsrcON);
		});
	$('#background_box_sub > #nav a').mouseout(function(){
       var imgsrc = $(this).children("img").attr('src');
	   imgsrc = imgsrc.replace(/_on.png$/ig,"_off.png");
		$(this).children("img").attr("src", imgsrc);
		});
	});
