var FooterControls=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-footercontrols",initialize:function($super,f,a,b,e,d,c){if(f!=null){$super(f,a,b,e,d,c);NotificationCenter.addObserver(this,FooterControls.prototype.p_handlePaginationContentsNotification,"paginationSpanContents",this.p_mediaGridID());this.updateFromPreferences()}},onload:function(){if(this.preferences&&this.preferences.postNotification){this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1)}},onunload:function(){},updateFromPreferences:function(){this.setPage(0)},changedPreferenceForKey:function(a){if(this.runningInApp){if(a=="x-paginationSpanContents"){this.p_setPaginationControls(this.p_paginationSpanContents())}}},prevPage:function(){if(this.runningInApp){this.setPreferenceForKey(null,"x-previousPage")}else{NotificationCenter.postNotification(new IWNotification("PreviousPage",this.p_mediaGridID(),null))}},nextPage:function(){if(this.runningInApp){this.setPreferenceForKey(null,"x-nextPage")}else{NotificationCenter.postNotification(new IWNotification("NextPage",this.p_mediaGridID(),null))}},setPage:function(a){if(this.runningInApp){this.setPreferenceForKey(a,"x-setPage")}else{NotificationCenter.postNotification(new IWNotification("SetPage",this.p_mediaGridID(),{pageIndex:a}))}},p_mediaGridID:function(){var a=null;if(this.preferences){a=this.preferenceForKey("gridID")}if(a===undefined){a=null}return a},p_paginationSpanContents:function(){var a=null;if(this.preferences){a=this.preferenceForKey("x-paginationSpanContents")}if(a===undefined){a=null}return a},p_handlePaginationContentsNotification:function(c){var a=c.userInfo();var b=a.controls||"";this.p_setPaginationControls(b)},p_setPaginationControls:function(a){var b=new Template(a);var c=b.evaluate({WIDGET_ID:this.instanceID});this.getElementById("pagination_controls").update(c)}});