/******************************************************************

Copyright © Global Knowledge Software LLC 2007.  All Rights Reserved.

This program is protected by U.S. and International Copyright and
Patent Laws.  Unauthorized duplication and/or distribution of this
program is strictly prohibited. Distribution and duplication of this
program are limited by license. If you do not currently have a valid
license from Global Knowledge for this program, any copying or
distribution of the program is unauthorized.  If you do have a current
license from Global Knowledge to utilize this program, your use is
strictly limited by the terms of that license.

Patent Pending.

******************************************************************/

function MyEscape(s)
{
	var snew="";

	for (var i=0;i<s.length;i++)
	{
		ss=s.substr(i,1);
		if ((ss>='0' && ss<='9') ||
			(ss>='a' && ss<='z') ||
			(ss>='A' && ss<='Z'))
		{
			snew+=ss;
		}
		else
		{
			ss=s.charCodeAt(i);		
			a="0000"+ss.toString(16).toUpperCase();
			snew+="$"+a.substr(a.length-4);		
		}
	}

	return snew;
}

function MyUnEscape(s)
{
	var snew="";

	var bEscape=false;
	for (var i=0;i<s.length;i++)
	{
		if (bEscape)
		{
			ss=s.substr(i,4);
			snew+=String.fromCharCode(parseInt("0x"+ss));
			i+=3;
			bEscape=false;
		}
		else
		{
			ss=s.substr(i,1);
			if (ss=='$')
				bEscape=true;
			else
				snew+=ss;
		}
	}

	return snew;
}
