$(document).ready(function() {
	var highestCol = Math.max($('#main-subpage').height(),$('#col-tertiary').height());
	$('.equalht').height(highestCol);
	
	
	
	// VIDEO CYCLE
	$('#video-player-wrap').cycle({ 
	    fx:     'scrollHorz', 
	    prev:	'#prev', 
	    next:	'#next', 
	    timeout: 0,
	    speed:	500
	});
	
	
	// MASTHEAD WAITING FAMILY IMAGES FADER
	$('#family-fader-inner').innerfade({
		speed: 'slow',
		timeout: 4000,
		type: 'sequence',
		containerheight: '170px'
	});
	
	
	// WAITING FAMILY IMAGES CYCLE
	$('#sb-photoslidewrap').cycle({ 
	    fx:     'scrollHorz', 
	    prev:	'#prev', 
	    next:	'#next', 
	    timeout: 0,
	    speed:	500,
	    pager:	'#photonav',
	    pagerAnchorBuilder: pagerFactory
	});
	
	function pagerFactory(idx, slide) {
        var s = idx > 10 ? ' style="display:none"' : '';
        return '<a href="#"'+s+'>'+(idx+1)+'</a>';
    };
    
    $('#photonav a').last().css('border', 'none');
    
    
    // WAITING FAMILY SIDEBAR FIX
    var newMargin = $('.familymedia').height();
	$('#sb-stories').css('margin-top', newMargin);
	
	
	// MODAL WINDOW
	//var triggers = $(".view-modal").overlay({
	$(".viewmodal").overlay({
	
		// some mask tweaks suitable for modal dialogs
		mask: {
			color: '#000',
			loadSpeed: 200,
			opacity: 0.5
		},
	
		closeOnClick: true
	});
	
	
	// TOOL TIPS
	// initialize tooltip
	$("p.tiptrigger").tooltip({
	
	   // tweak the position
	   offset: [0, -5],
	   position: 'center, left',
	   tipClass: 'tooltip',
	   effect: 'fade',
	   layout: '<div><span>'
	
	// add dynamic plugin with optional configuration for bottom edge
	}).dynamic({ bottom: { direction: 'left' } });
	
	
	
	
	
	
}); // end ready
