﻿
var pictureProxy;

// Initializes global and proxy default variables.
function pageLoad()
{
    pictureProxy = new Boro2g.Website.WebServices.PictureWebService();
    pictureProxy.set_defaultSucceededCallback(SucceededCallback);
    pictureProxy.set_defaultFailedCallback(FailedCallback);
}


// Processes the button click and calls
// the service Greetings method.  
function GetPicture(pictureId)
{	
    var picture = pictureProxy.GetPicture(pictureId);    
    
    return picture;
}

function GetNextPicture(pictureId)
{	
    var picture = pictureProxy.GetNextPicture(pictureId);  
    
    return picture;  
}

function GetPreviousPicture(pictureId)
{	
    var picture = pictureProxy.GetPreviousPicture(pictureId); 
    
    return picture;   
}

// Callback function that
// processes the service return value.
function SucceededCallback(result, userContext, methodName)
{
	if (result) {
		if (methodName == 'GetPicture') {
			loadImage(result);
		}
	}
}

// Callback function invoked when a call to 
// the  service methods fails.
function FailedCallback(error, userContext, methodName) 
{
    if(error !== null) 
    {
        alert("An error occurred: " + error.get_message());
    }
}

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();

