<!--
// Hide

//
// Create a clickable "mailto:" link that displays the e-mail address
// All funtions of the object are static.
//
// The main reason for this class is dynamically writing the "mailto:"  href in a anchor.
// This will prevent spiders and bots to read the actual mail address from the page source.
//
// thoughts: 
//	spiders/bots cannot process scripts (no spam!)
//	using "mailto" opens the clients mail client
//	if "mailto" is not properly configured the e-mail address is visible.
//
// References:
// http://blogger.xs4all.nl/peterned/archive/2006/08/15/114545.aspx
//
var MailTo =
{
	// --------------------------------------------------------------------------------
	// Public fields/methods
	// --------------------------------------------------------------------------------

	HostName		: "ShopRopeMarks.com",
	UserInfo		: "info",
	UserOrder		: "order",
	UserWebmaster	: "webmaster",
	
	// ----------------------------------------
	// Simple anchors
	// ----------------------------------------

	_mailTo: function( /* string */ username, /* string */ hostname, /* string */ displayText, /* string*/ subject )
	{
		//alert( "MailTo::mailTo( " + username + ", " + hostname + ", " + displayText + ", " + subject + " )" );
		
		document.write( 
			'<a ' + 'href="' + 'mail' + 'to:' + username + '@' + hostname + '?subject=' + subject + '">' 
			+ displayText
			+ '</a>' 
		);
	},	
	simple: function( /* string */ username )
	{
		//alert( "MailTo::simple( " + username + " )" );
		
		var displayText = username + '@' + this.HostName;
		var subject = '';

		this._mailTo( username, this.HostName, displayText, subject );
	},	
	subject: function( /* string */username, /* string */subject )
	{
		//alert( "MailTo::subject( ... )" );
		var displayText = username + '@' + this.HostName;
		this._mailTo( username, this.HostName, displayText, subject );
	},	
	text: function( /* string */ username, /* string */ displayText, /* string */ subject )
	{
		//alert( "MailTo::text( " + username + ", " + displayText + ", " + subject + " )" );
		this._mailTo( username, this.HostName, displayText, subject );
	},
	
	// ----------------------------------------
	// Form field anchors
	// ----------------------------------------
	
	formFieldSimple: function( /* string */username, /* string */ formFieldName  )
	{
		document.write( 
			'<input '
			+ 'type="hidden" '
			+ 'name="' + formFieldName + '" '
			+ 'value="' + username + '@' + gHostName + '"> ' 
		);
	}//, 
	
} // class MailTo

/* EOF */
// -->
