// JavaScript Document
function validateCform(){

if(document.commentForm.name.value == ""){
		alert("Please fill Name");
		document.commentForm.name.focus();
		document.commentForm.name.select();
		return false;	
	}	

if(document.commentForm.email.value == ""){
		alert("Please fill Email");
		document.commentForm.email.focus();
		document.commentForm.email.select();
		return false;	
	}		
if(document.commentForm.email.value != "" ){	
				var EmailOk  = true
				var Temp     = document.commentForm.email.value
				var AtSym    = Temp.indexOf('@')
				var Period   = Temp.lastIndexOf('.')
				var Space    = Temp.indexOf(' ')
				var Length   = Temp.length - 1   // Array is from 0 to length-1

				if ((AtSym < 1) ||                     // '@' cannot be in first position
	    		(Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
	    		(Period == Length ) ||             // Must be atleast one valid char after '.'
	    		(Space  != -1))                    // No empty spaces permitted
	   		{
	    		  EmailOk = false;
	    		  alert('Please enter a valid e-mail address.');
				  document.commentForm.email.focus();
				  document.commentForm.email.select();
				  if(EmailOk == false)
	    		  return EmailOk;
	   	}
	}	
	
if(document.commentForm.comment.value == ""){
		alert("Please leave a comment");
		document.commentForm.comment.focus();
		document.commentForm.comment.select();
		return false;	
	}
if(document.commentForm.code.value == ""){
		alert("Please fill the code in image");
		document.commentForm.code.focus();
		document.commentForm.code.select();
		return false;	
	}

		return true;
}
