var photoIndex = 0;
function pagerReset() {
	if (photoIndex > 0) {
		document.getElementById('prev_photo_1').disabled = false;
		document.getElementById('prev_photo_2').disabled = false;
	} else {
		document.getElementById('prev_photo_1').disabled = true;
		document.getElementById('prev_photo_2').disabled = true;
	}
	if (photoIndex < photoCount - 1) {
		document.getElementById('next_photo_1').disabled = false;
		document.getElementById('next_photo_2').disabled = false;
	} else {
		document.getElementById('next_photo_1').disabled = true;
		document.getElementById('next_photo_2').disabled = true;
	}
	document.getElementById('photo_number_1').innerHTML = photoIndex+1;
	document.getElementById('photo_number_2').innerHTML = photoIndex+1;
}
function nextPhoto() {
	document.getElementById('photo_'+photoIndex).style.display = 'none';
	photoIndex++;
	if (photoIndex > photoCount - 1) {
		photoIndex = 0;
	}
	document.getElementById('photo_'+photoIndex).style.display = 'block';
	pagerReset();
}
function prevPhoto() {
	document.getElementById('photo_'+photoIndex).style.display = 'none';
	photoIndex--;
	document.getElementById('photo_'+photoIndex).style.display = 'block';
	pagerReset();
}
function showPhoto(showIndex) {
	document.getElementById('photo_'+photoIndex).style.display = 'none';
	photoIndex = showIndex;
	document.getElementById('photo_'+showIndex).style.display = 'block';
	pagerReset();
}
function bigMapInit(latitude, longitude, name) {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById('big_gmap_ctrl'));
		map.setCenter(new GLatLng(latitude, longitude), 13);
		var point = map.getCenter();
		var marker = new GMarker(point);
		map.addOverlay(marker);
		map.openInfoWindow(map.getCenter(), name);
		map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(5,15)));
	} else {
		alert('Not compatible browser. Map loading failed.')
	}
}
function smallMapInit(latitude, longitude) {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById('small_gmap_ctrl'));
		map.setCenter(new GLatLng(latitude, longitude), 14);
		var point = map.getCenter();
		var marker = new GMarker(point);
		map.addOverlay(marker);
	} else {
		alert('Not compatible browser. Map loading failed.')
	}
}
function slideShow(photoCount, idPrefix, objName) {
	this.photoCount = photoCount;
	this.idPrefix = idPrefix;
	this.objName = objName;
}
slideShow.prototype = {
	 timeInterval:3000
	,photoIndex:0
	,start:function() {
		this.slideShow = setInterval(this.objName+'.next()', this.timeInterval);
	}
	,stop:function() {
		clearInterval(this.slideShow);
	}
	,next:function() {
		document.getElementById(this.idPrefix+this.photoIndex).style.display = 'none';
		this.photoIndex++;
		if (this.photoIndex > this.photoCount - 1) {
			this.photoIndex = 0;
		}
		document.getElementById(this.idPrefix+this.photoIndex).style.display = 'block';
	}
	,prev:function() {
		document.getElementById(this.idPrefix+this.photoIndex).style.display = 'none';
		this.photoIndex--;
		document.getElementById(this.idPrefix+this.photoIndex).style.display = 'block';
	}
}
function returnIdElement(id) {
	if (document.getElementById) {
		var returnVar = document.getElementById(id);
	}
	else if (document.all) {
		var returnVar = document.all[id];
	}
	else if (document.layers) {
		var returnVar = document.layers[id];
	}
	return returnVar;
}
