(function() {
	// get all anchors
	var anchors = document.getElementsByTagName('a');

	for(var i = 0; i < anchors.length; i += 1) {
		var a = anchors[i],
			href = a.getAttribute('href') || '';

		// skip relative uri
		if(href.indexOf('://') === -1) {
			continue;
		}

		// skip same domain
		if(href.indexOf(window.location.host) !== -1) {
			continue;
		}

		// add target attr for external links
		a.setAttribute('target', '_blank');
	}
}());

