function trim(str){
			
				return ltrim(rtrim(str));
			}
			function ltrim(stringToTrim) {
				return stringToTrim.replace(/^\s+/,"");
			}
			function rtrim(stringToTrim) {
				return stringToTrim.replace(/\s+$/,"");
			}
			function checkemail(email)   {
				var at = email.indexOf('@');
				var dot = email.indexOf('.',at);
				var l = email.length ;
				if(at !=-1 && dot !=-1 && dot < l-1)
					return true;
				else return false;
			}
			function checkmobile(mobile)
			{
				var l = mobile.length ;
			
				var i;
				for( i=0;i<l;i++)
					if(mobile.charAt(i) < '0' || mobile.charAt(i) >'9')
						return false; 
				return true;
			}
				
			function validate(form){
			
							
				var name = trim(form.name.value);
				var email = trim ( form.email.value);
				var mobile = trim ( form.mobile.value);
				var college = trim ( form.college.value);
				var password = form.password.value;
				var repassword = form.repassword.value;
				if(name.length == 0 || email.length == 0 || mobile.length == 0 || college.length == 0){
					alert("All fields are mandatory ! ");
					return(true);
				}
				
				if(!checkmobile(mobile)){
				alert("Enter a valid mobile number ! ");
				return true;
				}
				if(!checkemail(email)) {
			    alert("Enter a valid email address ! ");
				return true ;
				}
				 if(password.length < 6) {
				alert("Password should contain a minimum of 6 characters !");
				return true;
				}
				if(password != repassword ){
				alert("The retyped password doesnt match the original password ! ");
			    return true;
				}
				form.submit();	
			}