
/*===============================================================================
	listing.js
	John Larson
	4/01/08
	
	All page-specific JavaScript for listing.asp

===============================================================================*/


window.addEvent('domready', function() {
	
	dbug.enable();
	
	
	$$('.directoryLink').each(function(theImage, index) {
		theImage.addEvents({
			click: function() {
				loadBandVenueGroup(index);
			},
			mouseover: function() {
				activateSection(index);
			},
			mouseout: function() {
				deactivateSection(index);
			}
		});
	});
	
	loadBandVenueGroup(0);
});

	

/****************************************************************************
//	SECTION::Listing Browsing
*/
	
	currentIndex = 0;
	function loadBandVenueGroup(index) {
		showLoad();
		new Ajax('listing.asp?pageAction=loadAffiliateSection&section=' + index, {
			method: 'get',
			update: $('rightContent'),
			evalScripts: true,
			onComplete: function() {
				hideLoad();
				var oldIndex = currentIndex;
				currentIndex = index;
				deactivateSection(oldIndex);
				activateSection(index);
			}
		}).request();
	}
	
	function activateSection(index) {
		$ES('.directoryLink')[index].src = 'images/listing/section' + index + '_on.gif';
	}
	
	function deactivateSection(index) {
		if(index != currentIndex) {
			$ES('.directoryLink')[index].src = 'images/listing/section' + index + '.gif';
		}
	}
	
/*
//	End SECTION::Listing Browsing
****************************************************************************/
