// ************************************************************************************************************
// *  PLEASE DO NOT USE THESE SCRIPTS FOR PRODUCTION. THIS IS JUST A DEMO. PLEASE EVALUATE BEFORE USING THESE *
// ************************************************************************************************************
function buildAccordion( accordionID, direction, firstOpenNumber) {
	// ACCORDION SCRIPT
	firstOpenNumber--;
	var top_venues_accordion = new accordion(accordionID, {
		resizeSpeed : 8,
		classNames : {
			toggle : 'accordion-item',
			toggleActive : 'accordion-open',
			content : 'accordion-content'
		},
		direction : direction
	});
	if( firstOpenNumber >= 0 ) {
		// activate first item
		top_venues_accordion.activate($$('.accordion-item')[firstOpenNumber]);
	}
}

function startWeekShowsScript() {
	// Shows This Week module script
	$$('.tabs a').each( function(tab, index) {
		tab.observe('click', function() {
			$$('.tabs a').each( function(e) {
				e.removeClassName('selected');
			});
			tab.addClassName('selected');
			$$('.tab-content ul').invoke('hide');
			$$('.tab-content ul')[index].show();
		});
	});
}
// **************************************************************************
// *  THE FOLLOWING SCRIPT IS TO FORCE THE FOOTER TO THE BOTTOM OF THE PAGE *
// **************************************************************************
function forceFooterBottom(){
	var viewportheight = document.viewport.getHeight();
	// IF THE PAGE HEIGHT IS LESS THAN THE VIEWPORTHEIGHT, ADJUST THE MAIN HEIGHT.
	if ( $("page").getHeight() < viewportheight) {
		$("main").style.height = (viewportheight - 318) + "px";
	}
}
Event.observe(window, "resize", forceFooterBottom );

// *************************************************
// *  THE FOLLOWING SCRIPT IS TO CREATE THE POPUP  *
// *************************************************

function createPopup(popupID, linkID) {
	if($(popupID) != null) {
		new Popup( popupID, {
				close_id: $$(".popup .close")[0].id,
				links: [{
					link_id: linkID,
					anchor_align: {
						x: 1,
						y: 1
					},
					popup_align: {
						x: 0,
						y: -1
					},
	
					offset: {
						x: 0,
						y: 5
					}
	
				}]
			});
	}
}

