// CCDC Coleman Town Javascript Library
// Requires jquery.js

// Javascript Rollover Navbar
$(function() {
    $("#navbar img").hover(function() {
	$(this).attr("src", $(this).attr("src").split("_no.").join("_ro."));
    }, function() {
	$(this).attr("src", $(this).attr("src").split("_ro.").join("_no."));
    });
});

// Javascript Rollover Sidebar
$(function() {
    $("#sidenav img").hover(function() {
	$(this).attr("src", $(this).attr("src").split("_no.").join("_ro."));
    }, function() {
	$(this).attr("src", $(this).attr("src").split("_ro.").join("_no."));
    });
});

// Preload Image Function
jQuery.preloadImages = function()
{
    for(var i = 0; i<arguments.length; i++)
    {
	jQuery("<img>").attr("src", arguments[i]);
    }
}

// Email Hiding
$(function(){
    var spt = $('span.mailme');
    var at = / at /;
    var dot = / dot /g;
    var addr = $(spt).text().replace(at,"@").replace(dot,".");
    $(spt).after('<a href="mailto:'+addr+'" title="Send an email" class="footer_links">'+ addr +'</a>')
	.hover(function(){window.status="Send a letter!";}, function(){window.status="";});
    $(spt).remove();
});

