function displayTab(img) {
	var re = /(.*tab_)([a-z]+)(1)a*(.*)/;
	// hide all tabs
	$('.p_ascension_tab').eq(0).find('img').each(function(){
		
		if($(this).attr('src') != 'undefined') $(this).attr('src', $(this).attr('src').replace(re, '$1$2$3$4');

	});
	$('.tabContent').each(function(){

		if($(this).attr('style') != undefined) $(this).css('display', 'none');

	});
	
	var newSrc = img.src.replace(re, '$1$2$3a$4');
	img.src = newSrc;
	var type = img.src.replace(re, '$2');
	
	$('.p_ascension_' + type).eq(0).show();
}

function rotateImg(arrowImg, zone) {
	var direction = arrowImg.src.replace(/.*arrow_(\w+)\.jpg/, '$1');
	var currentImg = arrowImg.parentNode.parentNode
	                 .getElementsByTagName('td')[1].getElementsByTagName('img')[0];
	var re = /zone\/\w+_([0-9]+)/;
	var currentNum = re.exec(currentImg.src)[1];
	var imgIndex;
	if (direction == 'right') {
		imgIndex = parseInt(currentNum, 10) + 1;
	} else {
		imgIndex = parseInt(currentNum, 10) - 1;
	}
	
	switch (zone) {
		case 'LandOfImmortals':
			var images = ['LandOfImmortals_00.jpg',
			              'LandOfImmortals_01.jpg',
			              'LandOfImmortals_02.jpg',
			              'LandOfImmortals_03.jpg',
			              'LandOfImmortals_04.jpg',
			              'LandOfImmortals_05.jpg',
			              'LandOfImmortals_06.jpg',
			              'LandOfImmortals_07.jpg',
			              'LandOfImmortals_08.jpg',
			              'LandOfImmortals_09.jpg',
			              'LandOfImmortals_10.jpg',
			              'LandOfImmortals_11.jpg',
			              'LandOfImmortals_12.jpg'];
			break;
		case 'PurifiedLands':
			var images = ['PurifiedLands_00.jpg',
			              'PurifiedLands_01.jpg',
			              'PurifiedLands_02.jpg',
			              'PurifiedLands_03.jpg',
			              'PurifiedLands_04.jpg',
			              'PurifiedLands_05.jpg',
			              'PurifiedLands_06.jpg',
			              'PurifiedLands_07.jpg',
			              'PurifiedLands_08.jpg',
			              'PurifiedLands_09.jpg',
			              'PurifiedLands_10.jpg',
			              'PurifiedLands_11.jpg',
			              'PurifiedLands_12.jpg',
			              'PurifiedLands_13.jpg',
			              'PurifiedLands_14.jpg'];
			break;
		case 'TheFelLands':
			var images = ['TheFelLands_00.jpg',
			              'TheFelLands_01.jpg',
			              'TheFelLands_02.jpg',
			              'TheFelLands_03.jpg',
			              'TheFelLands_04.jpg',
			              'TheFelLands_05.jpg',
			              'TheFelLands_06.jpg',
			              'TheFelLands_07.jpg',
			              'TheFelLands_08.jpg',
			              'TheFelLands_09.jpg',
			              'TheFelLands_10.jpg',
			              'TheFelLands_11.jpg',
			              'TheFelLands_12.jpg',
			              'TheFelLands_13.jpg',
			              'TheFelLands_14.jpg',
			              'TheFelLands_15.jpg',
			              'TheFelLands_16.jpg'];
			break;
	}
	if (imgIndex >= images.length) {
		imgIndex = 0;
	} else if (imgIndex < 0) {
		imgIndex = images.length - 1;
	}
	currentImg.src = currentImg.src.replace(/(.+zone\/).*/, '$1' + images[imgIndex]);
	currentImg.parentNode.href = currentImg.src;
}

