/*
	Hielo by TEMPLATED
	templated.co @templatedco
	Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
*/

var settings = {

	banner: {

		// Indicators (= the clickable dots at the bottom).
			indicators: true,

		// Transition speed (in ms)
		// For timing purposes only. It *must* match the transition speed of "#banner > article".
			speed: 1500,

		// Transition delay (in ms)
			delay: 8000,

		// Parallax intensity (between 0 and 1; higher = more intense, lower = less intense; 0 = off)
			parallax: 0.25

	}

};

(function($) {

	skel.breakpoints({
		xlarge:	'(max-width: 1680px)',
		large:	'(max-width: 1280px)',
		medium:	'(max-width: 980px)',
		small:	'(max-width: 736px)',
		xsmall:	'(max-width: 480px)'
	});

	/**
	 * Applies parallax scrolling to an element's background image.
	 * @return {jQuery} jQuery object.
	 */
	$.fn._parallax = (skel.vars.browser == 'ie' || skel.vars.mobile) ? function() { return $(this) } : function(intensity) {

		var	$window = $(window),
			$this = $(this);

		if (this.length == 0 || intensity === 0)
			return $this;

		if (this.length > 1) {

			for (var i=0; i < this.length; i++)
				$(this[i])._parallax(intensity);

			return $this;

		}

		if (!intensity)
			intensity = 0.25;

		$this.each(function() {

			var $t = $(this),
				on, off;

			on = function() {

				$t.css('background-position', 'center 100%, center 100%, center 0px');

				$window
					.on('scroll._parallax', function() {

						var pos = parseInt($window.scrollTop()) - parseInt($t.position().top);

						$t.css('background-position', 'center ' + (pos * (-1 * intensity)) + 'px');

					});

			};

			off = function() {

				$t
					.css('background-position', '');

				$window
					.off('scroll._parallax');

			};

			skel.on('change', function() {

				if (skel.breakpoint('medium').active)
					(off)();
				else
					(on)();

			});

		});

		$window
			.off('load._parallax resize._parallax')
			.on('load._parallax resize._parallax', function() {
				$window.trigger('scroll');
			});

		return $(this);

	};

	/**
	 * Custom banner slider for Slate.
	 * @return {jQuery} jQuery object.
	 */
	$.fn._slider = function(options) {

		var	$window = $(window),
			$this = $(this);

		if (this.length == 0)
			return $this;

		if (this.length > 1) {

			for (var i=0; i < this.length; i++)
				$(this[i])._slider(options);

			return $this;

		}

		// Vars.
			var	current = 0, pos = 0, lastPos = 0,
				slides = [], indicators = [],
				$indicators,
				$slides = $this.children('article'),
				intervalId,
				isLocked = false,
				i = 0;

		// Turn off indicators if we only have one slide.
			if ($slides.length == 1)
				options.indicators = false;

		// Functions.
			$this._switchTo = function(x, stop) {

				if (isLocked || pos == x)
					return;

				isLocked = true;

				if (stop)
					window.clearInterval(intervalId);

				// Update positions.
					lastPos = pos;
					pos = x;

				// Hide last slide.
					slides[lastPos].removeClass('top');

					if (options.indicators)
						indicators[lastPos].removeClass('visible');

				// Show new slide.
					slides[pos].addClass('visible').addClass('top');

					if (options.indicators)
						indicators[pos].addClass('visible');

				// Finish hiding last slide after a short delay.
					window.setTimeout(function() {

						slides[lastPos].addClass('instant').removeClass('visible');

						window.setTimeout(function() {

							slides[lastPos].removeClass('instant');
							isLocked = false;

						}, 100);

					}, options.speed);

			};

		// Indicators.
			if (options.indicators)
				$indicators = $('<ul class="indicators"></ul>').appendTo($this);

		// Slides.
			$slides
				.each(function() {

					var $slide = $(this),
						$img = $slide.find('img');

					// Slide.
						$slide
							.css('background-image', 'url("' + $img.attr('src') + '")')
							.css('background-position', ($slide.data('position') ? $slide.data('position') : 'center'));

					// Add to slides.
						slides.push($slide);

					// Indicators.
						if (options.indicators) {

							var $indicator_li = $('<li>' + i + '</li>').appendTo($indicators);

							// Indicator.
								$indicator_li
									.data('index', i)
									.on('click', function() {
										$this._switchTo($(this).data('index'), true);
									});

							// Add to indicators.
								indicators.push($indicator_li);

						}

					i++;

				})
				._parallax(options.parallax);

		// Initial slide.
			slides[pos].addClass('visible').addClass('top');

			if (options.indicators)
				indicators[pos].addClass('visible');

		// Bail if we only have a single slide.
			if (slides.length == 1)
				return;

		// Main loop.
			intervalId = window.setInterval(function() {

				current++;

				if (current >= slides.length)
					current = 0;

				$this._switchTo(current);

			}, options.delay);

	};

	$(function() {

		var	$window 	= $(window),
			$body 		= $('body'),
			$header 	= $('#header'),
			$banner 	= $('.banner');

		// Disable animations/transitions until the page has loaded.
			 $body.addClass('is-loading');

			 $window.on('load', function() {
			 	window.setTimeout(function() {
			 		$body.removeClass('is-loading');
			 	}, 100);
			 });

		// Prioritize "important" elements on medium.
			skel.on('+medium -medium', function() {
				$.prioritize(
					'.important\\28 medium\\29',
					skel.breakpoint('medium').active
				);
			});

		// Banner.
			$banner._slider(settings.banner);

		// Menu.
			$('#menu')
				.append('<a href="#menu" class="close"></a>')
				.appendTo($body)
				.panel({
					delay: 500,
					hideOnClick: true,
					hideOnSwipe: true,
					resetScroll: true,
					resetForms: true,
					side: 'right'
				});

		// Header.
			if (skel.vars.IEVersion < 9)
				$header.removeClass('alt');

			if ($banner.length > 0
			&&	$header.hasClass('alt')) {

				$window.on('resize', function() { $window.trigger('scroll'); });

				$banner.scrollex({
					bottom:		$header.outerHeight(),
					terminate:	function() { $header.removeClass('alt'); },
					enter:		function() { $header.addClass('alt'); },
					leave:		function() { $header.removeClass('alt'); $header.addClass('reveal'); }
				});

			}

	});

})(jQuery);


