function initTrickGallery() {
	// define link height
	var LINK_HEIGHT = 35;
	
	// set visible height
	var visibleHeight = 35 * 9;
	
	// get combined height of all trick links
	var totalHeight = ($("trickLinks").getChildren().length) * LINK_HEIGHT;
	
	// set height of list
	$("trickLinks").setStyle("height", totalHeight);
	
	// set initial classes for buttons
	$("trickLinksDown").addClass("disabled");
	
	if (totalHeight <= visibleHeight)
		$("trickLinksUp").addClass("disabled");
	
	// define effects
	var fx = new Fx.Styles($("trickLinks"), {duration: 300, transition: Fx.Transitions.Sine.easeInOut});

	// TODO: assign button functions
	$("trickLinksUp").addEvent("click", function(e) {
			// stop anchor event
			e = new Event(e).stop();
						
			// get current position
			var currentTop = $("trickLinks").getStyle("top").toInt();
			
			// calculate new position
			var tempTop = currentTop - LINK_HEIGHT;
			
			if ((totalHeight - Math.abs(tempTop)) >= visibleHeight) {
				// animate
				fx.start({
					"top": tempTop 
				});
				
				// update button statuses
				$("trickLinksDown").removeClass("disabled");
				
				if ((totalHeight - Math.abs(tempTop)) == visibleHeight) {
					if (!$("trickLinksUp").hasClass("disabled"))
						$("trickLinksUp").addClass("disabled");
				}
			}
		}
	);

	$("trickLinksDown").addEvent("click", function(e) {
			// stop anchor event
			e = new Event(e).stop();
						
			// get current position
			var currentTop = $("trickLinks").getStyle("top").toInt();

			// calculate new position
			var tempTop = currentTop + LINK_HEIGHT;
			
			if (tempTop <= 0) {
				// animate
				fx.start({
					"top": tempTop 
				});
				
				// update button statuses
				$("trickLinksUp").removeClass("disabled");
				
				if (tempTop == 0) {
					if (!$("trickLinksDown").hasClass("disabled"))
						$("trickLinksDown").addClass("disabled");
				}
			}
		}
	);
	
	// assign trick link functions
	
	// get links
	var trickLinks = $$("ul#trickLinks a");
	
	// add events to all trick links
	for (var i = 0; i < trickLinks.length; i++) {
		trickLinks[i].addEvents({
						
			"click": function(ev) {
				loadTrickVideo(ev);
			}
			
		});
	}
	
	return false;
}

function loadTrickVideo(ev) {
	// get link index
	var event = new Event(ev).stop();
	var link_index = $(event.target).getProperty("id").replace("link", "").toInt();

	// get video id
	var video_id = $(event.target).getProperty("name").replace("video", "").toInt();

	// set video name
	$("nowPlaying").getChildren()[0].innerHTML = $(event.target).getProperty("title");
	
	// set active link
	var trickLinks = $$("ul#trickLinks a");
	
	for (var i = 0; i < trickLinks.length; i++) {
		trickLinks[i].removeClass("active");
	}
	
	$(event.target).addClass("active");
	
	// load video
	var url = DOCUMENT_ROOT + "/misc/scripts/ajax/gallery_video.asp?video=" + video_id;
	var element = "videoStage";
	ajaxRequest(url, element);
}
