$(document).ready(function() {
	$("#contact-dialog").dialog({
		autoOpen: false,
		bgiframe: true,
		resizable: false,
		//height:340,
		width:540,
		modal: true,
		overlay: {
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: {
			'Fermer': function() {
				$(this).dialog('close');
			},
			'Contacter': function() {
				$("#contact-dialog-form").submit();
			}
		}
	});
	
	$('#all-rides-table tbody tr').click( function () {
		$this = $(this);
		if($this.attr('id').length == 0)
			return true;
	    $('#contact-dialog-content').load(
	    	$this.attr('id').replace(" ", "%20"),
	    	function () {
	    		// This is a callback, after the ajax gets loaded
	    		$("#contact-dialog").dialog('open');
	    });
	    // to prevent actually making the link go anywhere
	    return false;
   });
	
	$('#all-rides-table tbody tr').each(function(){
		$(this).hover(function(){
			$(this).addClass('hover');
		}, function(){
			$(this).removeClass('hover');
		});
	});
});
