




function loginAction(userId,password,whichPartOfComments,contextPath)
		{
			
			document.getElementById("cms.component.emailForm");
			//alert("going for ajax:>"+userId+"<------->"+password);
			//var req2=null;
			
			//return true;
			
		

			if (window.XMLHttpRequest) 
	           {
              //    Tries to create a new request object and XMLHttpRequest is the type of request object
		          req2= new XMLHttpRequest();
               } 
	           else if (window.ActiveXObject) 
	           {
                  //	Tries to create a new request object but in a way that works on IExplorer
	                 req2 = new ActiveXObject('Microsoft.XMLHTTP');
	           }	

				req2.onreadystatechange = processReqChange;
				var strparams="userId="+userId+"&password="+password+"&which="+whichPartOfComments;
				var url=contextPath+'/CommentloginAjaxServlet?'+strparams;
				//alert("url="+url);
				req2.open('POST', url, true);
               //   alert("url2="+url);
				
				req2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				req2.send(strparams);	
				//showMailForm(articleId);
		}

		function processReqChange()
		{
			// when readystate is set to 4 ,the server is done with the request'
		    if (req2.readyState == 4) 
			{
			// server sends status of 200 when everything is ok
			    if (req2.status == 200) 
				{
					//alert('req2.responseText='+req2.responseText);
					var httpreq=req2.responseText;
					
					//alert("httpreq="+httpreq);
						if(httpreq.match("userAuth=false")=='userAuth=false')
							alert("User is Not Authenticated ");
						else if(httpreq.match("userAuth=true")=='userAuth=true'){
							//alert("User is Authenticated ");
							startId=httpreq.indexOf('+');
							if(startId!=-1){
							newString= httpreq.substring(startId+1);
							endId=newString.indexOf('+');
							}
						if(startId!=-1 && endId!=-1)
							emailId=newString.substring(0,endId);


							if(httpreq.match("postComments")=='postComments'){

								//alert("emailId"+emailId);
							   commentsPost(true,emailId,true);
							}
							else if(httpreq.match("abuse")=='abuse'){
								makeReportAbuse(false,emailId,false);
							}
							else if(httpreq.match("reply")=='reply'){	
								makeReply(true,emailId,false);
							}
							
							
							
							
							
							
							
							
							
							
							
							
							}
						else
							alert("Some problem has arised");


							
				}
			}
		}
		
	
		function commentsPostAfterLogin(post_condition,emailId)
		{
			
			var captchaimg = document.frm.captchaimg.value;
			//alert(captchaimg)
			var flag = false;
			if (post_condition){
				state = 'visible';
				}
			else{
				state = 'hidden';
			}
			    

		 
		 param = document.frm.commentTitle.value;
			var ctitle=	description(param,"Title");
			if(!ctitle){
				return false;
			}
		 param1 = document.frm.commentDesc.value;
			var cdesc = description(param1,"Description");
			if(!cdesc) {
				return false;
			}
		 param2 = document.frm.authorName.value;
		  var cname=description(param2,"Name");
			 if(!cname){
			   return false;
			 }
		 var cname=validName(param2);
		 if(!cname){
		   return false;
		 }


		var param3 = document.frm.authorEmail.value;
		 var cmail=emailValidation(param3);
		 if(!cmail){
		   return false;
		 }
		
		var captchafieldObj = document.frm.captchafield.value;	

		
		
		var irrelevantObj = eval("document.frm.commentMail").value;

        // alert("emailId"+emailId);
		//alert("irrelevantObj"+irrelevantObj);
		if(emailId != irrelevantObj) 
		{		
							
			alert('Wrong Email Id..');
			return false;
		}	
		if(captchafieldObj == "")
		{
			
		alert('Please put valid code');
		return false;
			}
			clearData();
			
		
		
				makeRequest('/cms/components/comments/postCommentsStore.jsp','commentTitle='+param+
							'&'+'commentDesc='+param1+'&'+'authorName='+param2+
							'&'+'authorEmail='+param3+
							'&'+'aid='+a_id+
								'&'+'endUserId='+endUserId+
								'&'+'image='+captchafieldObj);
			
				//document.getElementById("mainTabContainer").selectedTab="tab1";	
				
									//document.getElementById("CommentsPostForm").style.visibility="hidden";
									//document.getElementById("cms.component.loginForm").style.visibility="hidden";
									//document.getElementById("cms.component.loginForm").style.display="none";
									//document.getElementById("success").style.visibility="visible";


			// location.href=location.href; 
			
			//if (document.all) { //IS IE 4 or 5 (or 6 beta)
				//eval( "document.all.div_frm"+ ".style.visibility = state");
			//}
			//if (document.layers) { //IS NETSCAPE 4 or below
			//	document.layers['div_frm'].visibility = state;
			//}
			//if (document.getElementById && !document.all) {
			//	maxwell_smart = document.getElementById('div_frm');
			//	maxwell_smart.style.visibility = state;
			//}

		}	
