                                                                        // JavaScript Document

    $(function(){


// REMOVE THE LAST "|" IN THE FOOTER NAV

$('.footer-nav').each(function(){
 var x = $(this).html();
 lastComma = x.lastIndexOf("|");
 x = x.substring(0, lastComma);
 $(this).html(x);
});


// SELECTED STATE FOR THE NAVIGATION AND SUB NAV

try{
 var hiddenNav = $(".hiddenNav").attr("id");
 $(".navigation li[class="+hiddenNav+"] a").addClass("selected");
 }
 catch(err){}

try{
 var hiddenNav = $(".hiddenNav").attr("rel");
 $("#subNav li a[title="+hiddenNav+"] ").addClass("selected");
 }
 catch(err){}


// EXPAND AND COLLAPSE FUNCTION
//try{  
$('#expand-list .item .exp-col').toggle(function() {                                  
            $(this).parent().siblings(".full-content").animate({
                height: 'toggle'
                }, 200);    
                if(activeState == false){  

                    $(this).addClass('active');
//$(this).parent().parent(".item").css("position","relative");
                    activeState = true;
                }else{
                    $(this).removeClass('active');
//$(".item").css("position"," ");
                    activeState = true;
                }
            }, function() {
            $(this).parent().siblings(".full-content").animate({
                height: 'toggle'
                }, 200);
               if(activeState == false){  
                    $(this).removeClass('active');
//$(".item").css("position"," ");
                    activeState = true;
                }else{
                    $(this).addClass('active');
//$(this).parent().parent(".item").css("position","relative");
                    activeState = true;                    
               }
        });
    
    
    
    
 //   }catch(err){}


// VIEW ALL
try{  
      
        $("#view-more .item .exp-col").click(function(){
            activeState = false;       
        });                
        
        
        $('#view-more .item .exp-col').toggle(function() {                                    
            $(this).parent().siblings(".full-content").animate({
                height: 'toggle'
                }, 200);    
                if(activeState == false){  
                   $(this).text("close");
                    $(this).addClass('active');
                    activeState = true;
                }else{
                    $(this).text("view more");
                    $(this).removeClass('active');
                    activeState = true;
                    
               }
            }, function() {
            $(this).parent().siblings(".full-content").animate({
                height: 'toggle'
                }, 200);
               if(activeState == false){  
                    $(this).text("view more");  
                    $(this).removeClass('active');
                    activeState = true;
                }else{
                    $(this).text("close");
                    $(this).addClass('active');
                    activeState = true;                    
               }
        });

    
    }catch(err){}



});

    

    

    

    
