function checkForm(that) {
	var errmsg = '';
	if (that.name.value.length < 1) {
		errmsg += '-> Enter your name\n';
	}
	if (that.email.value.length < 1) {
		errmsg += '-> Enter your e-mail address\n';
	}
	if (!isValidEmail(that.email.value)) {
		errmsg += '-> Enter a valid e-mail address\n';
	}
	if (that.comments.value.length < 1) {
		errmsg += '-> Enter a message\n';
	}
	if (that.electrode_diameter.value.length < 1) {
		errmsg += '-> Enter electrode diameter\n';
	}
	if (that.pin_size.value.length < 1) {
		errmsg += '-> Enter connecting pin size\n';
	}
	if (that.thread_pitch.value.length < 1) {
		errmsg += '-> Enter thread pitch\n';
	}
	if (errmsg > '') {
		alert('Oops...please go back and fix the following errors:\n\n'+errmsg);
		return false;
	} else {
		return true;
	}
}

function isValidEmail(address) {
	if (address != '' && address.search) {
		if (address.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
	  	return true;
		} else {
			return false;
	  }
	} else {
		return true;
	}
}

$(document).ready(function() {
	$("a#diag_image").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'hideOnContentClick' : 'true',
		'type' : 'image'
	});
	$('.inputText').focus(function() {  
		$(this).addClass("inputTextFocus");  
	});
	$('.inputText').blur(function() {
		$(this).removeClass("inputTextFocus");
	});
});
