var textZoom = {    
  init:function(){
    this.DEFAULT_INDEX = 1;
    this.LEVELS = [65, 75, 85, 100];
    this.index = Number(site.getCookie('zoom') || this.DEFAULT_INDEX);
    this.update();
  },
  
  zoomIn: function(obj){ 
    this.index = Math.min(this.index + 1, this.LEVELS.length - 1);
    this.update(obj);
  },

  zoomOut: function(obj){
    this.index = Math.max(this.index - 1, 0);
    this.update(obj); 
  },
  
  zoomDefault: function(obj){
    this.index = this.DEFAULT_INDEX;
    this.update(obj);
  },
  
  update: function(obj){
    document.body.style.fontSize = this.LEVELS[this.index] + '%';
    site.setCookie('zoom', this.index, 365, '/');
		if (obj != null) {
			omniture.changeFontSize(obj, this.index);
		  googleAnalytics.trackZoom(this.index);
		}
  }
};

jq$(document).ready(function() {
  textZoom.init();
  jq$(".textzoom .minus").click(function(e){e.preventDefault();e.stopImmediatePropagation();textZoom.zoomOut(this);});
  jq$(".textzoom .reset").click(function(e){e.preventDefault();e.stopImmediatePropagation();textZoom.zoomDefault(this);});
  jq$(".textzoom .plus").click(function(e){e.preventDefault();e.stopImmediatePropagation();textZoom.zoomIn(this);});
});
