
var aC = 0;var dN = 0;
var loaderUrl = "/ticker/xmlTicker.cfm";
var wk = null;var gr2 = true;
var gr = "GiaRo";var UM = null;
var tB = false;var aW = 5 * 60000;
var db = 4000;var bY = 3000;
var Ex = false;var uB = false;
var TB = "sequence";
var Xh = new Array();
var bq = null;var ed = 'Loading...';
var hA = 'Contenuti non disponibili';
var Bg = 'Errore nel caricamento dei contenuti!';
var JV = null;var XZ = null;
var KS = -1;var qw = null;
var GS = null;var Ni = false;
function initTicker(Ce){
return initTicker(Ce, null);
}
function initTicker(Ce, qV){
uB = false;
if(dN != 0){ clearTimeout(dN); }
if(qV != null) this.loaderUrl = qV;
if(Ce != null && Ce != ''){
wk = Ce;
} else{
gV = document.getElementById("tickerConf");
if(gV && gV.value && trim(gV.value) != ''){
wk = trim(gV.value);
}
}
if(wk){
dt(new Fj(ed, null, null, null, null).cs());
waitingTicker();
refreshNews();
fw();
}else{
dt(new Fj(hA, null, null, null, null).cs());
}
}
function Fj(Tj, iV, qq, cE, Nc){
this.Tj = Tj;this.iV  = iV;
this.cE = cE;this.Nc = Nc;
this.qq = qq;
this.IV = function(){
return this.Tj;
}
this.SH = function(){
return this.iV;
}
this.Uf = function(){
return this.cE;
}
this.bF = function(){
return this.Nc;
}
this.YD = function(){
return this.qq;
}
this.cs = function(){
var cv = '';
if(this.iV != null){
if(this.cE != null){
cv = '<a href=' + this.iV + ' target=' + this.cE + ' class=tickerLink>' + this.Tj + '</a>';
} else {
cv = '<a href=' + this.iV + ' class=tickerLink>' + this.Tj + '</a>';
}
} else return this.Tj;
return cv;
}
}
function DD(FQ, iV, qq, Ig, Nc, jP, sC){
this.FQ = FQ;this.iV  = iV;
this.qq = qq;this.Ig = Ig;
this.Nc = Nc;this.jP = jP;
this.ge = sC;
this.QE = null;
this.qw  = null;
this.uo = function(){
return this.FQ;
}
this.SH = function(){
return this.iV;
}
this.YD = function(){
return this.qq;
}
this.YN = function(){
return this.Ig;
}
this.bF = function(){
return this.Nc;
}
this.ES = function(){
return this.mage;
}
this.jc = function(){
return this.ge;
}
this.tg = function(){
return this.jP != null;
}
this.gs = function(){
var cv = '';
if(this.iV != null){
if(this.cE != null){
cv = '<a href=' + this.iV + ' target=' + this.cE + '>' + this.Tj + '</a>';
} else {
cv = '<a href=' + this.iV + '>' + this.Tj + '</a>';
}
} else return this.Tj;
return cv;
}
this.sH = function(){
var cv = '';
if(this.jP != null){
return this.jP.GV();
}
return '';
}
this.tm = function(){
if(Ig == 'random'){
this.QE = Math.round(Math.random() * this.ge.length-1);
} else if(Ig == 'planning'){
if(this.qw == null || this.qw == xv.length-1){
this.qw = 0;
} else {
this.qw += 1;
}
this.QE = xv[this.qw] - 1;
} else {
this.QE = (this.QE == null || this.QE == this.ge.length-1) ? 0 : this.QE + 1;
}
return this.ge[this.QE];
}
}
function Hp(FQ, Os, iV, DC, TQ){
this.FQ = FQ;
this.Os  = Os;
this.iV = iV;
this.DC = DC;
this.TQ = TQ;
this.uo = function(){
return this.FQ;
}
this.SH = function(){
return this.iV;
}
this.dO = function(){
return this.Os;
}
this.Mk = function(){
return this.DC;
}
this.WN =  function(){
return this.TQ;
}
this.GV = function(){
var cv = '';
if(this.Os != null){
var uM = '<img src='
+ this.Os
+ ' alt='
+ (this.FQ ? this.FQ : ' ')
+ (this.DC ? ' width=' + this.DC : ' ')
+ (this.TQ ? ' height=' + this.TQ : ' ')
+ ' border=0>';
if(this.iV != null){
cv = '<a href=' + this.iV + '>' + uM + '</a>';
} else {
cv = uM;
}
} else return '';
return cv;
}
}
function Zn(Hn, qq, qV, dY, Ig, Gh, Nc, aD, Nk, Je){
this.Hn          = Hn;
this.qq = qq;
this.qV      = qV;
this.dY      = dY;
this.Ig   = Ig;
this.Gh     = Gh;
this.Nc  = Nc;
this.aD        = aD;
this.Nk    = Nk;
this.Je     = Je;
this.iR = function(){
return this.Hn;
}
this.YD = function(){
return this.qq;
}
this.OL = function(){
return this.qV;
}
this.wp = function(){
return this.dY;
}
this.YN = function(){
return this.Ig;
}
this.vZ = function(){
return this.Gh;
}
this.bF = function(){
return this.Nc;
}
this.ow = function(){
return this.aD;
}
this.ow_Os = function(){
return this.Nk;
}
this.FP = function(){
return this.Je;
}
this.iY = function(){
if(this.Gh){
return this.Gh.split(',');
} else return new Array();
}
}
function sZ(){
dt(new Fj(Bg, null, null, null, null).cs());
stopTicker();
}
function refreshNews(){
XF();
}
function Gl(){
if(tB && bq && bq.wp()){
setTimeout("refreshNews()", bq.wp());
}
}
function XF() {
try{
var PW = loaderUrl + "?news=" + wk;
if (window.XMLHttpRequest) {
GS = new XMLHttpRequest();
} else if (window.ActiveXObject) {
GS = new ActiveXObject("Microsoft.XMLHTTP");
}
GS.open("GET", PW, true);
GS.onreadystatechange = dD;
GS.send(null);
}catch(e){
//alert('' + e);
sZ();
}
}
function dD() {
try{
if(GS.readyState == 4) {
if(GS.status == 200) {
HH(GS.responseXML);
} else if(GS.status >= 500) {
sZ();
}
}
}catch(e){
//alert('Errore loadNewsCallback exception= ' + e);
GS.abort();
sZ();
}
}
function HH(responseXML) {
try{
var hW = responseXML.documentElement;
waitingTicker();
var Hh = hW.getElementsByTagName("config")[0];
if(Hh != null){
var Jr = Hh.getElementsByTagName("id")[0];
var Hn = Jr.firstChild.nodeValue;
var TZ = Hh.getElementsByTagName("description")[0];
var Nf = TZ.firstChild.nodeValue;
var ac = Hh.getElementsByTagName("loader")[0];
var qV = ac.firstChild.nodeValue;

var NF = Hh.getElementsByTagName("reload")[0];
var dY = null;
if(NF != null){
dY = NF.firstChild.nodeValue;
} else {
dY = aW;
}

var Ab = Hh.getElementsByTagName("scheduler")[0];
var ui = null;
if(Ab != null){
ui = Ab.firstChild.nodeValue;
} else {
ui = TB;
}
var Qg = Hh.getElementsByTagName("plannig")[0];
var TO = (Qg != null ? Qg.firstChild.nodeValue : null);

var hE = Hh.getElementsByTagName("impression")[0];
var lt = null;
if(hE != null){
lt = hE.firstChild.nodeValue;
} else {
lt = bY;
}
var LL = Hh.getElementsByTagName("icon")[0];
var aD = (LL != null ? (LL.firstChild.nodeValue == "true" ? true : false) : false);

var wD = Hh.getElementsByTagName("icon_url")[0];
var mP = (wD != null ? wD.firstChild.nodeValue : false);

var sk = Hh.getElementsByTagName("jumpurl")[0];
var FE = (sk != null ? sk.firstChild.nodeValue : false);
this.bq = new Zn(Hn, Nf, qV, dY, ui, TO, lt, aD, mP, FE);
} else {
return;
}
var At = hW.getElementsByTagName("channel");
var HM = new Array();
var DP = null;var pK = null;
var DP = null;var FQ = null;
var TZ = null;var Nf = null;
var Ut = null;var iV = null;
var Li = null;
for(kp=0; kp<At.length; kp++){
pK = At[kp];
DP = pK.getElementsByTagName("title")[0];
FQ = DP.firstChild.nodeValue;
TZ = pK.getElementsByTagName("description")[0];

Nf = TZ.firstChild.nodeValue;
Ut = pK.getElementsByTagName("link")[0];
iV = Ut.firstChild.nodeValue;
Li = pK.getElementsByTagName("image")[0];
var pj = null;
if(Li != null){
var RS = Li.getElementsByTagName("url")[0];
if(RS != null){
var rx = RS.firstChild.nodeValue;
var img_DP = Li.getElementsByTagName("title")[0];
var sO = (img_DP != null ? img_DP.firstChild.nodeValue : null);
var img_TZ = Li.getElementsByTagName("description")[0];
var img_Nf = (img_TZ != null ? img_TZ.firstChild.nodeValue : null);
var img_Ut = Li.getElementsByTagName("link")[0];
var lf = (img_Ut != null ? img_Ut.firstChild.nodeValue : null);
var AK = Li.getElementsByTagName("width")[0];
var qh = (AK != null ? AK.firstChild.nodeValue : null);
var hU = Li.getElementsByTagName("height")[0];
var Zd = (hU != null ? hU.firstChild.nodeValue : null);
pj = new Hp(sO, rx, lf, qh, Zd);
}
}
var Ab = pK.getElementsByTagName("scheduler")[0];
var ui = null;
if(Ab != null){
ui = Ab.firstChild.nodeValue;
} else {
ui = TB;
}
var hE = pK.getElementsByTagName("impression")[0];
var lt = null;
if(hE != null){
lt = hE.firstChild.nodeValue;
} else {
lt = bY;
}
var sC = new Array();
var rM = null;var item_DP = null;
var mf = null;var item_TZ = null;
var item_Nf = null;var item_Ut = null;
var item_iV = null;
for(lW=0; lW<pK.childNodes.length; lW++){
rM = pK.childNodes[lW];
if(rM.nodeName == 'item'){
item_DP = rM.getElementsByTagName("title")[0];
mf = item_DP.firstChild.nodeValue;
item_TZ = rM.getElementsByTagName("description")[0];
if(item_TZ.firstChild){
item_Nf = item_TZ.firstChild.nodeValue;
} else { item_Nf = ""; }
item_Ut = rM.getElementsByTagName("link")[0];
if(item_Ut.firstChild){
item_iV = item_Ut.firstChild.nodeValue;
}
sC[sC.length] = new Fj(mf, item_iV, item_Nf, null, null);
}
}
if(sC.length > 0){
HM[HM.length] = new DD(FQ, iV, Nf, ui, lt, pj, sC);
}
}
Xh = new Array();
if(HM.length > 0){
Xh = Xh.concat(HM);
restartTicker();
} else {
dt(new Fj(hA, null, null, null, null).cs());
}
Gl();
}catch(e){
//alert('' + e);
sZ();
}
}
function stopTicker(){
uB = true;
}
function waitingTicker(){
Ex = true;
}
function restartTicker(){
KS = null;qw = null;Ex = false;
}
function fw(){
if(uB) return;
if(Ex){
dN = setTimeout("fw()", db);
} else {
aC++;
XZ = mV();
JV = XZ.tm();
var cv = '';
if(this.bq.ow()){
cv = XZ.sH() + '&nbsp;' + JV.cs();
}else{
cv = JV.cs();
}
dt(cv);
tM = (XZ.bF() != null) ? XZ.bF() : bY;
var vJ = document.getElementById ? document.getElementById("tickercontenitore") : document.all.tickercontenitore;
var iX = (vJ.filters && vJ.filters.length >0 )? vJ.filters[0].duration * 1000 : 0;
dN = setTimeout("fw()", parseInt(tM) + parseInt(iX));
}
}
function mV(){
Vv = this.bq.YN();
if(Vv == 'random'){
KS = Math.round(Math.random() * Xh.length-1);
} else if(Vv == 'planning'){
xv = this.bq.iY();
if(qw == null || qw == xv.length-1){
qw = 0;
} else {
qw += 1;
}
KS = xv[qw] - 1;
if(KS > Xh.length-1){ KS = 0; }
} else {
KS = (KS == null || KS == Xh.length-1) ? 0 : KS + 1;
}
return Xh[KS];
}
function dt(cv) {
var vJ = document.getElementById ? document.getElementById("tickercontenitore") : document.all.tickercontenitore;
if(vJ.filters && vJ.filters.length>0)
vJ.filters[0].Apply();
vJ.innerHTML = cv;
if(vJ.filters && vJ.filters.length>0)
vJ.filters[0].Play();
}

