var cookieDomain='.asetecgroup.com';
var baseUrl='http://www.asetecgroup.com';
var siteLang='es';
var idSplitLen=3;
var numWordsComment=100;
var commentsPerPage=10;
var hpMatchDetail=Class.create()
hpMatchDetail.prototype={
_matchid:[],
_roundid:[],
_matchday:[],
_viewtype:[],
_boxid:[],
_par1:[],
_par2:[],
_currentitem:-1,
_currmatchid:-1,
_currenttype:'',
_rollInterval:0,
_liveDefaultSet:0,
_urlp:'/worldcup/matches/round={round}/match={match}/library/_hppreview.html',
_urll:'/Live/Competitions/worldcup/matchday={matchday}/day=1/match={match}/_hplive.html',
_urls:'/worldcup/matches/round={round}/match={match}/library/_hpsummary.html?ign=' + Math.floor(Math.random() * 10000000000),
_urlm:'/Live/Competitions/worldcup/_hptournament.html',
_urlc:'/worldcup/matches/round={round}/match={match}/comments.html',
_urlmc:'/worldcup/matches/round={round}/match={match}/index.html',
_previtem:-1,
_tm:'',
_tmperiodical:'',
initialize:function() {
},
reset:function() {
this._matchid=[];
this._roundid=[];
this._matchday=[];
this._viewtype=[];
this._boxid=[];
this._par1=[];
this._par2=[];
},
add:function(boxid,id,round,mday,type,par1,par2) {
this._boxid.push(boxid);
this._matchid.push(id);
this._roundid.push(round);
this._matchday.push(mday);
this._viewtype.push(type);
this._par1.push(par1);
this._par2.push(par2);
},
show:function(id,source) {
if(source==2&&this._liveDefaultSet==1) return;
var i;
var surl='';
this.stopRotation();
for (i=0;i<this._matchid.length;i++) {
if(this._matchid[i]==id) {
if(this._currentitem!=i) {
$j('#fwcHPMatchlist li').removeClass("current");
this.update(i);
}
else {
surl=this._urlmc.replace('{round}',this._roundid[this._currentitem]);
surl=surl.replace('{match}',this._matchid[this._currentitem]);
surl=surl.replace('{matchday}',this._matchday[this._currentitem]);
window.location=surl;
}
break;
}
}
if(source==2) this._liveDefaultSet=1;
this.startRotation();
},
update:function(item) {
this._currmatchid=this._matchid[item];
this._currenttype=this._viewtype[item];
this._currentitem=item;
var surl='';
var par1='';
var boxid=this._boxid[item];
var viewtype=this._viewtype[item];
switch (viewtype) {
case 'p':
surl=this._urlp.replace('{round}',this._roundid[item]);
surl=surl.replace('{match}',this._matchid[item]);
break;
case 's':
surl=this._urls.replace('{round}',this._roundid[item]);
surl=surl.replace('{match}',this._matchid[item]);
break;
case 'l':
surl=this._urll.replace('{round}',this._roundid[item]);
surl=surl.replace('{match}',this._matchid[item]);
surl=surl.replace('{matchday}',this._matchday[item]);
break;
}
if(surl!='') {
$j('#newsReaderMatchDetail').load(surl,function() {
switch (viewtype) {
case 'p':
$j("#fwc_matchDetails .picture a,#fwc_matchDetails .matchHeaderTab a").click(function() { wAnalytics.onHPTop("newsreader - preview - picture");});
$j("#fwc_matchDetails h2 a").click(function() { wAnalytics.onHPTop("newsreader - preview - caption");});
$j("#fwc_matchDetails .quicklink a").click(function() { wAnalytics.onHPTop("newsreader - preview - related items");});
mngHPMatchDetail.currentviewtype='p';
break;
case 's':
$j("#fwc_matchDetails .picture a").click(function() { wAnalytics.onHPTop("newsreader - summary - picture");});
$j("#fwc_matchDetails h2 a").click(function() { wAnalytics.onHPTop("newsreader - summary - caption");});
$j("#fwc_matchDetails .quicklink a").click(function() { wAnalytics.onHPTop("newsreader - summary - related items");});
$j("#fwc_matchDetails .extcontent .video a").click(function() { wAnalytics.onHPTop("newsreader - summary - highlights");});
mngHPMatchDetail.currentviewtype='s';
break;
case 'l':
$j("#fwc_matchDetails .matchHeader a").click(function() {
wAnalytics.onHPTop("newsreader - match - launch matchcast");
});
mngHPMatchDetail.currentviewtype='l';
if(par1!='') {
}
break;
}
NewsReader.showNone()
$j('#newsReaderMatchDetail').show();
$j('#' + boxid).addClass("current");
});
}
},
updateCurrent:function() {
if(this._currentitem!=-1) {
if(this._matchid[this._currentitem]!=this._currmatchid) {
this._currentitem=-1;
this._currmatchid=-1;
this._currenttype='';
}
$j('#' + this._boxid[this._currentitem]).addClass("current");
$j('#newsReaderMatchDetail').show();
}
if(this._currentitem!=-1&&(this._currenttype!=this._viewtype[this._currentitem]||this._viewtype[this._currentitem]=='l')) {
this.update(this._currentitem);
}
},
updateFanVoice:function(fanvoiceurl) {
if(fanvoiceurl!='') {
var commUrl=this._urlc.replace('{round}',this._roundid[this._currentitem]);
commUrl=commUrl.replace('{match}',this._matchid[this._currentitem]);
$j.get(fanvoiceurl,null,function(data) {
for (var i=1;i<4;i++) {
var parent='';
parent=$j(data).next('.comment.mc' + i);
if(parent!=null) {
var sel="#newsReaderMatchDetail .fanvoice #comments" + i;
var obj='';
obj=$j(parent).find('.avatarComment');
if(obj!=null&&$j(obj).html()!=null) {
$j("#newsReaderMatchDetail .fanvoice").append("<div id=\"comments" + i + "\" class=\"fanvoiceComments\">");
var str=$j(obj).html();
str=str.replace("avatar_50.png","avatar_24.png");
str=str.replace('width="50"','width="24"');
str=str.replace('height="50"','height="24"');
str=str.replace('avatarContainer50','avatarContainer24');
$j('<div class="avatarCommentHP">' + str + '</div>').appendTo(sel);
obj=$j(parent).find('.nickname');
$j('<div id="userCommentsHP' + i + '" class="commentsDetails">').appendTo(sel);
var user="#userCommentsHP" + i;
if(obj!=null&&$j(obj).html()!=null) {
$j('<div class="nicknameHP">' + $j(obj).html() + '</div>').appendTo(user);
$j('#newsReaderMatchDetail .nicknameHP').replaceWith('<strong style="display:block;">' + $j('#newsReaderMatchDetail .nicknameHP strong').html() + '</strong>');
}
obj=$j(parent).find('.usercomment');
if(obj!=null&&$j(obj).html()!=null) {
$j('<div class="usercommentHP"><a href="' + commUrl + '">' + $j(obj).html().truncate(65,'...') + '</a></div>').appendTo(user);
}
$j('</div>').appendTo(sel);
}
}
}
if(mngHPMatchDetail.currentviewtype=='p') {
$j("#fwc_matchDetails .extcontent .fanvoice a").click(function() { wAnalytics.onHPTop("newsreader - summary - fan voice");});
} else if(mngHPMatchDetail.currentviewtype=='s') {
$j("#fwc_matchDetails .extcontent .fanvoice a").click(function() { wAnalytics.onHPTop("newsreader - summary - fan voice");});
}
});
}
},
getLiveDefaultSet:function() {
return this._liveDefaultSet;
},
getCurrentItem:function() {
return this._currentitem;
},
getCurrentMatch:function() {
return this._currmatchid;
},
getCurrentType:function() {
return this._currenttype;
},
startRotation:function(auto) {
if(this._rollInterval>0) {
if(auto&&this._currentitem==-1) this.show(this._matchid[0]);
if(this._tm=='') this._tm=setInterval(this.onTimerRotation.bind(this),this._rollInterval);
}
},
stopRotation:function() {
clearInterval(this._tm);
this._tm='';
},
setRotation:function(_rollInterval) {
this._rollInterval=_rollInterval;
},
onTimer:function() {
$j('#fwcHPMatchlist').load(this._urlm,function() { mngHPMatchDetail.setMatchListAnalytics() });
this._tmperiodical=setTimeout(this.onTimer.bind(this),30000);
},
startPerioricalUpdater:function() {
if(this._tmperiodical=='') {
$j('#fwcHPMatchlist').load(this._urlm,function() { mngHPMatchDetail.setMatchListAnalytics() });
this._tmperiodical=setTimeout(this.onTimer.bind(this),30000);
}
},
onTimerRotation:function() {
if(this._currentitem!=-1) {
if(this._currentitem<this._matchid.length - 1) {
var okView=0;
for (var i=this._currentitem + 1;i<this._matchid.length;i++) {
if(this._viewtype[i]!='') {
this.show(this._matchid[i],0);
okView=1;
break;
}
}
if(okView==0) this.restartNewsReader();
}
else {
this.restartNewsReader();
}
}
},
restartNewsReader:function() {
this.stopRotation();
$j('#fwcHPMatchlist li').removeClass("current");
this._currentitem=-1;
NewsReader.showNews('1');
$j('#fwcHPMatchlist').load(this._urlm,function() { mngHPMatchDetail.setMatchListAnalytics() });
},
deselectAll:function() {
$j('#fwcHPMatchlist li').removeClass("current");
this._previtem=this._currentitem;
this._currentitem=-1;
$j('#newsReaderMatchDetail').hide();
},
reselectItem:function() {
this._currentitem=this._previtem;
this.updateCurrent();
},
setMatchListAnalytics:function() {
$j("#hpmatchbox_1").click(function() { wAnalytics.onHPTop("newsreader - right box 1") });
$j("#hpmatchbox_2").click(function() { wAnalytics.onHPTop("newsreader - right box 2") });
$j("#hpmatchbox_3").click(function() { wAnalytics.onHPTop("newsreader - right box 3") });
$j("#hpmatchbox_4").click(function() { wAnalytics.onHPTop("newsreader - right box 4") });
$j("#hpmatchbox_5").click(function() { wAnalytics.onHPTop("newsreader - right box 5") });
}
};
var mngHPMatchDetail=new hpMatchDetail();



