
// Generates A Pop Up With Event Details
function event_detail(serial_num) {

    // Create The Single Event Pop Up Div If One Doesn't Already Exist
    if (jQuery("#single_event_popup").length === 0) {
	var div = jQuery('<div></div>');
	jQuery(div).attr("id","single_event_popup") ;
	jQuery('body').prepend(div);
    }

    // Now Close It So We Start With A Blank Slate Each Time
    close_it("single_event_popup");

    // Set Our Coordinates
    var lefty = parseInt( ( ( window.viewport.width() / 2) - 250 ), 10 ) + 'px';
    var toppy = parseInt( ( window.viewport.scrollTop() + 60 ), 10) + 'px';

    // Style It
    jQuery("#single_event_popup").css({
	        display: 'block',
	        position: 'absolute',
		'z-index': '5000',
		left: lefty,
		top: toppy,
		border: '5px solid #ccc',
		padding: '5px',
		background: 'white',
		width: '500px'
		});

    // Loading...
    jQuery("#single_event_popup").empty().html('<small><img src="/images/loading.gif" style="float:left;margin-right:5px;"> Loading...</small>');

    // Grab And Load The Content
    var event_detail_page = "/cgi-bin/calnug?id=" + serial_num;
    jQuery("#single_event_popup").load(event_detail_page).fadeIn('slow');

    // And We're Out
    return false;
}

// Hides The Informational Pop Up
function close_it(el_to_close) {

    // Empty The HTML And Relocate Via CSS
    jQuery("#" + el_to_close).empty().html("");
    jQuery("#" + el_to_close).css({ display: "none" });

    // And Out
    return false;

}
