
/*
	@author: Rooc
	@version: 0.1 internal release
*/


jQuery.fn.targetBlank = function(settings) {

	jQuery(this).find("a[target='_blank']").each(function() {
		// replace with window.open
		try {
			var href = jQuery(this).attr('href');
			jQuery(this).removeAttr('target');
			jQuery(this).attr('href','javascript:window.open("' + href + '");void(0);');
		} catch (e) {
			//console.error(e);	
		}
	});
	jQuery(this).find("a[rel='_blank']").each(function() {
		// replace with window.open
		try {
			var href = jQuery(this).attr('href');
			jQuery(this).removeAttr('rel');
			jQuery(this).attr('href','javascript:window.open("' + href + '");void(0);');
		} catch (e) {
			//console.error(e);	
		}
	});
		
	// return the element
	return jQuery(this);
};
