
//	include_display_phoneme_grid.js		2007-05-08
//
//	inits for the include_phoneme_grid procedure (css and pl)
//
//	2007-09-30	replation of null (zero) on IE was not working
//
//

var globalPhonemeGrid	='';	// global to hold current name of image
var globalImageFormName	='';		// global to hold current name of form

function initPhonemeGrid(prmFormName, prmPhonemeSymbol)	{
	globalImageFormName	= prmFormName		;	// set the global image form name to this input form name
	globalPhonemeGrid	= prmPhonemeSymbol	;	// set the phomeme symbol to this global 
};

function setPhonemeGrid(prmValue)	{
			// set the picture to this input name
	//document.getElementById(globalPhonemeGrid).textContent	= prmValue;
	document[globalImageFormName][globalPhonemeGrid].value	= prmValue;
};

function ascii_value (c)
{
	// restrict input to a single character
	c = c . charAt (0);

	// loop through all possible ASCII values
	var i;
	for (i = 0; i < 256; ++ i)
	{
		// convert i into a 2-digit hex string
		var h = i . toString (16);
		if (h . length == 1)
			h = "0" + h;

		// insert a % character into the string
		h = "%" + h;

		// determine the character represented by the escape code
		h = unescape (h);

		// if the characters match, we've found the ASCII value
		if (h == c)
			break;
	}
	return i;
}
