function explode (item, delimiter)
{
	tempArray=new Array(1);
	var Count=0;
	var tempString=new String(item);

	while (tempString.indexOf(delimiter)>0)
	{
		tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
		tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
		Count=Count+1
	}

	tempArray[Count]=tempString;
	return tempArray;
}

function implode (item, delimiter)
{
	returnString = item[0];
	
	for (i = 1; i < item.length; i++)
		returnString = returnString + delimiter + item[i];

	return returnString;
}

function mail (to, cc, bcc, subject, body)
{
	if (to)
	{
		to_array = explode (to, ',');
		var to_string_array = Array(1);
		for (i = 0; i < to_array.length; i++)
		{
			current_to = explode (to_array[i], ' ');
			to_string_array[i] = current_to[0] + '@' + current_to[1] + '.' + current_to[2];
		}
		to_string = implode (to_string_array, ',');
	}
	else
		to_string = '';
	
	if (cc)
	{
		cc_array = explode (cc, ',');
		var cc_string_array = Array(1);
		for (i = 0; i < cc_array.length; i++)
		{
			current_cc = explode (cc_array[i], ' ');
			cc_string_array[i] = current_cc[0] + '@' + current_cc[1] + '.' + current_cc[2];
		}
		cc_string = '&cc=' + implode (cc_string_array, ',');
	}
	else
		cc_string = '';
	
	if (bcc)
	{
		bcc_array = explode (bcc, ',');
		var bcc_string_array = Array(1);
		for (i = 0; i < bcc_array.length; i++)
		{
			current_bcc = explode (bcc_array[i], ' ');
			bcc_string_array[i] = current_bcc[0] + '@' + current_bcc[1] + '.' + current_bcc[2];
		}
		bcc_string = '&bcc=' + implode (bcc_string_array, ',');
	}
	else
		bcc_string = '';
	
	if (!subject)
		subject = ' ';
		
	if (!body)
		body = ' ';
	
	newwindow = window.open("mailto:" + to_string + "?null=null" + cc_string + bcc_string + "&subject=" + subject + "&body=" + body, "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no")
	if (newwindow)
		newwindow.close();
}