//Created On 11/04/2011
//Created by Pankaj, for mantis issue 0000448 – Note # 0001902, 0002038
//The JS contains code for the Slideshow on paper detail page.
//Reference: http://colorpowered.com/colorbox

var currSlideNum;
var paperTitle;

function assignCurrSlideNum()
{
	currSlideNum = $("a[rel='vwSlideShow']").colorbox.element().attr("pgNum");
}

function slideshowClosed()
{
	//if (currSlideNum != 0)
	//{
		$.ajax({
			type: "POST",
			url: "/setGoToPgNumInSession.php",
			data: "goToPageNum="+currSlideNum,
			success: function(data)
			{
				location.reload();
			}
		});
	//}
}

$(document).ready(function()
{
	$("a[rel='vwSlideShow']").colorbox
	(
		{
			title:paperTitle,
			width:"75%",
			initialWidth:"75%",
			initialHeight:"75%",
			slideshow:true,
			slideshowSpeed:10000,
			slideshowStart:"Start Slideshow",
			slideshowStop:"Stop Slideshow",
			current:"Page {current} Of {total}",
			previous:"Previous",
			next:"Next",
			close:"Close",
			opacity:0.70,
			onComplete:function(){assignCurrSlideNum();},
			onClosed:function(){slideshowClosed();}
		}
	);
});
