function iPhoneTest() { if ( !isIPhone( ) ) { // render full page document.body.className = "bodyDesktopVersion"; $("theContainerBackground").className = "theContainerBackgroundDesktopVersion"; } else { // on the phone, scroll the page to the top, just once in the beginning setTimeout(function() { window.scroll(0, 1); }, 1); } } function clickSection(id) { // figure out what was clicked var baseId = id; var tail = id.indexOf("SectionHeader"); if ( tail > 0 ) { baseId = id.substr(0, tail) + "Section"; } return toggleSectionContent(baseId); } function toggleSectionContent(baseId, dontScroll) { // toggle the div var content = $(baseId + "Content"); if ( content && (content.style.display == "none" || !content.style.display )) { openSection(baseId, dontScroll); return true; } else if ( content && content.style.display == "block" ) { closeSection(baseId, dontScroll); return false; } } function openSection(baseId, dontScroll) { // toggle the div var content = $(baseId + "Content"); // display down arrow $(baseId + "HeaderArrow").src = "img/arrow_down.png"; // show contents content.style.display = "block"; // scroll window onless told otherwise if ( !dontScroll ) { setTimeout( function() { var offsetTop = $(baseId + "Shell").offsetTop + data.scrollFudgeFactor; var delta = offsetTop - window.pageYOffset; window.scroll( 0, offsetTop - Math.floor(delta*0.1) ); setTimeout( function() { window.scroll( 0, offsetTop - Math.floor(delta*0.05) ) }, 75 ); setTimeout( function() { window.scroll( 0, offsetTop - Math.floor(delta*0.03) ) }, 130 ); setTimeout( function() { window.scroll( 0, offsetTop ) }, 150 ); }, 0 ); } } function closeSection(baseId) { // toggle the div var content = $(baseId + "Content"); // display right arrow $(baseId + "HeaderArrow").src = "img/arrow_right.png"; // hide contents content.style.display = "none"; }