// JavaScript Document
function xmlhttpPost_MzoneAd(timeval,dis) {
	var xmlHttpReq2_mzone = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq2_mzone = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq2_mzone = new ActiveXObject("Microsoft.XMLHTTP");
    }
	strURL="home_middleads.php?flag="+dis;
	self.xmlHttpReq2_mzone.open('POST', strURL, true);
    self.xmlHttpReq2_mzone.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq2_mzone.onreadystatechange = function() 
    {	
		if (self.xmlHttpReq2_mzone.readyState == 4) {
			//alert(self.xmlHttpReq2.responseText);
            updatepage_mzoneResult(self.xmlHttpReq2_mzone.responseText);
        }
    }
    self.xmlHttpReq2_mzone.send(null);
	psetid=setTimeout("xmlhttpPost_MzoneAd('"+timeval+"','" + dis + "')",timeval);
}

function updatepage_mzoneResult(str)
{
	document.getElementById("divmzone").innerHTML= str;
}

function xmlhttpPost_RzoneAd(timeval,dis) {
//alert('rzone'+timeval);
	var xmlHttpReq2_rzone = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq2_rzone = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq2_rzone = new ActiveXObject("Microsoft.XMLHTTP");
    }
	strURL="home_rightads.php?flag="+dis;
	self.xmlHttpReq2_rzone.open('POST', strURL, true);
    self.xmlHttpReq2_rzone.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq2_rzone.onreadystatechange = function() 
    {	
		if (self.xmlHttpReq2_rzone.readyState == 4) {
			//alert(self.xmlHttpReq2.responseText);
            updatepage_rzoneResult(self.xmlHttpReq2_rzone.responseText);
        }
    }
    self.xmlHttpReq2_rzone.send(null);
	psetid=setTimeout("xmlhttpPost_RzoneAd('"+timeval+"','" + dis + "')",timeval);
}

function updatepage_rzoneResult(str)
{
	document.getElementById("divrzone").innerHTML= str;
}


function xmlhttpChannelPost(vardate,vartype,cid) {
	alert("hello"+vardate);
    var xmlHttpChannelReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpChannelReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpChannelReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
	
	strURL="guideprogTNS.php?test="+vardate+"&type="+vartype;
	if(cid != "")
	{
		strURL =strURL + "&cidval="+cid;
	}
	//alert(strURL);
    self.xmlHttpChannelReq.open('POST', strURL, true);
    self.xmlHttpChannelReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
    self.xmlHttpChannelReq.onreadystatechange = function() 
    {
        //alert(self.xmlHttpReq.readyState);
        if (self.xmlHttpChannelReq.readyState == 4) {
            updateChannelpage(self.xmlHttpChannelReq.responseText);
        }
    }
    self.xmlHttpChannelReq.send(null);
	
}

function xmlhttpAllChannelProg(vardate) {

    var xmlHttpChannelReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpChannelReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpChannelReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
	
	strURL="guideprogTNS.php?fdt="+vardate+"dp=test";

	//alert(strURL);
    self.xmlHttpChannelReq.open('GET', strURL, true);
    self.xmlHttpChannelReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
    self.xmlHttpChannelReq.onreadystatechange = function() 
    {
        //alert(self.xmlHttpReq.readyState);
        if (self.xmlHttpChannelReq.readyState == 4) {
            updateChannelpage(self.xmlHttpChannelReq.responseText);
        }
    }
    self.xmlHttpChannelReq.send(null);
	
	alert('marche');
}


function updateChannelpage(str)
{
	document.getElementById("divPage").innerHTML= str;
	//alert(str);
}



//For Arrow Effects 

var xmlHttp_arrow

function showGallery(str,idval,cid)
{
var hidetot=document.getElementById('hidetot'+idval).value;
if (str.length==0)
{ 
document.getElementById("DivChannels"+idval).innerHTML="";
return;
}
xmlHttp_arrow=GetXmlHttp_arrowObject()
if (xmlHttp_arrow==null)
{
alert ("Your browser does not support AJAX!");
return;
} 
var url="getprograms.php";
url=url+"?s="+str+"&t="+hidetot+"&j="+idval+"&cid="+cid;

xmlHttp_arrow.onreadystatechange=function()
 {
        //alert(self.xmlHttpReq.readyState);
        if (self.xmlHttp_arrow.readyState == 4) {
            stateChanged(self.xmlHttp_arrow.responseText,idval);
        }
    }
xmlHttp_arrow.open("GET",url,true);
xmlHttp_arrow.send(null);
} 

