$(document).ready(function() {
	$('#visual-portal-wrapper').after('<div id="banner-top" />');
	
	$('a.mail').each(function() {
		$(this).attr('href', 'mailto:' + $(this).html().toLowerCase().split(' ')[1] + '@metrix-marketing.com');
	});
	
	$('.target-blank, .external-link').attr('target', 'blank');
	
	$('.section-our-people .portletNavigationTree a span').each(function() {
		item = $(this).html();
		space = item.indexOf(' ');
		space = item.indexOf(' ', space + 1);
		
		result = item.substring(0, space) + '<br />' + item.substring(space);
		
		$(this).html(result);
	});

	// must initiate before the lightbox events
	$(function() {
	$('.jMyCarousel').jMyCarousel({
			speed: 100,
	        eltByElt: false,
	        circular: true,
	        evtStart: 'mouseover',
	        evtStop: 'mouseout'
	    });
	});
	
	/* $('.section-capabilities .jMyCarousel li a').click(function() {
		$('#case-study-wrapper').load($(this).attr('href') + '/view #parent-fieldname-text');
		return false;
	}); */
	
	$('.section-portfolio .jMyCarousel li.port-image a, .banner-solo-image').colorbox({ photo: true, maxHeight: 600, maxWidth: 800, opacity: .7 });
	$('.jMyCarousel li.port-video a').colorbox({ iframe: true, width: 640, height: 510, maxHeight: 600, maxWidth: 800, opacity: .7 });
	
	$('.case-study-list li a').colorbox({iframe: true, width: 950, height: 650, opacity: .65});

})

