var direction = '';
var imgWidth = '';
var leftOffset = '';

bindImgPreviewEvents = function() {
	
	$('.showing').hide();
	
	//on hover over images, get the preview effect for all entries
try {
	if($('a.photo-link').length)
	{
		$('a.photo-link').each(function(){
			direction = $(this).attr('name');
			imgWidth = $(this).attr('imgwidth');
			
			if(direction == 'left')
			{
				leftOffset = 20;
			}
			else
			{
				leftOffset = ((-1)*imgWidth) - 40;
			}
			$(this).imgPreview({
				containerID: 'imgPreviewWithStyles',
				containerLoadingClass: 'loading',
				distanceFromCursor: { top: -210, left: leftOffset },
				onShow: function(){
					$(this).addClass('showing');
				},
				onHide: function(){
					$(this).removeClass('showing');
				}
			});
		});
	}
}
finally {
	$('.photo-link').click(function(event){
		event.preventDefault();
		window.location = $(this).attr('althref');
		return false;
	});
}
}

$(document).ready(function(){
		
	bindImgPreviewEvents();
})

