// External Link Control

$(document).ready(function(){
						   String.prototype.endsWith = function(that) {
							   return this.lastIndexOf(that) == this.length - that.length;
						   };
						   $("a").click(function () {
												  $("a").filter(function() {
																		 return this.hostname && this.hostname !== location.hostname;
																		 })
												  .attr({
														target: "_blank" //Adds target="blank" to any external link
														});
												  $("a").filter(function() {
																		 return this.hostname && this.hostname.endsWith(location.hostname);
																		 })
												  .attr({
														target: "" //Removes target="blank" from any subdomain link
														});
												  $('a[rel*="external"]').live('click',function(){ this.target='_blank'; }); // Adds target="_blank" to any link
												  $('a[rel*="internal"]').live('click',function(){ this.target=''; }); // Removes target="_blank" from any link
												  });
						   });