// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

var ExternalLinker = {
	// © 2008, Sander Voerman
	// Checks the document and makes all links to other sites open in new windows/tabs
 	init : function() {
		var domain   = window.location.href.split('/')[2];
		var a = document.getElementsByTagName('a');
		for(var i = 0, len = a.length; i < len; ++i){
			if (((a[i].href).indexOf(domain) == -1) || ((a[i].href).indexOf(domain) > 8)) {
				// An external link, set the target!
				a[i].target = "_blank"; 
			}
		}
	}
}
