function loader() { setToggles(); selectIt = $('filterSelect'); if (selectIt) {selectIt.onchange = function() { selectValue = $F('filterSelect'); selectRel = $('filterSelect')[selectValue].getAttribute('rel') startSearch(selectValue, selectRel);} } if ($('alertClose')) { $('alertClose').onclick = function() { userID = $('newsAlert').className; alertID = $('newsAlertButton').className; closeAlert(userID, alertID); } $('alertClose').onmouseover = function() {this.style.cursor = 'pointer';} } if ($('newsAlertMini')) { $('newsAlertMini').onmouseover = function() {this.style.cursor = 'pointer';} $('newsAlertMini').onclick = function() { new Effect.BlindUp('newsAlertMini', {duration: 0.3, afterFinish: function() { //$('newsIn').style.marginTop = '15px'; new Effect.BlindDown('newsAlert', {duration: 0.9}); }}); } } } function startSearch(page, relText) { whyNot = $("newsIt"); loadIt = $("loadingit"); new Effect.Fade('newsIt', {duration: 0.3, afterFinish: function() {sendData(page, relText);}}); } // -------------------------------------------------------------------------------------------------------------------------------------------------// function sendData(page, relText) { var ajax = false; try {ajax = new XMLHttpRequest();} catch(e) {ajax = new ActiveXObject("Microsoft.XMLHTTP");} if(!ajax) {alert('ajax unsupported!'); return false;} ajax.onreadystatechange = function() { if(ajax.readyState == 1) { loadIt.show(); loadIt.innerHTML = "

LOADING!
"; } if(ajax.readyState == 4) { if(ajax.status == 200) { loadIt.hide(); receiveData(ajax.responseText, relText); } else {alert('oops: '+ajax.status+ ' ' + page); return false;} } } alert('TEST'); ajax.open('POST','http://www.jamplay.com/includes/new/index-filter.php?cat_id=' + page,true); ajax.send(null); return false; } // -------------------------------------------------------------------------------------------------------------------------------------------------// function receiveData(page, relText) { whyNot.innerHTML = page; $$('#newsIn p')[0].update(relText); $('newsIt').style.display = 'block'; $('newsIt').style.opacity = '1'; $('newsIt').style.filter = 'alpha(opacity = 100)'; setToggles(); //new Effect.Appear('newsIt', {duration: 0.2, afterFinish: function() {$('newsIt').style.opacity = '1.0'; setToggles();}}); } // -------------------------------------------------------------------------------------------------------------------------------------------------// ///////////////////////////////////////////////////////////////// function setToggles() { toggles = $$('#newsIt .extend'); imgThumbs = $$('#newsIt .key'); adapter = $$('#newsIt .show'); toggles.each(function(s, index) { theBlock = s.parentNode.parentNode; var itsHeight = $$('#newsIt .show')[index].getHeight(); if (itsHeight < 68) { s.getElementsByTagName('img')[0].className = 'noExtendHide'; } else { s.onmouseover = function(){this.style.cursor='pointer';}; s.onclick = function() {doToggle(s, index);}; }}); imgThumbs.each(function(s, index) {s.onmouseover = function(){this.style.cursor='pointer';}; }); adapter.each(function(s, index) {s.style.height = '45px'; s.style.overflow = 'hidden';}); } function doToggle(theLink, count) { adapter = $$('#newsIt .show')[count]; thumb = $$('#newsIt .key')[count]; theimg = theLink.getElementsByTagName('img')[0]; wiggle = $$('#newsIt .show')[count].style.overflow; if (wiggle == 'visible') { theimg.src = '/images/buttons/pull-More2.gif'; adapter.style.overflow = 'hidden'; adapter.style.height = '45px'; } else { adapter.style.display = 'block'; adapter.style.overflow = 'visible'; adapter.style.height = ''; theimg.src = '/images/buttons/pull-Less2.gif'; } } function closeAlert(userID, alertID) { new Effect.BlindUp('newsAlert', {duration: 0.8, afterFinish: function() { //$('newsAlertMini').style.marginTop = '15px'; new Effect.BlindDown('newsAlertMini', {duration: 0.4}); }}); xajax_update_alert(userID, alertID); } Event.observe(window, 'load', loader, false);