All pastes #955854 Raw Edit

Something

public javascript v1 · immutable
#955854 ·published 2008-03-24 21:48 UTC
rendered paste body
<?php require('configuration.php'); ?>window.onload = function() {                 var myDivs = document.getElementsByClassName('items');                 var myLinks = document.getElementsByClassName('itemhead');                 var myAccordion = new fx.Accordion(myLinks, myDivs, {opacity: true, duration: <?php echo($menu_speed); ?>});                 myAccordion.showThisHideOpen(myDivs[0]);                 myAbout = new fx.Height('about', {duration: <?php echo($header_speed); ?>});myAccordion.showThisHideOpen = function(toShow){        this.elements.each(function(el, i){           if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el);        }.bind(this));        setTimeout(function(){this.clearAndToggle(toShow)  ;}.bind(this), this.options.delay);};		}function activateSearch() {    if ($('searchform')) {                 $('s').value = 'Search...'; // Default text in the search box                 var o = document.createElement('div'); // Old search results div                 var n = document.createElement('div'); // New search results div                 $('searchform').onsubmit = function() { doSearch();return false; };                 $('s').onfocus = focusS; // Function to clear the default search box text on focus                 var s = $('search-results');                 var f = $('searchform');                 o.id = 'old-search-results';                 n.id = 'current-search-results';                 s.appendChild(n);                 s.appendChild(o);                 o.style.height = '0';                 o.style.overflow = 'hidden';                 n.style.height = '0';                 n.style.overflow = 'hidden';                 is_searching = false;    }}function doSearch() {                 // If we're already loading, don't do anything                 if (is_searching) return false;                  s = $F('s');                 // Same if the search is blank                 if (s == '' || s == 'Search...') return false;                  is_searching = true;                 c = $('current-search-results');                 o = $('old-search-results');                 o.innerHTML = c.innerHTML;                 c.style.height = '0';                 o.style.height = 'auto';                 // Setup the parameters and make the ajax call                 pars = 's=' + escape(s) + '&ajax';                 var myAjax = new Ajax.Request('<?php print("http://".$_SERVER['SERVER_NAME'].$urlend); ?>', 			{method: 'get', parameters: pars, onComplete:doSearchResponse});}function doSearchResponse(response) {                 $('current-search-results').innerHTML = response.responseText;                 var oldSearch = new fx.Height('old-search-results',{duration: <?php echo($search_results_speed); ?>});                 oldSearch.toggle();                 var newSearch = new fx.Height('current-search-results',{duration: <?php echo($search_results_speed); ?>, onComplete:resetForm});                 newSearch.toggle();}function resetForm() {                 is_searching = false;  }function focusS() {    if ($F('s') == 'Search...') $('s').value = '';}Event.observe(window, 'load', activateSearch, false);