var position = 0;

function changeContent(direction){
    var contentArray    = ['bestBuy1', 'bestBuy2', 'bestBuy3'];
    var contentLength   = contentArray.length;
    var showArray;
    var hideArray       = [];

    
    if(direction === 'forward'){
        position += 1;
        
        if(position >= contentLength){
            position = 0;
        }
    }
    
    if(direction === 'back'){
        position -= 1;
        
        if(position < 0){
            position = contentLength + position;
        }
    }
    
    showArray = [contentArray[position]];
    
    for(i = 0; i < contentLength; i++){
        if(i !== position){
            hideArray.push(contentArray[i]);
        }
    }
    
    showHide(showArray, hideArray);
}


function changeTab(tab){
    
    var tab = tab.id;
    var showArray = [];
    var hideArray = [];
    
    if( !tab ){
        tab = 'a1';
    }
    
    
    
    switch (tab){
        case 'a1':
                        
            showArray = ['tab1Contents'];
            hideArray = ['tab2Contents', 'tab3Contents', 'tab4Contents', 'tab5Contents'];

        break;
        
        case 'a2':
                        
            showArray = ['tab2Contents'];
            hideArray = ['tab1Contents', 'tab3Contents', 'tab4Contents', 'tab5Contents'];
            
        
        break;
        
        case 'a3':
                        
            showArray = ['tab3Contents'];
            hideArray = ['tab1Contents', 'tab2Contents', 'tab4Contents', 'tab5Contents'];

        break;
        
        case 'a4':
                        
            showArray = ['tab4Contents'];
            hideArray = ['tab1Contents', 'tab2Contents', 'tab3Contents', 'tab5Contents'];

        break;
        
        case 'a5':
                        
            showArray = ['tab5Contents'];
            hideArray = ['tab1Contents', 'tab2Contents', 'tab3Contents', 'tab4Contents'];
            
        break;
    }
    
    showHide(showArray, hideArray);
}