// Add logic for FAQs
Event.observe( window, "load", function() {
    $$('.txst-faqitem-question a').each( function( item ) {
        console.log(item);
        var answerElement = item.ancestors()[0].next();
        Event.observe( item, "click", function( event ) { 
        Effect.toggle( answerElement, 'blind' );
        Event.stop( event );
        });
    });
    
    Event.observe( 'txst-expand-all-faqs', "click", function(event) {
        $$('.txst-faqitem-answer').each( function( item ) {
            if ( !item.visible() ) Effect.BlindDown( item );
        });
	Event.stop(event);
    });

    Event.observe( 'txst-collapse-all-faqs', "click", function(event) {
        $$('.txst-faqitem-answer').each( function( item ) {
            if ( item.visible() ) Effect.BlindUp( item );
        });
	Event.stop(event);
    });
    
});


// Add background graphic on gato-public
Event.observe(window, "load", function() {
		
	if ( window.location.hostname == 'gato-public.its.txstate.edu' ) {
	
		$$(".txst-destroyer-contentcolumn").each( function(element) {
				element.setStyle({
					backgroundImage: 'url(/magnoliaAssets/css/images/txst/txst-destroyer/preview_background.gif)'
				});
			});
		
	}
		
});


Event.observe(window, "load", function() {
	$$('.txst-photogallery').each( function(galleryElement,galleryIndex) {
			galleryElement.getElementsBySelector("img").each( function(imageElement,imageIndex) {
				Effect.Appear(imageElement,{ duration: .5, delay: .150*imageIndex  });
			});
		}
	);
});
