//******************************************************************************

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 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 chkdiscount(cuopon_code,standard,premium)
{   

if(standard==true)
{
	var type='standard';
}
if(premium==true)
{
	var type='premium';
}
 //alert(type);
	var xmlHttp
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url='get_your_price.php?cuopon_code='+cuopon_code+'&type='+type;
	xmlHttp.onreadystatechange=function(){
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 			
			var result	=	xmlHttp.responseText;
			document.getElementById('YourPrice').innerHTML=result;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);		
	
}


