﻿Type.registerNamespace('Flixon.Ajax');Flixon.Ajax.WidgetBehavior=function(element){Flixon.Ajax.WidgetBehavior.initializeBase(this,[element]);this._targetElement=null;this._isOwnProfile=false;this._headerControlID=null;this._bodyControlID=null;this._settingsControlID=null;this._toggleBodyButtonControlID=null;this._toggleSettingsButtonControlID=null;this._removeButtonControlID=null;this._saveSettingsButtonControlID=null;this._titleControlID=null;this._titleTextBoxControlID=null;this._servicePath=null;this._moveMethod=null;this._collapseMethod=null;this._expandMethod=null;this._removeMethod=null;this._toggleBodyHandler=null;this._toggleSettingsHandler=null;this._saveSettingsHandler=null;this._removeHandler=null;this._settings=null;this._toggleBodyButton=null;this._toggleSettingsButton=null;this._removeButton=null;this._saveSettingsButton=null;}
Flixon.Ajax.WidgetBehavior.prototype={initialize:function(){Flixon.Ajax.WidgetBehavior.callBaseMethod(this,'initialize');this._targetElement=this.get_element();this._settings=$get(this.get_SettingsControlID());this._toggleBodyButton=$get(this.get_ToggleBodyButtonControlID());this._toggleSettingsButton=$get(this.get_ToggleSettingsButtonControlID());this._removeButton=$get(this.get_RemoveButtonControlID());this._saveSettingsButton=$get(this.get_SaveSettingsButtonControlID());this._toggleBodyHandler=Function.createDelegate(this,this._onToggleBody);this._toggleSettingsHandler=Function.createDelegate(this,this._onToggleSettings);if(this._removeButton!=null)
this._removeHandler=Function.createDelegate(this,this._onRemove);$addHandler(this._toggleBodyButton,'click',this._toggleBodyHandler);if(this.get_IsOwnProfile()){$addHandler(this._toggleSettingsButton,'click',this._toggleSettingsHandler);if(this._removeButton!=null)
$addHandler(this._removeButton,'click',this._removeHandler);}
if(this.get_IsOwnProfile()){var header=$get(this.get_HeaderControlID());header.style.cursor='move';}},dispose:function(){$removeHandler(this._toggleBodyButton,'click',this._toggleBodyHandler);if(this.get_IsOwnProfile()){$removeHandler(this._toggleSettingsButton,'click',this._toggleSettingsHandler);if(this._removeButton!=null)
$removeHandler(this._removeButton,'click',this._removeHandler);}
Flixon.Ajax.WidgetBehavior.callBaseMethod(this,'dispose');},move:function(column,row){var instanceID=parseInt(this._targetElement.getAttribute('instanceID'));var params={'userWidgetID':instanceID,'column':column,'row':row};Sys.Net.WebServiceProxy.invoke(this.get_ServicePath(),this.get_MoveMethod(),false,params,null,null,null);},toggleBody:function(){var instanceID=parseInt(this._targetElement.getAttribute('instanceID'));var bodyExtender=$find(this._targetElement.id+'_BodyExtender');if(bodyExtender.get_Collapsed()){if(this.get_IsOwnProfile()){var params={'userWidgetID':instanceID};Sys.Net.WebServiceProxy.invoke(this.get_ServicePath(),this.get_ExpandMethod(),false,params,null,null,null);}
bodyExtender.expandPanel();this._toggleBodyButton.src=bodyExtender.get_ExpandedImage();this._toggleBodyButton.title=bodyExtender.get_ExpandedText();if(this.get_IsOwnProfile())this._toggleSettingsButton.style.visibility='visible';}else{if(this.get_IsOwnProfile()){var params={'userWidgetID':instanceID};Sys.Net.WebServiceProxy.invoke(this.get_ServicePath(),this.get_CollapseMethod(),false,params,null,null,null);}
bodyExtender.collapsePanel();this._toggleBodyButton.src=bodyExtender.get_CollapsedImage();this._toggleBodyButton.title=bodyExtender.get_CollapsedText();if(this.get_IsOwnProfile())this._toggleSettingsButton.style.visibility='hidden';}},toggleSettings:function(){var instanceID=parseInt(this._targetElement.getAttribute('instanceID'));var settingsExtender=$find(this._targetElement.id+'_SettingsExtender');if(settingsExtender.get_Collapsed()){settingsExtender.expandPanel();this._toggleSettingsButton.src=settingsExtender.get_ExpandedImage();this._toggleSettingsButton.title=settingsExtender.get_ExpandedText();}else{settingsExtender.collapsePanel();this._toggleSettingsButton.src=settingsExtender.get_CollapsedImage();this._toggleSettingsButton.title=settingsExtender.get_CollapsedText();}},saveSettings:function(){this.toggleSettings();$get(this.get_TitleControlID()).innerText=$get(this.get_TitleTextBoxControlID()).value;},remove:function(){var instanceID=parseInt(this._targetElement.getAttribute('instanceID'));var params={'userWidgetID':instanceID};Sys.Net.WebServiceProxy.invoke(this.get_ServicePath(),this.get_RemoveMethod(),false,params,null,null,null);this._targetElement.style.display='none';},_onToggleBody:function(e){this.toggleBody();e.preventDefault();},_onToggleSettings:function(e){this.toggleSettings();e.preventDefault();},_onSaveSettings:function(e){this.saveSettings();},_onRemove:function(e){this.remove();e.preventDefault();},get_IsOwnProfile:function(){return this._isOwnProfile;},set_IsOwnProfile:function(value){this._isOwnProfile=value;},get_HeaderControlID:function(){return this._headerControlID;},set_HeaderControlID:function(value){this._headerControlID=value;},get_BodyControlID:function(){return this._bodyControlID;},set_BodyControlID:function(value){this._bodyControlID=value;},get_SettingsControlID:function(){return this._settingsControlID;},set_SettingsControlID:function(value){this._settingsControlID=value;},get_ToggleBodyButtonControlID:function(){return this._toggleBodyButtonControlID;},set_ToggleBodyButtonControlID:function(value){this._toggleBodyButtonControlID=value;},get_ToggleSettingsButtonControlID:function(){return this._toggleSettingsButtonControlID;},set_ToggleSettingsButtonControlID:function(value){this._toggleSettingsButtonControlID=value;},get_RemoveButtonControlID:function(){return this._removeButtonControlID;},set_RemoveButtonControlID:function(value){this._removeButtonControlID=value;},get_SaveSettingsButtonControlID:function(){return this._saveSettingsButtonControlID;},set_SaveSettingsButtonControlID:function(value){this._saveSettingsButtonControlID=value;},get_TitleControlID:function(){return this._titleControlID;},set_TitleControlID:function(value){this._titleControlID=value;},get_TitleTextBoxControlID:function(){return this._titleTextBoxControlID;},set_TitleTextBoxControlID:function(value){this._titleTextBoxControlID=value;},get_ServicePath:function(){return this._servicePath;},set_ServicePath:function(value){this._servicePath=value;},get_MoveMethod:function(){return this._moveMethod;},set_MoveMethod:function(value){this._moveMethod=value;},get_CollapseMethod:function(){return this._collapseMethod;},set_CollapseMethod:function(value){this._collapseMethod=value;},get_ExpandMethod:function(){return this._expandMethod;},set_ExpandMethod:function(value){this._expandMethod=value;},get_RemoveMethod:function(){return this._removeMethod;},set_RemoveMethod:function(value){this._removeMethod=value;}}
Flixon.Ajax.WidgetBehavior.registerClass('Flixon.Ajax.WidgetBehavior',AjaxControlToolkit.BehaviorBase);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();