(function($) {
$(document).ready(function() {

	//	@todo:	check for existence of mySMTUrl

	if (mySMTUrl) {
		$.post(
			'/' + mySMTUrl + '/retrievesmt',
			{},
			function(data){
				if (data) {
					var email_string = data.split(',');
	
					$('.smt-replacer').each(function(i){
						var myId = $(this).attr('id').split('-');
						myId = myId[2];
	
						$(this).html(email_string[myId]);
					});
				}
			}
		)

		$.post(
			'/' + mySMTUrl + '/retrievecontactsmt',
			{},
			function(data) {
				if (data) {
					var email_string = data.split(',');
	
					$('.smt-contactreplacer').each(function(i){
						var myId = $(this).attr('id').split('-');
						myId = myId[2];
	
	//					$(this).prepend('Email: ');
						$(this).wrap('<a href="mailto:' + email_string[myId-1] + '"></a>');
					});
				}
			}
		);
	}

});
})(jQuery);
