/*
Class: ResponsiveMenu
Menu widget to convert menu into a slide down menu when screen size reaches certain breakpoint.
*/
/* global __, jQuery */
__.classes.ResponsiveMenu = __.core.Classes.create({
	init: function(){
		var _this = this;
		this.__base(arguments);
		if(typeof this.$action === 'string'){
			this.$action = this.$.find(this.$action);
		}
		if(typeof this.$list === 'string'){
			this.$list = this.$.find(this.$list);
		}
		if(!this.responsiveHandler){
			this.responsiveHandler = new __.classes.ResponsiveHandler();
		}
		if(!this.responsiveSubscription){
			this.responsiveSubscription = this.responsiveHandler.sub('change', function(_data){
				_this.switchBreakpoint(_data.breakPoint);
			});
		}
		if(!__.lib.isArray(this.nvpBreakPoints)){
			var _bpArray = [this.nvpBreakPoints];
			this.nvpBreakPoints = _bpArray;
		}

		//--set to initial breakpoint
		this.switchBreakpoint(this.responsiveHandler.getBreakPoint());

		//--attach action listener
		this.$action.on('click', function(){
			_this.toggleOpen();
		});
	}
	,properties: {
		$: null
		,$action: '.siteMainNavTitle'
		,$list: '.siteMainNavList'
		,closedClass: 'hasClosedMenu'
		,openedClass: 'hasOpenMenu'
		,nvpBreakPoints: 'nvp'
		,responsiveHandler: null
		,responsiveSubscription: null
		,state: null
		,switchBreakpoint: function(_breakpoint){
			if(_breakpoint !== this.state){
				if(jQuery.inArray(_breakpoint, this.nvpBreakPoints) > -1){
					this.switchToNVP();
				}else{
					this.switchToWVP();
					// __.topnavigationDropdownhandler.sizeAndCenter2();
				}
				this.state = _breakpoint;
			}
		}
		,switchToNVP: function(){
			//--show action
			this.$action.show();
			//--hide menu
			this.$list.hide();

			this.isOpened = false;
		}
		,switchToWVP: function(){
			//--hide action
			this.$action.show().css('display', '');
			//--show menu
			this.$list.show().css('display', '');

			this.isOpened = undefined;
		}
		,closeList: function(){
			if(this.isOpened){
				var _this = this;
				this.$list.slideUp(function(){
					_this.$.removeClass(_this.openedClass).addClass(_this.closedClass);
					_this.isOpened = false;
				});
			}
		}
		,openList: function(){
			if(!this.isOpened){
				this.$.addClass(this.openedClass).removeClass(this.closedClass);
				this.$list.slideDown();
				this.isOpened = true;
			}
		}
		,isOpened: undefined
		,toggleOpen: function(){
			if(typeof this.isOpened === 'undefined'){
				this.isOpened = this.$list.is(':visible');
			}
			if(this.isOpened){
				this.closeList();
			}else{
				this.openList();
			}
		}
	}
});

@@ -1016,20 +1016,20 @@
 s.toggle
-Open
+List
 ();%0A%09%09%7D)
@@ -1704,34 +1704,32 @@
 %0A%0A%09%09%09this.isOpen
-ed
  = false;%0A%09%09%7D%0A%09%09
@@ -1889,18 +1889,16 @@
 s.isOpen
-ed
  = undef
@@ -1946,26 +1946,24 @@
 (this.isOpen
-ed
 )%7B%0A%09%09%09%09var _
@@ -2100,18 +2100,16 @@
 s.isOpen
-ed
  = false
@@ -2162,34 +2162,32 @@
 %09if(!this.isOpen
-ed
 )%7B%0A%09%09%09%09this.$.ad
@@ -2281,26 +2281,24 @@
 %09this.isOpen
-ed
  = true;%0A%09%09%09
@@ -2312,18 +2312,16 @@
 %09,isOpen
-ed
 : undefi
@@ -2333,20 +2333,20 @@
 %09,toggle
-Open
+List
 : functi
@@ -2375,18 +2375,16 @@
 s.isOpen
-ed
  === 'un
@@ -2409,18 +2409,16 @@
 s.isOpen
-ed
  = this.
@@ -2461,18 +2461,16 @@
 s.isOpen
-ed
 )%7B%0A%09%09%09%09t

change in naming conventions