	function validateCommentForm() {
		var name=document.frmComment.txtCommentFullName.value;
		var content=document.frmComment.txtCommentContent.value;
		var email=document.frmComment.txtCommentEmail.value;
		var msg="";
		if(content.length >450) {
			msg+="The length of the comment/question should be less than 450\n";
		} 
		if(content.length ==0) {
			msg+="No content provided\n";	
		}	
		if(name.length==0) {
			msg+="Please provide the name\n";	
		}					
		if(name.length>50) {
			msg+="Name should be less than 50 characters\n";	
		}
		if(email.length ==0) {
			msg+="The email field should not be empty\n";
		}
		if(/^\w+([\._]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
			
		} else {
			msg+="The email is invalid";
		}
		if(msg!="") {
			msg="Please check the following errors\n\n"+msg;
			alert(msg);
			return false;
		} else {
			return true;
		}											
	}
	
	function getCommentPostElements(frmComment) {
		var str="";
		for(var i=0;i<frmComment.elements.length;i++) {
			str+=frmComment.elements[i].name+"="+frmComment.elements[i].value+"&";
		}
		return str;
	}
	
	function setCommentElementsStatus(frmComment,flag) {
		frmComment.txtCommentFullName.disabled=flag;
		frmComment.txtCommentEmail.disabled=flag;
		frmComment.txtCommentContent.disabled=flag;
		frmComment.submitcmnt.disabled=flag;
	}
	
	function postCommentRequest(objID,path) {
		var obj=document.getElementById(objID); // get the html object using objID
		var processingText="<div class=\"ajax_processing_image\"><img src=\"../resources/images/ajax-loader.gif\"></div><div class=\"ajax_processing_text\"><span class=\"body_text_normal_bold\">Posting Comment/Question... please wait</span></div>";
		var validated=validateCommentForm();
		if(!validated) {
			return false;
		}
		obj.innerHTML=processingText;
		var str= getCommentPostElements(document.frmComment);	
		xmlHTTP=getXmlHttpObject();		
		xmlHTTP.open("POST",path+"PostCommentRequest.php",true);
		xmlHTTP.setRequestHeader("Content-Type",
		"application/x-www-form-urlencoded; charset=UTF-8");	
		xmlHTTP.onreadystatechange=function () {		
			if(xmlHTTP.readyState==4 ) {
				obj.innerHTML=xmlHTTP.responseText;
				setCommentElementsStatus(document.frmComment,true);
			} else {
				obj.innerHTML=processingText;	
			}
		}
		xmlHTTP.send(str);		
		return false;
	}

