function flag_items(value,flag)
{
    
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      //alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }

    var theQuery = value;
  
    
    if(theQuery=="")
    {
         //document.getElementById('result33').style.display='none';
        //alert("Plaese select Escort!.");
        return false;
    }
    else
    {   //alert(theQuery);
      var theQuery = value;
    
        var url = 'pub_flag_items.php?publish_id='+theQuery+'&flag='+flag;      
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = function() 
        {
            if(xmlHttp.readyState == 4) 
            {
               // alert(xmlHttp.responseText);
                 document.getElementById('hide_nk').style.display='none';
                // document.getElementById('content-block').style.display='none';                
                 document.getElementById('result').innerHTML = xmlHttp.responseText + ' ';
            } 
        };
        
        xmlHttp.send(null);
    }
  }

  /////////////////////////////////////////////////////////////////////////////////////////
 function show_flag(id , value,flag)
{
      var item_id  =  id.split('_');
     // alert(item_id[1]);
     // alert(item_id[0]);
       
  //  alert(value); 
   // alert(flag);         
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      //alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }

    var theQuery = value;
  
    
    if(theQuery=="")
    {
        
        //alert("Plaese select Escort!.");
        return false;
    }
    else
    {   //alert(theQuery);
      var theQuery = value;
    
    
    
         var url = 'starflag.php?pid='+theQuery+'&flag='+flag+'&id='+item_id[1];    
         //alert(url);  
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = function() 
        {
            if(xmlHttp.readyState == 4) 
            { //alert(xmlHttp.responseText);
              //  alert("aditya");
                if(item_id[0]=='greystar')
                {
                   // alert('member_'+item_id[1]);
                  document.getElementById('redstar_'+item_id[1]).style.display='block';   
                  document.getElementById('greystar_'+item_id[1]).style.display='none'; 
                  document.getElementById('member_'+item_id[1]).style.display='block';
                }
                
                if(item_id[0]=='redstar')
                {
                  // alert('ss'+item_id[1])
                  document.getElementById('redstar_'+item_id[1]).style.display='none';   
                  document.getElementById('greystar_'+item_id[1]).style.display='block'; 
                  document.getElementById('member_'+item_id[1]).style.display='none';
                }
                
               if(item_id[0]=='greystar1')
                {
                 // alert('ssmember_'+item_id[1])
                  document.getElementById('redstar1_'+item_id[1]).style.display='block';   
                  document.getElementById('greystar1_'+item_id[1]).style.display='none';
                  document.getElementById('member_'+item_id[1]).style.display='block';  
                }
                
                if(item_id[0]=='redstar1')
                {
                  //   alert('wwmember_'+item_id[1])
                  document.getElementById('redstar1_'+item_id[1]).style.display='none';   
                  document.getElementById('greystar1_'+item_id[1]).style.display='block'; 
                  document.getElementById('member_'+item_id[1]).style.display='none';
                }
                
                 // alert(xmlHttp.responseText);
                 // document.getElementById('redstar').style.display='block';   
                 // document.getElementById('greystar').style.display='none'; 
                             
              
            } 
        };
        
        xmlHttp.send(null);
    }
  }




  ////////////////////
function check_per_click(id,pid){
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
//alert("Your browser does not support AJAX!");
return false;
}
}
}

var theQuery = pid;


if(theQuery=="")
{

alert("Plaese select Escort!.");
return false;
}
else{
var theQuery = pid;
var url = 'capture_click.php?pid='+theQuery+'&id='+id;    
//alert(url);  
xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = function() 
{

if((xmlHttp.readyState==1)||(xmlHttp.readyState==2)||(xmlHttp.readyState==3))
    {document.getElementById('documentos').innerHTML ='<p align="center"><img src="assets/gfx/loading.gif"></p>';
 }

if(xmlHttp.readyState == 4) 
{
	
var aa=xmlHttp.responseText;
var row=aa.split("_");
//alert(row[0]);
//alert(row[1]);
window.location.href="archivo.php?id="+trim(row[0])+"&publish_id="+trim(row[1]);
	
}
};

xmlHttp.send(null);
}
}

function trim(inputString)
{
    inputString = inputString.replace(/^\s+/g,"");
    inputString = inputString.replace(/\s+$/g,"");
    return inputString;
}