


document.createElement("header");
document.createElement("footer");
document.createElement("section");
document.createElement("nav");


    function initSubMenu()
    {
	
	//cache nav
	$('.sub-menu').hide();
	var nav = $(".menu");  
	
	//add indicators and hovers to submenu parents  
	nav.find("li").each(function()
	{  
	    if ($(this).find("ul").length > 0)
	    {   
	    //$("<span>").text("^").appendTo($(this).children(":first"));    
	    //show subnav on hover  
		$(this).mouseenter(function()
		{  
		    $(this).find("ul").stop(true, true).show();  
		});  
		
		//hide submenus on exit  
		$(this).mouseleave(function()
		{  
		    $(this).find("ul").stop(true, true).hide();  
		});  
	    }  
	});
    }
    
    function initCarousel()
    {
	var flag=0;
		
	$('#slider ul li').click(function() {
	if (flag==3)
	{
	$('#slider ul').animate({left: '+=2880'}, {duration: 500,specialEasing: {left: 'easeOutQuad'},});
	flag=0;
	}
	else
	{
	$('#slider ul').animate({left: '-=960'}, {duration: 500,specialEasing: {left: 'easeOutQuad'},});
	flag++;
	}

});
    }
    
    function initToggleEvents()
    {
	var lastID=0;
	$('.post-title').click(function(event) {
	var parentID = (this.parentNode.id);

        

        $('.currentDescription').removeClass('.currentDescription');
	$( '.currentTitle').removeClass('.currentTitle');
        $( '#'+parentID +' div.post-content').toggle( "blind", {direction: "vertical"}, 300);
	
	if($(this).hasClass('currentTitle'))

	  $(this).removeClass('currentTitle');

	else
	    
	    $(this).addClass('currentTitle');
	
            

        $( '#'+parentID +' div.post-content').addClass('currentDescription')
	
	
        
        lastID = parentID;
      
});
    }
    
function mCustomScrollbars(){
	/* 
	malihu custom scrollbar function parameters: 
	1) scroll type (values: "vertical" or "horizontal")
	2) scroll easing amount (0 for no easing) 
	3) scroll easing type 
	4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
	5) scrollbar height/width adjustment (values: "auto" or "fixed")
	6) mouse-wheel support (values: "yes" or "no")
	7) scrolling via buttons support (values: "yes" or "no")
	8) buttons scrolling speed (values: 1-20, 1 being the slowest)
	*/
	$("#content").mCustomScrollbar("vertical",300,"easeOutCirc",1.05,"auto","yes","yes",15); 
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#"+id+" .customScrollBox .content").load(file,function(){
		mCustomScrollbars();
	});
}
