// JavaScript Document for lscb.org.uk

/* Created: 31/05/2006
   Last modified: 31/05/2006
   Project by: www.mediascopeltd.com */
   
<!--

// DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)

function echeck(str) {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1){
		alert("Invalid E-mail address.");
		return false;
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		alert("Invalid E-mail address.");
		return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid E-mail address.");
		return false;
	}
	if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid E-mail address.");
		return false;
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid E-mail address.");
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid E-mail address.");
		return false;
	}
	if (str.indexOf(" ")!=-1){
		alert("Invalid E-mail address.");
		return false;
	}
	return true;					
}

function ValidateEmail(){
	var emailID=document.form1.Email;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email address.");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
	}
	return true;
 }

<!-- Original: wsabstract.com -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

function checkrequired(which) {
var pass=true;
if (document.images) {
	for (i=0;i<which.length;i++) {		
		var tempobj=which.elements[i];
		if (tempobj.type) {
			if (tempobj.name.substring(0,3)=="req") {
				//alert ("This element begins with req");
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==0)) {
					pass=false;
					break;
				}
			}
		}
    }
}
/*if (!document.form.reqDeclarationAgreement.checked) {
	alert ("You must agree to the declaration before continuing.");
	return false;
}*/

if (!pass) {
	shortFieldName=tempobj.name.substring(3,40);
	alert("Please fill in the '"+shortFieldName+"' field.");
	return false;
}
else
	return true;
}
//-->
