// =========================================================================
// CHANGE LOG (most recent first)
// =========================================================================
//
// -------------------------------------------------------------------------
// 
// 23 Mar 2011.	First version. Includes ADAT's email-replace and 
//		cross-tab scripts, tidied and converted to jQuery.
//
// -------------------------------------------------------------------------

$( function() {
		
	// -------------------------------------------
	// E-mail address replacement
	// -------------------------------------------
	$('a.email_link').each( function() {
		var address = $(this).text().replace( "[at]", "@" );
		$(this).html( '<a href="mailto:'+address+'">' + address + '</a>' );
	} );

	// -------------------------------------------
	// Cross tabs: X scrollbar only
	// -------------------------------------------
	// NB. ct-1-outer can be removed once ADAT using ADAT:Template
	var cross_div_el = $('#ct-1').length ? $('#ct-1') : $('#ct-1-outer'); 

	if (cross_div_el.length) {

		cross_div_el.css( 'width', '100%' );		
		cross_div_el.css( 'overflow-x', 'auto' );

		if ( $.browser.msie ) { // IE6, IE7
			// set height including height of scrollbar
			cross_div_el.css('height', ( ( cross_div_el.find('table').height() + 17) +'px') );
			
			if ( $.browser.version < 7 ) { // prevent horiz scrollbar IE6
				cross_div_el.css('margin-right','-2px');
			}	
		}
		else { // Others
			cross_div_el.css('height','auto');
		}

		if ( $.browser.mozilla ) {
			cross_div_el.css('padding-left','1px'); // prevents left border disappearing		
		}
	}
} );
