function paginate(sType, iInteresting){
    
   if(sType == 'left'){
   
      var iNext = iCurrentSwitch-1;
      if((iNext) < 0){  
          iNext = (iInteresting - 2) ;
          //alert(iInteresting)
      }  
   }  else {
        var iNext = iCurrentSwitch+1;
        if((iNext) >= iInteresting - 1){  
            iNext = 0; 
        } 
   
   }
   
    
    changeSwitcher(iNext, iInteresting, true);
    
}

function switchNextInterval(iCountInteresting){
    
       oTimer = setTimeout(function () {
        
            var iNext = iCurrentSwitch+1;
            
            if((iNext) >= iCountInteresting - 1 ){  
                iNext = 0;
            } 

            changeSwitcher(iNext, iCountInteresting);
            iCurrentSwitch = iNext; 
            
            switchNextInterval(iCountInteresting);
        }, iTimeout);

}

function changeSwitcher(iIds, iCountInteresting, bResetTime){
    
    //get iCurrentSwitch global
        
    if(iCurrentSwitch != iIds){
    iCurrentSwitch = iIds;
    
    //set timer again to 0
    if(bResetTime != undefined){
      clearTimeout(oTimer); 
      switchNextInterval(iCountInteresting)
    }
    //alert(iIds);
    
   changeBox(iIds); 
   }    
}

function changeBox(iId){
    //alert(iCurrentSwitch + ' ' +iId)
    jQuery("#box_load_header").html(aBox[iId][0]);
    jQuery("#box_load_title").html(aBox[iId][1]);
    jQuery("#box_load_content").html(aBox[iId][2]);
    jQuery("#panel").css("background","transparent url(images/bg_banner_0" + iId + ".jpg) repeat scroll 0 0");
    for(var i = 0; i < aBox.length; i++ ){   
        if(i == iId){ 
            jQuery("#box_load_title").addClass('title' + i + '');
            jQuery("#box_load_content").addClass('content' + i + '');
            jQuery("#panel .arrow_left").addClass('arrow_left' + i + '');
            jQuery("#panel .arrow_right").addClass('arrow_right' + i + '');
        } else {
            jQuery("#box_load_title").removeClass('title' + i + '');
            jQuery("#box_load_content").removeClass('content' + i + '');
            jQuery("#panel .arrow_left").removeClass('arrow_left' + i + '');
            jQuery("#panel .arrow_right").removeClass('arrow_right' + i + '');
        }
     }
     
     jQuery("#arrow_left_baner").attr('src','images/nav_arrow_left' + iId + '.png');
     jQuery("#arrow_right_baner").attr('src','images/nav_arrow_right' + iId + '.png');
    
    iCurrentSwitch = iId;
}