var end_reached = false; var selected_sidebar = ""; var current_position = ""; var end_position = ""; var move_by = ""; var delay_time = ""; var intval = ""; var first_slowdown_point = 60; // FIRST TOP-POSITION WHERE SLIDING SIDEBAR SHOULD START SLOWING DOWN var second_slowdown_point = 85; // SECOND var first_slowdown_move_by = 2; // DISTANCE SIDEBAR SHOULD MOVE AFTER FIRST SLOWDOWN var second_slowdown_move_by = 1; // SECOND //-------------------------------------------------------------------------------- function resetValues() { window.clearInterval(intval); current_position = -220; // STARTING TOP-POSITION OF SIDEBAR end_position = 110; // END POSITION move_by = 4; // STARTING DISTANCE SIDEBAR SHOULD MOVE EACH INTERVAL delay_time = 1; // DELAY BETWEEN INTERVALS (MOVES) intval = ""; } // END FUNCTION resetValues(); //-------------------------------------------------------------------------------- function changeSideBar(sidebar_name) { document.getElementById('sidebar_wsrsuhit').style.visibility='hidden'; document.getElementById('sidebar_9rsymxua').style.visibility='hidden'; document.getElementById('sidebar_e7j8wbia').style.visibility='hidden'; document.getElementById('sidebar_x7j9x79x').style.visibility='hidden'; document.getElementById('sidebar_advanced').style.visibility='hidden'; document.getElementById('sidebar_xfmx7i3s').style.visibility='hidden'; // IF IT IS NOT THE HOME TAB AND IF A SIDEBAR EXISTS FOR THE PASSED NAME if(document.getElementById(sidebar_name) != null && sidebar_name != 'sidebar_xfmx7i3s') selected_sidebar = document.getElementById(sidebar_name); else selected_sidebar = document.getElementById('sidebar_advanced'); if(!end_reached) { resetValues(); intval = window.setInterval("moveIt()",delay_time); } // END IF WE NEED TO SLIDE THE SIDEBAR else { selected_sidebar.style.top = (end_position)+'px'; } // END ELSE WE JUST NEED TO MOVE IT INSTANTLY selected_sidebar.style.visibility='visible'; } // END FUNCTION //-------------------------------------------------------------------------------- function moveIt() { current_position += move_by; selected_sidebar.style.top = (current_position)+'px'; // SLOW IT DOWN AFTER IT GETS CLOSE if(current_position >= first_slowdown_point) move_by = first_slowdown_move_by; if(current_position >= second_slowdown_point) move_by = second_slowdown_move_by; if (current_position >= end_position) { resetValues(); end_reached = true; } // END IF WE'VE REACHED THE END } // END FUNCTION