//******************************************************************************

function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}
////////////////////////////////////////AJAX PAGE//////////////////////////
var xmlHttp;
var divId="";
var txt='';
//*****************************************************************************
function htmlData(url,did)
{
	divId=did;	
    document.getElementById(divId).innerHTML="<img src='images/load.gif' border='0'>";

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	var url=url;

	xmlHttp.onreadystatechange=stateChanged1 ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function getstate(countryid)
	{
		var xmlHttp
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
			alert ("Your browser does not support AJAX!");
			return;
		} 
		var url='action.php?action=getstate&country_id='+countryid;
	
		xmlHttp.onreadystatechange=function(){
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 			
				if(xmlHttp.responseText!=''){
					document.getElementById('countrystate').innerHTML=xmlHttp.responseText;
				}
				
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
		
	}
function getNewform(page,cat)
{
	
    var xmlHttp
  	xmlHttp	=	GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	document.getElementById('cattable'+cat).innerHTML="<div align='center'><img src='images/loadingAnimation.gif' style='position:relative;top:32%;'></div>";	

 	var url='userclass.php?action=Getnewfrom&cat='+cat+'&page='+page;
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			//alert(xmlHttp.responseText);
			document.getElementById('cattable'+cat).innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}


function GetCity(state)
{ 

//alert(state)
   var xmlHttp
  	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
 	var url='userclass.php?action=GetCity&state='+state;
  	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			document.getElementById('getcity').style.display='block';
			document.getElementById('getcity').innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}

function makefavourite(id)
{
   var xmlHttp
  	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
 	var url='userclass.php?action=saveasfavorite&id='+id;
  	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	{
			alert("Selected video set as favorite")
			document.getElementById('newone').style.display='none';
			document.getElementById('afterfavorite').style.display='block';
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	

}
function rate_this_topic(vdid,rating)
{   
	var xmlHttp
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url='rating_video.php?id_vdo='+vdid+'&rate='+rating+'&vdo_rt=rate_topic';
	xmlHttp.onreadystatechange=function(){
		var result	=	xmlHttp.responseText;
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 			
			document.getElementById('rating').innerHTML=result;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);		
	
}


function getprovidercountrystate(id)
{
	
	var xmlHttp
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url='https://www.easyagreements.com/action.php?action=getprovidercountrystate&country_id='+id;
	//alert(url);
	xmlHttp.onreadystatechange=function(){
		//alert(xmlHttp.readyState);
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 			
			if(xmlHttp.responseText!=''){
				alert(xmlHttp.responseText);
				document.getElementById('countrystate').innerHTML=xmlHttp.responseText;
			}
			
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}
function getprovidercountryincome(countryid)
	{
		var xmlHttp
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
			alert ("Your browser does not support AJAX!");
			return;
		} 
		var url='https://www.easyagreements.com/action.php?action=getprovidercountryincome&country_id='+countryid;
		//alert(url);
		xmlHttp.onreadystatechange=function(){
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
				if(xmlHttp.responseText!=''){
					//alert(xmlHttp.responseText);
				document.getElementById('income').innerHTML=xmlHttp.responseText;
				}
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
}
function geteditprofilestate(countryid)
	{
		var xmlHttp
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
			alert ("Your browser does not support AJAX!");
			return;
		} 
		var url='action.php?action=geteditprofilestate&country_id='+countryid;

		xmlHttp.onreadystatechange=function(){
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 			
				if(xmlHttp.responseText!=''){
					document.getElementById('State').innerHTML=xmlHttp.responseText;
				}
				
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
		
	}


