function Init_AJAX() {
try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
alert("XMLHttpRequest not supported");
return null;
};


function validateComment(form) {
			if(form.articleid.value==""){
				alert("Invalid article!");
			}else{
                if (form.comments.value.length==0) {
                    alert("please enter your comments");
                 }
			     else{             
                     var httpRequest= Init_AJAX();
        			 actionURL="article.php";
        		  	 var today = new Date().getTime();
        			 actionURL+="?timeS="+today;
					 var posData ="articleid="+form.articleid.value+"&comment="+form.comments.value;	 
					 //alert(actionURL);
					 httpRequest.onreadystatechange = function() { showComments(httpRequest); };
        		     httpRequest.open("POST", actionURL,true);
        			 httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        	         httpRequest.send(posData);
        		}
			}	
		}
		
function showComments(httpRequest){
    if (httpRequest.readyState == 4) {

        if (httpRequest.status == 200) {
			   document.getElementById('viewcomments').innerHTML=httpRequest.responseText;
		}else {
                alert('There was a problem with the request.');
           }
    }
}		