var cpiURL = 'http://www.publicintegrity.org/project_assets/hsMapAssets/';

function showStateText(stateID) {
	stateID = stateID.replace(/_/gi, ' ');
	$.ajax({
		type: "GET",
		beforeSend: function() { 
			$('#mapTextHed').html('');
			$('#mapText').html('Loading ' + stateID + ' information ...'); 
		},
		url: cpiURL + 'Data/getData.php',
		dataType: 'xml',
		data: 'state=' + stateID,
		success: function(xml) {
			$("#mapTextHed").html(stateID);
			$("#mapText").html("<p>" + $(xml).find("text").text() + "</p>");
			$("#mapText").append($(xml).find("documentsIndex").text());
			$("#mapText").append(' <a href=\"http://www.centerforinvestigativereporting.org/files/stateprofiles/'+ stateID.toLowerCase().replace(' ', '') + 'web.zip\">Download the analysis and documents listed above from ' + stateID + ' here.</a>');
		}
	});
}