function stateChanged(str,idval) 
{ 
document.getElementById("DivChannels"+idval).innerHTML=str;
}

function GetXmlHttp_arrowObject()
{
var xmlHttp_arrow=null;
try
  {  
  xmlHttp_arrow=new XMLHttpRequest();
  }
catch (e)
  {  
  try
    {
    xmlHttp_arrow=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp_arrow=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp_arrow;
}
//End

//For Strong time
var xmlHttp_strong

function showStrong(str)
{
var hidetot=document.getElementById('hidstrong').value;
if (str.length==0)
{ 
document.getElementById("DivStrong").innerHTML="";
return;
}
xmlHttp_strong=GetXmlHttpObject_strong()
if (xmlHttp_strong==null)
{
alert ("Your browser does not support AJAX!");
return;
} 
var url="getstrongtime.php";
url=url+"?s="+str+"&t="+hidetot;

xmlHttp_strong.onreadystatechange=stateChanged_strong;
xmlHttp_strong.open("GET",url,true);
xmlHttp_strong.send(null);
} 

function stateChanged_strong() 
{ 
if (xmlHttp_strong.readyState==4)
{ 

document.getElementById("DivStrong").innerHTML=xmlHttp_strong.responseText;
}
}

function GetXmlHttpObject_strong()
{
var xmlHttp_strong=null;
try
  {  
  xmlHttp_strong=new XMLHttpRequest();
  }
catch (e)
  {  
  try
    {
    xmlHttp_strong=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp_strong=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp_strong;
}
//End




// For Channel and Radio on Formula page
function xmlhttpPost_Formula(fid,title) {
	//alert(timeval);
	var xmlHttpReq2_formula = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq2_formula = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq2_formula = new ActiveXObject("Microsoft.XMLHTTP");
    }
	//alert(document.getElementById("divnews").innerHTML);
	
	strURL="formula_chaine.php?fid="+fid+"&title="+title;
	self.xmlHttpReq2_formula.open('POST', strURL, true);
    self.xmlHttpReq2_formula.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq2_formula.onreadystatechange = function() 
    {	
		if (self.xmlHttpReq2_formula.readyState == 4) {
			//alert(self.xmlHttpReq2.responseText);
            updatepage_Result_formula(self.xmlHttpReq2_formula.responseText);
        }
    }
    self.xmlHttpReq2_formula.send(null);
}

function updatepage_Result_formula(str)
{
	document.getElementById("divChaine").style.display="";
	document.getElementById("super_logo").style.display="none";
	document.getElementById("divChaine").innerHTML= str;
}

// For Channel and Radio on Formula page
function xmlhttpPost_Formula_radio(fid) {
	//alert(timeval);
	var xmlHttpReq2_formula_radio = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq2_formula_radio = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq2_formula_radio = new ActiveXObject("Microsoft.XMLHTTP");
    }
	//alert(document.getElementById("divnews").innerHTML);
	
	strURL="formula_radio.php?fid="+fid;
	self.xmlHttpReq2_formula_radio.open('POST', strURL, true);
    self.xmlHttpReq2_formula_radio.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
	self.xmlHttpReq2_formula_radio.onreadystatechange = function() 
    {	
		if (self.xmlHttpReq2_formula_radio.readyState == 4) {
			//alert(self.xmlHttpReq2.responseText);
            updatepage_Result_formula_radio(self.xmlHttpReq2_formula_radio.responseText);
        }
    }
    self.xmlHttpReq2_formula_radio.send(null);
}

function updatepage_Result_formula_radio(str)
{
	document.getElementById("divRadio").style.display="";
	document.getElementById("super_radio").style.display="none";
	document.getElementById("divRadio").innerHTML= str;
}
