$(document).ready(function(){
	
	// Defuscate any hrefs in format you(replace+with+at+symbol)domain.com. Replaces the mailto and the link text.
	// Note that emails are being encrypted in the CMS via the cleanup_rich_text function
	$('p').defuscate({link: true});
    
    // Any links with rel="external" attribute will open in new window
	$('A[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
	
 });

/* IE6: Turn on image caching
 * Stops image flicker on rollovers
 *********************************************/
(function(){
	/*Use Object Detection to detect IE6*/
	var m = document.uniqueID /*IE*/ 
	&& document.compatMode /*>=IE6*/ 
	&& !window.XMLHttpRequest /*<=IE6*/ 
	&& document.execCommand ; 
	try{ 
		if(!!m){ 
			m("BackgroundImageCache", false, true) /* = IE6 only */ 
		} 
	}catch(oh){}; 
})(); 

/*
=========
BASIC FUNCTIONS
=========
*/
var newWindow = null;
function popup(theURL, winName, features) { 
	closePopup(winName);
	newWindow=window.open(theURL,winName,features);
	newWindow.focus();
}
function closePopup(winName) {
	if (newWindow && newWindow.open && !newWindow.closed) newWindow.close();
}

