Here call the bindMediaID method.
function bindMediaID(mediaID,nev)
{
PageMethods.SlideShow(parseInt(mediaID), nev, OnSucceededID, OnFailedID);
}
function OnSucceededID(result, methodName)
{
var str = result.split('~');
var data ='<div id="lightbox" style="top: 1px;left: 0px;display:none;">'+
'<div id="outerImageContainer" style="height: auto;max-height:470px; font-size:72.192px;width:auto; max-width:600px ">'+
'<div id="imageContainer"><img id="lightboxImage" src="'+str[0]+'"
style="max-height:470px;">'+
'<div style="" id="hoverNav">'+
'<a href="#" id="prevLink"></a>'+
'<a href="#" id="nextLink"></a>'+
'</div>'+
'</div>'+
'<div id="imageDataContainer" style="width:600px;padding-top:20px;">'+
'<div id="imageData">'+
'<div id="imageDetails">'+
'<span id="caption">'+str[3]+'</span>'+
'<span id="numberDisplay" style="width: 100%;margin-top: 10px;float: left;">'+str[4]+'<ahref="#"id="bottomNavClose">'+
'<imgsrc="images/uplode_form_close_button.png">'+
'</a>'+'</span>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'+
'</div>';
jq(data).appendTo("body");
jq("#lightbox").fadeIn("slow", function(){ jq("#lightbox").show(); });
jq("#imageData").slideDown("slow");
if(str[1] != "0")
{
pId = str[1];
}
else
{
jq("#prevLink").hide();
}
if(str[2] != "0")
{
nId = str[2];
}
else
{
jq("#nextLink").hide();
}
jq("#loading").fadeOut('slow');
}
jq(document).ready(function() {
// Add the page method call as an onclick handler for the div.
jq("#prevLink").live("click", function(){
bindMediaID(pId,"P");
});
jq("#nextLink").live("click", function(){
bindMediaID(nId,"N");
});
jq("#bottomNavClose").live("click", function(){
jq("#overlay").fadeOut('slow', function(){ jq("#overlay").remove(); });
jq("#lightbox").fadeOut('slow', function(){ jq("#lightbox").remove(); });
});
});
function OnFailedID(error, methodName) {
if (error !== null) {
alert(error.get_message());
}
}