<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<%= stylesheet_link_tag "/javascripts/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle" %>
<%= javascript_include_tag "fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow" %>
<script type="text/javascript" language="javascript">
// <![CDATA[
	var suggs = new Array();
	var words = new Array();
	var textinputs = new Array();
	var error;

	textinputs[0] = decodeURIComponent('<%= @original_text %>');
	words[0] = [];
	suggs[0] = [];

	<% @words.each_with_index do |pair, i| %>
		words[0][<%= i %>] = '<%= pair[0] %>';
		suggs[0][<%= i %>] = [<%= pair[1] %>];
	<% end %>

	var wordWindowObj = new wordWindow();
	wordWindowObj.originalSpellings = words;
	wordWindowObj.suggestions = suggs;
	wordWindowObj.textInputs = textinputs;

	function init_spell() {
	  // check if any error occured during server-side processing
	  if( error ) {
	    alert( error );
	  } else {
	    // call the init_spell() function in the parent frameset
	    if (parent.frames.length) {
	      parent.init_spell( wordWindowObj );
	    } else {
	      alert('This page was loaded outside of a frameset. It might not display properly');
	    }
	  }
	}
</script>
</head>
<body onload="init_spell();">

<script type="text/javascript" language="javascript">
// <![CDATA[
	wordWindowObj.writeBody();
// ]]>
</script>

</body>
</html>