////////////////////////////////////////////////////////////////////////////////
//
// Mail To Link Builder Module
// Copyright 2003-2010 Russell Warburton
//
// Filename: /js-bin/mailto.js (javascript)
// Author: Russell Warburton (russell@warburnet.com.au)
//
// No portion of this computer program may be used without prior written 
// permission from the author. This computer program is protected by 
// international copyright laws.
//
// Created: --/--/--
// Updated: 21/10/10 - head comment section added
//
////////////////////////////////////////////////////////////////////////////////

function createMailToLink(theRecipient,theDomain,theSubject)
{
	// Reverse the recipient string
	var Recipient = stringReverse(theRecipient)

	// Create the mailto link
	document.write("<a href=\"mailto:" + Recipient + "@" + theDomain + "?subject=" + theSubject + "\">" + Recipient + "@" + theDomain + "</a>");
}

function stringReverse(theSourceString)
{
   if (!theSourceString)
	return '';

   var DestinationString = '';

   for (index = (theSourceString.length - 1); index >= 0; index--)
       DestinationString += theSourceString.charAt(index);

   return DestinationString;
}

