jQuery( document ).ready(function(){

	/* -------- Pufferfish Implementation -------- */
	jQuery( 'a.spritemap, #photo-grid .inner, #photo-square-1, #photo-square-2' ).append( '<span class="hover"></span>' );
 	jQuery( 'a.spritemap, #photo-grid .inner, #photo-square-1, #photo-square-2' ).hover( function() {
 		jQuery( 'span.hover', this ).stop().animate( {
 			'opacity': 1
 		}, 400, 'easeOutSine' )
 	}, function(){
 		jQuery( 'span.hover', this ).stop().animate( {
       'opacity': 0
 		}, 2000, 'easeOutExpo' )
 	} )
  
	$( '#oligo-eu-link' ).click( function(){
		$( '#warning' ).lightbox_me( { centered: true } );
		return false;
	} );

  /* -------- Email Address De-obfuscation -------- */
  if ( jQuery( "span.addy" ).length ){
    jQuery( "span.addy" ).each( function( index, span ){
      addy = span.innerHTML.replace( " -at- ", "@" );
      addy = addy.replace( " -dot- ", "." );
      addy = addy.replace( "[\(]", "" );
      addy = addy.replace( "[\)]", "" );
      span.innerHTML = '<a href="mailto:' + addy + '">' + addy + '</a>';
    } );
  };

  /* -------------- Agent Locator ----------------- */
	$( 'a.button' ).each( function(){
		var link = $( this );
		var id   = link.attr( 'id' ).match( /\d+(\.\d{1,2})?/ )[0];
		link.click( function(){
			$( 'div.agent_contact_box:visible' ).hide();
			$( 'div#agent_' + id ).show();
						
			return false;
		} );
	} );

} );