function validateForm(formID) {
	var strng = document.getElementById(formID).email.value;
	var error = "";

	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) { 
		error = "Adresa de mail invalida.\n";
	}

	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (strng.match(illegalChars)) {
	   error = error + "Adresa de mail contine caractere ilegale.\n";
	}

	if (error == "") {
		return true;
	}

	alert(error);
	return false;
}

// functions that handle the slideshow of pictures

function closeOverall() {
	document.getElementById("big_photo").src = "";
	document.getElementById("overall").style.display = "none";
}

function showOverall(photo) {
	h = document.documentElement.clientHeight-30;
	if (h>618) { h=618; };
	document.getElementById("big_photo").height = h;
	document.getElementById("big_photo_link").href = photo;
	document.getElementById("big_photo").src = photo;
	document.getElementById("overall").style.display = "block";
}

function prevOverall() {
	step(false);
}

function nextOverall() {
	step(true);
}

function step(forward) {
	photo = document.getElementById("big_photo_link").href;
	document.getElementById("big_photo_link").href = "";
	num = stripZeros(photo.substring(photo.length-7,photo.length-4));

	if (forward) {
		if (num < (img_nrs-1)*2) num = num + 2;
	} else {
		if (num > 0) num = num - 2;
	}
	
	photo = photo.replace(photo.substring(photo.length-7,photo.length-4), addZeros(num));
	document.getElementById("big_photo_link").href = photo;
  document.getElementById("big_photo").src = "";
	document.getElementById("big_photo").src = photo;
}

function stripZeros(num) {
	if (num.substring(0,1) == "0") num = num.substring(1);
	if (num.substring(0,1) == "0") num = num.substring(1);
	return parseInt(num);
}

function addZeros(num) {
	num = "" + num;
	while (num.length < 3) {
		num = "0" + num;
	}
	return num;
}
