             function GetXmlHttpObject()
	     {
		var xmlHttp=null;
		try
 		 {
  	            xmlHttp=new XMLHttpRequest();
 		  }
		 catch (e)
  		  {
  		          try
   			  {
   			     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
   			   }
  			 catch (e)
  			   {
   			       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
   			   }
  		    }
		  return xmlHttp;
	       }
	function showbusy(tbl)
	{
		if(tbl=='tbl1')
	                 document.getElementById('subtouser').style.display = 'inline';
	        else if(tbl=='tbl2')
	                 document.getElementById('subtochannel').style.display = 'inline';  
		
	}
	
	function hidebusy(tbl)
	{
	     if(tbl=='tbl1')
	           document.getElementById('subtouser').style.display = 'none';
	     else if(tbl=='tbl2')
	           document.getElementById('subtochannel').style.display = 'none';   	
		
	}		       

     	function getstatus(init,uid,mcid,tbl)
	   {
    	 	  var xmlHttp=GetXmlHttpObject();
    	 	  
                  if (xmlHttp==null)
    		    {
     			
     			alert ("Your browser does not support AJAX!");
     		    	return;
    		    }  	
    
      		   var url="getstatus.php";		
    		   url+="?init="+init+"&uid="+uid+"&mcid="+mcid+"&tbl="+tbl;
   	           
   	           //alert(url);

   	         xmlHttp.onreadystatechange=function() 
		   { 
	              
	                showbusy(tbl);
	                //alert('a'+xmlHttp.readyState);
	              
	              if (xmlHttp.readyState==4)
			{ 
		          
		           hidebusy(tbl); 
                   //xmlHttp.responseText=''; 
		           //alert('b'+xmlHttp.responseText);
		           if(xmlHttp.status==200)
		            
		            {
		             var res;
		             var id1,id2;
			     res=trim(xmlHttp.responseText);

			     //alert(xmlHttp.responseText);

			     if(res=="9")
			     {
			        
			         hidebusy(tbl);  
			        alert("Please Login To Subscribe");
			        
			        return;	
			     }	
			    else
			    { 
			     
			     //alert("res "+res);
                           if(tbl=="tbl1")
                            {
                              	id1="usb";
                              	id2="sb";
                              	
                            }   
                           else if(tbl=="tbl2") 
                            {
                            	id1="cusb";
                              	id2="csb";
                            }
                           if(res=="0")
		             { 	  
			         document.getElementById(id1).style.display = 'none';
			         document.getElementById(id2).style.display='block';
			      }
			      else if(res=="1")
			      {
			         document.getElementById(id2).style.display = 'none';
			         document.getElementById(id1).style.display='block';
			      }
			      else
			       {
			      	  alert("invalid return");
			       }
			    }
			    }
			  
			 }
			      
                  }
  			xmlHttp.open("get",url,true);
                        xmlHttp.send(null);	
                      }	
      
