// Case study toggle

function toggle(targetId) {

  if (document.getElementById) {

  		target = document.getElementById( targetId );

  			if (target.style.display == "none") {

  				target.style.display = "";

  			} else {

  				target.style.display = "none";

  			}

  	}

}



function togglehide(targetId) {

  if (document.getElementById) {

  		target = document.getElementById( targetId );

		target.style.display = "none";

  }

}





// Spam blocker

function nospam(user,domain) {

	locationstring = "mailto:" + user + "@" + domain;

	window.location = locationstring;

}



function validateString(field, msg, min, max) {

	if (!min) { min = 1 }

	if (!max) { max = 65535 }

	if (!field.value || field.value.length < min || 

	field.value.max > max) {

	alert(msg);

	field.focus();

	field.select();

	return false;

	}



return true;

}



function validateEmail(email, msg, optional) {

	if (!email.value && optional) {

	return true;

	}

	var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;

	if (!re_mail.test(email.value)) {

	alert(msg);

	email.focus();

	email.select();

	return false;

	}

	return true;

	}



