$(document).ready(function() {
	
	// setup the drop down functionality on our "extra" buttons
	$('.lnkAllPublishers').click(
		function(){
			// close any open boxes
			$('.extraDropdownActive').not($(this).next('.extraDropdown')).removeClass('extraDropdownActive');
			
			$(this).next('.extraDropdown').toggleClass('lnkAllPublishersActive');
			
			if ($(this).next('.extraDropdown ').is(".lnkAllPublishersActive")) {
				$(this).next('.extraDropdown').css( {
												   'left':$(this).position().left+1,
												   'top':$(this).position().top+18
												   }
												   );
			} else {
				$(this).next('.extraDropdown').css( {
												   'left':-999,
												   'top':-999
												   }
												   );
			}
			return false;
		}
	);

	// make sure a click outside will hide the dropdown
	$('body').click(
		function() {
			$('.lnkAllPublishersActive').removeClass('lnkAllPublishersActive').css({'top':-999,'left':-999});
		}
	)



	// setup the drop down functionality on our "location" buttons
	$('.lnkAllLocations').click(
		function(){
			// close any open boxes
			$('.extraDropdownActive').not($(this).next('.extraDropdown')).removeClass('extraDropdownActive');
			
			// now toggle it
			//$(this).next('.extraDropdown').css('left',$(this).position().left+1);
			//$(this).next('.extraDropdown').css('top',$(this).position().top+20);
			$(this).next('.extraDropdown').toggleClass('lnkAllLocationsActive');
			return false;
		}
	);

	// make sure a click outside will hide the dropdown
	$('body').click(
		function() { $('.lnkAllLocationsActive').removeClass('lnkAllLocationsActive').css({'top':-999,'left':-999}); }
	);

})