

Search = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'search';
		this.form = '#searchForm';
		this.name = "Search Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 250, 100))
  }

});

if (WidgetManager)
	WidgetManager.registerWidget(new Search())

Calendar = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'calendar';
		this.form = '#calendarForm';
		this.name = "Calendar Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 250, 100))
  }

});

if (WidgetManager)
	WidgetManager.registerWidget(new Calendar())

TagCloud = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'tagcloud';
		this.form = '#tagCloudForm';
		this.name = "TagCloud Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 250, 100))
  }

});

if (WidgetManager)
	WidgetManager.registerWidget(new TagCloud())

Categories = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'categories';
		this.form = '#categoriesForm';
		this.name = "Categories Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 250, 100))
  },

  onChange: function(select)
  {
		var url = blogURL
		if (select.value != '') url += '/category/'+select.value
		window.location.replace(url)
  }

});

if (WidgetManager)
	WidgetManager.registerWidget(new Categories())


Archives = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'archives';
		this.form = '#archivesForm';
		this.name = "Archives Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 250, 100))
  },

  onChange: function(select)
  {
		var url = blogURL
		if (select.value != '') url += '/'+select.value
		window.location.replace(url)
  }

});

if (WidgetManager)
	WidgetManager.registerWidget(new Archives())


Links = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'links';
		this.form = '#linksForm';
		this.name = "Links Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 250, 100))
  }

});

if (WidgetManager)
	WidgetManager.registerWidget(new Links())


Pages = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'pages';
		this.form = '#pagesForm';
		this.name = "Pages Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 250, 100))
  },

  onChange: function(select)
  {
		var url = blogURL
		if (select.value != '') url += '/'+select.value
		window.location.replace(url)
  }

});

if (WidgetManager)
	WidgetManager.registerWidget(new Pages())


RecentComments = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'recentcomments';
		this.form = '#recentcommentsForm';
		this.name = "Recent Comments Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 270, 100))
  },

	event: function(ev)
	{
		if (ev == 'ok'){
			var comments = $(this.form+' #ncomments')
			var ncomments = toInteger(comments.val())
			if (ncomments > 15) ncomments = 15
			if (ncomments <= 0) ncomments = 5
			comments.val(ncomments)
		}
		this.constructor.prototype.event.call(this, ev);
	}

});

if (WidgetManager)
	WidgetManager.registerWidget(new RecentComments())


RecentPosts = newClass(WidgetBase,{
  
  constructor: function()
  {
		this.type = 'recentposts';
		this.form = '#recentpostsForm';
		this.name = "Recent Posts Widget";
    this.constructor.prototype.constructor.call(this);
    if (WindowManager)
			WindowManager.registerWindow(new Window(this.type, this.name, "/widgets/"+this.type+"/properties.wnd", 270, 100))
  },

	event: function(ev)
	{
		if (ev == 'ok'){
			var posts = $(this.form+' #nposts')
			var nposts = toInteger(posts.val())
			if (nposts > 15) nposts = 15
			if (nposts <= 0) nposts = 5
			posts.val(nposts)
		}
		this.constructor.prototype.event.call(this, ev);
	}

});

if (WidgetManager)
	WidgetManager.registerWidget(new RecentPosts())


