
var xmlHttp

 
function aticleRecommend(post_id,c_id)
{
	c_id=c_id;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(post_id==''){
		  document.getElementById('showrecmon_'+c_id).style.visibility='visible';
	}else{
		  document.getElementById('showrecmon_'+c_id).style.display='none';
		  document.getElementById('showdisrecmon_'+c_id).style.visibility='visible';
		  url = '/index/rec?post_id='+post_id+'&c_id='+c_id;
		 
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showdisrecmon_"+c_id).innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}

function aticleRecommendunder(post_id,c_id)
{
	c_id=c_id;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(post_id==''){
		  document.getElementById('showrecmon_'+c_id).style.visibility='visible';
	}else{
		  document.getElementById('showrecmon_'+c_id).style.display='none';
		  document.getElementById('showdisrecmon_'+c_id).style.visibility='visible';
		  url = '/index/rec?post_id='+post_id+'&c_id='+c_id;
		 
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showdisrecmon_"+c_id).innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}

function aticleRecommendlower(post_id,c_id)
{
	c_id=c_id;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(post_id==''){
		  document.getElementById('showrecmonlower_'+c_id).style.visibility='visible';
	}else{
	    	return aticleRecommendunder(post_id,c_id)
		  document.getElementById('showrecmonlower_'+c_id).style.display='none';
		  document.getElementById('showdisrecmonlower_'+c_id).style.visibility='visible';
		  url = '/index/reclower?post_id='+post_id+'&c_id='+c_id;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showdisrecmonlower_"+c_id).innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}

function aticleRecommendlowerunder(post_id,c_id)
{
	c_id=c_id;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(post_id==''){
		  document.getElementById('showrecmonlower_'+c_id).style.visibility='visible';
	}else{
		  document.getElementById('showrecmonlower_'+c_id).style.display='none';
		  document.getElementById('showdisrecmonlower_'+c_id).style.visibility='visible';
		  url = '/index/reclower?post_id='+post_id+'&c_id='+c_id;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showdisrecmonlower_"+c_id).innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}

function groupRecommend(g_id,ds_id,c_id)
{
	c_id=c_id;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(g_id==''){
		  document.getElementById('showgrouprecmon_'+c_id).style.visibility='visible';
	}else{
		  document.getElementById('showgrouprecmon_'+c_id).style.visibility='hidden';
		  document.getElementById('showdisgrouprecmon_'+c_id).style.visibility='visible';
		  url = '/group/grouprec?ds_id='+ds_id+'&c_id='+c_id+'&g_id='+g_id;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showdisgrouprecmon_"+c_id).innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}

function showsubgroupcat(gcat_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(gcat_id==''){
		  //document.getElementById('showsubcat').style.visibility='visible';
	}else{
		  //document.getElementById('showsubcat').style.display='none';
		  //document.getElementById('showsubcatbycat').style.visibility='visible';
		  if(gcat_id!=""){
		    url = '/group/subcat?gcat_id='+gcat_id;
		  }
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showsubcatbycat").innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}  

function showsubsearchgroupcat(gcat_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
	if(gcat_id==''){
		  document.getElementById('showserchsubcat').style.visibility='visible';
	}else{
		  document.getElementById('showserchsubcat').style.display='none';
		  document.getElementById('showsearchsub').style.visibility='visible';
		  url = '/group/subsearchcat?gcat_id='+gcat_id;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showsearchsub").innerHTML=xmlHttp.responseText;
				
			}		

		}
	xmlHttp.send(null);
}

function addFavouties(post_id,c_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   document.getElementById('enstar'+c_id).style.display='none'; 
   document.getElementById('disstar'+c_id).style.visibility='visible';
   url = '/post/favouties?post_id='+post_id+'&c_id='+c_id;
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				
				document.getElementById("disstar"+c_id).innerHTML=xmlHttp.responseText;
				
			}		

		}
	xmlHttp.send(null);
}

function groupnameCheck(val)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   document.getElementById('dupgname').style.visibility='visible';
   url = '/group/groupname?gname='+val;
	// alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				
				document.getElementById("dupgname").innerHTML=xmlHttp.responseText;
				
			}		

		}
	xmlHttp.send(null);
}

function joingroup(g_id,c_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
	if(g_id==''){
		  document.getElementById('showjoingroup'+c_id).style.display='none';
                  alert("Well this is embarrassing. This should not happen. Please report this through the feedback link on the top, so we can correct it.");
                  return;
	}
        url = '/group/joingroup?g_id='+g_id;
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
                          var response = xmlHttp.responseText.replace("\n", "");
                          if(response != null && response == "success")
                          {
                                document.getElementById("showjoingroup"+c_id).style.display = "none";
				document.getElementById("showleavegroup"+c_id).style.display = "table-row";
                          }
                          else
                          {
                            alert("Your request failed. Please try again. If you repeatedly get this error, please report through feedback link on the top.");
                          }
			}		
           }
	xmlHttp.send(null);
}
function reqjoingroup(g_id,c_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
	if(g_id==''){
		  document.getElementById('reqjoingroup'+c_id).style.visibility='visible';
		  document.getElementById('reqjoingroup1'+c_id).style.visibility='visible';
	}else{
                  var main_link = document.getElementById('reqjoingroup'+c_id);
                  if(main_link != null) 
                  {
                    document.getElementById('reqjoingroup'+c_id).style.display='none';
                    document.getElementById('reqjoingroup1'+c_id).style.display='none';
                    document.getElementById('reqjoingroup11'+c_id).style.display='inline';
                  }
                  var extra_link = document.getElementById('reqjoingroup2');
                  if(extra_link != null)
                  {
		    document.getElementById('reqjoingroup2').style.display='none';
		    document.getElementById('reqjoingroup12').style.display='none';
                  }
		  url = '/group/reqjoingroup?g_id='+g_id;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
	                  alert("A request was sent to the group administrator. You will be notified when your request is accepted");
			}		

		}
	xmlHttp.send(null);
}

function reqjoindetailgroup(g_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
	if(g_id==''){
		  document.getElementById('reqshowjoindetailgroup1').style.visibility='visible';
	}else{
		 document.getElementById('reqshowjoindetailgroup1').style.display='none';
		 document.getElementById('showjoinimg1').style.display='none';
		 document.getElementById('reqshowjoindetailgroup2').style.display='block';
		  url = '/group/reqjoingroup?g_id='+g_id;

		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				
				
			}		

		}
	xmlHttp.send(null);
}
function leavegroup(g_id,c_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
   
	if(g_id==''){
		  document.getElementById('leavejoingroup'+c_id).style.display='none';
                  alert("Well this is embarrassing. This should not happen. Please report this through the feedback link on the top, so we can correct it.");
                  return;
	} 
        url = '/group/leavegroup?g_id='+g_id;
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)
			{
                          var response = xmlHttp.responseText.replace("\n", "");
                          if(response != null && response == "success")
                          {
                                document.getElementById("showleavegroup"+c_id).style.display = "none";
                                var showjoingroupele = document.getElementById("showjoingroup"+c_id);
				if(showjoingroupele != null) showjoingroupele.style.display = "table-row";
                          }
                          else
                          {
                            alert("Your request failed. Please try again. If you repeatedly get this error, please report through feedback link on the top.");
                          }
			}		
		}
	xmlHttp.send(null);
}


