window.object_mes_hashTab = function(tabId, tourId) {
	var hash = window.location.hash.replace(/#/, ''),
		cId = tourId.replace(/-.*/, ''),
		cTabId = $('#tab-' + hash),
		cTourId = $('#' + cId + '-' + hash),
		first = $('#' + tabId + ' li.selected')[0],
		tId = 0,
		_autoplayTimeout = 5000,
		_intervalId = 0,
		_autoplayIndex = 0,
		_tabs = $('li', '#' + tabId);
		
	if (hash && cTabId && cTabId) {		
		if (first) {
			$(first).removeClass('selected');
			$('#' + tourId + ' div.active').removeClass('active');
		}
		cTabId.addClass('selected');
		cTourId.addClass('active');
	}
	var handleTabClick = function(){
		hash = $(this).attr('id').replace(/.*?-/,'');
		$('.selected','#'+tabId).removeClass('selected');
		$('div.active','#'+tourId).fadeOut(250);
		$('#' + cId + '-' + hash).css('visibility','visible').fadeIn().addClass('active');
		$(this).addClass('selected');
	};
	//$.ready($('li','#'+tabId).hover(handleTabClick));
	//added empty function arg for 'hover-out' to prevent errors in IE
	$.ready($('li','#'+tabId).hover(handleTabClick, function(){}));
	
	var targetTabFromHash = function() {
		var nhash = window.location.hash.replace(/#/, '') || (first && first.id.replace(/.*-/, ''));
		if (hash && nhash && hash !== nhash) {
			handleTabClick.call($('#tab-' + nhash));
		}
	};
};
