function explode(separator, string)
{
	var j, tmp;

	if (separator==null)
		return;

	var result = new Array();

	if (string=='' | string==null)
		return result;

	if (strpos(string, separator)<0) {
		result[0]=string;
		return result;
	}

	//-- errors handled
	tmp = string;
	j=0;
	
	while (strpos(tmp, separator)>-1) {
		result[j] = tmp.substring(0, strpos(tmp, separator));
		tmp = strDelete(tmp, 0, strpos(tmp, separator) + separator.length);
		j++;
	}

	if (tmp!='')
		result[j] = tmp;

	return result;
}

function implode (glue, pieces)
{
	var i;
	var result = '';
	for (i=0;i<pieces.length;i++) 
	{
		if (i == pieces.length-1)
		{
			result = result + pieces[i];
			break;
		}
		result = result + pieces[i] + glue;
	}
	return result;
}

function strpos(haystack, needle)
{
	var i;
	for (i=0;i<=(haystack.length - needle.length);i++)
	{
		if (haystack.substr(i, needle.length) == needle)
			return i;
			
	}
	return -1;
}
function strDelete(string, start, count)
{
	if (string=='' | count==0)
		return string;
		
	return string.substring(0, start-1) + string.substring(start+count, string.length);
}