function leavedetailgroup(g_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
	if(g_id==''){
		  document.getElementById('showjoindetailgroup').style.visibility='visible';
		  document.getElementById('showleaveimg').style.visibility='visible';
	}else{
		  document.getElementById('showjoindetailgroup').style.display='none';
		  document.getElementById('showleaveimg').style.display='none';
		  document.getElementById('showleavedetailgroup').style.visibility='visible';
		  document.getElementById('showjoinimg').style.display='block';
		  document.getElementById('postarticlelink').style.display='none';
		  document.getElementById('postarticlelinkimg').style.display='none';
		  url = '/group/leavedetailgroup?g_id='+g_id;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showleavedetailgroup").innerHTML=xmlHttp.responseText;
                                window.location.reload();
				
			}		

		}
	xmlHttp.send(null);
}
function  joindetailgroup(g_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
	if(g_id==''){
		  document.getElementById('showjoindetailgroup1').style.visibility='visible'; 
		  document.getElementById('showjoinimg1').style.visibility='visible';
	}else{
		  document.getElementById('showjoindetailgroup1').style.display='none';	
		  document.getElementById('showjoinimg1').style.display='none';
		  document.getElementById('showleavedetailgroup1').style.visibility='visible';
		  document.getElementById('showleavedetailgroup1').style.display='block';
		  document.getElementById('showleaveimg1').style.display='block';
		  url = '/group/joindetailgroup?g_id='+g_id;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showleavedetailgroup1").innerHTML=xmlHttp.responseText;
                                window.location.reload();
			}		

		}
	xmlHttp.send(null);
}

