<!-- // good old hiding from stupid user agents
  
  if(!com){
    var com = {};
    com.infor = {};
  }
  else {
    if(!com.infor) { com.infor = {}; }
  }
  if(!com.infor.homepage) {
    com.infor.homepage = {}; 
  }
  
  
  com.infor.homepage.Animation = function() {
  
    return {
      count:          0, 
      transition:     1000, 
      interval:       8000, 
      reset_interval: 12000, 
      is_animating:   false, 
      data: [

		{category: 'BUSINESS', bgimage: 'images/w_res3.jpg', quote: '',href: ''},
		{category: 'TESTIMONIAL', bgimage: 'images/w_res2a.jpg', quote: '',href: ''},
		{category: 'Testimonial', bgimage: 'images/w_res21a.jpg', quote: '',href: ''}

], 
      
      
      getCounter: function() {
        if(this.count++ >= this.data.length - 1)
          this.count = 0;
        return this.count;
      },
    
      
      setupControls: function () {
        for(x = 0; x <= this.data.length - 1 ; x++) {
          var control = $('<div>');
          control.addClass('topbar_home_widget_control');
          if(x == 0)
            control.addClass('on'); 
          $('#topbar_home_widget').append(control);
        }
        
        
        $('div.topbar_home_widget_control').each(function(index){
          $(this).click(function() {
            if(!com.infor.homepage.Animation.is_animating) {
              window.clearInterval(com.infor.homepage.Animation.intervalID);
              window.clearTimeout(com.infor.homepage.Animation.timeoutID);
              com.infor.homepage.Animation.homeAnimate(index);
              com.infor.homepage.Animation.count = index;
              com.infor.homepage.Animation.updateControls(index);
              
              com.infor.homepage.Animation.timeoutID = window.setTimeout(function(){com.infor.homepage.Animation.intervalID = window.setInterval('com.infor.homepage.Animation.homeCycle()', com.infor.homepage.Animation.interval);}, com.infor.homepage.Animation.reset_interval);
            }
          });
        });
      },
      
      
      updateControls: function (i) {
        $('div.topbar_home_widget_control').removeClass('on');
        $('div.topbar_home_widget_control:eq(' + i + ')').addClass('on');
      },
      
      
      homeAnimate: function (i) {
        this.is_animating = true; 
        var img_1 = $('#topbar_home_img img');
        var img_2 = img_1.clone(true);
        img_2.attr('src', this.data[i].bgimage);
        img_2.insertAfter(img_1).hide();

        
        $('#topbar_home_img > a').attr('href', this.data[i].href);
        
        
        var head_1 = $('#topbar_home_headline').children('div');
        var head_2_inner = $('<table>');
		head_2_inner.append(this.data[i].quote).wrapInner('<td valign="middle"></td>').wrapInner('<tr></tr>').wrapInner('<tbody></tbody>');
        var head_2 = $('<div>').addClass('topbar_home_headline_container').append(head_2_inner)
        head_2.insertAfter(head_1).hide();
    
        
        xf_time = this.transition;
        head_1.fadeOut(xf_time * 0.6, function(){$(this).remove()});
        img_1.fadeOut(xf_time * 0.6, function(){$(this).remove()});
        this.updateControls(i);
        $('#topbar_home_widget_label').text(this.data[i].category);
        img_2.fadeIn(xf_time);
        head_2.fadeIn(xf_time);
        
        window.setTimeout(function(){com.infor.homepage.Animation.is_animating = false;}, xf_time + 100); // reset lock
      },
      
      
      homeCycle: function homeCycle() {
          i = this.getCounter();
          this.homeAnimate(i);
      }
    };
    
  } (); 

  // -->

