jQuery.noConflict();
jQuery(document).ready(function(){

  jQuery("a.overlay").overlay({ 
        target: '#simple_overlay',
        expose: '#000',
        onBeforeLoad: function() { 
            var wrap = this.getContent().find(".contentWrap"); 
            wrap.load(this.getTrigger().attr("href")); 
        } 
 
  }); 

  
jQuery.fn.defuscate = function( settings ) {
    settings = jQuery.extend({
        link: true
    }, settings);
    var regex = /\b([A-Z0-9._%-]+)\([^)]+\)((?:[A-Z0-9-]+\.)+[A-Z]{2,6})\b/gi;
    return this.each(function() {
        if ( jQuery(this).is('a[@href]') ) {
            // If it's an <a> element, defuscate the href attribute
            jQuery(this).attr('href', jQuery(this).attr('href').replace(regex, '$1@$2'));
            // Make sure that the element's contents is not made into a link
            var is_link = true;
            //alert(jQuery(this).attr('href'));
        }
        // Defuscate the element's contents
        jQuery(this).html(jQuery(this).html().replace(regex, (settings.link && !is_link ? '<a href="mailto:$1@$2">$1@$2</a>' : '$1@$2')));
  });
}
  
// E-mail defuscator

  jQuery('a[href^="mailto:"]').addClass('email');
  if ( jQuery('a.email').length > 0 ) { jQuery('a.email').defuscate(); }

// External links auto-styler

  jQuery('p a').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
  }).addClass('external');

  jQuery('a.external').click(function(){
    window.open(this.href);
    return false;
  });

// Addthis button

	jQuery('#addthis').hover(
		function(){ return addthis_open(this, '', '[URL]', '[TITLE]'); },
		function(){ addthis_close();  }
	);	
  jQuery('#addthis').click(function(){ return addthis_sendto(); });

	jQuery('.opacity50').hover(
		function(){ jQuery(this).fadeTo('fast', 1); },
		function(){ jQuery(this).fadeTo('fast', 0.5);  }
	);	

	jQuery('.opacity75').hover(
		function(){ jQuery(this).fadeTo('fast', 1); },
		function(){ jQuery(this).fadeTo('fast', 0.75);  }
	);	

  if( jQuery('#cycle-hero').length > 0) {
    jQuery('#cycle-hero').cycle();
  }
 
  if (jQuery('form[name="catwebformform56524"]').length > 0) {
    jQuery('#placeholder-box3').empty();
    jQuery('#sidebar').appendTo('#placeholder-box3');
  }  

});