var g_tnuid = '';
var g_taxon = '';
var g_pub_id = '';

function prepareTreatment(tnuid, taxon, pub_id, elementID) {
	var urlTreatment = 'http://hymfiles.biosci.ohio-state.edu/scripts/OJ_Break.pl?action=getTreatment&lsid=urn:lsid:biosci.ohio-state.edu:osuc_concepts:' + tnuid + '&pub_id=' + pub_id + '&elementID=' + elementID + '&callback=handlePrepareTreatment';
	
	g_tnuid = tnuid;
	g_taxon = taxon;
	g_pub_id = pub_id;
	
	// Create a new script object (JSON-style query)
	aObj = new JSONscriptRequest(urlTreatment);
	// Build the script tag
	aObj.buildScriptTag();
	// Execute (add) the script tag
	aObj.addScriptTag();
}

function handlePrepareTreatment(jData) {
	if (jData == null) {
		// Parse problem so return
		return;
	}
	
	// Prepare treatment if data is available
	if (jData.count > 0) {
		document.getElementById(jData.callback_opt1).innerHTML += ' Plazi Digital Archive: <a href="http://plazi.org:8080/GgSRS/search?searchMode=displayDocument&118273105.LSID=urn:lsid:biosci.ohio-state.edu:osuc_concepts:' + g_tnuid + '&214588052.ModsDocID=' + g_pub_id + '&118273105.isNomenclature=1&minRelevance=0.9" target="_new"><img src="http://atbi.biosci.ohio-state.edu/HymOnline/plazi_logo.png" title="View formatted treatment from Plazi" border="0"></a>';
	}
}
