$(document).ready(function($){

	//SideNav

	$(".side-nav li ul.sub-menu").hide(); // Hide all sub menus

	$(".side-nav li.current_page_item a").parent().find("ul").slideToggle("slow"); 		

	$(".side-nav>li").hover( 

		function() { // Do this on hover

			if ( $(this).is('.current_page_item') ) {

				$(this).siblings().find("ul").slideUp("normal");

			}

			var i = 0; // Counter

			if ( i%2 != 0 ){

				$(this).children('ul').slideUp("normal");

				i++;

			}

			else {

				$(this).children('ul').slideDown("normal");

				i++;

			}

			return false;

		},

		function() { // Do this on unhover

			if ( $('.page_item').length === 0 ) { // If there isn't a submenu opened in the DOM, slide all up

				$(this).siblings().find("ul").slideUp("normal");

			}

			return false;

		}

	);

		

	//SideNav Parent Link

		$(".side-nav li a").click( 

			function () {

				window.location.href=(this.href);

				return false;

			}

		); 



    // SideNav Hover Effect

		

		$(".side-nav li a").hover(

			function () {

				$(this).stop().animate({ paddingLeft: "25px" }, 200);

			}, 

			function () {

				$(this).stop().animate({ paddingLeft: "15px" });

			}

		);

});
