Type.registerNamespace('MySpace.PhotoAlbums.Pages');

MySpace.PhotoAlbums.Pages.ViewImage = function(element){
	MySpace.PhotoAlbums.Pages.ViewImage.initializeBase(this, [element]);
}

MySpace.PhotoAlbums.Pages.ViewImage.prototype = {
	_nextLink: null,
	_prevLink: null,
	_reportAbuse: null,
	
	get_nextLink: function(){
	    return this._nextLink;
	},
	
	set_nextLink: function(value){
	    this._nextLink = value;
	},
	
	get_prevLink: function(){
	    return this._prevLink;
	},
	
	set_prevLink: function(value){
	    this._prevLink = value;
	},
	
	get_reportAbuse: function(){
	    return this._reportAbuse;
	},
	
	set_reportAbuse: function(value){
	    this._reportAbuse = value;
	},
	
	initialize: function(){
	},

	AttachEvents: function(){
	    //Next Previous Keyboard events logic
		$addHandlers(document,{keydown:this.getkey}, this);
        var aReportAbuseBtn = $get(aReportAbuse);
        this.set_reportAbuse(aReportAbuseBtn);
    	$addHandlers(this.get_reportAbuse(), {click:this.confirmAbuseReport},this);

	},
	
	confirmAbuseReport: function (url){
		if ( confirm(MySpaceRes.ViewMorePicsPage.ReportConfirmation) )  {
			location.href = url;
		}
	},
	
	next: function() {
	  window.location.href = this.get_nextLink();
	},
	
	prev: function() {
	  window.location.href = this.get_prevLink();
	},
	
	getkey: function(e) {
		switch(e.keyCode) { 
			case 39 : this.next(); return false; //right arrow
			case 37 : this.prev(); return false; //left arrow
		}
	},
	
	
    
	dispose: function(){
	    this._nextLink = null;
	    this._prevLink = null;
	    this._reportAbuse = null;
	}

};

MySpace.PhotoAlbums.Pages.ViewImage.registerClass('MySpace.PhotoAlbums.Pages.ViewImage', Sys.UI.Behavior);

var ClientCodeBehind;

Sys.Application.add_init(setupPage);

function setupPage(){
	ClientCodeBehind = $create(MySpace.PhotoAlbums.Pages.ViewImage, null, null, null, $get("content"));
};



