var Ajax;
if (Ajax && (Ajax != null)) {
	Ajax.Responders.register({
	  onCreate: function() {
        if($('spinner') && Ajax.activeRequestCount>0)
          Effect.Appear('spinner',{duration:0.5,queue:'end'});
	  },
	  onComplete: function() {
        if($('spinner') && Ajax.activeRequestCount==0)
          Effect.Fade('spinner',{duration:0.5,queue:'end'});
	  }
	});
}

function addEditor(textAreaName, language, toolbarSet, width, height, value){
    // toolbarSet can be one of the followings: { Default, Basic, d1g}
    if(toolbarSet == null)
        toolbarSet = "d1g";

    var oFCKeditor = new FCKeditor( textAreaName, width, height, toolbarSet, value  ) ;
    oFCKeditor.BasePath = "/js/fckeditor/" ;

    oFCKeditor.Config[ "DefaultLanguage" ] = language ;
    oFCKeditor.Config[ "CustomConfigurationsPath" ] =  "/js/d1g_fckeditor_config.js"  ;

    // getting language and text direction:
    var direction = 'ltr'
    if(language == 'ar')
        direction = 'rtl';
    oFCKeditor.Config[ "ContentLangDirection" ] = direction ;

    // oFCKeditor.Create() ;
    oFCKeditor.ReplaceTextarea() ;
}