
function stock_detail_page_init_dialogs() { 
        jQuery('#stock_trials_info_popup').dialog({ 
	'autoOpen' : false,
	'modal' : true,
	'height' : 600,
	'width' : 700,
	'buttons' : {
	    'OK' : function() { 
		jQuery('#stock_trials_info_popup').dialog("close");
	    }
	}
	    
    });

}

function show_stock_trial_detail(stock_id, stock_name, trial_id, trial_name) { 
    jQuery('#stock_trials_info_popup').dialog("option", "title", "Phenotypic data for "+stock_name+" from trial "+trial_name);
    jQuery('#stock_trials_info_popup').dialog("open");
    jQuery('#stock_trials_info_table').DataTable().destroy();

    jQuery('#stock_trials_info_table').DataTable( { 
	ajax: '/stock/'+stock_id+'/datatables/trial/'+trial_id,	
    });
}

@@ -283,16 +283,285 @@
    %7D);%0A%0A
+    jQuery('#remove_parent_dialog').dialog(%7B %0A%09'autoOpen' : false,%0A%09'modal' : true,%0A%09'title' : 'Remove a parent',%0A%09'height' : 300,%0A%09'width' : 400,%0A%09'buttons' : %7B%0A%09    'Done' : function() %7B %0A%09%09jQuery('#remove_parent_dialog').dialog(%22close%22);%0A%09    %7D,%0A%0A%09%7D%0A%09    %0A    %7D);%0A%0A%0A
 %7D%0A%0Afunct
@@ -1001,8 +1001,1103 @@
   %7D);%0A%7D%0A
+%0Afunction get_remove_parents_list(stock_id) %7B %0A    jQuery.ajax( %7B %0A%09url : '/ajax/stock/parents?stock_id='+stock_id,%0A%09success: function(response) %7B %0A%09    var html = %22%22;%0A%09    for (var n=0; n%3Cresponse.parents.length; n++) %7B %0A%09%09html += response.parents%5Bn%5D%5B1%5D+ '&nbsp;&nbsp;%3Ca href=%22javascript:remove_parents('+response.stock_id+','+ response.parents%5Bn%5D%5B0%5D+');%22 %3E%3Cfont color=%22red%22 %3EX%3C/font%3E%3C/a%3E%3Cbr /%3E%3Cbr /%3E';%0A%09%09%0A%09    %7D%0A%0A%09    jQuery('#remove_parent_list').html(html);%0A%09%7D,%0A%09error: function(response) %7B %0A%09    alert(%22an error occurred.%22);%0A%09%7D%0A    %7D);%0A%0A%7D%0A%0Afunction remove_parents(stock_id, parent_id) %7B %0A    var yes = confirm(%22Are you sure you want to remove this parent?%22);%0A    if (yes) %7B %0A%09jQuery.ajax( %7B %0A%09    url: '/ajax/stock/parent/remove',%0A%09    data: %7B 'stock_id' : stock_id, 'parent_id' : parent_id %7D,%0A%09    success : function(response) %7B %0A%09%09if (response.error) %7B %0A%09%09    alert(response.error);%0A%09%09%7D%0A%09%09else %7B %0A%09%09    alert(%22The parent has been removed.%22);%0A%09%09    jQuery('#remove_parent_dialog').dialog(%22close%22);%0A%09%09    window.location.href = '/stock/'+stock_id+'/view';%0A%09%09    %0A%09%09%7D%0A%09    %7D%0A%09%7D);%0A%09%0A    %7D%0A%0A%7D%0A

add javascript module for stock detail page.