

//--- Display an entities correctly. This function is called at every point in the document 
// an enitity appears. ---
function Ent(strUnicode, strHTML, strImageFileName, strEnglishChar) {

	// - n.b. charcode 38 is an ampersand we use it get round XML escaping.
	var strAmp = String.fromCharCode(38);
	
	var blnRendered = false;
	
	
	
	// First attempt for all non-mac platforms is to use decimal unicode entity
	//Commented Defect ID 28848
	//if ((strUnicode.length > 0) && (navigator.platform.indexOf('Mac') == -1)) {
	
		// - a contains all the non-continuous unicode values not present in Verdana
		var a = new Array(0x1ce,0x1e7,0x259,0x2038,0x212b,0x2192,0x21cb,0x2208,0x2209,0x2220,0x2223,0x2229,0x222a,0x2245,0x2261,0x2282,0x2284,0x2573,0x2660,0x2663,0x2665,0x2666,0x266d,0x266e,0x266f,0x2003,0x2223);
		
		// - w contains the non-continuous unicode values not present in Verdana on Win95 only
		var w = new Array(0x221E,0x2260,0x2265,0x222B,0x221A,0x010D)

		if(strUnicode == '2223') {
			// - 2223 is a divides (vertical bar) symbol. For reasons unknown, it does not
			// display in browsers, but is in character map for both fonts. Take a quick-fix
			// approach and replace it with one that looks the same.
			strUnicode = '7c';
		}

		// - cast the hex string unicode value to an integer
		var u = new Number('' + '0x' + strUnicode);

		// - f determines if we need to change the font from Verdana
		var f = false;
		
		if((u >= 0x200) && (u <= 0x2c5)) {
			// - This character is in the continuous range of characters we know are missing from Verdana
			f = true;
		}
		else {
			// - Check to see if this is one of the other characters that are missing from Verdana
			for(i=0;i<a.length;i++) {
				if (a[i] == u) {
					f = true;
				}
			};
		}
		
		if((navigator.appVersion.indexOf('95') != -1)) {
			// - This character should be in Verdana on most systems. The exception is Win 95
			// so we need to check against our second list of missing chars for this platform.
			for(i=0;i<w.length;i++) {
				if (w[i] == u) {
					f = true;
				}
			};
		}
		
		if(f) {
			// - This unicode is not present in Verdana, so use Lucida if the platform is 
			// not Win9x or Mac.
			if((navigator.appVersion.indexOf('Win9') == -1) && (navigator.appVersion.indexOf('Windows 9') == -1)) {
				document.write('<span class="spnEnt">' + strAmp + '#' + u + ';' + '</span>');
				blnRendered=true;
			}
		}
		else {
			// - This unicode is present in Verdana, so just use the HTML entity
			document.write(strAmp + '#' + u + ';');
			blnRendered=true;
		}
	//}
	
	if((!blnRendered) && (strHTML.length > 0)) {
		// - otherwise, if there is an HTML version then use that.
		document.write(strAmp + strHTML + ';');
		blnRendered=true;
	}
	
	if((!blnRendered) && (strImageFileName.length > 0)) {
	   // - failing that, if there is an image, then use it.
		document.write('<img src="/images/entities/' + strImageFileName + '" border="0" alt="' + strEnglishChar + '"/>');
		blnRendered=true;
	}
	
	if(!blnRendered) {
		// - Use english char if we have no other choice
		document.write(strEnglishChar);
	}
}
