/* Minification failed. Returning unminified contents.
(1,1): run-time error CSS1019: Unexpected token, found ''use strict''
(1,14): run-time error CSS1019: Unexpected token, found '('
(1,16): run-time error CSS1019: Unexpected token, found 'function('
(1,25): run-time error CSS1019: Unexpected token, found '$'
(1,26): run-time error CSS1019: Unexpected token, found ')'
(1,28): run-time error CSS1019: Unexpected token, found '{'
(3,3): run-time error CSS1019: Unexpected token, found '$'
(3,19): run-time error CSS1031: Expected selector, found '='
(3,19): run-time error CSS1025: Expected comma or open brace, found '='
(143,2): run-time error CSS1019: Unexpected token, found '}'
(143,3): run-time error CSS1019: Unexpected token, found '('
(143,10): run-time error CSS1031: Expected selector, found ')'
(143,10): run-time error CSS1025: Expected comma or open brace, found ')'
(145,1): run-time error CSS1019: Unexpected token, found ''use strict''
(146,11): run-time error CSS1031: Expected selector, found '='
(146,11): run-time error CSS1025: Expected comma or open brace, found '='
(686,2): run-time error CSS1019: Unexpected token, found '('
(686,3): run-time error CSS1019: Unexpected token, found ')'
(688,1): run-time error CSS1019: Unexpected token, found ''use strict''
(689,10): run-time error CSS1031: Expected selector, found '='
(689,10): run-time error CSS1025: Expected comma or open brace, found '='
(1287,2): run-time error CSS1019: Unexpected token, found '('
(1287,3): run-time error CSS1019: Unexpected token, found ')'
(1289,17): run-time error CSS1031: Expected selector, found '='
(1289,17): run-time error CSS1025: Expected comma or open brace, found '='
(1413,2): run-time error CSS1019: Unexpected token, found '('
(1413,3): run-time error CSS1019: Unexpected token, found ')'
(1428,1): run-time error CSS1019: Unexpected token, found '('
(1428,3): run-time error CSS1019: Unexpected token, found 'function('
(1428,20): run-time error CSS1031: Expected selector, found ')'
(1428,20): run-time error CSS1025: Expected comma or open brace, found ')'
(1494,2): run-time error CSS1019: Unexpected token, found ')'
(1494,3): run-time error CSS1019: Unexpected token, found '('
(1494,12): run-time error CSS1031: Expected selector, found ')'
(1494,12): run-time error CSS1025: Expected comma or open brace, found ')'
(1506,2): run-time error CSS1019: Unexpected token, found '('
(1506,4): run-time error CSS1019: Unexpected token, found 'function('
(1506,21): run-time error CSS1031: Expected selector, found ')'
(1506,21): run-time error CSS1025: Expected comma or open brace, found ')'
(1827,3): run-time error CSS1019: Unexpected token, found ')'
(1827,4): run-time error CSS1019: Unexpected token, found '('
(1827,13): run-time error CSS1031: Expected selector, found ')'
(1827,13): run-time error CSS1025: Expected comma or open brace, found ')'
(1828,18): run-time error CSS1031: Expected selector, found '='
(1828,18): run-time error CSS1025: Expected comma or open brace, found '='
(1940,2): run-time error CSS1019: Unexpected token, found '('
(1940,3): run-time error CSS1019: Unexpected token, found ')'
 */
