var current_image = 0;

function nextImage() {
	if(current_image < image_count) {
		document.getElementById('image_' + current_image).style.display = 'none';
		current_image++;
		document.getElementById('image_' + current_image).style.display = '';
		document.getElementById('image_num').innerHTML = current_image + 1;
	}
}

function prevImage() {
	if(current_image > 0) {
		document.getElementById('image_' + current_image).style.display = 'none';
		current_image--;
		document.getElementById('image_' + current_image).style.display = '';
		document.getElementById('image_num').innerHTML = current_image + 1;
	}
	return true;
}

function additionalInfoClick(elSrc){
	var elMainInfo = document.getElementById('main_html');
	var elMoreInfo = document.getElementById('more_info');
	var sNodeValue = elSrc.firstChild.nodeValue; 
	elSrc.firstChild.nodeValue = sNodeValue == 'Additional Information' 
		? 'View Review'
		: 'Additional Information';
	elMainInfo.style.display = sNodeValue == 'Additional Information'  ? 'none' : 'block'; 
	elMoreInfo.style.display = sNodeValue == 'Additional Information' ? 'block' : 'none';
	
	return false;
}

function changeCalendar(sDate){
	document.location.href='index.php?id={/literal}{$nBovId}{literal}&sStartDate='+sDate;
}
	
var tab_count=5;
var current_tab = Array();

function switchTab(type, num) {
	if(!current_tab[type]) {
		current_tab[type] = 1;
	}

	if(num == 'left') {
		num = current_tab[type] - 1;
	} else if (num == 'right') {
		num = current_tab[type] + 1;
	}

	if(num > tab_count || num < 1) {
		return false;
	}

	for(i=1; i <= tab_count; i++) {
		if(document.getElementById(type + '_' + i)) {
			if(i == num) {
				document.getElementById(type + '_' + i).style.display = '';
				current_tab[type] = num;
			} 
			else {
				document.getElementById(type + '_' + i).style.display = 'none';
			}
		}
	}

	if(current_tab[type] != num) {
		switchTab(type, current_tab[type]);
	}

	return false;
}
