$(document).ready(function() {
	var closeTimer = null;
	
	$('.rollHandle').each( function() {
		$(this).bind('mouseover', function() {
			showBox('#' + $(this).attr('title'));
		});
		$(this).bind('mouseout', function() {
			hideBox('#' + $(this).attr('title'));
		});
	});
	
	$('.rollBox').each( function() {
		$(this).bind('mouseover', function() {
			showBox(this);
		});
		$(this).bind('mouseout', function() {
			hideBox(this);
		});
	});
	
	function showBox(el) {
		if(closeTimer) { 
			window.clearTimeout(closeTimer);
			closeTimer = null;
		}
		$(el).show();
	}
	
	function hideBox(el) {
		closeTimer = window.setTimeout($(el).css('display', 'none'), 1000);
	}
	
	function createLinkTargets() {
	    $('a.newWindow').each( function() {
	        $(this).bind( 'click', function () {
	            var newWindow = window.open($(this).attr('href'));
	            return false;
	        });
	    });
	    return;
	}

	createLinkTargets();
});
