// Global Javascripts for the Physics Website // Requires JQuery // show the print stylesheet if '&print' is in the location gy = window.location.search.substring(1).split("&"); ft = gy[0].split("="); if (ft[0]=='print') { document.write(''); } function printVersion() { window.open(location.href+"?print"); } // code attrib: http://derekallard.com/blog/post/conditionally-sticky-sidebar/ function physics_activateBackToTopLink(div_id) { window.onscroll = function() { child_match = div_id + ' > div'; if( window.XMLHttpRequest ) { // Exclude use IE 6 if (document.documentElement.scrollTop > 500 || self.pageYOffset > 500) { $(child_match).css('position', 'fixed'); $(child_match).css('top', '0'); $(child_match).css('float', 'right'); $(div_id).css('display','block'); } else if (document.documentElement.scrollTop < 500 || self.pageYOffset < 500) { $(child_match).css('position', 'absolute'); $(child_match).css('top', '500px'); $(div_id).css('display','none'); } } } }