	function PopUpWindow(h, w, name)
	{
		this.height = new Number(h);
		this.width = new Number(w);
		this.winName = name;

		var width, height;
		// determine the popup location
		/*
		** a certain mac browser does not like this code
		if (typeof java != 'undefined' && navigator.javaEnabled())
		{
			width = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;
			height = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height;
		}
		else
		{
			width = 1024;
			height = 768;
		}
		*/
		width = 1024;
		height = 768;

		width -= 10; // center a little better

		this.left = (width > this.width) ? (Math.round((width - this.width) / 2)) : (0);
		this.top = (height > this.height) ? (Math.round((height - this.height) / 2)) : (0);

		this.winAttributes = new String("toolbar=no,location=no,directories=no,status=no,memubar=no,scrollbars=yes,resizable=yes,width=" + this.width + ",height=" + this.height + ",left=" + this.left + ",top=" + this.top + ",alwaysraised=yes,z-lock=yes");
		//this.popup = this;

		//this.checkPopupBlocker = new Function(
		//		"",
		//		"if (typeof(this.popup) == 'undefined') {alert('Please turn off you popup blocker.');} else {alert('Popups are working.')};"
		//);

		this.open = new Function("url", "code", "this.close(); if(typeof url != 'undefined' && url != '') {this.popup = window.open(url, this.winName, this.winAttributes);} else if(typeof code != 'undefined' && code != '') {this.popup = window.open('', this.winName, this.winAttributes); this.popup.document.write(code); this.popup.document.close();}");
		// this.close = new Function("if(this.isOpen() == true){this.popup.close();}");
		this.close = new Function(
			"",
			"if(this.isOpen() == true) {if (typeof(this.popup) != 'undefined') this.popup.close();}"
		);

		//this.isOpen = new Function("", "return (this.popup.closed == true) ? (false) : (true);");
		this.isOpen = new Function(
			"",
			"if (typeof(this.popup) != 'undefined') return (this.popup.closed == true) ? (false) : (true); else return true;"
		);
		//this.closed = new Boolean(true); // fake window attrubute
	}

	var misc_window = new PopUpWindow(500, 800, "misc_window");

	function greatEscape (s)
	{
		var i, c;
		var d = new String('');
		var hex = new Object();

		hex["\x00"] = "%00";
		hex["\x01"] = "%01";
		hex["\x02"] = "%02";
		hex["\x03"] = "%03";
		hex["\x04"] = "%04";
		hex["\x05"] = "%05";
		hex["\x06"] = "%06";
		hex["\x07"] = "%07";
		hex["\x08"] = "%08";
		hex["\x09"] = "%09";
		hex["\x0a"] = "%0a";
		hex["\x0b"] = "%0b";
		hex["\x0c"] = "%0c";
		hex["\x0d"] = "%0d";
		hex["\x0e"] = "%0e";
		hex["\x0f"] = "%0f";
		hex["\x10"] = "%10";
		hex["\x11"] = "%11";
		hex["\x12"] = "%12";
		hex["\x13"] = "%13";
		hex["\x14"] = "%14";
		hex["\x15"] = "%15";
		hex["\x16"] = "%16";
		hex["\x17"] = "%17";
		hex["\x18"] = "%18";
		hex["\x19"] = "%19";
		hex["\x1a"] = "%1a";
		hex["\x1b"] = "%1b";
		hex["\x1c"] = "%1c";
		hex["\x1d"] = "%1d";
		hex["\x1e"] = "%1e";
		hex["\x1f"] = "%1f";
		hex["\x20"] = "%20";
		hex["\x21"] = "%21";
		hex["\x22"] = "%22";
		hex["\x23"] = "%23";
		hex["\x24"] = "%24";
		hex["\x25"] = "%25";
		hex["\x26"] = "%26";
		hex["\x27"] = "%27";
		hex["\x28"] = "%28";
		hex["\x29"] = "%29";
		hex["\x2a"] = "%2a";
		hex["\x2b"] = "%2b";
		hex["\x2c"] = "%2c";
		hex["\x2d"] = "%2d";
		hex["\x2e"] = "%2e";
		hex["\x2f"] = "%2f";
		hex["\x30"] = "%30";
		hex["\x31"] = "%31";
		hex["\x32"] = "%32";
		hex["\x33"] = "%33";
		hex["\x34"] = "%34";
		hex["\x35"] = "%35";
		hex["\x36"] = "%36";
		hex["\x37"] = "%37";
		hex["\x38"] = "%38";
		hex["\x39"] = "%39";
		hex["\x3a"] = "%3a";
		hex["\x3b"] = "%3b";
		hex["\x3c"] = "%3c";
		hex["\x3d"] = "%3d";
		hex["\x3e"] = "%3e";
		hex["\x3f"] = "%3f";
		hex["\x40"] = "%40";
		hex["\x41"] = "%41";
		hex["\x42"] = "%42";
		hex["\x43"] = "%43";
		hex["\x44"] = "%44";
		hex["\x45"] = "%45";
		hex["\x46"] = "%46";
		hex["\x47"] = "%47";
		hex["\x48"] = "%48";
		hex["\x49"] = "%49";
		hex["\x4a"] = "%4a";
		hex["\x4b"] = "%4b";
		hex["\x4c"] = "%4c";
		hex["\x4d"] = "%4d";
		hex["\x4e"] = "%4e";
		hex["\x4f"] = "%4f";
		hex["\x50"] = "%50";
		hex["\x51"] = "%51";
		hex["\x52"] = "%52";
		hex["\x53"] = "%53";
		hex["\x54"] = "%54";
		hex["\x55"] = "%55";
		hex["\x56"] = "%56";
		hex["\x57"] = "%57";
		hex["\x58"] = "%58";
		hex["\x59"] = "%59";
		hex["\x5a"] = "%5a";
		hex["\x5b"] = "%5b";
		hex["\x5c"] = "%5c";
		hex["\x5d"] = "%5d";
		hex["\x5e"] = "%5e";
		hex["\x5f"] = "%5f";
		hex["\x60"] = "%60";
		hex["\x61"] = "%61";
		hex["\x62"] = "%62";
		hex["\x63"] = "%63";
		hex["\x64"] = "%64";
		hex["\x65"] = "%65";
		hex["\x66"] = "%66";
		hex["\x67"] = "%67";
		hex["\x68"] = "%68";
		hex["\x69"] = "%69";
		hex["\x6a"] = "%6a";
		hex["\x6b"] = "%6b";
		hex["\x6c"] = "%6c";
		hex["\x6d"] = "%6d";
		hex["\x6e"] = "%6e";
		hex["\x6f"] = "%6f";
		hex["\x70"] = "%70";
		hex["\x71"] = "%71";
		hex["\x72"] = "%72";
		hex["\x73"] = "%73";
		hex["\x74"] = "%74";
		hex["\x75"] = "%75";
		hex["\x76"] = "%76";
		hex["\x77"] = "%77";
		hex["\x78"] = "%78";
		hex["\x79"] = "%79";
		hex["\x7a"] = "%7a";
		hex["\x7b"] = "%7b";
		hex["\x7c"] = "%7c";
		hex["\x7d"] = "%7d";
		hex["\x7e"] = "%7e";
		hex["\x7f"] = "%7f";
		hex["\x80"] = "%80";
		hex["\x81"] = "%81";
		hex["\x82"] = "%82";
		hex["\x83"] = "%83";
		hex["\x84"] = "%84";
		hex["\x85"] = "%85";
		hex["\x86"] = "%86";
		hex["\x87"] = "%87";
		hex["\x88"] = "%88";
		hex["\x89"] = "%89";
		hex["\x8a"] = "%8a";
		hex["\x8b"] = "%8b";
		hex["\x8c"] = "%8c";
		hex["\x8d"] = "%8d";
		hex["\x8e"] = "%8e";
		hex["\x8f"] = "%8f";
		hex["\x90"] = "%90";
		hex["\x91"] = "%91";
		hex["\x92"] = "%92";
		hex["\x93"] = "%93";
		hex["\x94"] = "%94";
		hex["\x95"] = "%95";
		hex["\x96"] = "%96";
		hex["\x97"] = "%97";
		hex["\x98"] = "%98";
		hex["\x99"] = "%99";
		hex["\x9a"] = "%9a";
		hex["\x9b"] = "%9b";
		hex["\x9c"] = "%9c";
		hex["\x9d"] = "%9d";
		hex["\x9e"] = "%9e";
		hex["\x9f"] = "%9f";
		hex["\xa0"] = "%a0";
		hex["\xa1"] = "%a1";
		hex["\xa2"] = "%a2";
		hex["\xa3"] = "%a3";
		hex["\xa4"] = "%a4";
		hex["\xa5"] = "%a5";
		hex["\xa6"] = "%a6";
		hex["\xa7"] = "%a7";
		hex["\xa8"] = "%a8";
		hex["\xa9"] = "%a9";
		hex["\xaa"] = "%aa";
		hex["\xab"] = "%ab";
		hex["\xac"] = "%ac";
		hex["\xad"] = "%ad";
		hex["\xae"] = "%ae";
		hex["\xaf"] = "%af";
		hex["\xb0"] = "%b0";
		hex["\xb1"] = "%b1";
		hex["\xb2"] = "%b2";
		hex["\xb3"] = "%b3";
		hex["\xb4"] = "%b4";
		hex["\xb5"] = "%b5";
		hex["\xb6"] = "%b6";
		hex["\xb7"] = "%b7";
		hex["\xb8"] = "%b8";
		hex["\xb9"] = "%b9";
		hex["\xba"] = "%ba";
		hex["\xbb"] = "%bb";
		hex["\xbc"] = "%bc";
		hex["\xbd"] = "%bd";
		hex["\xbe"] = "%be";
		hex["\xbf"] = "%bf";
		hex["\xc0"] = "%c0";
		hex["\xc1"] = "%c1";
		hex["\xc2"] = "%c2";
		hex["\xc3"] = "%c3";
		hex["\xc4"] = "%c4";
		hex["\xc5"] = "%c5";
		hex["\xc6"] = "%c6";
		hex["\xc7"] = "%c7";
		hex["\xc8"] = "%c8";
		hex["\xc9"] = "%c9";
		hex["\xca"] = "%ca";
		hex["\xcb"] = "%cb";
		hex["\xcc"] = "%cc";
		hex["\xcd"] = "%cd";
		hex["\xce"] = "%ce";
		hex["\xcf"] = "%cf";
		hex["\xd0"] = "%d0";
		hex["\xd1"] = "%d1";
		hex["\xd2"] = "%d2";
		hex["\xd3"] = "%d3";
		hex["\xd4"] = "%d4";
		hex["\xd5"] = "%d5";
		hex["\xd6"] = "%d6";
		hex["\xd7"] = "%d7";
		hex["\xd8"] = "%d8";
		hex["\xd9"] = "%d9";
		hex["\xda"] = "%da";
		hex["\xdb"] = "%db";
		hex["\xdc"] = "%dc";
		hex["\xdd"] = "%dd";
		hex["\xde"] = "%de";
		hex["\xdf"] = "%df";
		hex["\xe0"] = "%e0";
		hex["\xe1"] = "%e1";
		hex["\xe2"] = "%e2";
		hex["\xe3"] = "%e3";
		hex["\xe4"] = "%e4";
		hex["\xe5"] = "%e5";
		hex["\xe6"] = "%e6";
		hex["\xe7"] = "%e7";
		hex["\xe8"] = "%e8";
		hex["\xe9"] = "%e9";
		hex["\xea"] = "%ea";
		hex["\xeb"] = "%eb";
		hex["\xec"] = "%ec";
		hex["\xed"] = "%ed";
		hex["\xee"] = "%ee";
		hex["\xef"] = "%ef";
		hex["\xf0"] = "%f0";
		hex["\xf1"] = "%f1";
		hex["\xf2"] = "%f2";
		hex["\xf3"] = "%f3";
		hex["\xf4"] = "%f4";
		hex["\xf5"] = "%f5";
		hex["\xf6"] = "%f6";
		hex["\xf7"] = "%f7";
		hex["\xf8"] = "%f8";
		hex["\xf9"] = "%f9";
		hex["\xfa"] = "%fa";
		hex["\xfb"] = "%fb";
		hex["\xfc"] = "%fc";
		hex["\xfd"] = "%fd";
		hex["\xfe"] = "%fe";
		hex["\xff"] = "%ff";

		// this does not know how to deal with two byte chars
		if (typeof(s) != 'undefined')
		{
			for (i=0; i<s.length; i++)
			{
				c = s.charAt(i);
				if (typeof(c) != 'undefined' && typeof(hex[c]) != 'undefined')
				{
					d += hex[c];
				}
			}
		}
		return d;
	}
