jQuery(document).ready(function($) {
	$('div.wrapper').addClass('clearfix');

	/**
	 * Also track jump-to links as pageviews. Many pages are so large
	 * to justify this
	 */
	$('a[href^=#]').click(function() { pageTracker._trackPageview(this.href); });
	$('#navigation ul.level_1').addClass('sf-menu').superfish({
		pathClass: 'true',
		delay: 750,
		pathLevels: 0,
		animation: { speed: 'fast', height:'show'}
	});
	/*
	$('.b_NewsDisplay ul, .b_NewsDisplay ol').before('<div style="clear: both"></div.');
	*/

	$('form.lbsubmit').submit($.lbsubmit);
	$('#family-links').prepend('<div class="slider-arrow slider-arrow-up"></div>');
	$('#more h3 a').click(function() {
		$('#family-links').slideToggle();
		return false;
	});
	/**
	 * Change all objects and embeds to have wmode=transparent
	 */
	try {
		$('object').append('<param name="wmode" value="transparent" />');
		$('embed').attr('wmode', 'transparent');
	} catch (e) { }
});

function fbs_click() {
	/** 
	 * Just to make sure stage is never referenced
	*/
	var u=location.href.replace('stage', 'www').replace('esc2009.dev', 'www').replace('dev', 'wwww');
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

/**
 * Hook into lytebox in order to track images
*/
(function() {
if (typeof(LyteBox) != "undefined") {
	var orig = LyteBox.prototype.changeContent;
	LyteBox.prototype.changeContent = function(imageNum) {

		orig.apply(this, arguments);
		if (!this.isLyteframe) {

			var src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
			pageTracker._trackPageview(src);

		}
	};
}
})();
