/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 var toggleMenuClicked = false;
 
 function createToggleMenu(){
 
     var navList = $(".oneit-vertical-tab .nav-list");
    var navHeadDiv = $("<div/>",{"class":"tab-title"}).click(function(){
       
          $(navList).slideToggle('fast');
          toggleMenuClicked = true;
        
    });
    navHeadDiv.append('<span class="tab-title-text">' + $(".oneit-vertical-tab .nav-list .active a").text() + '</span>');
    navHeadDiv.append('<span class="caret"></span>');
    navHeadDiv.insertBefore(navList);
      
     
 }
 

$(document).ready(function(){
   
    var navList = $(".oneit-vertical-tab .nav-list");
    if($(navList).is(":hidden")){
         $(".tab-title").remove();
        createToggleMenu();
    }
    

        $(".oneit-vertical-tab .nav-list li a").click(function(){
            
           if(toggleMenuClicked){
               $(".tab-title-text").text($(this).text());
               navList.hide();
           }
        });

    
  
});


$(window).resize(function(){
    var navList = $(".oneit-vertical-tab .nav-list");

     if($(".tab-title").length)  $(".tab-title").remove();
     
     
       var widowWidth = $(window).width();
     
       if(widowWidth < 992){
           
              navList.hide();
           createToggleMenu();
           
       }
       else {
           toggleMenuClicked = false;
           navList.show();
           
       }
       

});






