Type.registerNamespace('MySpace.PhotoAlbums.Pages');

MySpace.PhotoAlbums.Pages.EditAlbumsPhotos = function(element){
	MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.initializeBase(this, [element]);
}

MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.prototype = {
	initialize: function(){
	    //Setup handlers
		this.AttachEvents();
	},

	AttachEvents: function(){
    },
    
   	dispose: function(){
	  
	}
};
    
var Captions = new Array();

//Static Functions - Start

MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.OpenPrintPreview = function(url){
       window.open(url,'AlbumPrintPreview'); 
       return false;
}

MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.CloseAllCaptionEdits = function(editingBoxId){
       var CaptionCount = Captions.length;	
	    for	(var i=0; i<CaptionCount; i++){
		    if (Captions[i].get_control().id !== editingBoxId)
			    Captions[i].ResetToDefault();
	    }
}

MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.SaveCaption = function(){	
   //Make Web Service call
   if(arguments.length > 0)
	    MySpace.Web.Modules.PhotoAlbums.Services.PhotoAlbums.SaveCaption(parseInt(arguments[1].imageId), arguments[1].text, MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.SaveCaptionSuccess(parseInt(arguments[1].imageId)), MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.SaveCaptionFailure);	
}

MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.SaveCaptionSuccess = function(result){

        //show and fade success message
	    var CaptionCount = Captions.length;	
	    for	(var i=0; i<CaptionCount; i++){
		    if (Captions[i].get_imageId() === result){
			    Captions[i].ShowCompleteMessage();
			    break;	
		    }
	    }
}

MySpace.PhotoAlbums.Pages.EditAlbumsPhotos.SaveCaptionFailure = function(){
   	    alert(MySpaceRes.ViewMorePicsPage.ErrorAjaxAction);
}
//Static Functions - End








