/home/coolpkct/www/websites/cake3.cool.rocks/_themes/zero/js/init.js
/* Normalized hide address bar for iOS & Android (c) Scott Jehl, scottjehl.com MIT License */
//(function(a){var b=a.document;if(!location.hash&&a.addEventListener){window.scrollTo(0,1);var c=1,d=function(){return a.pageYOffset||b.compatMode==="CSS1Compat"&&b.documentElement.scrollTop||b.body.scrollTop||0},e=setInterval(function(){if(b.body){clearInterval(e);c=d();a.scrollTo(0,c===1?0:1)}},15);a.addEventListener("load",function(){setTimeout(function(){if(d()<20){a.scrollTo(0,c===1?0:1)}},0)})}})(this);



(function(w){

	$(document).ready(function() {
		setNav();
		//$("nav ul ul").clone().addClass("nav-2").insertAfter($("nav>ul"));
	});

	/*
	 * Toggle navigation for small screens
	 * Doesn't hide or show anything, just appends a classname
	 * It's up to your CSS to decide if you want to hide or show it.
	 * Can handle different links to toggle different menu panels
	 * Each <a> in the #nav-anchors element should have its href set to
	 * the ID of the menu panel you want to toggle. 
	 */
	function setNav() {
		//Add a classname to the menu to allow CSS to control display
		var menuClass = ".header-nav-items";
		
		/*
		 * Default is to add a class to all menus to indicate that the 
		 * menu can be hidden if required by the media query
		 */ 
		$(menuClass).addClass("hidden-nav");
		//Grab all the anchorLinks : These are the button to show the menus
		var $anchorLinks = $('#nav-anchors').find('a');
		//Give them something to do
		$anchorLinks.click(function(e){
			e.preventDefault();
			var $this = $(this);
			var thisHref = $this.attr('href');
			if($this.hasClass('active')) {
				//Use to set the select state of the anchor
				$this.removeClass('active');
				//remove the "hidden" class to the relevant menu 
				$(thisHref).addClass("hidden-nav");
			} else {
				//Clear the select state of all the anchorlinks
				$anchorLinks.removeClass('active');
				//Set the select state of the clicked anchor
				$this.addClass('active');
				//append the "hidden" class to the relevant menu 
				$(thisHref).removeClass("hidden-nav");
			}
		});
	}
	
})(this);