function replyboxcomm(c_id,clevel,post_id,dlevel)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
   document.getElementById('replyComm'+dlevel).style.display='block';
   document.getElementById('replyComm'+dlevel).style.visibility='visible';
   url = '/post/box?c_id='+c_id+'&clevel='+clevel+'&post_id='+post_id+'&dlevel='+dlevel;
	//alert(url); 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{ 
			
				document.getElementById("replyComm"+dlevel).innerHTML=xmlHttp.responseText;	   
                document.getElementById('comments'+dlevel).focus();
				
			}		

		}
	xmlHttp.send(null);
}

function userpoll(poll_id,u_id)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
	var cv=0;
	var opt_id='';
	answerlen = document.pollform.answer.length;
	if(answerlen >0){
		for(j=0;j<answerlen;j++){
		   if(document.pollform.answer[j].checked==true){
			   opt_id = document.pollform.answer[j].value;
			   cv=1;
		   }
		}
	}
	if(cv==0){
		alert('Please select at least one option');
	}

   
	if(opt_id==''){
		  document.getElementById('showpoll').style.visibility='visible';
	}else{
		  document.getElementById('hiddenpoll').style.visibility='visible';
		  document.getElementById('showpoll').style.display='none';
		  url = '/group/poll?poll_id='+poll_id+'&opt_id='+opt_id+'&u_id='+u_id;
		 // alert(url);
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("hiddenpoll").innerHTML=xmlHttp.responseText;
				
			}		

		}
	xmlHttp.send(null);
} 


function postreply(pc_id,level,post_id,dlevel)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

	 comments = document.getElementById('comments'+dlevel).value;
	 if(comments==''){
		  alert('Please enter the reply for this comments');
		  document.getElementById('comments'+dlevel).focus();
		  return false;
	 }


	   document.getElementById('replyComm'+dlevel).style.display='none';
	   document.getElementById('showCommhide'+dlevel).style.display='none';
	   document.getElementById('replyComm'+dlevel).innerHTML = "";
	   document.getElementById('showComm'+dlevel).style.visibility='visible';

	  url = '/post/showcomments?pc_id='+pc_id+'&level='+level+'&post_id='+post_id+'&post_id='+post_id+'&comments='+comments;
	
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				//alert(xmlHttp.responseText);
				document.getElementById("showComm"+dlevel).innerHTML=xmlHttp.responseText;
				
			}		

		}
	xmlHttp.send(null);
} 


function replygroupboxcomm(c_id,clevel,gd_id,g_id,dlevel)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

   
   document.getElementById('replyComm'+dlevel).style.display='block';
   document.getElementById('replyComm'+dlevel).style.visibility='visible';
   url = '/group/box?c_id='+c_id+'&clevel='+clevel+'&gd_id='+gd_id+'&dlevel='+dlevel+'&g_id='+g_id;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{ 
			
				document.getElementById("replyComm"+dlevel).innerHTML=xmlHttp.responseText;	   
                document.getElementById('comments'+dlevel).focus();
				
			}		

		}
	xmlHttp.send(null);
}

