/* Collection of scripts for Epitope Viewer use
 * 
 * Author: buellj
 * 
 */   


function createDialogContent(assayId)	{

	var dialogContent = "<br/>"
		+ "<button id='buttonOne'"  
		+ "dojoType='dijit.form.Button' " 
		+ "type='button' "
		+ "onClick='runJnlp(\"cur\", " + assayId + ");'>"
		+ "Curated"
		+ "</button>"

		+ "&nbsp; &nbsp;"

		+ "<button id='buttonTwo'"  
		+ "dojoType='dijit.form.Button' " 
		+ "type='button' "
		+ "onClick='runJnlp(\"calc\", " + assayId + ");'>"
		+ "Calculated"
		+ "</button>"
		+ "<p/>";

	return dialogContent;

}

var secondDlg;
dojo.addOnLoad(function() {
	// create the dialog:
	// IE has an issue defining multiple attributes in the constructor
	secondDlg = new dijit.Dialog({
		title: "Epitope Viewer Selection"
	});
	secondDlg.attr("style", "width: 300px; background-color:#FFFFFF");
	secondDlg.attr("class", "tundra");
	
	dojo.body().appendChild(secondDlg.domNode);
	secondDlg.startup();

});

function showDialog(assayId) {

	var dialogContent = createDialogContent(assayId);
	secondDlg.attr("content", dialogContent);
	secondDlg.show();
}


/*
		///runJnlp Function///
		type = 'cur' (curated) or 'calc' (calculated)
		id = Assay ID (a number)
		relativePath = Path to jnlp file.  Default= "/viewer/jnlp/".
 */
function runJnlp(type, id, relativePath)	{
	var path = relativePath || "/viewer/jnlp/";
	var url = path + id + "_" + type + "_.jnlp"; 

	openURL(url);   /// see iedb_misc.js for this function.

}	
