/** This file contains the js validations of testimony form **/

function validateWitness()
{

var filename,extension;
filename=document.frm1.file1.value;
extension = filename.substring(filename.length - 3, filename.length);

/*Name validation starts*/
if (document.frm1.fname.value=="" ||document.frm1.fname.value==null ){
 	alert("Please Enter Your Name");
 	document.frm1.fname.focus();
 	return(false);
} else {
	isNameValid=onlyAlphaValidation(document.frm1.fname.value);
	if(!isNameValid){
		alert("Please Enter a valid First Name");
		return false;
	}
}
/*Name validatiion ends*/
		
/*Place validation starts*/	
if (document.frm1.place.value=="" || document.frm1.place.value==null){
	 alert("Please Enter Your Residing Place");
	 document.frm1.place.focus();
	 return(false);
} else {
	isPlaceValid=onlyAlphaValidation(document.frm1.place.value);
	if(!isPlaceValid){
		alert("Please Enter a valid Place");
		return false;
	}
}
/*Place validation ends*/	

/*Witness title validation starts*/	
if (document.frm1.ttitle.value=="" || document.frm1.ttitle.value==null) {
	 alert("Please Enter Title of the Witness");
	 document.frm1.ttitle.focus();
	 return(false);
} else {
	isOnlyNumbers = onlyNumbers(document.frm1.ttitle.value);
	if(isOnlyNumbers){
		alert("Please Enter a valid Title for your witness");
		return false;
	}else{
		isTitleValid=textvalidation(document.frm1.ttitle.value);
		if(!isTitleValid){
			alert("Please Enter a valid Title for your witness");
			return false;
		}
	}
}
/*Witness title validation ends*/	

/*Witness validation starts*/	
if (document.frm1.feedback.value=="" || document.frm1.feedback.value==null){
	 alert("Please Enter Your Witness");
	 document.frm1.feedback.focus();
	 return(false);
} else {
	isWitnessValid=textvalidation(document.frm1.feedback.value);
	if(!isWitnessValid){
		alert("Please Enter a valid witness");
		return false;
	}
}
/*Witness validation ends*/	

if ((filename.length>0)&&(extension.toUpperCase() != 'JPG' && extension.toUpperCase() != 'JPEG' && extension.toUpperCase() != 'GIF' && extension.toUpperCase() != 'PNG')) {
	alert("Kindly Select the  Valid Image Fie (JPG/JPEG/GIF/PNG).");
	return(false);
}
return true;
}