function postgroupcooreply(pc_id,level,g_id,gd_id,dlevel)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

	 comments = document.getElementById('comments'+dlevel).value;
	 if(comments==''){
		  alert('Please enter the reply for this comments');
		  document.getElementById('comments'+dlevel).focus();
		  return false;
	 }


	   document.getElementById('replyComm'+dlevel).style.display='none';;
	   document.getElementById('replyComm'+dlevel).innerHTML = "";
	   document.getElementById('showComm'+dlevel).style.visibility='visible';

	  url = '/group/showcomments?pc_id='+pc_id+'&level='+level+'&g_id='+g_id+'&comments='+comments+'&gd_id='+gd_id+'&dlevel='+dlevel;
		  // alert(url)
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				//alert(xmlHttp.responseText);
				document.getElementById("showComm"+dlevel).innerHTML=xmlHttp.responseText;
				
			}		

		}
	xmlHttp.send(null);
}

function selstate(val)
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(val==''){
		  document.getElementById('disshowstate').style.visibility='block';
	}else{
		  document.getElementById('showstate').style.display='block';
		  document.getElementById('disshowstate').style.display='none';
		  url = '/people/fetchstate?country='+val;
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				
				document.getElementById("showstate").innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}

function showcity(val)
{  
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	if(val==''){
		  document.getElementById('disshowcity').style.visibility='block';
	}else{
		  document.getElementById('showcity').style.display='block';
		  document.getElementById('disshowcity').style.display='none';
		  url = '/people/fetchcity?state='+val;
		 // alert(url);
		
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				
				document.getElementById("showcity").innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
} 

function Sendinvitation(val)
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


		  friendsid = document.getElementById('friendsid'+val).value;
		  message   = document.getElementById('message'+val).value;	 		 
		  document.getElementById('display_div_text'+val).style.display='none';
		  document.getElementById('display_div_after'+val).style.display='block';
		  document.getElementById("current_id").value = 'display_div_after'+val;
		  url = '/people/invite?friendid='+friendsid+'&message='+message;
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
			

		}
	xmlHttp.send(null);
} 

function Sendmessage(val)
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


		  toid      = document.getElementById('toid'+val).value;
		  subject   = document.getElementById('subject'+val).value;
		  message   = document.getElementById('pmessage'+val).value;	 
		  if(subject==""){
			  alert('please enter the subject');
			  document.getElementById('subject'+val).focus();
			   return false;
		  }
		  if(message==""){
			  alert('please enter the message');
			  document.getElementById('pmessage'+val).focus();
			  return false;
		  }
		  document.getElementById('display_div'+val).style.display='none';
		  document.getElementById('display_div_after'+val).style.display='block';
		  document.getElementById("current_id").value = 'display_div_after'+val;
		  url = '/people/sendmessage?toid='+toid+'&subject='+subject+'&message='+message;
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
			

		}
	xmlHttp.send(null);
}

function Subscribepost(val)
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

		   //alert(document.getElementById('subscribe'+val).checked)
		  buser_id   = document.getElementById('buser_id'+val).value;
		  subscribe  = document.getElementById('subscribe'+val).checked;
		  hval       = document.getElementById('val'+val).value;


		   if(hval!=1){
			  if(document.getElementById('subscribe'+val).check==false){
				  alert("You can't subscribe without the check this.");
				   return false;
			  }
		   }

		  if(hval==1){
			  document.getElementById('display_sdiv'+val).style.display='none';
			  document.getElementById('showunsubscribe'+val).style.display='block';
			  document.getElementById('showsubscribe'+val).style.display='none';
			  url = '/people/subscribepost?buser_id='+buser_id;
		  }else{
			  document.getElementById('display_sdiv'+val).style.display='none';
			  document.getElementById('showunsubscribe'+val).style.display='none';
			  document.getElementById('showsubscribe'+val).style.display='block';
			  url = '/people/unsubscribepost?buser_id='+buser_id;
		  }
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
			

		}
	xmlHttp.send(null);
}

