// Allows console to alert in IE
if( !console ) { var console = { log: function(msg) { alert(msg); } } }

$(window).bind('load', function() {
    var preload = new Array();
    $(".hover").each(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_on.$1");
        preload.push(s)
    });
    var img = document.createElement('img');
    $(img).bind('load', function() {
        if(preload[0]) {
            this.src = preload.shift();
        }
    }).trigger('load');
});


$().ready(function() {


    /* general hovers */
    $(".hover").each(function() {
        if ($(this).attr("src").match(/_on\.(.+)$/i)) {
            $(this).removeClass("hover");
        }
    });
    $(".hover").hover(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_on.$1");
        $(this).attr("src", s);
    }, function() {
        s = $(this).attr("src").replace(/_on\.(.+)$/i, ".$1");
        $(this).attr("src", s);
    });
	
	//pagination for articles
	$('table.paginated').each(function() {

    var currentPage = 0;

    var numPerPage = 10;

    var $table = $(this);

    $table.find('tbody tr').show()

      .lt(currentPage * numPerPage)

        .hide()

      .end()

      .gt((currentPage + 1) * numPerPage - 1)

        .hide()

      .end();

  });

});//main data
