function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function len(str) 
	{ return str.length }

function contains(str,toSearch) 
	{ 
	return str.toLowerCase().indexOf(toSearch.toLowerCase()) 
	}
	
function xReplace(checkMe,toberep,repwith)
	{
		var temp = checkMe;
		var i = contains(temp,toberep);
		while(i > -1)
		{
			temp = temp.replace(toberep, repwith);
			i = temp.indexOf(toberep, i + repwith.length + 1);
		}
		return temp;
	}

function StripUnsafeCode(incoming)

{
	var returnStr  = incoming
	alert(returnStr)
	returnStr = returnStr.replace(/'/g,"\\'");
	returnStr = returnStr.replace(/[\r\n\f]/g,"");
	return returnStr;
}

function ConvertHTMLToJavascript(html)
{
	var linesize = 75;
	var returnStr = '<scri'+'pt language="JavaScript"'+'>\r';
	var innerStr = ""
	html = StripUnsafeCode(html)
	for (var i=0;i<=html.length; i+=linesize) {
		var to = i+linesize;
		if (to>html.length) { to = html.length;}
		innerStr += 'document.write(\'' + (html.substring(i,to)) + '\');\r';
	}
	returnStr += innerStr+ '</scri'+'pt' + '>';
	return innerStr;

}

function IsNumeric(strString)
//  check for valid numeric strings  
	{
		var strValidChars = "0123456789.-";
		var strChar;
		var blnResult = true;
		
		if (strString.length == 0) return false;
		
		//  test strString consists of valid characters listed above
		for (i = 0; i < strString.length && blnResult == true; i++)
			{
				strChar = strString.charAt(i);
				if (strValidChars.indexOf(strChar) == -1)
				{
				blnResult = false;
				}
			}
		return blnResult;
	}

