
function popImagePG(imageURL, imageTitle, thumb_name, w, h)
{
	PopupPic(imageURL.replace(thumb_name, "thumbs800x600/"), imageTitle, w, h);
}

function PopupPic(sPicURL, title, w, h) { 
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height=100,width=100,top='+wint+',left='+winl+'resizable=0';
  	window.open(base_href + "picturedetail.html?" + sPicURL + "&" + title + "", "", winprops);
}


function gallery_move(offset)
{
	if (gallery_localita_images_len < 1)
		return;
	var img_el = document.getElementById('gallery_localita_big');
	
	// gallery_localita_images_len
	var pos = gallery_localita_images_pos + offset;
	if (pos >= gallery_localita_images_len)
		pos = gallery_localita_images_len - 1;
	if (pos < 0)
		pos = 0;
		
	img_el.src = gallery_localita_images[pos];
	gallery_localita_images_pos = pos;
}


function gallery_move2(offset)
{
	if (gallery_localita_images_len < 4)
		return;
	var img_el1 = document.getElementById('gallery_localita_big1');
	var img_el2 = document.getElementById('gallery_localita_big2');
	var img_el3 = document.getElementById('gallery_localita_big3');
	
	var pos = gallery_localita_images_pos + offset;
	if (pos + 3 >= gallery_localita_images_len)
		pos = gallery_localita_images_len - 3;
	if (pos < 0)
		pos = 0;
		
	img_el1.src = gallery_localita_images[pos];
	img_el2.src = gallery_localita_images[pos+1];
	img_el3.src = gallery_localita_images[pos+2];
	gallery_localita_images_pos = pos;
}

function check_form(form)
{
	var date_1 = form.periodo_1.value;
	var date_2 = form.periodo_2.value;
	if (date_1 != '' && date_2 != '')
		if (date_1 > date_2)
		{
			alert('The end date cannot be smaller than the start date!');
			form.periodo_2.value = date_1;
			return false;
		}
		else { }
	else
	{
		alert('You need to fill out all the fields!');
		return false;
	}
	
	return true;
}

function show_img(src)
{
	Modalbox.show('<img src="' + src + '" style="width: 800px; cursor: pointer;" onclick="Modalbox.hide();" />', {title: '&nbsp', width: '820', height: '600'});
	// Modalbox.resizeToContent();
}