'use strict';( function($) {

		$.fn.letterIcon = function(options) {

			var settings = $.extend({
				color : "#556b2f",
				backgroundColor : "white"
			}, options);

			var parseColourString = function(s) {

				// Tokenise input
				var m = s.match(/^\#|^rgb\(|[\d\w]+$|\d{3}/g);

				// Other variables
				var value, values;
				var valid = true, double = false;

				// If no matches, return false
				if (!m)
					return false;

				// If hex value
				if (m.length < 3) {
					// Get the value
					value = m[m.length - 1];

					// Split into parts, either x,x,x or xx,xx,xx
					values = value.length == 3 ? double = true && value.split('') : value.match(/../g);

					// Convert to decimal values - if #nnn, double up on values 345 => 334455
					values.forEach(function(v, i) {
						values[i] = parseInt( double ? '' + v + v : v, 16);
					});

					// Otherwise it's rgb, get the values
				} else {
					values = m.length == 3 ? m.slice() : m.slice(1);
				}

				// Check that each value is between 0 and 255 inclusive and return the result
				values.forEach(function(v) {
					valid = valid ? v >= 0 && v <= 255 : false;
				});

				// If string is invalid, return false, otherwise return an array of the values
				return valid && values;
			};

			return this.each(function() {
				var _this = $(this);

				var string = '', letter = '';
				if (typeof _this.data('text') !== "undefined" && _this.data('text') !== null) {
					string = _this.data('text').toString().trim();					
				}

				if (_this.data('charCount') && !isNaN(_this.data('charCount'))) {
					var newString = string.split(/(?=[A-Z])/), count = parseInt(_this.data('charCount'));

					if (count > newString.length) {
						count = newString.length;
					}
					for (var i = 0; i < count; i++) {
						letter = letter + newString[i].charAt(0);

					}
					letter = letter.toUpperCase();
				} else {
					letter = string.charAt(0).toUpperCase();
				}

				_this.append("<div class='letter-icon-wrapper'><span class='letter-icon'>" + letter + "</span></div>");

				var elem = _this.children();

				if (_this.data('size') && (_this.data('size') == 'sm' || _this.data('size') == 'lg')) {
					elem.addClass('size-' + _this.data('size'));
				}
				if (_this.data('icon')) {
                    elem.append('<i class="' + _this.data('icon') + '"></i>');
                }
				if (_this.data('customClass')) {
					if (_this.data('customClass').charAt(0) === '.')
						_this.data('customClass', _this.data('customClass').substr(1));
					elem.addClass(_this.data('customClass'));
				}

				if (_this.data('box') && (_this.data('box') == 'round' || _this.data('box') == 'circle')) {
					elem.addClass('box-' + _this.data('box'));
				}

				if (_this.data('color') && _this.data('color') == 'auto') {

					elem.removeClass(function(index, css) {
						return (css.match(/(^|\s)letter-color-\S+/g) || []).join(' ');
					});
					elem.addClass('letter-color-' + string.charAt(0).toLowerCase());

				}

				if (_this.data('color') && (parseColourString(_this.data('color')) !== false || _this.data('color') !== 'auto')) {
					var boxColor;
					elem.removeClass(function(index, css) {
						return (css.match(/(^|\s)letter-color-\S+/g) || []).join(' ');
					});
					boxColor = parseColourString(_this.data('color'));
					elem.css({
						backgroundColor : 'rgb(' + boxColor + ')'
					});
				}
				if (_this.data('colorHover') && (parseColourString(_this.data('colorHover')) !== false || _this.data('colorHover') == 'auto')) {
					if (_this.data('colorHover') == 'auto') {
						elem.add(elem.closest("a")).on('mouseenter', function() {
							elem.addClass('hover');
						}).on('mouseleave', function() {
							elem.removeClass('hover');
						});
					} else {
						var hoverColor, originalColor;
						hoverColor = parseColourString(_this.data('colorHover'));
						if (_this.data('color') && _this.data('color') !== 'auto') {
							originalColor = _this.data('color');

						} else {
							originalColor = elem.css("background-color");
						}
						elem.add(elem.closest("a")).on('mouseenter', function() {
							elem.css({
								backgroundColor : 'rgb(' + hoverColor + ')'
							});
						}).on('mouseleave', function() {
							elem.css({
								backgroundColor : originalColor
							});
						});
					}
				}
			});

		};

	}(jQuery));

'use strict';
var Index = function() {
	var chart1Handler = function() {
		if ($("#acquisitionChart").length) {
			var data = {
				labels : ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
				datasets : [{
					label : 'dataset',
					fillColor : 'rgba(148,116,153,0.7)',
					strokeColor : 'rgba(148,116,153,0)',
					highlightFill : 'rgba(148,116,153,1)',
					highlightStroke : 'rgba(148,116,153,1)',
					data : [65, 59, 80, 81, 56, 55, 40]
				}]
			};

			var options = {
				maintainAspectRatio : false,
				showScale : false,
				barDatasetSpacing : 0,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				responsive : true,
				scaleBeginAtZero : true,
				scaleShowGridLines : false,
				scaleLineColor : "transparent",
				barShowStroke : false,
				barValueSpacing : 5
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#acquisitionChart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart1 = new Chart(ctx).Bar(data, options);
		}
	};
	var chart2Handler = function() {
		if ($("#conversionChart").length) {
			// Chart.js Data
			var data = {
				labels : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
				datasets : [{
					label : 'Transactions',
					fillColor : 'rgba(91,155,209,0.5)',
					strokeColor : 'rgba(91,155,209,1)',
					data : [65, 59, 80, 81, 56, 55, 40, 84, 64, 120, 132, 87]
				}, {
					label : 'Unique Visitors',
					fillColor : 'rgba(91,155,209,0.5)',
					strokeColor : 'rgba(91,155,209,0.5)',
					data : [172, 175, 193, 194, 161, 175, 153, 190, 175, 231, 234, 250]
				}]
			};

			// Chart.js Options
			var options = {
				maintainAspectRatio : false,
				showScale : false,
				scaleLineWidth : 0,
				responsive : true,
				scaleFontFamily : "'Helvetica', 'Arial', sans-serif",
				scaleFontSize : 11,
				scaleFontColor : "#aaa",
				scaleShowGridLines : true,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontSize : 12,
				scaleGridLineColor : 'rgba(0,0,0,.05)',
				scaleGridLineWidth : 1,
				bezierCurve : true,
				bezierCurveTension : 0.5,
				scaleLineColor : 'transparent',
				scaleShowVerticalLines : false,
				pointDot : false,
				pointDotRadius : 4,
				pointDotStrokeWidth : 1,
				pointHitDetectionRadius : 20,
				datasetStroke : true,
				datasetStrokeWidth : 2,
				datasetFill : true,
				animationEasing : "easeInOutExpo"
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#conversionChart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart2 = new Chart(ctx).Line(data, options);
		}

	};
	var chart3Handler = function() {
		if ($("#productsChart").length) {
			// Chart.js Data
			var data = {
				labels : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
				datasets : [{
					label : 'Alpha',
					fillColor : 'rgba(90,135,112,0)',
					strokeColor : 'rgba(90,135,112,1)',
					pointColor : 'rgba(90,135,112,1)',
					data : [656, 594, 806, 817, 568, 557, 408, 843, 642, 1202, 1322, 847]
				}, {
					label : 'Omega',
					fillColor : 'rgba(127,140,141,0)',
					strokeColor : 'rgba(127,140,141,1)',
					pointColor : 'rgba(127,140,141,1)',
					data : [282, 484, 402, 194, 864, 275, 905, 1025, 123, 1455, 650, 1651]
				}, {
					label : 'Kappa',
					fillColor : 'rgba(148,116,153,0)',
					strokeColor : 'rgba(148,116,153,1)',
					pointColor : 'rgba(148,116,153,1)',
					data : [768, 368, 253, 163, 437, 678, 1239, 1345, 1898, 1766, 1603, 2116]
				}]
			};

			// Chart.js Options
			var options = {
				maintainAspectRatio : false,
				responsive : true,
				scaleFontFamily : "'Helvetica', 'Arial', sans-serif",
				scaleFontSize : 11,
				scaleFontColor : "#aaa",
				scaleShowGridLines : true,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontSize : 12,
				scaleGridLineColor : 'rgba(0,0,0,.05)',
				scaleGridLineWidth : 1,
				bezierCurve : false,
				bezierCurveTension : 0.4,
				scaleLineColor : 'transparent',
				scaleShowVerticalLines : false,
				pointDot : false,
				pointDotRadius : 4,
				pointDotStrokeWidth : 1,
				pointHitDetectionRadius : 20,
				datasetStroke : true,
				tooltipXPadding : 20,
				datasetStrokeWidth : 2,
				datasetFill : true,
				animationEasing : "easeInOutExpo"
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#productsChart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart3 = new Chart(ctx).Line(data, options);
		}
	};
	var chart4Handler = function() {
		if ($("#lineChart").length) {
			// Chart.js Data
			var data = {
				labels : ['a', 'b', 'c', 'd', 'e', 'f', 'g'],
				datasets : [{
					label : 'dataset',
					fillColor : 'rgba(0,0,0,0)',
					strokeColor : 'rgba(0,0,0,0.2)',
					data : [65, 59, 80, 81, 56, 95, 100]
				}]
			};

			// Chart.js Options
			var options = {
				maintainAspectRatio : false,
				showScale : false,
				scaleLineWidth : 0,
				responsive : true,
				scaleFontFamily : "'Helvetica', 'Arial', sans-serif",
				scaleFontSize : 11,
				scaleFontColor : "#aaa",
				scaleShowGridLines : true,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontSize : 12,
				scaleGridLineColor : 'rgba(0,0,0,.05)',
				scaleGridLineWidth : 1,
				bezierCurve : false,
				bezierCurveTension : 0.2,
				scaleLineColor : 'transparent',
				scaleShowVerticalLines : false,
				pointDot : true,
				pointDotRadius : 4,
				pointDotStrokeWidth : 1,
				pointHitDetectionRadius : 20,
				datasetStroke : true,
				datasetStrokeWidth : 2,
				datasetFill : true,
				animationEasing : "easeInOutExpo"
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#lineChart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart4 = new Chart(ctx).Line(data, options);
		}
	};

	var chart5Handler = function() {
		if ($("#barChart").length) {
			// Chart.js Data
			var data = {
				labels : ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'a', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'i', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],
				datasets : [{
					label : 'dataset',
					fillColor : 'rgba(255,255,244,0.3)',
					strokeColor : 'rgba(255,255,244,0.5)',
					data : [65, 59, 80, 81, 56, 55, 40, 65, 59, 80, 81, 56, 55, 40, 65, 59, 80, 81, 56, 55, 40, 65, 59, 80, 81, 56, 80, 81]
				}]
			};

			// Chart.js Options
			var options = {
				maintainAspectRatio : false,
				showScale : false,
				barDatasetSpacing : 0,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				responsive : true,
				scaleBeginAtZero : true,
				scaleShowGridLines : false,
				scaleLineColor : 'transparent',
				barShowStroke : false,
				barValueSpacing : 5
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#barChart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart5 = new Chart(ctx).Bar(data, options);
		}
	};
	var chart6Handler = function() {
		if ($("#socialChart").length) {
			// Chart.js Data
			var data = [{
				value : 300,
				color : "#6F83B6",
				label : "Fb"
			}, {
				value : 50,
				color : "#79BEF1",
				label : "YT"
			}, {
				value : 100,
				color : "#ED5952",
				label : "Tw"
			}];

			// Chart.js Options
			var options = {
				responsive : false,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipCornerRadius : 0,
				tooltipCaretSize : 2,
				segmentShowStroke : true,
				segmentStrokeColor : '#fff',
				segmentStrokeWidth : 2,
				percentageInnerCutout : 50,
				animationSteps : 100,
				animationEasing : 'easeOutBounce',
				animateRotate : true,
				animateScale : false
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#socialChart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart6 = new Chart(ctx).Doughnut(data, options);
		}
	};
	var chart7Handler = function() {
		if ($("#social2Chart").length) {
			// Chart.js Data
			var data = [{
				value : 200,
				color : "#8BC33E",
				label : "Sc"
			}, {
				value : 150,
				color : "#7F8C8D",
				label : "Ad"
			}];

			// Chart.js Options
			var options = {
				responsive : false,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipCornerRadius : 0,
				tooltipCaretSize : 2,
				segmentShowStroke : true,
				segmentStrokeColor : '#fff',
				segmentStrokeWidth : 2,
				percentageInnerCutout : 50,
				animationSteps : 100,
				animationEasing : 'easeOutBounce',
				animateRotate : true,
				animateScale : false
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#social2Chart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart6 = new Chart(ctx).Doughnut(data, options);
		}
	};
	var chart8Handler = function() {
		if ($("#social3Chart").length) {
			// Chart.js Data
			var data = [{
				value : 300,
				color : "#6F83B6",
				label : "Facebook"
			}, {
				value : 150,
				color : "#79BEF1",
				label : "Twitter"
			}, {
				value : 100,
				color : "#ED5952",
				label : "YouTube"
			}, {
				value : 80,
				color : "#8BC33E",
				label : "Spotify"
			}];

			// Chart.js Options
			var options = {
				responsive : false,
				scaleShowLabelBackdrop : true,
				scaleBackdropColor : 'rgba(255,255,255,0.75)',
				scaleBeginAtZero : true,
				scaleBackdropPaddingY : 2,
				scaleBackdropPaddingX : 2,
				scaleShowLine : true,
				segmentShowStroke : true,
				segmentStrokeColor : '#fff',
				segmentStrokeWidth : 2,
				animationSteps : 100,
				animationEasing : 'easeOutBounce',
				animateRotate : true,
				animateScale : false
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#social3Chart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart6 = new Chart(ctx).PolarArea(data, options);
		}
	};
	var chart9Handler = function() {
		if ($("#social4Chart").length) {
			// Chart.js Data
			var data = [{
				value : 180,
				color : "#6F83B6",
				label : "Facebook"
			}, {
				value : 210,
				color : "#79BEF1",
				label : "Twitter"
			}, {
				value : 97,
				color : "#ED5952",
				label : "YouTube"
			}, {
				value : 60,
				color : "#8BC33E",
				label : "Spotify"
			}];

			// Chart.js Options
			var options = {
				responsive : false,
				scaleShowLabelBackdrop : true,
				scaleBackdropColor : 'rgba(255,255,255,0.75)',
				scaleBeginAtZero : true,
				scaleBackdropPaddingY : 2,
				scaleBackdropPaddingX : 2,
				scaleShowLine : true,
				segmentShowStroke : true,
				segmentStrokeColor : '#fff',
				segmentStrokeWidth : 2,
				animationSteps : 100,
				animationEasing : 'easeOutBounce',
				animateRotate : true,
				animateScale : false
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#social4Chart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart6 = new Chart(ctx).PolarArea(data, options);
		}
	};
	var chart10Handler = function() {
		if ($("#salesChart").length) {
			// Chart.js Data
			var data = {
				labels : ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
				datasets : [{
					label : 'First',
					fillColor : 'rgba(148,116,153,0.7)',
					highlightFill : 'rgba(148,116,153,1)',
					data : [65, 59, 80, 81, 56, 55, 40]
				}, {
					label : 'Second',
					fillColor : 'rgba(127,140,141,0.7)',
					highlightFill : 'rgba(127,140,141,1)',
					data : [28, 48, 40, 19, 86, 27, 90]
				}]
			};

			// Chart.js Options
			var options = {
				maintainAspectRatio : false,
				responsive : true,
				scaleFontFamily : "'Helvetica', 'Arial', sans-serif",
				scaleFontSize : 11,
				scaleFontColor : "#aaa",
				scaleBeginAtZero : true,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontFamily : "'Helvetica', 'Arial', sans-serif",
				tooltipTitleFontSize : 12,
				scaleShowGridLines : true,
				scaleLineColor : "transparent",
				scaleShowVerticalLines : false,
				scaleGridLineColor : "rgba(0,0,0,.05)",
				scaleGridLineWidth : 1,
				barShowStroke : false,
				barStrokeWidth : 2,
				barValueSpacing : 5,
				barDatasetSpacing : 1
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#salesChart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart8 = new Chart(ctx).Bar(data, options);
		}
	};
	var chart11Handler = function() {
		if ($("#bar2Chart").length) {
			// Chart.js Data
			var data = {
				labels : ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'a', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'i', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],
				datasets : [{
					label : 'dataset',
					fillColor : 'rgba(154,137,181,0.6)',
					highlightFill : 'rgba(154,137,181,0.9)',
					data : [65, 59, 80, 81, 56, 55, 40, 65, 59, 80, 81, 56, 55, 40, 65, 59, 80, 81, 56, 55, 40, 65, 59, 80, 81, 56, 80, 81]
				}]
			};

			// Chart.js Options
			var options = {
				maintainAspectRatio : false,
				showScale : false,
				barDatasetSpacing : 0,
				tooltipFontSize : 11,
				tooltipFontFamily : "'Helvetica', 'Arial', sans-serif",
				responsive : true,
				scaleBeginAtZero : true,
				scaleShowGridLines : false,
				scaleLineColor : 'transparent',
				barShowStroke : false,
				barValueSpacing : 5
			};
			// Get context with jQuery - using jQuery's .get() method.
			var ctx = $("#bar2Chart").get(0).getContext("2d");
			// This will get the first returned node in the jQuery collection.
			var chart9 = new Chart(ctx).Bar(data, options);
		}
	};
	var randomUserHandler = function() {
		var randomUsers = 0;
		var interval = 1500;
		$('.random-user').text(randomUsers);
		var realtime = function() {

			var random = setInterval(function() {
				randomUsers = Math.floor((Math.random() * 6) + 100);
				interval = Math.floor((Math.random() * 5000) + 1000);
				$('.random-user').text(randomUsers);
				clearInterval(random);
				realtime();
			}, interval);
		};
		realtime();
	};

	var knob1Handler = function() {
		$(".dial").knob({
			'min' : 0,
			'max' : 100,
			'readOnly' : true,
			'width' : 70,
			'height' : 70,
			'thickness' : .25,
			'fgColor' : "#8773A8",
			'bgColor' : "#C3B8D3",
			'inputColor' : 'transparent',
			'format' : function(value) {
				return value + '%';
			}
		});
		$(".dial-sales").knob({
			'min' : 0,
			'max' : 100,
			'readOnly' : true,
			'width' : 135,
			'height' : 135,
			'thickness' : .16,
			'fgColor' : "#98E1E6",
			'bgColor' : "#EBF5FC",
			'inputColor' : 'transparent',
			'format' : function(value) {
				return value + '%';
			}
		});
	};
	$(".budegt-slider").slider({
		formatter : function(value) {
			return value + ' $';
		}
	});
	return {
		init : function() {
			chart1Handler();
			chart2Handler();
			chart3Handler();
			chart4Handler();
			chart5Handler();
			chart6Handler();
			chart7Handler();
			chart8Handler();
			chart9Handler();
			chart10Handler();
			chart11Handler();
			randomUserHandler();
			knob1Handler();
		}
	};
}();

'use strict';
var Main = function() {
	var $html = $('html'), $win = $(window), wrap = $('.app-aside'), MEDIAQUERY = {}, app = $('#app');
	var clipSetting = {}, appSetting = {};
	MEDIAQUERY = {
		desktopXL : 1200,
		desktop : 992,
		tablet : 768,
		mobile : 480
	};
	$(".current-year").text((new Date()).getFullYear());
	//sidebar
    var sidebarHandler = function (sidebarClosed) {

		var eventObject = isTouch() ? 'click' : 'mouseenter', elem = $('#sidebar'), ul = "", menuTitle, _this, sidebarToggler = $('.sidebar-toggler'), sidebarMobileToggler = $('.sidebar-mobile-toggler'), $winOffsetTop = 0, $winScrollTop = 0, $appWidth, space = 0;

		if (sidebarClosed) {
		    $(".sidebar-toggler").click();
		    //app.toggleClass('app-sidebar-closed');
		}

		elem.on('click', 'ul.main-navigation-menu > li > a', function (e) {

		    _this = $(this);		    

			if (sidebarClosed && isSidebarClosed() && !isSmallDevice() && !_this.closest("ul").hasClass("sub-menu"))
				return;

		    //_this.closest("ul").find(".open").not(".active").children("ul").not(_this.next()).slideUp(200).parent('.open').removeClass("open");

			if ($(document).outerWidth() <= 991) {
			    if (_this.next().is('ul') /*&& _this.parent().toggleClass('open')*/) {
			    	_this.next().slideToggle(200, function() {
			    		$win.trigger("resize");
			    	});

			    	e.stopPropagation();
			    	e.preventDefault();
			    } else {
			    	_this.parent().addClass("active");
			    }
			}

			//if (_this.next().is('ul') && _this.parent().toggleClass('open')) {

			//	_this.next().slideToggle(200, function() {
			//		$win.trigger("resize");

			//	});
			//	e.stopPropagation();
			//	e.preventDefault();
			//} else {
			//	//_this.parent().addClass("active");

			//}
		});
		elem.on(eventObject, 'a', function(e) {
			if (!isSidebarClosed() || isSmallDevice())
				return;
			_this = $(this);

			if (!_this.parent().hasClass('hover') && !_this.closest("ul").hasClass("sub-menu")) {
				wrapLeave();
				_this.parent().addClass('hover');
				menuTitle = _this.find(".item-inner").clone();
				if (_this.parent().hasClass('active')) {
					menuTitle.addClass("active");
				}

				if ($('#app').hasClass('lyt-3')) {
					space = $('#sidebar > .sidebar-container').position().top - $('header').outerHeight() + _this.position().top;
				}
				var offset = $('#sidebar > .sidebar-container > div').position().top + $('.nav-user-wrapper').outerHeight() + $('header').outerHeight();
				var itemTop = isSidebarFixed() && !isBoxedPage() ? _this.parent().position().top + offset + space : (_this.parent().offset().top - $('header').outerHeight());
				menuTitle.css({
					position : isSidebarFixed() && !isBoxedPage() ? 'fixed' : 'absolute',
					height : _this.parent().outerHeight(),
					top : itemTop,
					borderBottomRightRadius : '10px',
					lineHeight : _this.parent().outerHeight() + 'px',
					padding : 0
				}).appendTo(wrap);
				if (_this.next().is('ul')) {
					ul = _this.next().clone(true);
					menuTitle.css({
						borderBottomRightRadius : 0
					});
					ul.appendTo(wrap).css({
						top : itemTop + _this.parent().outerHeight(),
						position : isSidebarFixed() && !isBoxedPage() ? 'fixed' : 'absolute',
					});
					if (_this.parent().position().top + _this.outerHeight() + offset + ul.height() > $win.height() && isSidebarFixed() && !isBoxedPage()) {
						ul.css('bottom', 0);
					} else {
						ul.css('bottom', 'auto');
					}

					wrap.find('.sidebar-container').scroll(function() {
						if (isSidebarFixed() && !isBoxedPage())
							wrapLeave();
					});

					setTimeout(function() {

						if (!wrap.is(':empty')) {
							$(document).on('click tap', wrapLeave);
						}
					}, 300);

				} else {
					ul = "";
					return;
				}

			}
		});
		wrap.on('mouseleave', function(e) {
			$(document).off('click tap', wrapLeave);
			$('.hover', wrap).removeClass('hover');
			$('> .item-inner', wrap).remove();
			$('> ul', wrap).remove();
		});

		sidebarMobileToggler.on('click', function() {
			$winScrollTop = $winOffsetTop;
			if (!$('#app').hasClass('app-slide-off') && !$('#app').hasClass('app-offsidebar-open')) {
				$winOffsetTop = $win.scrollTop();
				$winScrollTop = 0;
				$('footer').hide();
				$appWidth = $('#app .main-content').innerWidth();
				$('#app .main-content').css({
					position : 'absolute',
					top : -$winOffsetTop,
					width : $appWidth
				});
			} else {
				resetSidebar();
			}

		});

		sidebarToggler.on('click', function() {
			$('.main-content').on('webkitTransitionEnd mozTransitionEnd oTransitionEnd otransitionend transitionend', function() {
				var evt = window.document.createEvent('UIEvents');
				evt.initUIEvent('resize', true, false, window, 0);
				window.dispatchEvent(evt);

				$('.main-content').off('webkitTransitionEnd mozTransitionEnd oTransitionEnd otransitionend transitionend');
			});

		});

		$(document).on("mousedown touchstart", function(e) {
			if (elem.has(e.target).length === 0 && !elem.is(e.target) && sidebarMobileToggler.has(e.target).length === 0 && !sidebarMobileToggler.is(e.target) && ($('#app').hasClass('app-slide-off') || $('#app').hasClass('app-offsidebar-open'))) {
				resetSidebar();
			}
		});

		var resetSidebar = function() {
			$winScrollTop = $winOffsetTop;
			$("#app .app-content").one("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function() {

				if (!$('#app').hasClass('app-slide-off') && !$('#app').hasClass('app-offsidebar-open')) {
					$('#app .main-content').css({
						position : 'relative',
						top : 'auto',
						width : 'auto'
					});

					window.scrollTo(0, $winScrollTop);
					$('footer').show();
					$("#app .app-content").off("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd");
				}

			});
		};
	};
	$('.lettericon').letterIcon();

    /*
	$('.sidebar-toggler').on('click', function() {
		app.toggleClass('app-sidebar-closed');
		$('#closed-sidebar').siblings().remove();
		$('#closed-sidebar').prop('checked', app.hasClass('app-sidebar-closed'));
		//var switchery = new Switchery(document.getElementById('closed-sidebar'));
		appSetting.closedSidebar = app.hasClass('app-sidebar-closed');

		if (appSetting.closedSidebar) {
		    $(".main-navigation-menu").addClass("menu-collapsed");
            $("nav").addClass("menu-collapsed");

            $(".small-logo").show();
        } else {
            $(".small-logo").hide();
		    //$(".main-navigation-menu").removeClass("menu-collapsed");
		   //$("nav").removeClass("menu-collapsed");
		}
	});
    */

	// navbar collapse
	var navbarHandler = function() {
		var navbar = $('.navbar-collapse > .nav');
		var pageHeight = $win.innerHeight() - $('header').outerHeight();
		var collapseButton = $('#menu-toggler');
		if (isSmallDevice()) {
			navbar.css({
				height : pageHeight
			});
		} else {
			navbar.css({
				height : 'auto'
			});
		}
		$(document).on("mousedown touchstart", toggleNavbar);
		function toggleNavbar(e) {
			if (navbar.has(e.target).length === 0 && !navbar.is(e.target) && collapseButton.has(e.target).length === 0 && !collapseButton.is(e.target) && navbar.parent().hasClass("collapse in")) {
				collapseButton.trigger("click");
			}
		}

	};
	// tooltips handler
	var tooltipHandler = function() {
        $('[data-toggle="tooltip"]').tooltip();
	};
	// popovers handler
	var popoverHandler = function() {
		$('[data-toggle="popover"]').popover();
	};
	// perfect scrollbar
	var perfectScrollbarHandler = function() {
		var pScroll = $(".perfect-scrollbar");

		if (!isMobile() && pScroll.length) {
			pScroll.perfectScrollbar({
				suppressScrollX : true
			});
			pScroll.on("mousemove", function() {
				$(this).perfectScrollbar('update');
			});

		}
	};
	//toggle class
	var toggleClassOnElement = function() {
		var toggleAttribute = $('*[data-toggle-class]');
		toggleAttribute.each(function() {
			var _this = $(this);
			var toggleClass = _this.attr('data-toggle-class');
			var outsideElement;
			var toggleElement;
			typeof _this.attr('data-toggle-target') !== 'undefined' ? toggleElement = $(_this.attr('data-toggle-target')) : toggleElement = _this;
			_this.on("click", function(e) {
				if (_this.attr('data-toggle-type') !== 'undefined' && _this.attr('data-toggle-type') == "on") {
					toggleElement.addClass(toggleClass);
				} else if (_this.attr('data-toggle-type') !== 'undefined' && _this.attr('data-toggle-type') == "off") {
					toggleElement.removeClass(toggleClass);
				} else {
					toggleElement.toggleClass(toggleClass);
				}
				e.preventDefault();
				if (_this.attr('data-toggle-click-outside')) {

					outsideElement = $(_this.attr('data-toggle-click-outside'));
					$(document).on("mousedown touchstart", toggleOutside);

				}

			});

			var toggleOutside = function(e) {
				if (outsideElement.has(e.target).length === 0 && !outsideElement.is(e.target) && !toggleAttribute.is(e.target) && toggleElement.hasClass(toggleClass)) {
					toggleElement.removeClass(toggleClass);
					$(document).off("mousedown touchstart", toggleOutside);
				}
			};

		});
	};
	//switchery
	var switcheryHandler = function() {
		var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));

		elems.forEach(function(html) {
			var switchery = new Switchery(html);
		});
	};
	//search form
	var searchHandler = function() {
		var elem = $('.search-form');
		var searchForm = elem.children('form');
		var formWrap = elem.parent();

		$(".s-open").on('click', function(e) {
			searchForm.prependTo(wrap);
			e.preventDefault();
			$(document).on("mousedown touchstart", closeForm);
		});
		$(".s-remove").on('click', function(e) {
			searchForm.appendTo(elem);
			e.preventDefault();
		});
		var closeForm = function(e) {
			if (!searchForm.is(e.target) && searchForm.has(e.target).length === 0) {
				$(".s-remove").trigger('click');
				$(document).off("mousedown touchstart", closeForm);
			}
		};
	};
	// settings
	var settingsHandler = function() {

		clipSetting = {
			fixedHeader : true,
			fixedSidebar : true,
			closedSidebar : false,
			fixedFooter : false,
			theme : 'lyt1-theme-1'
		};

		if (Cookies.get('clip-setting')) {
			appSetting = $.parseJSON(Cookies.get('clip-setting'));
		} else {
			appSetting = clipSetting;
		}

		appSetting.fixedHeader ? app.addClass('app-navbar-fixed') : app.removeClass('app-navbar-fixed');
		//appSetting.fixedSidebar ? app.addClass('app-sidebar-fixed') : app.removeClass('app-sidebar-fixed');
		//appSetting.closedSidebar ? app.addClass('app-sidebar-closed') : app.removeClass('app-sidebar-closed');
		appSetting.fixedFooter ? app.addClass('app-footer-fixed') : app.removeClass('app-footer-fixed');
		app.hasClass("app-navbar-fixed") ? $('#fixed-header').prop('checked', true) : $('#fixed-header').prop('checked', false);
		//app.hasClass("app-sidebar-fixed") ? $('#fixed-sidebar').prop('checked', true) : $('#fixed-sidebar').prop('checked', false);
		//app.hasClass("app-sidebar-closed") ? $('#closed-sidebar').prop('checked', true) : $('#closed-sidebar').prop('checked', false);
		app.hasClass("app-footer-fixed") ? $('#fixed-footer').prop('checked', true) : $('#fixed-footer').prop('checked', false);
		$('#skin_color').attr("href", "assets/css/themes/" + appSetting.theme + ".css");
		$('input[name="setting-theme"]').each(function() {
			$(this).val() == appSetting.theme ? $(this).prop('checked', true) : $(this).prop('checked', false);
		});
		//switchLogo(appSetting.theme);

		$('input[name="setting-theme"]').change(function() {
			var selectedTheme = $(this).val();
			$('#skin_color').attr("href", "assets/css/themes/" + selectedTheme + ".css");
			appSetting.theme = selectedTheme;

		});

		$('#fixed-header').change(function() {
			$(this).is(":checked") ? app.addClass("app-navbar-fixed") : app.removeClass("app-navbar-fixed");
			appSetting.fixedHeader = $(this).is(":checked");
		});
		$('#fixed-sidebar').change(function() {
			$(this).is(":checked") ? app.addClass("app-sidebar-fixed") : app.removeClass("app-sidebar-fixed");
			appSetting.fixedSidebar = $(this).is(":checked");
		});
		$('#closed-sidebar').change(function() {
			$(this).is(":checked") ? app.addClass("app-sidebar-closed") : app.removeClass("app-sidebar-closed");
			appSetting.closedSidebar = $(this).is(":checked");
		});
		$('#fixed-footer').change(function() {
			$(this).is(":checked") ? app.addClass("app-footer-fixed") : app.removeClass("app-footer-fixed");
			appSetting.fixedFooter = $(this).is(":checked");

		});
		function switchLogo(theme) {
			switch (theme) {
			case "theme-2":
			case "theme-3":
			case "theme-5":
			case "theme-6":
				$(".navbar-brand img").attr("src", "assets/images/logo2.png");
				break;

			default:
				$(".navbar-brand img").attr("src", "assets/images/logo.png");
				break;
			}
		}

		function defaultSetting() {

		}

	};
	// function to allow a button or a link to open a tab
	var showTabHandler = function(e) {
		if ($(".show-tab").length) {
			$('.show-tab').on('click', function(e) {
				e.preventDefault();
				var tabToShow = $(this).attr("href");
				if ($(tabToShow).length) {
					$('a[href="' + tabToShow + '"]').tab('show');
				}
			});
		}
	};
	var saveLayout = $('#save-layout').ladda();

	$('#save-layout').on('click', function() {
		saveLayout.ladda('start');
		Cookies.set("clip-setting", JSON.stringify(appSetting));
		setTimeout(function() {
			saveLayout.ladda('stop');
		}, 1500);
	});

	var resetLayout = $('#reset-layout').ladda();

	$('#reset-layout').on('click', function() {
		resetLayout.ladda('start');
		Cookies.remove('clip-setting');
		$('input.js-switch').siblings().remove();
		$('#fixed-header').prop('checked', true);
		$('#fixed-sidebar').prop('checked', true);
		$('#closed-sidebar').prop('checked', false);
		$('#fixed-footer').prop('checked', false);
		$('#skin_color').attr("href", "assets/css/themes/lyt1-theme-1.css");
		switcheryHandler();
		settingsHandler();
		setTimeout(function() {
			resetLayout.ladda('stop');
		}, 1500);
	});
	// function to enable panel scroll with perfectScrollbar
	var panelScrollHandler = function() {
		var panelScroll = $(".panel-scroll");
		if (panelScroll.length && !isMobile()) {
			panelScroll.perfectScrollbar({
				suppressScrollX : true
			});
		}
	};
	//function to activate the panel tools
	var panelToolsHandler = function() {

		// panel close
		$('body').on('click', '.panel-close', function(e) {
			var panel = $(this).closest('.panel');

			destroyPanel();

			function destroyPanel() {
				var col = panel.parent();
				panel.fadeOut(300, function() {
					$(this).remove();
					if (col.is('[class*="col-"]') && col.children('*').length === 0) {
						col.remove();
					}
				});
			}


			e.preventDefault();
		});
		// panel refresh
		$('body').on('click', '.panel-refresh', function(e) {
			var $this = $(this), csspinnerClass = 'csspinner', panel = $this.parents('.panel').eq(0), spinner = $this.data('spinner') || "load1";
			panel.addClass(csspinnerClass + ' ' + spinner);

			window.setTimeout(function() {
				panel.removeClass(csspinnerClass);
			}, 1000);
			e.preventDefault();
		});
		// panel collapse
		$('body').on('click', '.panel-collapse', function(e) {
			e.preventDefault();
			var el = $(this);
			var panel = $(this).closest(".panel");
			var bodyPanel = panel.children(".panel-wrapper");
			if (!bodyPanel.length) {
				bodyPanel = panel.children(".panel-body");
			}
			bodyPanel.slideToggle(300, 'linear', function() {
				panel.toggleClass("collapses");
			});
		});
		// panel expand
		$('body').on('click', '.panel-expand', function(e) {
			e.preventDefault();
			var el = $(this);

			var panel = $(this).closest(".panel");

			panel.toggleClass("panel-fullscreen").toggleFullScreen();
			if (panel.hasClass("panel-fullscreen")) {
				el.attr("data-original-title", "Compress");
			} else {
				el.attr("data-original-title", "Expand");
			}
		});

	};

	$('body').on('click', '.toggle-fullscreen', function(e) {
		e.preventDefault();
		var el = $(this);
		$(document).toggleFullScreen();
		$("#app").toggleClass("isFullscreen");
	});

	// function to activate the Go-Top button
	var goTopHandler = function(e) {
		$('.go-top').on('click', function(e) {
			$("html, body").animate({
				scrollTop : 0
			}, "slow");
			e.preventDefault();
		});
	};
	var customSelectHandler = function() {
		[].slice.call(document.querySelectorAll('select.cs-select')).forEach(function(el) {
			new SelectFx(el);
		});
	};
	// Window Resize Function
	var resizeHandler = function(func, threshold, execAsap) {
		$(window).resize(function() {
			navbarHandler();
			if (isLargeDevice()) {
				$('#app .main-content').css({
					position : 'relative',
					top : 'auto',
					width : 'auto'
				});
                $('footer').show();
                if (window.location.pathname != "/") {
                    navbarHandler();
                }
                //alert(window.location.pathname);
            }           
		});
	};
	$('.carousel').slick();
	$('.counter').each(function() {
		var _this = $(this);
		_this.numerator({
			toValue : _this.data('count-to'),
			duration : _this.data('duration'),
			delimiter : _this.data('delimiter')
		});
	});

	function wrapLeave() {
		wrap.trigger('mouseleave');
	}

	function isTouch() {
		return $html.hasClass('touch');
	}

	function isSmallDevice() {
		return $win.width() < MEDIAQUERY.desktop;
	}

	function isLargeDevice() {
		return $win.width() >= MEDIAQUERY.desktop;
	}

	function isSidebarClosed() {
		return $('.app-sidebar-closed').length;
	}

	function isSidebarFixed() {
		return $('.app-sidebar-fixed').length;
	}

	function isBoxedPage() {
		return $('.boxed-page').length;
	}

	function isMobile() {
		if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
			return true;
		} else {
			return false;
		}
	}

	return {
		init : function(sidebarClosed) {
		    settingsHandler();
			sidebarHandler(sidebarClosed);
			toggleClassOnElement();
			navbarHandler();
			searchHandler();
			tooltipHandler();
			popoverHandler();
			perfectScrollbarHandler();
			switcheryHandler();
			resizeHandler();
			showTabHandler();
			panelScrollHandler();
			panelToolsHandler();
			customSelectHandler();
			goTopHandler();
		}
	};
}();

var FormPickers = function () {
	"use strict";

	var datePickerHandler = function() {
		$('.datepicker').datepicker({
			autoclose : true,
		});

        /*

        $('.format-datepicker').datepicker({
		    format: 'yyyy-mm-dd',
		    autoclose: true,
		    todayHighlight: true,
		    language: 'pl'
		}).on("show", function () {
            // sets min date if found related object
		    var minFound = $("[data-update-min-date='" + $(this).attr("name") + "']");
		    if (typeof minFound != "undefined" && typeof $(minFound).val() != "undefined") {
		        $(this).datepicker("setStartDate", $(minFound).val());
		    }
		    // sets max date if found related object
		    var maxFound = $("[data-update-max-date='" + $(this).attr("name") + "']");
		    if (typeof maxFound != "undefined" && typeof $(maxFound).val() != "undefined") {
		        $(this).datepicker("setEndDate", $(maxFound).val());
		    }
		});

        */
	};	

	var timePickerHandler = function() {
		$('#timepicker-default').timepicker();
	};
	var colorPickerHandler = function() {
        /*
		$("#flat").spectrum({
			flat : true,
			showInput : true
		});
		$("#flatPalette").spectrum({
			flat : true,
			showInput : true,
			showPaletteOnly : true,
			togglePaletteOnly : true,
			palette : [['#000', '#444', '#666', '#999', '#ccc', '#eee', '#f3f3f3', '#fff'], ['#f00', '#f90', '#ff0', '#0f0', '#0ff', '#00f', '#90f', '#f0f'], ['#f4cccc', '#fce5cd', '#fff2cc', '#d9ead3', '#d0e0e3', '#cfe2f3', '#d9d2e9', '#ead1dc'], ['#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#9fc5e8', '#b4a7d6', '#d5a6bd'], ['#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6fa8dc', '#8e7cc3', '#c27ba0'], ['#c00', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3d85c6', '#674ea7', '#a64d79'], ['#900', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#0b5394', '#351c75', '#741b47'], ['#600', '#783f04', '#7f6000', '#274e13', '#0c343d', '#073763', '#20124d', '#4c1130']]
		});
		$("#preferredHsl").spectrum({
			preferredFormat : "hsl",
			showInput : false
		});
		$("#preferredHsv").spectrum({
			preferredFormat : "hsv",
			showInput : false
		});
		$("#preferredRgb").spectrum({
			preferredFormat : "rgb",
			showInput : false
		});
		$("#preferredHex").spectrum({
			preferredFormat : "hex",
			showInput : false
		});
		$("#preferredHex8").spectrum({
			preferredFormat : "hex8",
			showInput : false
		});
		$("#preferredAlpha").spectrum({
			preferredFormat : "rgb",
			showInput : false,
			showAlpha : true
		});
		$("#showInput").spectrum({
			preferredFormat : "hex",
			showInput : true
		});
		$("#disabled").spectrum({
			disabled : true
		});
		$("#showPalette").spectrum({
			showPalette : true,
			preferredFormat : "hex",
			palette : [['black', 'white', 'blanchedalmond', 'rgb(255, 128, 0);', 'hsv 100 70 50'], ['red', 'yellow', 'green', 'blue', 'violet']]
		});
		$("#showPaletteOnly").spectrum({
			showPalette : true,
			showPaletteOnly : true,
			preferredFormat : "hex",
			hideAfterPaletteSelect : true,
			palette : [['#000', '#444', '#666', '#999', '#ccc', '#eee', '#f3f3f3', '#fff'], ['#f00', '#f90', '#ff0', '#0f0', '#0ff', '#00f', '#90f', '#f0f'], ['#f4cccc', '#fce5cd', '#fff2cc', '#d9ead3', '#d0e0e3', '#cfe2f3', '#d9d2e9', '#ead1dc'], ['#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#9fc5e8', '#b4a7d6', '#d5a6bd'], ['#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6fa8dc', '#8e7cc3', '#c27ba0'], ['#c00', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3d85c6', '#674ea7', '#a64d79'], ['#900', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#0b5394', '#351c75', '#741b47'], ['#600', '#783f04', '#7f6000', '#274e13', '#0c343d', '#073763', '#20124d', '#4c1130']]
		});
		$("#togglePalette").spectrum({
			showPaletteOnly: true, 
			togglePaletteOnly: true, 
			togglePaletteLessText: 'less', 
			palette: [['#000','#444','#666','#999','#ccc','#eee','#f3f3f3','#fff'], ['#f00','#f90','#ff0','#0f0','#0ff','#00f','#90f','#f0f'], ['#f4cccc','#fce5cd','#fff2cc','#d9ead3','#d0e0e3','#cfe2f3','#d9d2e9','#ead1dc'], ['#ea9999','#f9cb9c','#ffe599','#b6d7a8','#a2c4c9','#9fc5e8','#b4a7d6','#d5a6bd'], ['#e06666','#f6b26b','#ffd966','#93c47d','#76a5af','#6fa8dc','#8e7cc3','#c27ba0'], ['#c00','#e69138','#f1c232','#6aa84f','#45818e','#3d85c6','#674ea7','#a64d79'], ['#900','#b45f06','#bf9000','#38761d','#134f5c','#0b5394','#351c75','#741b47'], ['#600','#783f04','#7f6000','#274e13','#0c343d','#073763','#20124d','#4c1130']]
		});
		$("#showSelectionPalette").spectrum({
			showPalette: true, 
			showSelectionPalette: true, 
			palette: [ ]
		});
		$("#showInitial").spectrum({
			showInitial: true
		});
		$("#showInputInitial").spectrum({
			showInitial: true, 
			showInput: true
		});
		$("#buttonText").spectrum({
			allowEmpty:true, 
			chooseText: 'Alright', 
			cancelText: 'No way'
		});
        */
	};
	return {
		//main function to initiate template pages
		init : function() {
			datePickerHandler();
			timePickerHandler();
			colorPickerHandler();
		}
	};
}();

/*!
 * classie - class helper functions
 * from bonzo https://github.com/ded/bonzo
 * 
 * classie.has( elem, 'my-class' ) -> true/false
 * classie.add( elem, 'my-new-class' )
 * classie.remove( elem, 'my-unwanted-class' )
 * classie.toggle( elem, 'my-class' )
 */

/*jshint browser: true, strict: true, undef: true */
/*global define: false */

( function( window ) {

'use strict';

// class helper functions from bonzo https://github.com/ded/bonzo

function classReg( className ) {
  return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}

// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;

if ( 'classList' in document.documentElement ) {
  hasClass = function( elem, c ) {
    return elem.classList.contains( c );
  };
  addClass = function( elem, c ) {
    elem.classList.add( c );
  };
  removeClass = function( elem, c ) {
    elem.classList.remove( c );
  };
}
else {
  hasClass = function( elem, c ) {
    return classReg( c ).test( elem.className );
  };
  addClass = function( elem, c ) {
    if ( !hasClass( elem, c ) ) {
      elem.className = elem.className + ' ' + c;
    }
  };
  removeClass = function( elem, c ) {
    elem.className = elem.className.replace( classReg( c ), ' ' );
  };
}

function toggleClass( elem, c ) {
  var fn = hasClass( elem, c ) ? removeClass : addClass;
  fn( elem, c );
}

var classie = {
  // full names
  hasClass: hasClass,
  addClass: addClass,
  removeClass: removeClass,
  toggleClass: toggleClass,
  // short names
  has: hasClass,
  add: addClass,
  remove: removeClass,
  toggle: toggleClass
};

// transport
if ( typeof define === 'function' && define.amd ) {
  // AMD
  define( classie );
} else {
  // browser global
  window.classie = classie;
}

})( window );

/**
 * selectFx.js v1.0.0
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Copyright 2014, Codrops
 * http://www.codrops.com
 */
;( function( window ) {
	
	'use strict';

	/**
	 * based on from https://github.com/inuyaksa/jquery.nicescroll/blob/master/jquery.nicescroll.js
	 */
	function hasParent( e, p ) {
		if (!e) return false;
		var el = e.target||e.srcElement||e||false;
		while (el && el != p) {
			el = el.parentNode||false;
		}
		return (el!==false);
	};
	
	/**
	 * extend obj function
	 */
	function extend( a, b ) {
		for( var key in b ) { 
			if( b.hasOwnProperty( key ) ) {
				a[key] = b[key];
			}
		}
		return a;
	}

	/**
	 * SelectFx function
	 */
	function SelectFx( el, options ) {	
		this.el = el;
		this.options = extend( {}, this.options );
		extend( this.options, options );
		this._init();
	}

	/**
	 * SelectFx options
	 */
	SelectFx.prototype.options = {
		// if true all the links will open in a new tab.
		// if we want to be redirected when we click an option, we need to define a data-link attr on the option of the native select element
		newTab : true,
		// when opening the select element, the default placeholder (if any) is shown
		stickyPlaceholder : true,
		// callback when changing the value
		onChange : function( val ) { return false; }
	}

	/**
	 * init function
	 * initialize and cache some vars
	 */
	SelectFx.prototype._init = function() {
		var selectDisabled = false;
        if (this.el.hasAttribute("disabled")) {
            this.el.className = this.el.className + " disabled";
            selectDisabled = true;
        };
		// check if we are using a placeholder for the native select box
		// we assume the placeholder is disabled and selected by default
		var selectedOpt = this.el.querySelector( 'option[selected]' );
		this.hasDefaultPlaceholder = selectedOpt && selectedOpt.disabled;

		// get selected option (either the first option with attr selected or just the first option)
		this.selectedOpt = selectedOpt || this.el.querySelector( 'option' );

		// create structure
		this._createSelectEl();

		// all options
		this.selOpts = [].slice.call( this.selEl.querySelectorAll( 'li[data-option]' ) );
		
		// total options
		this.selOptsCount = this.selOpts.length;
		
		// current index
		this.current = this.selOpts.indexOf( this.selEl.querySelector( 'li.cs-selected' ) ) || -1;
		
		// placeholder elem
		this.selPlaceholder = this.selEl.querySelector( 'span.cs-placeholder' );

		if (!selectDisabled) {
            // init events
            this._initEvents();
        }
	}

	/**
	 * creates the structure for the select element
	 */
	SelectFx.prototype._createSelectEl = function() {
		var self = this, options = '', createOptionHTML = function(el) {
			var optclass = '', classes = '', link = '';

			if( el.selectedOpt && !this.foundSelected && !this.hasDefaultPlaceholder ) {
				classes += 'cs-selected ';
				this.foundSelected = true;
			}
			// extra classes
			if( el.getAttribute( 'data-class' ) ) {
				classes += el.getAttribute( 'data-class' );
			}
			// link options
			if( el.getAttribute( 'data-link' ) ) {
				link = 'data-link=' + el.getAttribute( 'data-link' );
			}

			if( classes !== '' ) {
				optclass = 'class="' + classes + '" ';
			}

			return '<li ' + optclass + link + ' data-option data-value="' + el.value + '"><span>' + el.textContent + '</span></li>';
		};

		[].slice.call( this.el.children ).forEach( function(el) {
			if( el.disabled ) { return; }

			var tag = el.tagName.toLowerCase();

			if( tag === 'option' ) {
				options += createOptionHTML(el);
			}
			else if( tag === 'optgroup' ) {
				options += '<li class="cs-optgroup"><span>' + el.label + '</span><ul>';
				[].slice.call( el.children ).forEach( function(opt) {
					options += createOptionHTML(opt);
				} )
				options += '</ul></li>';
			}
		} );

		var opts_el = '<div class="cs-options"><ul>' + options + '</ul></div>';
		this.selEl = document.createElement( 'div' );
		this.selEl.className = this.el.className;
		this.selEl.tabIndex = this.el.tabIndex;
		this.selEl.innerHTML = '<span class="cs-placeholder">' + this.selectedOpt.textContent + '</span>' + opts_el;
		this.el.parentNode.appendChild( this.selEl );
		this.selEl.appendChild( this.el );
	}

	/**
	 * initialize the events
	 */
	SelectFx.prototype._initEvents = function() {
		var self = this;

		// open/close select
		this.selPlaceholder.addEventListener( 'click', function() {
			self._toggleSelect();
		} );

		// clicking the options
		this.selOpts.forEach( function(opt, idx) {
			opt.addEventListener( 'click', function() {
				self.current = idx;
				self._changeOption();
				// close select elem
				self._toggleSelect();
			} );
		} );

		// close the select element if the target itÂ´s not the select element or one of its descendants..
		document.addEventListener( 'click', function(ev) {
			var target = ev.target;
			if( self._isOpen() && target !== self.selEl && !hasParent( target, self.selEl ) ) {
				self._toggleSelect();
			}
		} );

		// keyboard navigation events
		this.selEl.addEventListener( 'keydown', function( ev ) {
			var keyCode = ev.keyCode || ev.which;

			switch (keyCode) {
				// up key
				case 38:
					ev.preventDefault();
					self._navigateOpts('prev');
					break;
				// down key
				case 40:
					ev.preventDefault();
					self._navigateOpts('next');
					break;
				// space key
				case 32:
					ev.preventDefault();
					if( self._isOpen() && typeof self.preSelCurrent != 'undefined' && self.preSelCurrent !== -1 ) {
						self._changeOption();
					}
					self._toggleSelect();
					break;
				// enter key
				case 13:
					ev.preventDefault();
					if( self._isOpen() && typeof self.preSelCurrent != 'undefined' && self.preSelCurrent !== -1 ) {
						self._changeOption();
						self._toggleSelect();
					}
					break;
				// esc key
				case 27:
					ev.preventDefault();
					if( self._isOpen() ) {
						self._toggleSelect();
					}
					break;
			}
		} );
	}

	/**
	 * navigate with up/dpwn keys
	 */
	SelectFx.prototype._navigateOpts = function(dir) {
		if( !this._isOpen() ) {
			this._toggleSelect();
		}

		var tmpcurrent = typeof this.preSelCurrent != 'undefined' && this.preSelCurrent !== -1 ? this.preSelCurrent : this.current;
		
		if( dir === 'prev' && tmpcurrent > 0 || dir === 'next' && tmpcurrent < this.selOptsCount - 1 ) {
			// save pre selected current - if we click on option, or press enter, or press space this is going to be the index of the current option
			this.preSelCurrent = dir === 'next' ? tmpcurrent + 1 : tmpcurrent - 1;
			// remove focus class if any..
			this._removeFocus();
			// add class focus - track which option we are navigating
			classie.add( this.selOpts[this.preSelCurrent], 'cs-focus' );
		}
	}

	/**
	 * open/close select
	 * when opened show the default placeholder if any
	 */
	SelectFx.prototype._toggleSelect = function() {
		// remove focus class if any..
		this._removeFocus();
		
		if( this._isOpen() ) {
			if( this.current !== -1 ) {
				// update placeholder text
				this.selPlaceholder.textContent = this.selOpts[ this.current ].textContent;
			}
			classie.remove( this.selEl, 'cs-active' );
		}
		else {
			if( this.hasDefaultPlaceholder && this.options.stickyPlaceholder ) {
				// everytime we open we wanna see the default placeholder text
				this.selPlaceholder.textContent = this.selectedOpt.textContent;
			}
			classie.add( this.selEl, 'cs-active' );
		}
	}

	/**
	 * change option - the new value is set
	 */
	SelectFx.prototype._changeOption = function() {
		// if pre selected current (if we navigate with the keyboard)...
		if( typeof this.preSelCurrent != 'undefined' && this.preSelCurrent !== -1 ) {
			this.current = this.preSelCurrent;
			this.preSelCurrent = -1;
		}

		// current option
		var opt = this.selOpts[ this.current ];

		// update current selected value
		this.selPlaceholder.textContent = opt.textContent;
		
		// change native select elementÂ´s value
		this.el.value = opt.getAttribute( 'data-value' );

		// remove class cs-selected from old selected option and add it to current selected option
		var oldOpt = this.selEl.querySelector( 'li.cs-selected' );
		if( oldOpt ) {
			classie.remove( oldOpt, 'cs-selected' );
		}
		classie.add( opt, 'cs-selected' );

		// if thereÂ´s a link defined
		if( opt.getAttribute( 'data-link' ) ) {
			// open in new tab?
			if( this.options.newTab ) {
				window.open( opt.getAttribute( 'data-link' ), '_blank' );
			}
			else {
				window.location = opt.getAttribute( 'data-link' );
			}
		}

		// callback
		this.options.onChange( this.el.value );
	}

	/**
	 * returns true if select element is opened
	 */
	SelectFx.prototype._isOpen = function(opt) {
		return classie.has( this.selEl, 'cs-active' );
	}

	/**
	 * removes the focus class from the option
	 */
	SelectFx.prototype._removeFocus = function(opt) {
		var focusEl = this.selEl.querySelector( 'li.cs-focus' )
		if( focusEl ) {
			classie.remove( focusEl, 'cs-focus' );
		}
	}

	/**
	 * add to global namespace
	 */
	window.SelectFx = SelectFx;

} )( window );
var FormElements = function() {"use strict";

	//function to initiate jquery.maskedinput
	var maskInputHandler = function() {
		$.mask.definitions['~'] = '[+-]';
		$('.input-mask-date').mask('99/99/9999');
		$('.input-mask-phone').mask('(999) 999-9999');
		$('.input-mask-eyescript').mask('~9.99 ~9.99 999');
		$(".input-mask-product").mask("a*-999-a999", {
			placeholder: " ",
			completed: function() {
				alert("You typed the following: " + this.val());
			}
		});
	};
	//function to initiate bootstrap-touchspin
	var touchSpinHandler = function() {
		$("input[name='demo1']").TouchSpin({
			min: 0,
			max: 100,
			step: 0.1,
			decimals: 2,
			boostat: 5,
			maxboostedstep: 10,
			postfix: '%'
		});
		$("input[name='demo2']").TouchSpin({
			min: -1000000000,
			max: 1000000000,
			stepinterval: 50,
			maxboostedstep: 10000000,
			prefix: '$'
		});
		$("input[name='demo3']").TouchSpin({
			verticalbuttons: true
		});
		$("input[name='demo4']").TouchSpin({
			verticalbuttons: true,
			verticalupclass: 'fa fa-plus',
			verticaldownclass: 'fa fa-minus'
		});
		$("input[name='demo5']").TouchSpin({
			postfix: "a button",
			postfix_extraclass: "btn btn-default"
		});
		$("input[name='demo6']").TouchSpin({
			postfix: "a button",
			postfix_extraclass: "btn btn-default"
		});
		$("input[name='demo7']").TouchSpin({
			prefix: "pre",
			postfix: "post"
		});
	};
	
	var autosizeHandler = function() {
		$('.autosize.area-animated').append("\n");
		autosize($('.autosize'));
	};
	var select2Handler = function() {
		$(".js-example-basic-single").select2();
		$(".js-example-basic-multiple").select2();
		$(".js-example-placeholder-single").select2({
			placeholder: "Select a state"
		});
		var data = [{
			id: 0,
			text: 'enhancement'
		}, {
			id: 1,
			text: 'bug'
		}, {
			id: 2,
			text: 'duplicate'
		}, {
			id: 3,
			text: 'invalid'
		}, {
			id: 4,
			text: 'wontfix'
		}];
		$(".js-example-data-array-selected").select2({
			data: data
		});
		$(".js-example-basic-hide-search").select2({
			minimumResultsForSearch: Infinity
		});
	};
	var datePickerHandler = function() {
		$('.datepicker').datepicker({
			autoclose: true,
			todayHighlight: true
		});
		$('.format-datepicker').datepicker({
			format: "M, d yyyy"
		});
		
	};
	var timePickerHandler = function() {
		$('#timepicker-default').timepicker();		
	};
	return {
		//main function to initiate template pages
		init: function() {
			maskInputHandler();
			touchSpinHandler();
			autosizeHandler();
			select2Handler();
			datePickerHandler();
			timePickerHandler();
		}
	};
}();

