var initHistoryWidget = function(aDom) {
             
    //Init system vars    
  var _sUrl = 'widgets/historywidget',
      _sDataPath = 'data/';

  var _oScriptBlock = null,
      _oScriptConatiner = null,
      _oWidgetTextBlock = null,
      _oWidgetYearBlock = null,
      _oWidgetMoreLink = null,
      _sDateUrl = '',
      _sDateString = '',
      _aMonthes = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; 
  


  var getData = function(oCallback) {

    var iTime = new Date().getTime();
    sAction = _sDataPath + _sDateUrl + '?' + iTime;
  
    clearScriptBlock();
  
    _oScriptBlock = document.createElement('script');
    _oScriptBlock.setAttribute('type', 'text/javascript');
    _oScriptBlock.setAttribute('src', "http://www.wisegeek.com/"+_sUrl+"/"+sAction);

      // Attach handlers for all browsers
    _oScriptBlock.onload = _oScriptBlock.onreadystatechange = function() {
    
      if ( (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) {

        oCallback();

      }      
    
    };

    _oScriptConatiner.appendChild(_oScriptBlock);
    
  };//This is a last punched card of getData function
  
  var onGetData = function() {

    if( (typeof(wGFWidget.text) !== 'undefined') ) {
      _oWidgetTextBlock.innerHTML = wGFWidget.text;    
    }
  
    if( (typeof(wGFWidget.link) !== 'undefined') ) {
      _oWidgetMoreLink.href = 'http://www.wisegeek.com/' + wGFWidget.link + '.htm';    
    }
  
    if( (typeof(wGFWidget.year) !== 'undefined') ) {
      _oWidgetYearBlock.innerHTML = wGFWidget.year;    
    }
  
    clearScriptBlock();  
    
  };//This is a last punched card of onGetData function   

  var clearScriptBlock = function() {
  
    if(_oScriptBlock) {
      _oScriptConatiner.removeChild(_oScriptBlock);
      _oScriptBlock = null;
    } 
  
  };//This is a last punched card of clearScriptBlock function   

  
  _oScriptConatiner = document.getElementById(aDom._sScriptConatinerId);   
  _oWidgetTextBlock = document.getElementById(aDom._sWidgetTextBlock);   
  _oWidgetYearBlock = document.getElementById(aDom._sWidgetYearBlock);   
  _oWidgetMoreLink = document.getElementById(aDom._sWidgetMoreLink);   
  _oWidgetDateBlock = document.getElementById(aDom._sWidgetDateBlock);   
  
  var oDate = new Date();
  var sMonth = _aMonthes[oDate.getMonth()];
  var iDay = oDate.getDate();
  
  _sDateUrl = sMonth.toLowerCase()+'-'+iDay+'.js'; 
  _sDateString = sMonth + ' ' + iDay;
  
  _oWidgetDateBlock.innerHTML = _sDateString;
  
  getData(onGetData);

};
