$(document).ready(function () {


// Home page banner
		$('#home-banner').cycle('fade');

		
// Toggle

$("#login-button").click(function () {
$("#navigation .sub-navigation").slideToggle("slow");
});    
		
		

// Text limiter		
/*		  $.fn.textlimit = function()
		  { 

			return this.each(function()                       
			{

			var $elem = $(this);            // Adding this allows u to apply this anywhere
			var $limit = 110;                // The number of characters to show
			var $str = $elem.html();        // Getting the text
			var $strtemp = $str.substr(0,$limit);   // Get the visible part of the string
			$str = $strtemp + '<span class="hide">' + $str.substr($limit,$str.length) + '</span> ...';  
			$elem.html($str);
			})

		  };

		// Call the text limiter above 
			$('.post-entry p').textlimit();

*/


//  MID NAVIGATION EXPAND	

$('#menu-flag-menu > li > a').click(function(e) {e.preventDefault();});


$("#menu-flag-menu li a").click(function(){ 

    // close all opened sub menus
    $("ul", $(this).parent().siblings()).stop(true,true).slideUp();

    var ul = $(this).next("ul");     
    ul.stop(true,true).slideToggle('fast'); 
});

$(document).click(function (e) {

    // if we click on anything other than the navigation menu
    // or it's descendants then slide up the menu
    if(e.target.id !== "menu-flag-menu" 
        && !$(e.target).closest("#menu-flag-menu").length) {
        $(".sub-menu").stop().slideUp();
    }
});




   

});
