/*
 * This script uses AJAX to get WordOfDay feed in HTML format
 * An event obeserver is attached and it triggers AJAX search when the 
 * window is loaded
 *
 * Author: Netorek Oy / jmk
 */
 
var AjaxWordOfDay = Class.create();
var RSSFeederURL = 'http://nuoriso.sley.fi/nuoriso-webmanager/plugins/rssfeeder'

AjaxWordOfDay.prototype = 
{		
	initialize: function()
	{
	},

	doAjax: function() 
	{		 
  		var parameterQueryMap = 
    		{
      			//empty
    		};
		new Ajax.Request( RSSFeederURL, 
		{
			method: 'get', 
			parameters: '',
			onComplete: this.onResponse
		});
	},
			
	onResponse: function(response) 
	{		
    		try
    		{
        		var text = response.responseText;
//			alert(text);
        		$('wordOfDay').innerHTML = text;
    		}
    		catch(e)
    		{
      			alert(e); 
    		}
	}
}

Event.observe(window, 'load', function() 
{	
	new  AjaxWordOfDay();
}, false);


function initWordOfDayHTML()
{
	AjaxWordOfDay.prototype.doAjax();
}

