module.exports = {
	events: {
		"click .t1": "t1",
		"click .t2": "t2",
		"click .t3": "t3",
		"click .t4": "t4",
		"click .t5": "t5",
		"click .t6": "t6",
	},
	t0: function(e) {this.activate('t0')},
	t1: function(e) {this.activate('t1')},
	t2: function(e) {this.activate('t2')},
	t3: function(e) {this.activate('t3')},
	t4: function(e) {this.activate('t4')},
	t5: function(e) {this.activate('t5')},
	t6: function(e) {this.activate('t6')},
	activate: function(name) {
		if(this.$el.hasClass(name + '-active')) {
			return this.t0();
		}

		this.$el.
		removeClass('t0-active').
		removeClass('t1-active').
		removeClass('t2-active').
		removeClass('t3-active').
		removeClass('t4-active').
		removeClass('t5-active').
		removeClass('t6-active').
		addClass(name + '-active')

		//Scroll into view
		if(window.innerHeight > 900 && window.innerWidth > 1024){
			$pct = $('.slide-container');
			var $win = $('body,html,main');
			var minScrollVal = $pct.offset().top + 200 - window.innerHeight;
			$win.animate({scrollTop: minScrollVal}, 500)
		}
	},
	initialize: function(){
		function isIE () {
		  var myNav = navigator.userAgent.toLowerCase();
		  return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
		}

		var thisView = this;
		if(window.innerHeight > 900 && window.innerWidth > 1024){
			thisView.$el.removeClass('fade-mode').removeClass('flip-mode')
		}else{
			if(!isIE()) {
				thisView.$el.removeClass('fade-mode').addClass('flip-mode')
			}else{
				thisView.$el.addClass('fade-mode')
			}
		}
		$( window ).resize(function() {
			if(window.innerHeight > 900 && window.innerWidth > 1024){
				thisView.$el.removeClass('fade-mode').removeClass('flip-mode')
			}else{
				if(!isIE()) {
					thisView.$el.removeClass('fade-mode').addClass('flip-mode')
				}else{
					thisView.$el.addClass('fade-mode')
				}
			}
		})
	}
};
