var i=0;

function get_random_img() {
	// String before random number
	var imgPrefix = "<img src='/pics/slideshow";
	// String after random number
	var imgSuffix = ".jpg' width='214' height='51' vspace='15' id='slide'>";
	// Generate random number between 1 and 5
	var ranNum = Math.round(Math.random() * 3);
	// Build image name
	var imgName = imgPrefix + ranNum + imgSuffix;
	return imgName;
}

function slideshow(){
	myslide=document.getElementById('slide');
	myslide.setAttribute("src", "pics/slideshow"+i+".jpg");
	i++;
	if(i>3){
		i=0;
	}
}

function ValidateContact(form) {
	with (form) {
		if (!realname.value || !email.value || !question.value) {
			alert("Please fill in all the fields");
			return false;
		} else {
			// validate e-mail address
			with (email) {
				apos = value.indexOf("@"); 
				dotpos = value.lastIndexOf(".");
				lastpos = value.length - 1;
				if (apos < 1 || dotpos - apos < 2 || lastpos - dotpos > 3 || lastpos - dotpos < 2) {
					alert("Your e-mail address does not appear to be valid.");
					return false;
				} else {
					return true;
				}
			}
		}
	}
}

function ValidateQuote(form) {
	with (form) {
		if (!realname.value || !email.value) {
			alert("Please fill in all the required fields");
			return false;
		} else {
			// validate e-mail address
			with (email) {
				apos = value.indexOf("@"); 
				dotpos = value.lastIndexOf(".");
				lastpos = value.length - 1;
				if (apos < 1 || dotpos - apos < 2 || lastpos - dotpos > 3 || lastpos - dotpos < 2) {
					alert("Your e-mail address does not appear to be valid.");
					return false;
				} else {
					return true;
				}
			}
		}
	}
}