/*on click me*/
$(document).ready(function() {
	$('#show-hidden-menu').click(function() {
	  $('.hidden-menu').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

  /*on click me1*/
$(document).ready(function() {
	$('#show-hidden-menu1').click(function() {
	  $('.hidden-menu1').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

    /*on click me2*/
$(document).ready(function() {
	$('#show-hidden-menu2').click(function() {
	  $('.hidden-menu2').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

    /*on click me3*/
$(document).ready(function() {
	$('#show-hidden-menu3').click(function() {
	  $('.hidden-menu3').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

      /*on click me4*/
$(document).ready(function() {
	$('#show-hidden-menu4').click(function() {
	  $('.hidden-menu4').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

      /*on click me5*/
$(document).ready(function() {
	$('#show-hidden-menu5').click(function() {
	  $('.hidden-menu5').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

      /*on click me6*/
$(document).ready(function() {
	$('#show-hidden-menu6').click(function() {
	  $('.hidden-menu6').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

  /*on click me7*/
$(document).ready(function() {
	$('#show-hidden-menu7').click(function() {
	  $('.hidden-menu7').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

  /*on click me8*/
$(document).ready(function() {
	$('#show-hidden-menu8').click(function() {
	  $('.hidden-menu8').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

  /*on click me9*/
$(document).ready(function() {
	$('#show-hidden-menu9').click(function() {
	  $('.hidden-menu9').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

  /*on click me10*/
$(document).ready(function() {
	$('#show-hidden-menu10').click(function() {
	  $('.hidden-menu10').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

    /*on click me11*/
$(document).ready(function() {
	$('#show-hidden-menu11').click(function() {
	  $('.hidden-menu11').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

      /*on click me12*/
$(document).ready(function() {
	$('#show-hidden-menu12').click(function() {
	  $('.hidden-menu12').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

        /*on click me13*/
$(document).ready(function() {
	$('#show-hidden-menu13').click(function() {
	  $('.hidden-menu13').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

          /*on click me14*/
$(document).ready(function() {
	$('#show-hidden-menu14').click(function() {
	  $('.hidden-menu14').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

          /*on click me15*/
$(document).ready(function() {
	$('#show-hidden-menu15').click(function() {
	  $('.hidden-menu15').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

          /*on click me16*/
$(document).ready(function() {
	$('#show-hidden-menu16').click(function() {
	  $('.hidden-menu16').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

          /*on click me17*/
$(document).ready(function() {
	$('#show-hidden-menu17').click(function() {
	  $('.hidden-menu17').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

            /*on click me18*/
$(document).ready(function() {
	$('#show-hidden-menu18').click(function() {
	  $('.hidden-menu18').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

            /*on click me19*/
$(document).ready(function() {
	$('#show-hidden-menu19').click(function() {
	  $('.hidden-menu19').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

            /*on click me20*/
$(document).ready(function() {
	$('#show-hidden-menu20').click(function() {
	  $('.hidden-menu20').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

            /*on click me21*/
$(document).ready(function() {
	$('#show-hidden-menu21').click(function() {
	  $('.hidden-menu21').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

              /*on click me22*/
$(document).ready(function() {
	$('#show-hidden-menu22').click(function() {
	  $('.hidden-menu22').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

              /*on click me23*/
$(document).ready(function() {
	$('#show-hidden-menu23').click(function() {
	  $('.hidden-menu213').slideToggle("slow");
	  // Alternative animation for example
	  // slideToggle("fast");
	});
  });

/*selection services*/
  $(function() {
	$('.jqueryOptions').hide();
  
	$('#choose').change(function () {
	  $('.jqueryOptions').slideUp();
	  $('.jqueryOptions').removeClass('current-opt');
	  $("." + $(this).val()).slideDown();
	  $("." + $(this).val()).addClass('current-opt');
	});
  });