// preload function - should work in most browsers
var cache = [];
function preload(imageArray) {
    $(imageArray).each(function(){
    	var cacheImage = $('<img/>')[0];
        cacheImage.src = this;
        cache.push(cacheImage);
    });
}

var buttonRollSrc = './images/buynow_button_rollover.png';

$(document).ready(function() {
	preload([buttonRollSrc]);
	
	$('.buy_button img').each(function() {
		$(this).data('original',$(this)[0].src);
	}).hover(function() {
		$(this)[0].src = buttonRollSrc;
	},function() {
		$(this)[0].src = $(this).data('original');
	}).mousedown(function () {
		$(this).addClass('active');
	}).bind('mouseup mouseleave', function () {
		$(this).removeClass('active');
	});
});
