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)   return false;
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) return false;
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;
	if (str.indexOf(at,(lat+1))!=-1) return false;
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;
	if (str.indexOf(dot,(lat+2))==-1) return false;
	if (str.indexOf(" ")!=-1) return false;

	return true					
}

function isInteger(s) { 
	if (s=='') return true; 
	var digitsRequired = 4;
	var i; 
	for (i = 0; i < s.length; i++) { 
		var c = s.charAt(i); 
		if (((c < "0") || (c > "9"))) return false; 
	} 
	if (s.length == digitsRequired) { return true; } else { return false; } 
	return true; 
}


function ValidateForm() {
	var message='';
	var type = document.theForm.v1;
	var feedbackarea = document.theForm.v2;
	var name = document.theForm.v5;
	var emailID = document.theForm.v6;
	var phone = document.theForm.v7;
	var classification = document.theForm.v8;
	
/*	var desc='';*/
/*
		surname = document.theForm.v3;
		firname = document.theForm.v2;
		city = document.theForm.City;
		institution = document.theForm.v5;
		country = document.theForm.Country;
		desc = document.theForm.v16;*/

	if (type.value=='') {
		message+="Please select feedback type\n";
		type.focus();
	}
	if (feedbackarea.value=='') {
		message+="Please select feedback type\n";
		feedbackarea.focus();
	}
	
	if (name.value=='') {
		message+="Please enter your Name\n";
		name.focus();
		}
	if ((emailID.value==null)||(emailID.value=="")) {
		message+="Please enter your Email Address\n";
		emailID.focus();
	} else if (echeck(emailID.value)==false) {
		message+="Please enter a valid Email Address\n";
		emailID.value="";
		emailID.focus();
	}
	if (phone.value=='') {
		message+="Please enter your phone number\n";
		phone.focus();
	}
	if (classification.value=='') {
		message+="Please enter your classification\n";
		classification.focus();
	}
	if (message!='') {
		alert(message);
		return false;
	} else return true;
}
