jQuery.noConflict();
jQuery(document).ready(function($){

  $("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 ( $(this).is('a[@href]') ) {
            // If it's an <a> element, defuscate the href attribute
            $(this).attr('href', $(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($(this).attr('href'));
        }
        // Defuscate the element's contents
        $(this).html($(this).html().replace(regex, (settings.link && !is_link ? '<a href="mailto:$1@$2">$1@$2</a>' : '$1@$2')));
  });
}
  
// E-mail defuscator

  $('a[href^="mailto:"]').addClass('email');
  if ( $('a.email').length > 0 ) { $('a.email').defuscate(); }

// External links auto-styler

  $('p a').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
  }).addClass('external');

  $('a.external').click(function(){
    window.open(this.href);
    return false;
  });

// Addthis button

	$('#addthis').hover(
		function(){ return addthis_open(this, '', '[URL]', '[TITLE]'); },
		function(){ addthis_close();  }
	);	
  $('#addthis').click(function(){ return addthis_sendto(); });

	$('.opacity50').hover(
		function(){ $(this).fadeTo('fast', 1); },
		function(){ $(this).fadeTo('fast', 0.5);  }
	);	

	$('.opacity75').hover(
		function(){ $(this).fadeTo('fast', 1); },
		function(){ $(this).fadeTo('fast', 0.75);  }
	);	

  if( $('#cycle-hero').length > 0) {
    $('#cycle-hero').cycle();
  }
 
  if ($('form[name="catwebformform56524"]').length > 0) {
    $('#placeholder-box3').empty();
    $('#sidebar').appendTo('#placeholder-box3');
  }
  
  Cufon.replace('h1, h2, h3');
  Cufon.replace('.menu-item', {
    textShadow: '1px 1px #333',  
    color: '-linear-gradient(white, #ccccff)',
    hover: {
      color: '#fff',
      textShadow: '1px 1px #000'
    }
  });  
  
  Cufon.replace('.menu-item-selected', {
      color: '#fff',
      textShadow: '1px 1px #666'
  }); 
  

});