/**
 * file: email_table.js
 * date: Tue 23 March 2010
 * author: Karl Cordes
 *
 * purpose: uses jQuery to create a mail client-like interface for viewing the emails associated with an enquiry (or contact)
 *
 */


$(function () {

    $("#ViewDialog").dialog({
	autoOpen: false,

	width: 900,
	modal: false,
	position: 'top',
	buttons: {

	    Close: function() {
		$(this).dialog('close');
	    }
	},
	close: function() {
	//What happens on close goes here.
	}


    });

    $('.viewLink').click(function() {

	var currentID = $(this).attr('id');
	var subject = $(this).text();

	$("#ViewDialog").dialog("option", "title", subject);

	$.get('/emails/frame/'+currentID, function (data) {
	    $("#ViewDialog").html(data);
            
	});


	$("#ViewDialog").dialog('open');

	return false;
    
    });

    
    

}
);