var speller_output;
var can_fetch_speller;

function check_spelling(passage) {
	var url = "isa=Metadot::SystemApp::Speller;op=check_spelling;";
	if (passage != "" && passage != undefined) {
		url += "passage=" + escape(passage) + ";";
	}
	$.ajax({
		type: "POST",
		url: "/index.pl",
		data: url,
		beforeSend: function(item) {
			can_fetch_speller = false;
		},
		success: function(message) {	
  			if (message.length > 5) {							
				speller_output = $.evalJSON(message);
				speller_output = speller_output.results;
			}
			can_fetch_speller = true;
		}
	});
}

function can_fetch_speller_output() {
	return can_fetch_speller;
}

function fetch_speller_output() {
	return speller_output;
}


