var guide = { setUpFxTargets: function() { $$('div.fxTarget').each(function(target) { target.makeDraggable(); }); }, showFxTarget: function(target) { $(target).setStyles({ 'display': 'block', 'visibility':'visible' }); }, /* accordion */ makeAccordion: function () { $$('div.Accordion').each(function(el) { var minHeight = 0; el.getElements('.stretcher').each(function(stretcher) { if (minHeight < stretcher.scrollHeight) minHeight = stretcher.scrollHeight; }); el.setStyle('height', minHeight+200+'px'); new Accordion(el.getElements('.stretchtoggle'),el.getElements('.stretcher'), { alwaysHide:1, display:-1, onActive: function() { (function() { if(this.previousClick > 0) { var top = $(this.elements[this.previousClick]).getTop()-50; scroller.scrollTo(0, top); } }).bind(this).delay(500); } }); }); }, /* slider V1 */ makeSlider: function() { this.sliders = $$('ul#slider ul').map(function(ul) { return new Fx.Slide(ul, { mode: 'vertical', onComplete: function() { if (this.now[0] >= 0) this.wrapper.setStyle('height', 'auto'); } } ).hide(); }); $$('ul#slider a.slideOpener').each(function(lnk, index) { lnk.addEvent('click', function() { this.sliders.each(function(slider, sliderIndex) { if (sliderIndex == index) this.sliders[sliderIndex].toggle(); }, this); /* Here's the bind "this" for .each */ }.bind(this)); /* and here's the explicit .bind(this) for .addEvent's function */ }, this); /* and this is the last .each, so it has a "this" too */ }, get_tips: function () { var as = []; $$('.tip').each(function(a) { if (a.getAttribute('title')) as.push(a); } ); new Tips(as, { maxTitleChars: 100, onShow: function(tip) { tip.setStyle('opacity', '0.8'); }, onHide: function(tip) { tip.setStyle('visibility', 'hidden'); }, offsets: {'x': -10, 'y': 15} }); }, init: function() { this.setUpFxTargets(); this.makeSlider(); this.makeAccordion(); this.get_tips(); } } window.onDomReady(guide.init.bind(guide)); //used to call alert in admin for deletion function remove_confirm (id) { if ( confirm ( 'Delete This Item?') ) { new Fx.Style("ID_"+id, 'opacity').set(10); toggleHeight(id) // delete item from DB and page.. xajax_remove(id); } } function archive_confirm (id, status) { if ( confirm ( 'Archive This Item?') ) { new Fx.Style("ID_"+id, 'opacity').set(10); toggleHeight(id) // delete item from DB and page.. xajax_status(id, status); } } function toggleHeight(id) { new Fx.Slide("ID_"+id ).toggle() ; } function toggleHeight_raw(id) { new Fx.Slide(id ).toggle() ; } function pop_open (url, height, width ) { newwindow=window.open(url,'Venue Image', 'height='+height+', width='+width+'location=0, status=1, scrollbars=0, toolbar=0' ); s_width = screen.width ; s_height = screen.height - 50; y = (s_height - height )/2; x = (s_width - width)/2 ; newwindow.moveTo(x,y); if ( window.focus ) { newwindow.focus() } } function clearText(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } }