jQuery(document).ready(
	function()
	{
		var imgContainerHeight = parseInt($('#big-image-container').css('height').replace(/[^0-9]/, ''));
		jQuery('#thumb-image-container a').hover(
			function()
			{
				var parent = jQuery(this).parents('.thumb-image');
				if(!parent.hasClass('current-image'))
				{
					var maxWidth = parseInt(jQuery('#thumb-image-container').css('width').replace(/[^0-9]/, ''));
					var bigImageUrl = jQuery(this).attr('href');
					var imageTitle = jQuery(this).attr('title');
					var info = jQuery(this).attr('rel').split('|');
					var imageUrl = info[0];
					var width = info[1], height = info[2];
					if((height - 2) > imgContainerHeight)
					{
						height = imgContainerHeight - 2;
					}
					jQuery('#big-image-container a').
						attr('href', bigImageUrl).
						attr('title', imageTitle ? imageTitle : '').
						css({ 'width':width+'px', 'height':height+'px' });
					jQuery('#big-image-container img').attr('src', imageUrl);
					jQuery('#thumb-image-container .thumb-image.current-image').removeClass('current-image');
					parent.addClass('current-image');
				}
				
				return false;
			}, function() { }
		);
		
		jQuery('#big-image-container a').lightBox(
			{
				imageLoading: site_url+'/jquery-lightbox-0.5/images/lightbox-ico-loading.gif',
				imageBtnClose: site_url+'/jquery-lightbox-0.5/images/lightbox-btn-close.gif',
				imageBlank: site_url+'/jquery-lightbox-0.5/images/lightbox-blank.gif',
				fixedNavigation:true
			}
		);

		jQuery('#thumb-image-container a').lightBox(
			{
				imageLoading: site_url+'/jquery-lightbox-0.5/images/lightbox-ico-loading.gif',
				imageBtnClose: site_url+'/jquery-lightbox-0.5/images/lightbox-btn-close.gif',
				imageBlank: site_url+'/jquery-lightbox-0.5/images/lightbox-blank.gif',
				fixedNavigation:true
			}
		);
		
		jQuery('#show-other-details').click(function(){
			if(jQuery('#other-details').is(':hidden'))
			{
				jQuery('#other-details').slideDown('fast');
			}
			else
			{
				jQuery('#other-details').slideUp('fast');
			}
		});
	}
);

function checkToggle(row, id)
{
	var thisRow = jQuery(row);
	if(jQuery('#'+id+':visible').length > 0)
	{
		jQuery('#'+id).slideUp('fast');
		jQuery('.pointerdiv', thisRow).addClass('calltoaction');
	}
	else
	{
		jQuery('#'+id).slideDown('fast');
		jQuery('.pointerdiv', thisRow).removeClass('calltoaction');
	}
}

