/* GET XML OBJECT*/
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 getTVCategoryForCountry(cID)
{
if (cID.length==0)
  { 
  document.getElementById("showChannel").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getchannel.asp";
url=url+"?cid="+cID;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{
	
document.getElementById("showChannel").innerHTML=xmlHttp.responseText;
}
}
/*****************************************************************************/
/*function getChannelForCategory(catID,contryID)
{
if (catID.length==0)
  { 
  document.getElementById("channelList").innerHTML="";
  return;
  }
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url2="channellist.asp";
url2=url2+"?catID="+catID;
url2=url2+"&contryID="+contryID;
url2=url2+"&sid="+Math.random();
xmlHttp2.onreadystatechange=stateChanged2;
xmlHttp2.open("GET",url2,true);
xmlHttp2.send(null);
}
function stateChanged2() 
{ 
if (xmlHttp2.readyState==4)
{	
document.getElementById("channelList").innerHTML=xmlHttp2.responseText;
}
}*/
function getChannelForCategory(catID)
{
if (catID.length==0)
  { 
  document.getElementById("channelList").innerHTML="";
  return;
  }
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url2="channellist.asp";
url2=url2+"?catID="+catID;
url2=url2+"&sid="+Math.random();
xmlHttp2.onreadystatechange=stateChanged2;
xmlHttp2.open("GET",url2,true);
xmlHttp2.send(null);
}
function stateChanged2() 
{ 
if (xmlHttp2.readyState==4)
{	
document.getElementById("channelList").innerHTML=xmlHttp2.responseText;
}
}
/*****************************************************************************/
function playChannel(chID,sno,CustomerID)
{
if (chID.length==0)
  { 
  document.getElementById("tvArea").innerHTML="";
  return;
  }
 getCurrentChannel(chID)
 getChannelRating(sno)
xmlHttp3=GetXmlHttpObject()
if (xmlHttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url3="playTV.asp";
url3=url3+"?chID="+chID;
url3=url3+"&sid="+Math.random();
xmlHttp3.onreadystatechange=function stateChanged3() 
{ 
if (xmlHttp3.readyState==4)
	{
		document.getElementById("fav").innerHTML="<img src='images/favourite_icon.gif' width='16' height='16' align='absmiddle' /><a href='javascript:addToFavourite("+sno+","+CustomerID+");' class='tdTxt'> Add To Favorites</a> ";
		document.getElementById("rate").innerHTML="<img src='images/favourite_icon.gif' width='16' height='16' align='absmiddle' /><a href='javascript:showMe("+sno+");' class='tdTxt'> Rate This Channel</a> ";
		document.getElementById("repAbuse").innerHTML="<img src='images/report_abuse.gif' width='16' height='15' align='absmiddle' /> <a href='reportAbuse.asp?videoID="+sno+"'class='tdTxt'>Report Abuse </a>"
		document.getElementById("tvArea").innerHTML=xmlHttp3.responseText;
	}
else
{	
	document.getElementById("tvArea").innerHTML='<img src="images/loader.gif" class="tv_screen_mid" align="middle">';
}
}
xmlHttp3.open("GET",url3,true);
xmlHttp3.send(null);
}
/**********************/
function addToFavourite(chID,CustomerID)
{
	if (chID.length==0)
  { 
  document.getElementById("fav").innerHTML="";
  return;
  }
  
   getFavouriteChannel(CustomerID);
xmlHttp4=GetXmlHttpObject()
if (xmlHttp4==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url4="addTofavourite.asp";
url4=url4+"?chID="+chID;
url4=url4+"&sid="+Math.random();
xmlHttp4.onreadystatechange=function stateChanged4() 
{ 
if (xmlHttp4.readyState==4)
	{	
		document.getElementById("fav").innerHTML=xmlHttp4.responseText;
	}
}
xmlHttp4.open("GET",url4,true);
xmlHttp4.send(null);
}
/**********************/
function getFavouriteChannel(custID)
{
	if (custID.length==0)
  { 
  document.getElementById("favChannel").innerHTML="";
  return;
  }  
xmlHttp5=GetXmlHttpObject()
if (xmlHttp5==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url5="getFavouriteChannel.asp";
url5=url5+"?custID="+custID;
url5=url5+"&sid="+Math.random();
xmlHttp5.onreadystatechange=function stateChanged5() 
	{ 
		if (xmlHttp5.readyState==4)
			{					
				document.getElementById("favChannel").innerHTML=xmlHttp5.responseText;
			}
	}
xmlHttp5.open("GET",url5,true);
xmlHttp5.send(null);
}
/**************************************************/
function getCurrentChannel(chID)
{
		if (chID.length==0)
  { 
  document.getElementById("currentChannel").innerHTML="";
  return;
  }  
xmlHttp6=GetXmlHttpObject()
if (xmlHttp6==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url6="getCurrentChannel.asp";
url6=url6+"?chID="+chID;
url6=url6+"&sid="+Math.random();
xmlHttp6.onreadystatechange=function stateChanged6()
	{ 
		if (xmlHttp6.readyState==4)
			{					
				document.getElementById("currentChannel").innerHTML=xmlHttp6.responseText;
			}
	}
xmlHttp6.open("GET",url6,true);
xmlHttp6.send(null);
}
//******************************************
var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}
//***********************************************************************//
function submitRating(chid,comment)
{

for(var c=0;c<=4;c++)
{
	if(document.frmrate.rdRate[c].checked)
	{
		var rating=document.frmrate.rdRate[c].value;
	}
}


if (rating<1)
  { 
  		alert("Please select rating.");
		//document.frmrate.rdRate.focus();
		return false;
  }
  if (comment.length==0)
  { 
  		alert("Please put your comment.");
		document.frmrate.txtComment.focus();
		return false;
  }
  
xmlHttp9=GetXmlHttpObject()
if (xmlHttp9==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url9="rateChannel.asp";
url9=url9+"?chid="+chid;
url9=url9+"&rating="+rating;
url9=url9+"&comment="+comment;
url9=url9+"&sid="+Math.random();

xmlHttp9.onreadystatechange=function stateChanged9() 
{ 
if (xmlHttp9.readyState==4)
{ 
if(xmlHttp9.responseText=='NA')
{
		alert("you can not rate a channel more than one time!!!");
		hideMe();
		return false;
}
else
{
hideMe();
return false;
}
}
}
xmlHttp9.open("GET",url9,true);
xmlHttp9.send(null);

}
//***********************************************************************//
function getChannelRating(chid)
{
 
xmlHttp12=GetXmlHttpObject()
if (xmlHttp12==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url12="getRating.asp";
url12=url12+"?chid="+chid;
url12=url12+"&sid="+Math.random();

xmlHttp12.onreadystatechange=function stateChanged12() 
{ 
if (xmlHttp12.readyState==4)
{ 
document.getElementById("getRating").innerHTML=xmlHttp12.responseText;
}
}
xmlHttp12.open("GET",url12,true);
xmlHttp12.send(null);
}
//***************************Code for Radio********************************************//
function getRadioStation(rdl)
{
	xmlHttp13=GetXmlHttpObject()
	if (xmlHttp13==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url13="getRadioStation.asp";
	url13=url13+"?rdl="+rdl;
	url13=url13+"&sid="+Math.random();
	xmlHttp13.onreadystatechange=function stateChanged13() 
	{ 
	if (xmlHttp13.readyState==4)
	{ 
	    //alert(xmlHttp13.responseText);
	document.getElementById("getRadio").innerHTML=xmlHttp13.responseText;
	}
	}
	xmlHttp13.open("GET",url13,true);
	xmlHttp13.send(null);

}



function playRadio(cid,rname)
 {
    xmlHttp14=GetXmlHttpObject()
	if (xmlHttp14==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url14="play-radio.asp";
	url14=url14+"?chID="+cid;
	url14=url14+"&rname="+rname;
	url14=url14+"&sid="+Math.random();	
	xmlHttp14.onreadystatechange=function stateChanged14() 
	{ 
	if (xmlHttp14.readyState==4)
	{ 
	document.getElementById("divPlay").innerHTML=xmlHttp14.responseText;
	}
	}
	xmlHttp14.open("GET",url14,true);
	xmlHttp14.send(null);
 }
 
 function playTV(cid)
 {
    xmlHttp14=GetXmlHttpObject()
	if (xmlHttp14==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url14="livetv.aspx";
	url14=url14+"?cid="+cid;
	
	xmlHttp14.onreadystatechange=function stateChanged14() 
	{ 
	if (xmlHttp14.readyState==4)
	{ 
	document.getElementById("play").innerHTML=xmlHttp14.responseText;
	}
	}
	xmlHttp14.open("GET",url14,true);
	xmlHttp14.send(null);
 }
 
 //***** for radio web site
 
function getRadioStationWebSelected(rdl,str)
{   
 var str1=document.getElementById("rd");
 if(str1.value=="")
  {
  document.getElementById("rd").value=str;
 }
 else
 { 
    document.getElementById(str1.value).className="radior_leftr_menu";
      document.getElementById("rd").value=str;

 
 }
 
   
	xmlHttp15=GetXmlHttpObject()
	if (xmlHttp15==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url15="radio/getRadioStation.asp";
	url15=url15+"?rdl="+rdl;
	url15=url15+"&sid="+Math.random();
	xmlHttp15.onreadystatechange=function stateChanged15() 
	{ 
	if (xmlHttp15.readyState==4)
	{  

	
    document.getElementById(str).className="radio_channel_selected";
	document.getElementById("getRadio").innerHTML=xmlHttp15.responseText;
	

 		document.getElementById("divpopular1").style.display="none";
      document.getElementById("getRadio").style.display="block";
      document.getElementById("divfeature").style.display="none";
      document.getElementById("s").className="selected_radio"; 
       document.getElementById("f").className="animatedtabs_radio_dflt";

	}
	}
	xmlHttp15.open("GET",url15,true);
	xmlHttp15.send(null);

}



function getRadioStationWeb(rdl)
{   

   
	xmlHttp15=GetXmlHttpObject()
	if (xmlHttp15==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url15="radio/getRadioStation.asp";
	url15=url15+"?rdl="+rdl;
	url15=url15+"&sid="+Math.random();
	xmlHttp15.onreadystatechange=function stateChanged15() 
	{ 
	if (xmlHttp15.readyState==4)
	{  

	
  
	document.getElementById("getRadio").innerHTML=xmlHttp15.responseText;
	

	}
	}
	xmlHttp15.open("GET",url15,true);
	xmlHttp15.send(null);

}





function playRadioWeb(cid,rname)
 {
    xmlHttp16=GetXmlHttpObject()
	if (xmlHttp16==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url16="play-radio.asp";
	url16=url16+"?chID="+cid;
	url16=url16+"&rname="+rname;
	url16=url16+"&sid="+Math.random();	
	xmlHttp16.onreadystatechange=function stateChanged16() 
	{ 
	if (xmlHttp16.readyState==4)
	{ 
	document.getElementById("divPlay").innerHTML=xmlHttp16.responseText;
	}
	}
	xmlHttp16.open("GET",url16,true);
	xmlHttp16.send(null);
 }
 
 
 
 function GetPopular()
 {
    xmlHttp17=GetXmlHttpObject()
	if (xmlHttp17==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url17="radio/radio-popular.asp";	
	url17=url17+"?sid="+Math.random();	
	xmlHttp17.onreadystatechange=function stateChanged17() 
	{ 
	if (xmlHttp17.readyState==4)
	{ 
	document.getElementById("divpopular").innerHTML=xmlHttp17.responseText;
	document.getElementById("divpopular1").innerHTML=xmlHttp17.responseText;	
	}
	}
	xmlHttp17.open("GET",url17,true);
	xmlHttp17.send(null);
 }
 
 
 
 function GetFeature()
 {
    xmlHttp18=GetXmlHttpObject()
	if (xmlHttp18==null)
  	{
  	alert ("Your browser does not support AJAX!");
  	return;
  	} 
	var url18="radio/radio-feature.asp";	
	url18=url18+"?sid="+Math.random();	
	xmlHttp18.onreadystatechange=function stateChanged18() 
	{ 
	if (xmlHttp18.readyState==4)
	{ 
	document.getElementById("divfeature").innerHTML=xmlHttp18.responseText;	
	}
	}
	xmlHttp18.open("GET",url18,true);
	xmlHttp18.send(null);
 }
 













