// SRI ADDED INTERFACE FUNCTIONS and moved some into this lib TO MAKE IT EASIE TO GENERISIZE

  function checkspelling(fld)
    {
      if(eval(fld)) {
      chkfld = fld;
      spellcheck();
      }
    }

var spellCheckURL="SRIJSpell.jsp"; // change to point to the JSpell Spell Check Server
var imagePath="images"; // relative URL to JSpell button images directory
var chkfld;
function getSpellCheckItem() {
	// to spell check a field just enter the entire 'path' to the form and field
      return chkfld;
}


function spellcheck() {
	var directmode=false; var width=450; var height=200;
	if (navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.toLowerCase().indexOf("opera")==-1) {	
		directmode=true; width=220;
	}

	var w = 640, h = 480;
	if (document.all || document.layers)
		w = screen.availWidth; h = screen.availHeight;

	var leftPos = (w/2-width/2), topPos = (h/2-height/2);
	ww=window.open("", "checker", "width="+width+",height="+height+",top="+topPos+",left="+leftPos+",toolbar=no,status=no,menubar=no,directories=no,resizable=yes");
	var h="";
	// SRI ADDED THE onLoad event
	h+='<HTML><HEAD><TITLE>Spell Checker</TITLE></HEAD><BODY onLoad="self.opener.fieldsHaveChanged=true; go();">';
	h+='<FORM ACTION="'+spellCheckURL+'" METHOD="POST" NAME="jspell" target="checker">';
	h+='<INPUT TYPE=hidden NAME="field" VALUE="fieldvalue">';
	h+='<INPUT TYPE=hidden NAME="imagePath" VALUE="'+imagePath+'">';
	h+='<INPUT TYPE=hidden NAME="fieldvalue" VALUE="">';

	if (directmode)
		h+='<INPUT type=hidden NAME="directEdit" VALUE="YES">';
	else
		h+='<INPUT type=hidden NAME="directEdit" VALUE="NO">';

	h+='</FORM>';
	h+='<SCR'+'IPT>';
	// SRI ADDED
	h+=' function go() { ';
	if(navigator.userAgent.toLowerCase().indexOf("opera")==-1)	{
		h+='document.forms["jspell"].fieldvalue.value=opener.getSpellCheckItemValueValue();';
	} else {
		h+='document.forms["jspell"].fieldvalue.value=unescape("'+escape(eval(getSpellCheckItemValue()))+'");';
	}
	h+='document.forms["jspell"].submit();';
	// SRI ADDED
	h += ' } ';

	h+='</SCRIPT></BODY></HTML>';

	ww.document.open();	ww.document.write(h);	ww.document.close(); ww.focus();
}
function updateForm(newvalue) { eval(getSpellCheckItemValue()+"=newvalue"); }
function getSpellCheckItemValue() { return getSpellCheckItem()+".value"; }
function getSpellCheckItemValueValue() { return eval(getSpellCheckItemValue()); }

