/**
 * @author alex
 */
$(function() {
	var $pane = $('#match_results_holder');
	$pane.jScrollPane({showArrows:true, arrowSize:16, scrollbarWidth:18, animateTo: true});
	
	$("#accordion").accordion({
		autoHeight: false,
		header: '.torni'
	});

	if(window.XMLHttpRequest && window.location.hash != null && window.location.hash != "")
	{
		var who = "a[href=" + window.location.hash + "]";
		var dest = $("a[href=" + window.location.hash + "]").next("li.header");
		$pane[0].scrollTo(dest);
		$(who).parent("h3.torni").click();
	}
	else
	{
		var our_url = window.location.href;
		if(/#\d/.test(our_url))
		{
			var hash_array = /#\d/.exec(our_url);
			var our_hash = hash_array[0];
			
			if(our_hash != null && our_hash != "")
			{
				var who = "a[href=" + our_hash + "]";
				var dest = $("a[href=" + our_hash + "]").next("li.header");
				$pane[0].scrollTo(dest);
				$(who).parent("h3.torni").click();
			}
		}
	}
	
});
