// JavaScript Document
function getXMLHTTP(){
  var A = null;
  
  try{
    A = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(e){
    try{
      A = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(oc){
      A = null;
    }
  }
  
  if(!A && typeof XMLHttpRequest != "undefined") {
    A = new XMLHttpRequest();
  }
  
  return A;
}

function getStates(queryString)
{
  
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
    xmlHttp.open("GET", "getstate.php?con_id="+ queryString, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) {

        eval(xmlHttp.responseText);
     
      }
    }
    ;
    
    xmlHttp.send(null);
  }
  
}


function getContinentList(queryString,id)
{
  
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
	  
	  for(var i=1;i<=6;i++)
	  {
		if(i==id)
		  	eval("document.getElementById('con"+i+"')").className='clsBorder';
		else
		  	eval("document.getElementById('con"+i+"')").className='';
	  }
    xmlHttp.open("GET", "getcountrylist.php?con_id="+ queryString, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) {

		document.getElementById('selcountrylist').innerHTML=xmlHttp.responseText;
      }
    }
    ;
    
    xmlHttp.send(null);
  }
 }

function getStateList(queryString,id,tot)
{
  
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
	  for(var i=1;i<=tot;i++)
	  {
		if(i==id)
		  	eval("document.getElementById('coun"+i+"')").className='clsBorder';
		else
		  	eval("document.getElementById('coun"+i+"')").className='';
	  }
    xmlHttp.open("GET", "getstatelist.php?con_id="+ queryString, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) {

		document.getElementById('selstatelist').innerHTML=xmlHttp.responseText;
      }
    }
    ;
    
    xmlHttp.send(null);
  }
 }
function getPartnerList(queryString,country,id,tot)
{
  
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
	   for(var i=1;i<=tot;i++)
	  {
		if(i==id)
		  	eval("document.getElementById('sta"+i+"')").className='clsBorder';
		else
		  	eval("document.getElementById('sta"+i+"')").className='';
	  }
    xmlHttp.open("GET", "getpartnerlist.php?con_id="+ queryString+"&country="+country, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) {

     document.getElementById('selpartnerslist').innerHTML=xmlHttp.responseText;
     
      }
    }
    ;
    
    xmlHttp.send(null);
  }
  
}
function getOverallList(queryString,country,state,p,id,tot)
{
  
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
	   for(var i=1;i<=tot;i++)
	  {
		if(i==id)
		  	eval("document.getElementById('pat"+i+"')").className='clsBorder';
		else
		  	eval("document.getElementById('pat"+i+"')").className='';
	  }
    xmlHttp.open("GET", "getoveralllist.php?con_id="+ queryString+"&pageno="+p+"&country="+country+"&state="+state, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) {
	var r=xmlHttp.responseText;
	var res=r.split("^^^^");
     document.getElementById('selPartnerLsit').innerHTML=res[0];
      document.getElementById('selPage').innerHTML=res[1];
     
      }
    }
    ;
    
    xmlHttp.send(null);
  }
  
}
var glo_url='';
function getImageDetail(queryString,p,id,tot)
{
  glo_url="getimagedetail.php?con_id="+ queryString+"&pageno="+p;
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
	  for(var i=1;i<=tot;i++)
	  {
		if(i==id)
		  	eval("document.getElementById('overall"+i+"')").className='clsBorder';
		else
		  	eval("document.getElementById('overall"+i+"')").className='';
	  }
    xmlHttp.open("GET", "getimagedetail.php?con_id="+ queryString+"&pageno="+p, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) {

     document.getElementById('sleImageDetials').innerHTML=xmlHttp.responseText;
     
      }
    }
    ;
    
    xmlHttp.send(null);
  }
  
}
function aftergetImageDetail()
{
  
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
    xmlHttp.open("GET", glo_url, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) {

     document.getElementById('sleImageDetials').innerHTML=xmlHttp.responseText;
     
      }
    }
    ;
    
    xmlHttp.send(null);
  }
  
}



function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
selectbox.remove(i);
}
}
function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

function showQueryDiv( resultArray1, resultArray2)
{
 removeAllOptions(document.frmAdmin.state);
  for (var i = 0; i < resultArray1.length; i++)
  {
	  addOption(document.frmAdmin.state, resultArray2[i],resultArray1[i]);
  
  } 
}

function del(id)
{
	var a=confirm("Do you want to Delete?");
	if(a)
		window.location.href="deleteclub.php?refid="+id;
}
function postComments()
{ 
var refid=document.frmcomment.refid.value;  
	var comments=document.frmcomment.comments.value;  
	if(comments=="")
	{
			document.getElementById("selMsg").innerHTML="<font color='red'>Please enter the Comment</font>";
	}
	else
	{
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
	var params = "refid=" + refid + "&comments=" + comments;

    xmlHttp.open("GET", "postcomment.php?"+params, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) 
	  {
		var r=xmlHttp.responseText;
      document.getElementById('selMsg').innerHTML=r;
     document.frmcomment.comments.value='';  
      }
    }
    ;
    
    xmlHttp.send(null);
  }
	}
  return false;
  
}

function rating()
{ 
	var refid=document.frmcomment.refid.value;  
	var rate=getSelectedRadio(document.frmrate.rate);  
	
	if(rate<=0)
	{
			document.getElementById("selMsg").innerHTML="<font color='red'>Please Choose any one option</font>";
	}
	else
	{
  xmlHttp=getXMLHTTP();
  if(xmlHttp){
	var params = "refid=" + refid + "&rate=" + rate;

    xmlHttp.open("GET", "rating.php?"+params, true);
    // What do we do when the response comes back?
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 && xmlHttp.responseText ) 
	  {
		var r=xmlHttp.responseText;
      document.getElementById('selMsg').innerHTML=r;
     document.frmcomment.comments.value='';  
      }
    }
    ;
    
    xmlHttp.send(null);
  }
	}
  return false;
  
}
function getSelectedRadio(buttonGroup) {
   if (buttonGroup[0])
   { 
      for (var i=0; i<buttonGroup.length; i++) 
	  {
         if (buttonGroup[i].checked) 
		 {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }

   return -1;
} 
function winopen(url)
{
	window.open('popup.php?url='+url,'mywindow','width=800,height=800,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
}
