// JavaScript Document
//contains the base functions for the site
function startGallery() {
	$$('img.gallery_hide').removeClass('gallery_hide');
	var myGallery = new gallery($('myGallery'), {
		timed: true,
		delay: 8500,
		showArrows: false,
		showCarousel: false,
		showInfopane: false,
		embedLinks: false,
		fadeDuration: 1750
	});
}
function checkWholeForm(theForm) {
    var why = "";
    why += checkName(theForm.name.value);
    why += checkEmail(theForm.email.value);
    why += checkMessage(theForm.message.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkEmail (strng) {
		var error="";
		if (strng == "") {
		   error = "You didn't enter an email address.\n";
		}
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
			//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

function checkName (strng) {
	var error="";
	if (strng == "") {
	   error = "Please enter your name.\n";
	}
	return error;
}

function checkMessage (strng) {
	var error="";
	if (strng == "") {
	   error = "Please enter a message.\n";
	}
	return error;
}

