$(document).ready(function() {
	 
	 // disable store link		
		$('.nav .nav_store').bind('click', disableLink);
	
	// lightbox gallery formatting
	if(jQuery().lightBox) { // check if lighbox is loaded
		$('#gallerythumbs .thumbnail_link').lightBox();
		$('#gallerythumbs a[rel="lightbox[gallery]"]').lightBox();
		$('#gallerythumbs a[rel="lightbox[gallery2]"]').lightBox();
		$('.eck_lbimg a[rel="lightbox[img]"]').lightBox();
	}
	
	if(jQuery().cycle) { // check if lighbox is loaded
	 	$('.upcoming_list').cycle({ 
    			cleartype: true, 
    			cleartypeNoBg: true,
    			fx:    'fade', 
    			speed:  1500 
 	});

	}
	
	//wrap interior of ol li with a span
	$('.contentBody ol li').each(function(){
		$(this).wrapInner('<p></p>');
		
		});
	$('.contentBody img').parent('a').addClass('imgLink');
	$('.contentBody .previous a, .contentBody .next a').removeClass('imgLink');
	
	
	/** ======================================================================
     * Upcoming Events
     * ==================================================================== */
    	
	if($('#upcoming_count').length > 0 && $('#upcoming_events').length > 0) 
	{
		var upcoming_count = $('#upcoming_count').text();
		if(upcoming_count == 0)
		{
			$('#upcoming_events').hide();
		}
		
	}
	
    
    /** ======================================================================
     * Closing Alert
     * ==================================================================== */
    
    $('#registration_close_front p:last')
        .append(' <a href="https://www.bemidjidragonboat.com/registration/online_registration.php">Click here to register your team today!</a>');
    
    
    /** ======================================================================
     * OSCommerce formatting help
     * ==================================================================== */
    
    $.firstH1class = $('#bodyContent h1:first').attr('class');
    if ($.firstH1class == '') {
        $('#bodyContent h1:first').attr('class','product_title');
        
    }
	
	$('.infoBoxContents a img').parent().css('border','none');
	
	$('.contentContainer').wrapInner('<div class="contentPadding" />')
	
		
});	

function disableLink(e) {
    // cancels the event
    e.preventDefault();

    return false;
}

