var uvsi = location.search.substring(1, location.search.length)

if (uvsi == 'img') {
	uvsigif = "ivsu"
	uvsiquery= "uni"
	uvsidisp = "Unicode"
	uvsikey = "U"
	uvsikeynum1 = 85
	uvsikeynum2 = 117
	document.onkeypress = keyhandler;
	}
else {
	uvsigif = "uvsi"
	uvsiquery = "img"
	uvsidisp = "image-based"
	uvsikey = "I"
	uvsikeynum1 = 73
	uvsikeynum2 = 105
	document.onkeypress = keyhandler;
	}

uvsitext = "Click here or press the " + uvsikey + " key for " + uvsidisp + " text"

function keyhandler(e) {
    if (window.event) { Key = window.event.keyCode;}
    else { Key = e.which;}
    if (Key == uvsikeynum1 || Key == uvsikeynum2) {
    	self.location = '?' + uvsiquery;
    	}
    }

function imguni(imgtext,unitext) {
	if (uvsi == 'img') {
		charlist = new Array();
		charlist = imgtext.split("-");
		for (i=0; i<charlist.length; i++) {
			thischar = charlist[i];
			pos = thischar.lastIndexOf("jpg")
			if (pos == -1) {
				pos = thischar.lastIndexOf("gif")
				}
			if (pos != -1 && pos == thischar.length-3) {
				charlist[i] = "<img src=" + thischar + " align=absmiddle>";
				}
			else {
				pos = thischar.indexOf("|");
				if (pos == 1) {
					imgtype = thischar.substring(0, 1);
					thischar = thischar.substring(2, thischar.length);
					if (imgtype=='D') {
						imgpath="/images/char/doulos/";
						imgsuff=".gif";
						}
					if (imgtype=='B') {
						imgpath="/images/char/braille/";
						imgsuff=".gif";
						}
					if (imgtype=='G') {
						imgpath="/images/char/greek/";
						if (thischar <= 'z' && thischar >= 'a') {
							imgpath = imgpath + "lc/";
							}
						imgsuff="gr.gif";
						}

					charlist[i] = "<img src=" + 
						imgpath + thischar + imgsuff +
						" align=absmiddle>";
					}
				}
			}
		imgtext = charlist.join("");		
		}
	document.write("<nobr><span title='" + uvsitext + "' onClick='self.location=\"?" +
		uvsiquery + "\"'>")
	document.write((uvsi == 'img')?imgtext:unitext)
	document.write("</span></nobr>")
	}

function displayopt() {
	document.write('<a href="?' + uvsiquery + '"><img src="/images/char/' + uvsigif + '.gif" alt="' + uvsitext + '" text" title="' + uvsitext + '" border=0></a><img src="/images/t.gif" height=1 width=3></a>')
	}


var ie = document.all;
var dom = document.getElementById;
var ns4 = document.layers;
var units = document.layers?"":"px";

function unicodeHelpBox(){
	if (!dom&&!ie&&!ns4)
		return;
	now = new Date();
	now = new Date(Date.parse(now.toString()) + 5184000000)

	document.cookie="unicodeHelpBoxed=yes;PATH=/;EXPIRES=" + now.toGMTString();
	unicodeHelpBoxobj=(dom)?document.getElementById("unicodeHelpBox").style : ie? document.all.unicodeHelpBox : document.unicodeHelpBox;
	unicodeHelpBoxobj.visibility=(dom||ie)? "visible" : "show";
	}

function truebody() {
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

function dismissbox() {
	unicodeHelpBoxobj.visibility="hidden";
	}

function autounicodeHelpBox() {
	if (get_cookie("unicodeHelpBoxed")=="")
		unicodeHelpBox();
	}

function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = ""
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) {
			offset += search.length
			end = document.cookie.indexOf(";", offset)
			if (end == -1)
				end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
			}
		}
	return returnvalue;
	}

document.write('<!-----------Help Box Section----------><div id="unicodeHelpBox" style="position:absolute;visibility:hidden;left:100px;top:50px;width:500;height:500;background-color:#ffffff"><table border="0" width="500" cellspacing="0" cellpadding="1" bgcolor="#000000"><tr> <td width="100%"><table border="0" width="500" cellspacing="0" cellpadding="10" bgcolor="' 
+ brdr + 
'"><tr> <td width="100%"><table border="0" width="500" cellspacing="0" cellpadding="1" bgcolor="#000000"><tr> <td width="100%"><table border="0" width="100%" bgcolor="#FFFFFF" cellspacing="0" cellpadding="10"> <tr> <td width="100%"><font face="sans-serif" size="-1"><b>Quick Unicode Tips</b></font><font size="-1"><p>This page contains Unicode characters, such as <i>a with macron</i> (&#x0101;), <i>e with breve</i> (&#x0115;), <i>heng with hook</i> (&#x0267;), <i>Cyrillic de</i> (&#x0414;), <i>Armenian xeh</i> (&#x056D), <i>Devangari au</i> (&#x0914;), or <i>Cherokee yi</i> (&#x13F1;). The particular characters used on this page may not display properly in your browser depending on your browser settings and installed fonts.</p><p>If you are having trouble viewing the Unicode characters, you can switch to image-based characters, which do not look as good, but are compatible with almost all browsers.</p></font><blockquote> <font size="-1"><p> <img src="/images/char/uvsi.gif" align=absmiddle> <b>Unicode:</b> this icon in the upper right corner indicates that you are viewing Unicode-based text. </p><p> <img src="/images/char/ivsu.gif" align=absmiddle> <b>Images:</b> this icon in the upper right corner indicates that you are viewing image-based text.</p></font> </blockquote> <font size="-1"><p>Click on the icon on the page to toggle the kind of text you see. You may also press the <b>U</b> key for Unicode or the <b>I</b> key for image-based text.</p> </font><div align="right"><font size=-1><a href="" onClick="dismissbox();return false;">Close Unicode Help </a></div> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </div><!-----------Help Box Section---------->');

	
autounicodeHelpBox()