function trimAll(sString) 
{
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function checkPaperSubmit(){
	if(trimAll(document.frmPaperSubmit.PaperTitle.value)==''){
		alert('Please Specify  your Paper Title');
		document.frmPaperSubmit.PaperTitle.value = '';
		document.frmPaperSubmit.PaperTitle.focus();
		return false;
	}
	if( document.frmPaperSubmit.PaperType.value =='None Selected'){
		alert('Please select your Paper Type');
		document.frmPaperSubmit.PaperType.focus();
		return false;
	}
	if( document.frmPaperSubmit.PaperArea.value =='None Selected'){
		alert('Please select your Paper\'s Area');
		document.frmPaperSubmit.PaperArea.focus();
		return false;
	}
	if(trimAll(document.frmPaperSubmit.Abstract.value) ==''){
		alert('Please put your Paper\'s Manuscript/Abstract');
		document.frmPaperSubmit.Abstract.focus();
		return false;
	}	
	if(trimAll(document.frmPaperSubmit.Password.value) ==''){
		alert('Please specify your Password!');
		document.frmPaperSubmit.Password.focus();
		return false;
	}
	if(document.frmPaperSubmit.Password.value.length<6){
		alert('Password should be Larger than 6 Characters');
				document.frmPaperSubmit.Password.focus();
		return false;
	}
	
	if(trimAll(document.frmPaperSubmit.ConfirmPassword.value) ==''){
		alert('Please specify your Confirm Password!');
		document.frmPaperSubmit.ConfirmPassword.focus();
		return false;
	}
	if(trimAll(document.frmPaperSubmit.Password.value) != trimAll(document.frmPaperSubmit.ConfirmPassword.value)){
		alert('Password miss matched!');
		document.frmPaperSubmit.Password.select();
		return false;
	}
	
	if(trimAll(document.frmPaperSubmit.FirstName1.value) ==''){		

		alert('Please specify Authore\'s First Name!');
		document.frmPaperSubmit.FirstName1.focus();
		return false;
	}
	if(trimAll(document.frmPaperSubmit.LastName1.value) ==''){
		alert('Please specify Authore\'s Last Name!');
		document.frmPaperSubmit.LastName1.focus();
		return false;
	}
	<!--if(trimAll(document.frmPaperSubmit.Title1.value) ==''){
		alert('Please specify Authore\'s Title1!');
		document.frmPaperSubmit.Title1.focus();
		return false;
	}-->
	if(trimAll(document.frmPaperSubmit.University1.value) ==''){
		alert('Please specify Affiliation - University!');
		document.frmPaperSubmit.University1.focus();
		return false;
	}
	if(trimAll(document.frmPaperSubmit.Department1.value) ==''){
		alert('Please specify Affiliation - Department!');
		document.frmPaperSubmit.Department1.focus();
		return false;
	}
	
	if(trimAll(document.frmPaperSubmit.Email1.value)==''){
		alert('Email1 can not be empty');
		document.frmPaperSubmit.Email1.value = '';
		document.frmPaperSubmit.Email1.focus();
		return false;
	}
	else{
		var atpos = document.frmPaperSubmit.Email1.value.indexOf('@');
		if(atpos < 0){
			alert('Please enter your Email1 address in a valid format');
			document.frmPaperSubmit.Email1.select();
			return false;
		}
		else if(atpos == 0){
			alert('This is nto a valid Email1 address')
			document.frmPaperSubmit.Email1.select();
			return false;
		}
		else{
			var domainname = new Array(15);
			domainname[0] = 'com'; 
			domainname[1] = 'net'; 
			domainname[2] = 'org'; 
			domainname[3] = 'edu'; 
			domainname[4] = 'int'; 
			domainname[5] = 'mil'; 
			domainname[6] = 'gov'; 
			domainname[7] = 'arpa'; 
			domainname[8] = 'biz'; 
			domainname[9] = 'aero'; 
			domainname[10] = 'name'; 
			domainname[11] = 'coop'; 
			domainname[12] = 'info'; 
			domainname[13] = 'pro'; 
			domainname[14] = 'museum'; 
		
			var t = document.frmPaperSubmit.Email1.value.substr((atpos+1),document.frmPaperSubmit.Email1.value.length);
			if(t.indexOf('.')<1){
				alert("This is not a valid Email1 address");
				return false;
			}
			var outp = '';
			for (i = 0; i <= t.length; i++) { 
    			outp = t.charAt (i) + outp 
  			} 
			var dotpos = outp.indexOf('.');
			var domain = outp.substr(0,dotpos);
			var realdomian = ''
			for (j = 0; j <= domain.length; j++) { 
    			realdomian = domain.charAt (j) + realdomian 
  			} 
			
			if(realdomian.length > 2){
				var result = 0;
				for(k=0;k < 15;k++){
					if(domainname[k] == realdomian){
						result = 1;
					}	
				}
				if(result < 1){
					alert('This is not a valid top level domain.Please check it');
					document.frmPaperSubmit.Email1.select();
					return false;
				}		
			}
			else{
				if(realdomian.length != 2){
					alert('Please ckeck the Email1 address you have enter.This is not a valid address');
					document.frmPaperSubmit.Email1.select();
					return false;
				}			
			}	
		}
		var whitepos = document.frmPaperSubmit.Email1.value.indexOf(' ');
		if(whitepos > -1){
			alert('This is not a valid format.Email1 address can not white space');
			document.frmPaperSubmit.Email1.select();
			return false;
		}
		
	}		
	if(trimAll(document.frmPaperSubmit.ContactPerson.value)==''){
		alert('Please specify Corresponse Author Name');
		document.frmPaperSubmit.ContactPerson.value = '';
		document.frmPaperSubmit.ContactPerson.focus();
		return false;
	}
	if(trimAll(document.frmPaperSubmit.Address.value)==''){
		alert('Please specify Address Name');
		document.frmPaperSubmit.Address.value = '';
		document.frmPaperSubmit.Address.focus();
		return false;
	}
	if(trimAll(document.frmPaperSubmit.Address.value)==''){
		alert('Please specify Address Name');
		document.frmPaperSubmit.Address.value = '';
		document.frmPaperSubmit.Address.focus();
		return false;
	}
	if(trimAll(document.frmPaperSubmit.Email.value)==''){
		alert('Email1 can not be empty');
		document.frmPaperSubmit.Email.value = '';
		document.frmPaperSubmit.Email.focus();
		return false;
	}
	else{
		var atpos = document.frmPaperSubmit.Email.value.indexOf('@');
		if(atpos < 0){
			alert('Please enter your Email address in a valid format');
			document.frmPaperSubmit.Email.select();
			return false;
		}
		else if(atpos == 0){
			alert('This is nto a valid Email1 address')
			document.frmPaperSubmit.Email.select();
			return false;
		}
		else{
			var domainname = new Array(15);
			domainname[0] = 'com'; 
			domainname[1] = 'net'; 
			domainname[2] = 'org'; 
			domainname[3] = 'edu'; 
			domainname[4] = 'int'; 
			domainname[5] = 'mil'; 
			domainname[6] = 'gov'; 
			domainname[7] = 'arpa'; 
			domainname[8] = 'biz'; 
			domainname[9] = 'aero'; 
			domainname[10] = 'name'; 
			domainname[11] = 'coop'; 
			domainname[12] = 'info'; 
			domainname[13] = 'pro'; 
			domainname[14] = 'museum'; 
		
			var t = document.frmPaperSubmit.Email.value.substr((atpos+1),document.frmPaperSubmit.Email.value.length);
			if(t.indexOf('.')<1){
				alert("This is not a valid Email address");
				return false;
			}
			var outp = '';
			for (i = 0; i <= t.length; i++) { 
    			outp = t.charAt (i) + outp 
  			} 
			var dotpos = outp.indexOf('.');
			var domain = outp.substr(0,dotpos);
			var realdomian = ''
			for (j = 0; j <= domain.length; j++) { 
    			realdomian = domain.charAt (j) + realdomian 
  			} 
			
			if(realdomian.length > 2){
				var result = 0;
				for(k=0;k < 15;k++){
					if(domainname[k] == realdomian){
						result = 1;
					}	
				}
				if(result < 1){
					alert('This is not a valid top level domain.Please check it');
					document.frmPaperSubmit.Email.select();
					return false;
				}		
			}
			else{
				if(realdomian.length != 2){
					alert('Please ckeck the Email address you have enter.This is not a valid address');
					document.frmPaperSubmit.Email.select();
					return false;
				}			
			}	
		}
		var whitepos = document.frmPaperSubmit.Email.value.indexOf(' ');
		if(whitepos > -1){
			alert('This is not a valid format.Email address can not white space');
			document.frmPaperSubmit.Email.select();
			return false;
		}
	}
}
<!------------------------------------------------------------------------------------------------>
function checkLogin(){
	if(trimAll(document.frmLogin.PaperID.value)==''){
		alert('Please Specify  your Paper ID');
		document.frmLogin.PaperID.value = '';
		document.frmLogin.PaperID.focus();
		return false;
	}
	if(isNaN(document.frmLogin.PaperID.value)){
		alert('Please Specify  your Paper ID in number');
		document.frmLogin.PaperID.value = '';
		document.frmLogin.PaperID.focus();
		return false;
	}
	if(trimAll(document.frmLogin.Password.value)==''){
		alert('Please Specify  your Password');
		document.frmLogin.Password.value = '';
		document.frmLogin.Password.focus();
		return false;
	}
}



