// AJAX START
var indicatorFileName = 'indicator_bar.gif'; // Default Indicator GIF
var style = '';
function indicatorLoad(divId,indicatorFileName,style){
document.getElementById(divId).innerHTML = '
';
}
var dynamicContent_ajaxObjects = new Array();
var jsCache = new Array();
var enableCache = false; // true - if no dynamic content
function ajax_loadContent(divId,pathToFile)
{
if(enableCache && jsCache[pathToFile]){
document.getElementById(divId).innerHTML = jsCache[pathToFile];
return;
}
var ajaxIndex = dynamicContent_ajaxObjects.length;
dynamicContent_ajaxObjects[ajaxIndex] = new sack();
dynamicContent_ajaxObjects[ajaxIndex].requestFile = pathToFile;
dynamicContent_ajaxObjects[ajaxIndex].onCompletion =
function(){ ajax_showContent(divId,ajaxIndex,pathToFile); };
dynamicContent_ajaxObjects[ajaxIndex].runAJAX();
}
function ajax_showContent(divId,ajaxIndex,pathToFile)
{
document.getElementById(divId).innerHTML =
dynamicContent_ajaxObjects[ajaxIndex].response;
if(enableCache){
jsCache[pathToFile] =
dynamicContent_ajaxObjects[ajaxIndex].response;
}
dynamicContent_ajaxObjects[ajaxIndex] = false;
}
function sack(file){
this.AjaxFailedAlert = "Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";
this.requestFile = file;
this.method = "POST";
this.URLString = "";
this.encodeURIString = true;
this.execute = false;
this.onLoading = function() {};
this.onLoaded = function() {};
this.onInteractive = function() {};
this.onCompletion = function() {};
this.createAJAX = function() {
try {
this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (err) {
this.xmlhttp = null;
}
}
if(!this.xmlhttp && typeof XMLHttpRequest != "undefined")
this.xmlhttp = new XMLHttpRequest();
if (!this.xmlhttp){
this.failed = true;
}
};
this.setVar = function(name, value){
if (this.URLString.length < 3){
this.URLString = name + "=" + value;
} else {
this.URLString += "&" + name + "=" + value;
}
}
this.encVar = function(name, value){
var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
return varString;
}
this.encodeURLString = function(string){
varArray = string.split('&');
for (i = 0; i < varArray.length; i++){
urlVars = varArray[i].split('=');
if (urlVars[0].indexOf('amp;') != -1){
urlVars[0] = urlVars[0].substring(4);
}
varArray[i] = this.encVar(urlVars[0],urlVars[1]);
}
return varArray.join('&');
}
this.runResponse = function(){
eval(this.response);
}
this.runAJAX = function(urlstring){
this.responseStatus = new Array(2);
if(this.failed && this.AjaxFailedAlert){
alert(this.AjaxFailedAlert);
} else {
if (urlstring){
if (this.URLString.length){
this.URLString = this.URLString + "&" + urlstring;
} else {
this.URLString = urlstring;
}
}
if (this.encodeURIString){
var timeval = new Date().getTime();
this.URLString = this.encodeURLString(this.URLString);
this.setVar("rndval", timeval);
}
if (this.element) { this.elementObj = document.getElementById(this.element); }
if (this.xmlhttp) {
var self = this;
if (this.method == "GET") {
var totalurlstring = this.requestFile + "?" + this.URLString;
this.xmlhttp.open(this.method, totalurlstring, true);
} else {
this.xmlhttp.open(this.method, this.requestFile, true);
}
if (this.method == "POST"){
try {
this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
} catch (e) {}
}
this.xmlhttp.send(this.URLString);
this.xmlhttp.onreadystatechange = function() {
switch (self.xmlhttp.readyState){
case 1:
self.onLoading();
break;
case 2:
self.onLoaded();
break;
case 3:
self.onInteractive();
break;
case 4:
self.response = self.xmlhttp.responseText;
self.responseXML = self.xmlhttp.responseXML;
self.responseStatus[0] = self.xmlhttp.status;
self.responseStatus[1] = self.xmlhttp.statusText;
self.onCompletion();
if(self.execute){ self.runResponse(); }
if (self.elementObj) {
var elemNodeName = self.elementObj.nodeName;
elemNodeName.toLowerCase();
if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea"){
self.elementObj.value = self.response;
} else {
self.elementObj.innerHTML = self.response;
}
}
self.URLString = "";
break;
}
};
}
}
};
this.createAJAX();
}
// AJAX END !
var indicator_track = 'indicator_bar.gif';
var indicator_list = 'indicator_big.gif';
var indicator_90 = 'indicator_2.gif';
var indicator_600 = 'indicator_3.gif';
var indicator_250 = 'indicator_1.gif';
var indicator_track_style = '';
var indicator_Tlist_style = 'style="margin-top:5px;"';
var indicator_90_style = 'style="margin-top:30px"';
var indicator_600_style = 'style="margin-top:290px"';
var indicator_250_style = 'style="margin-top:115px"';
var loadingIndicatorTime = '3'; // Seconds
var trackInfoRefreshInt = '35'; // Seconds
var pub_max_t=120;
var pub_min_t=60;
var pub_max_v=120;
var pub_min_v=60;
var pub_max_c=120;
var pub_min_c=45;
var pub_max_all=150;
var pub_min_all=90;
var pubs_av=3;
// Track Info Start
function loadTrack_Infos() {
ajax_loadContent('track',channelTrack);
ajax_loadContent('tracklist',channelTracklist);
}
function loadTrackInfos() {
indicatorLoad('tracklist',indicator_list,indicator_Tlist_style);
indicatorLoad('track',indicator_track,indicator_track_style);
TOut_1 = setTimeout('loadTrack_Infos()', loadingIndicatorTime * 1000);
TOut_2 = setTimeout('loadTrackInfos()', trackInfoRefreshInt * 1000);
}
// Track Info End!
// Ad Display Start
function load_t(pub){ajax_loadContent('728x90','/main/inc/t.php?pub='+ pub);}
function load_v(pub){ajax_loadContent('160x600','/main/inc/r.php?pub='+ pub);}
function load_c(pub){ajax_loadContent('300x250','/main/inc/c.php?pub='+ pub);}
function load_all(pub){
ajax_loadContent('728x90','/main/inc/t.php?pub='+ pub);
ajax_loadContent('160x600','/main/inc/r.php?pub='+ pub);
ajax_loadContent('300x250','/main/inc/c.php?pub='+ pub);
}
function loadPub(pub,pos) {
if(pos == 't'){indicatorLoad('728x90',indicator_90,indicator_90_style);
var TOut_02 = setTimeout('load_t('+pub+')', loadingIndicatorTime * 1000);
}
if(pos == 'v'){indicatorLoad('160x600',indicator_600,indicator_600_style);
var TOut_01 = setTimeout('load_v('+pub+')', loadingIndicatorTime * 1000);
}
if(pos == 'c'){indicatorLoad('300x250',indicator_250,indicator_250_style);
var TOut_03 = setTimeout('load_c('+pub+')', loadingIndicatorTime * 1000);
}
if(pos == 'all'){
indicatorLoad('728x90',indicator_90,indicator_90_style);
indicatorLoad('160x600',indicator_600,indicator_600_style);
indicatorLoad('300x250',indicator_250,indicator_250_style);
var TOut_00 = setTimeout('load_all('+pub+')', loadingIndicatorTime * 1000);
}
}
function loadPubs_all(pub) {
randomNum = Math.floor(Math.random() * (pub_max_all * 1000 - pub_min_all * 1000 + 1)) + pub_min_all * 1000;
if(pub < pubs_av){pub = pub + 1;}
else {pub = 1;}
loadPub(pub,'all');
var TOut_000 = setTimeout('loadPubs_all('+pub+')', randomNum);
}
function loadPubs_t(pub) {
randomNum = Math.floor(Math.random() * (pub_max_t * 1000 - pub_min_t * 1000 + 1)) + pub_min_t * 1000;
if(pub < pubs_av){pub = pub + 1;}
else {pub = 1;}
loadPub(pub,'t');
var TOut_001 = setTimeout('loadPubs_t('+pub+')', randomNum);
}
function loadPubs_v(pub) {
randomNum = Math.floor(Math.random() * (pub_max_v * 1000 - pub_min_v * 1000 + 1)) + pub_min_v * 1000;
if(pub < pubs_av){pub = pub + 1;}
else {pub = 1;}
loadPub(pub,'v');
var TOut_002 = setTimeout('loadPubs_v('+pub+')', randomNum);
}
function loadPubs_c(pub) {
randomNum = Math.floor(Math.random() * (pub_max_c * 1000 - pub_min_c * 1000 + 1)) + pub_min_c * 1000;
if(pub < pubs_av){pub = pub + 1;}
else {pub = 1;}
loadPub(pub,'c');
var TOut_003 = setTimeout('loadPubs_c('+pub+')', randomNum);
}
// Ad Display End!
// Body onLoad....
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
loadPubs_all('0')
//loadPubs_t('0');
//loadPubs_v('0');
//loadPubs_c('0');
loadTrackInfos();
});
///////////////////////////////////////////////////
onerror = function(){return true;}