﻿// Auto for every request
$(function () {

	$('a[href^="http://"], a[href^="https://"]').asExternalLink();

	//email
	var email = $('span.email');
	if (email && email.length > 0) {
		email.each(function () {
			$this = $(this);
			text = $this.text().replace("{at}", "@");
			$this.empty();
			$('<a></a>').attr('href', 'mailto:' + text).text(text).appendTo($this);
		});
	}
});


// My Extensions...

(function ($) {

	$.fn.asExternalLink = function () {

		return this.each(function () {

			var $this = $(this);
			if ($this.is('a')) {
				$this.addClass('extlink').attr('target', '_blank');
			}

		});

	};

})(jQuery);


