jQuery(function($){

	$('.popup a.close').click(function(e) { 
		e.preventDefault();
		$('.popContainer').hide();
	});

	
	$('a').each(function() {
		var externalURL = new RegExp('^http(s)?://(?!'+window.location.host+')(www)?.*');
		if(this.href.match(externalURL) != null){
			$(this).click(function(event) {
				event.preventDefault();
				event.stopPropagation();
				window.open(this.href, '_blank');
			});
		}
	});
});


/*
 * jQuery plugin: fieldSelection - v0.1.1 - last change: 2006-12-16
 * (c) 2006 Alex Brem <alex@0xab.cd> - http://blog.0xab.cd
 */
(function(){jQuery.each({getSelection:function(){var b=this.jquery?this[0]:this;return("selectionStart"in b&&function(){var a=b.selectionEnd-b.selectionStart;return{start:b.selectionStart,end:b.selectionEnd,length:a,text:b.value.substr(b.selectionStart,a)}}||document.selection&&function(){b.focus();var a=document.selection.createRange();if(a===null)return{start:0,end:b.value.length,length:0};var c=b.createTextRange(),d=c.duplicate();c.moveToBookmark(a.getBookmark());d.setEndPoint("EndToStart",c);
return{start:d.text.length,end:d.text.length+a.text.length,length:a.text.length,text:a.text}}||function(){return null})()},setSelection:function(b){var a=this.jquery?this[0]:this,c=b||{};return("selectionStart"in a&&function(){var b=typeof c=="object"?c.start:c;if(b!=void 0)a.selectionStart=b;if(c.end!=void 0)a.selectionEnd=c.end;a.focus();return this}||document.selection&&function(){a.focus();var b=document.selection.createRange();if(b===null)return this;var e=typeof c=="object"?c.start:c;e!=void 0&&
(b.moveStart("character",-a.value.length),b.moveStart("character",e),b.collapse());c.end!=void 0&&b.moveEnd("character",c.end-e);b.select();return this}||function(){a.focus();return jQuery(a)})()},replaceSelection:function(b){var a=this.jquery?this[0]:this,c=b||"";return("selectionStart"in a&&function(){a.value=a.value.substr(0,a.selectionStart)+c+a.value.substr(a.selectionEnd,a.value.length);return this}||document.selection&&function(){a.focus();document.selection.createRange().text=c;return this}||
function(){a.value+=c;return jQuery(a)})()}},function(b){jQuery.fn[b]=this})})();
