/* Add the photos navigation when viewing an product: */
var num_photos = 0;
var spans;
var current_photo = 1;
function add_photo_controls() {
	spans = $('photos').getElementsByTagName('span');
	for(var i=0; i<spans.length; i++) {
		eval("spans["+i+"].onclick = function() { show_photo("+(i+1)+"); }");
		spans[i].style.cursor = 'pointer';
		spans[i].onmouseover = function() { this.style.textDecoration = 'underline'; }
		spans[i].onmouseout = function() { this.style.textDecoration = 'none'; }
		num_photos++;
	}
	$('currentphoto').onclick = function() {
		if($('photonumbers').style.display == 'none') {
			$('photonumbers').style.display = 'block';
		} else {
			$('photonumbers').style.display = 'none';
		}
	}
	$('currentphoto').style.cursor = 'help';
	spans[0].style.fontWeight = 'bold';
}

// /* hide all photo's and display the specified id: * /
function show_photo(id) {
	for(var i=1; i<=num_photos; i++) {
		if(i != id) {
			spans[i-1].style.fontWeight = 'normal';
			$('photo'+i).style.display = 'none';
		} else {
			current_photo = id;
			spans[i-1].style.fontWeight = 'bold';
			$('photo'+i).style.display = 'block';
		}
	}
	$('currentphoto').innerHTML = ''+id+' / '+num_photos;
}

// /* next photo * /
function next_photo() {
	if(current_photo != num_photos) {
		show_photo(current_photo+1);
	}
	return false;
}

// /* previous photo * /
function prev_photo() {
	if(current_photo != 1) {
		show_photo(current_photo-1);
	}
	return false;
}

function showBuyWherePopup(){
	document.getElementById('BuyWherePopup').style.display='block';
}

function closeBuyWherePopup(){
	document.getElementById('BuyWherePopup').style.display='none';
}

// */