function Subscribepost1(val)
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

		  //alert(document.getElementById('subscribe'+val).checked)
		  buser_id  = document.getElementById('buser_id'+val).value;
		  subscribe  = document.getElementById('subscribe'+val).checked;
		  hval       = document.getElementById('val'+val).value;

		   // alert(buser_id);
		   // alert(email);
		   // alert(hval);
		   if(hval!=1){
			  if(document.getElementById('subscribe'+val).check==false){
				  alert("You can't subscribe without the check this.");
				   return false;
			  }
		   }

		  if(hval==1){
			 // alert('i m here');
			  document.getElementById('display_usadiv'+val).style.display='none';
			  document.getElementById('showsubscribe'+val).style.display='block'; 
			  document.getElementById('showunsubscribe'+val).style.display='none'; 
			  url = '/people/unsubscribepost?buser_id='+buser_id;
		  }else{
			  //alert('i m here1111');
			  document.getElementById('display_sadiv'+val).style.display='none';
			  document.getElementById('showunsubscribe'+val).style.display='block';
			  document.getElementById('showsubscribe'+val).style.display='none';
			  url = '/people/subscribepost?buser_id='+buser_id;
		  }
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
			

		}
	xmlHttp.send(null);
}


function insertmes()
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


		  msgname     = document.getElementById('msgname').value;
		  messanger   = document.getElementById('messanger').value;

		  if(msgname==""){
			  alert('please enter the messanger id');
			  document.getElementById('msgname').focus();
			   return false;
		  }
		  if(messanger==""){
			  alert('please select the messanger');
			  document.getElementById('messanger').focus();
			  return false;
		  }
		  document.getElementById('displaymes').style.display='none';
		  document.getElementById('displayallmes').style.display='block';

		  url = '/index/showmessanger?msgname='+msgname+'&messanger='+messanger;
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
		document.getElementById("displayallmes").innerHTML=xmlHttp.responseText;	

		}
	xmlHttp.send(null);
} 

function fetchContacts(val)
{
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

    document.getElementById('showuserlists').style.visibility='block';
	if(val==1){
       url = '/group/usercontacts/f/1';		
	}else if(val==2){
	    url = '/group/usercontacts/f/2';		
	}else if(val==5){
	    url = '/group/usercontacts/f/5';
	}else if(val==6){
	    url = '/group/usercontacts/f/6';
	}
	 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function()
	   {
			if (xmlHttp.readyState==4)

			{
				document.getElementById("showuserlists").innerHTML=xmlHttp.responseText;
			}		

		}
	xmlHttp.send(null);
}


 function groupblogsubscription()
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

		 
		  user_id  = document.getElementById('userid').value;
		  g_id      = document.getElementById('g_id').value;
		  email     = document.getElementById('email').value;
		  sval      = document.getElementById('sval').value;

		  alert(sval);
		  alert(email);
		  alert(g_id);


		  if(email==""){
			  alert('please enter the email');
			  document.getElementById('email').focus();
			   return false;
		  }

			  document.getElementById('showsubscriptionbox').style.display='none';
			  document.getElementById('subscribegroup').style.display='none';
			  document.getElementById('unsubscribegroup').style.display='block';
			  url = '/group/groupsubscription?user_id='+user_id+'&email='+email+'&g_id='+g_id;				 
		  
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
			

		}
	xmlHttp.send(null);
}

function groupblogunsubscription()
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 

		 
		  user_id  = document.getElementById('userid').value;
		  g_id      = document.getElementById('g_id').value;
		  email     = document.getElementById('email1').value;

		
		  alert(email);
		  alert(g_id);


		  if(email==""){
			  alert('please enter the email');
			  document.getElementById('email').focus();
			   return false;
		  }

			  document.getElementById('unshowsubscriptionbox').style.display='none';
			  document.getElementById('unsubscribegroup').style.display='none';
			  document.getElementById('subscribegroup').style.display='block';
			  url = '/group/groupblogunsubscription?user_id='+user_id+'&email='+email+'&g_id='+g_id;	
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
			

		}
	xmlHttp.send(null);
}

function ApprovedComment(comm_id)
{    
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 


	  document.getElementById('approvedid').style.display='none';
	  url = '/post/approvedpostcomment?comm_id='+comm_id;	
		
	
	 
	xmlHttp.open("GET",url,true); 	
	xmlHttp.onreadystatechange=function()
	   {
			

		}
	xmlHttp.send(null);
}




function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}



