
Cstlkbc.prototype={



curOpts:{

mode:false,


allopen:false,

paintAnti:false,

paintPro:false,

nextrows:false,

prevrows:false,

opentalkback:false,
opentalkbackpage:false
},




onInit:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.initializor.onInit(onEnd);
});
},




onClickTsurrdiv:function(tid){
this.talkbacks.talkbackOpenClose(tid);
},


onClickOpenAll:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({allopen:true},onEnd);
});
},


onClickCloseAll:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({allopen:false},onEnd);
});
},


onClickSetModeDesc:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({mode:'desc',allopen:false},onEnd);
});
},


onClickSetModeAsc:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({mode:'asc',allopen:false},onEnd);
});
},


onClickSetModeRecmm:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({mode:'recmm',allopen:true},onEnd);
});
},


onClickSetModeInterest:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({mode:'interest',allopen:true},onEnd);
});
},


onClickNextTalkbacks:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({nextrows:true},onEnd);
});
},


onClickPrevTalkbacks:function(){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({prevrows:true},onEnd);
});
},


opentalkback:function(tid){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
_this.talkbacks.updater.update({opentalkback:parseInt(''+tid)},onEnd);
});
},



onClickAntiPro:function(isPro){
var _this=this;
_this._runInterfaceOperation(function(onEnd){
if (isPro) {
_this.talkbacks.updater.update({paintPro:!_this.curOpts.paintPro},onEnd);
} else {
_this.talkbacks.updater.update({paintAnti:!_this.curOpts.paintAnti},onEnd);
};
});
},




onClickPCImageArr:function(tid){
this.pcardMenu.open(tid);
},


onClickPcardMenu:function(w){
this.pcardMenu.openLink(w);
},


onClickPcardMenuClose:function(){
this.pcardMenu.close();
},





replyTalkback:function(tid,isAlwaysParent){
if (typeof(isAlwaysParent)=='undefined') var isAlwaysParent=false;
this.replyControl.open(tid,isAlwaysParent);
if (stlkbc.talkbackType != stlkbc.constComponentTalkbackType) {
if (typeof(tid)=='undefined' || tid == 0) {
var theDiv=document.getElementById('stlkbcparentreplydiv');
if (theDiv) stlkbcreply.showMerlin(theDiv,tid);
} else {
var theDiv=document.getElementById('stlkbc' + tid + 'treplydiv');
if (theDiv) stlkbcreply.showMerlin(theDiv,tid);
}
}

},


hideReplyDiv:function(tid){
this.replyControl.close(tid);
},




recmmTalkback:function(tid,irecmm){
this.recmm.doit(tid,irecmm);
},




gotoLogin:function(tid){
stlkbc.tracker.update({
opentalkback:tid,
autorecmm:stlkbc.recmm.getPendingTidRecmm(tid)
});

var _this=this;
var opp=_this.getOpentalkbackParam(tid);
try{

var cont=_this.articlesurl.replace('TIDREPLACE',opp);
var reglink=_this.registrationurl.replace('TIDREPLACE',opp);
var forgotpasslink=_this.forgotpassurl.replace('TIDREPLACE',opp);
if (_this.gt(tid,'trecmmlogindiv')) {
var tl=_this.util.getEltTopLeft(_this.gt(tid,'trecmmlogindiv'));
var left=tl[1]+_this.g('lightBoxAddLeft');
} else {
var left=false;
};
if (document.getElementById('uict')) {
document.getElementById('uict').contentWindow.LoginLightbox(cont,reglink,forgotpasslink,left);
} else {
LoginLightbox(cont,reglink,forgotpasslink,left);
};
}catch(e){

window.location.href=_this.loginurl.replace('TIDREPLACE',opp);
};
},


gotoregpage:function(tid){
stlkbc.tracker.update({
opentalkback:tid,
autorecmm:stlkbc.recmm.getPendingTidRecmm(tid)
});
var _this=this;
window.location.href=_this.registrationurl.replace('TIDREPLACE',_this.getOpentalkbackParam(tid));
},





loadPreviewRenderedContent:function(data){
var myDate=new Date();
var day=''+myDate.getDate();
if (day.length==1) day='0'+day;
var mon=''+(myDate.getMonth()+1);
if (mon.length==1) mon='0'+mon;
var year=''+myDate.getFullYear();
year=year.slice(2);
data.mainElt.innerHTML=[
"<div dir='rtl' align='right' style='height:270px;overflow:auto;'>",
this.rowtemplate.getContentdiv({
id:1,
title:data.replyTitle,
text:data.content,
LEVEL:1,
tc:1,
name:data.replyName,
location:data.replyLocation,
the_date:day+'.'+mon+'.'+year,
userid:0,
thumb_image_path:''
},true,false,true),
'</div>'
].join('');
},







getAjaxUrl:function(params,isNc) {

var _this=this;
if (typeof(isNc)=='undefined') var isNc=false;

var newparams=[];
for (var i=0;i<params.length;i++) {
newparams.push(''+params[i]);
};

if (params[0]=='loadcontent') {

var url=_this.ajaxurl_loadcontent;
} else if (isNc) {

var url=_this.ajaxurlnc;
} else {

var url=_this.ajaxurl
};



return url.replace('TOREPLACE',newparams.join('-'))+((isNc||_this.disableAkCache)?('?RN='+(new Date).getTime()):'');
},


g:function(vn){

return this.gobj[vn];
},


ue:function(str){

},


uee:function(obj){
return this.ue('error #'+obj.errcode+': '+obj.errmsg);
},



ge:function(id){

var __gecache=this._gecache;
if (typeof(__gecache[id])=='undefined') {
var elt=document.getElementById('stlkbc'+id);
if (elt) __gecache[id]=elt;
else elt=false;
} else {
var elt=__gecache[id];
};
return elt;
},
_gecache:{},


gt:function(tid,id){
return document.getElementById('stlkbc'+tid+''+id);
},


gs:function() {
var ans=false;
for(var i=0;i<document.styleSheets.length;i++){
var stylesheet=document.styleSheets[i];
if (stylesheet.title=='stlkbcstyle') {
ans=stylesheet;
break;
};
};
return ans;
},







getAdvertDivContent:function(myeltid,tadvertid){
if (stlkbc.talkbackType != stlkbc.constComponentTalkbackType) {

var _this=this;

var __advertdivsmyeltids=_this._advertdivsmyeltids;
if (typeof(__advertdivsmyeltids[tadvertid])=='undefined') __advertdivsmyeltids[tadvertid]=false;
var advertdivmyeltid=__advertdivsmyeltids[tadvertid];


__advertdivsmyeltids[tadvertid]=myeltid;




_this.fillAdvertDiv(myeltid,tadvertid);
}
},
_advertdivsmyeltids:{},


getOpentalkbackParam:function(tid){
return stlkbc.tracker.getUrlParam();


},



_runInterfaceOperation:function(callback){
var _this=this;
if (!_this._interfacedisabled) {


_this._interfacedisabled=true;
callback(function(){


_this._interfacedisabled=false;
});
}; 
},
_interfacedisabled:false

};



Cstlkbc.prototype.initializor={
onInit:function(onEnd){

var _this=this;

_this._onEnd=onEnd;


if (!window.attachEvent) window.addEventListener('unload',function(){},false);


_this._domReadyTimeout();
},


_domReadyTimeout:function(){

var _this=this;
if (!_this._isDomReady()) {
setTimeout(function(){_this._domReadyTimeout();},50);
} else {
_this._onDomReady();
};
},


_isDomReady:function(){

var _stlkbc=stlkbc;
for(var i=0;i<_stlkbc.domreadyeltids.length;i++){
if (!_stlkbc.ge(_stlkbc.domreadyeltids[i])) return false;
};
if (_stlkbc.isAntiPro) {
var stylesheet=_stlkbc.gs();
if (!stylesheet) {
this._numFailsCounter++;
if (this._numFailsCounter<this._numFailsLimit) return false;
else return true;
};
stylesheet.disabled=false;
};
return true;
},
_numFailsCounter:0,
_numFailsLimit:100,


_onDomReady:function(){
var _this=this;

stlkbc.userInfo.onInit(function(){
_this._onInit_AfterUserInfo();
});
},

_onInit_AfterUserInfo:function(){

stlkbc.recmm.onInit();

var _this=this;
stlkbc.tbheader.onInit(function(isDisplayedTalkbacks){
_this._onDomReady_AfterTbHeader(isDisplayedTalkbacks);
});
},

_onDomReady_AfterTbHeader:function(isDisplayedTalkbacks){

var _stlkbc=stlkbc;
var _this=this;
if (isDisplayedTalkbacks) {
var opts=stlkbc.tracker.getOpts();
if (opts==false) {

_stlkbc.talkbacks.updater.update({
mode:'desc',
opentalkback:false
},function(){_this._afterUpdater();});
} else if ((typeof(opts.mode)!='undefined')&&(typeof(opts.allopen)!='undefined')) {

_stlkbc.talkbacks.updater.update({
mode:opts.mode,
opentalkback:opts.opentalkback,
opentalkbackpage:opts.opentalkbackpage,
allopen:opts.allopen
},function(){
if ((opts.autorecmm!=false)&&(opts.opentalkback!=false)) {
stlkbc.recmm.doit(opts.opentalkback,(opts.autorecmm=='p'));
};
_this._afterUpdater();
});
} else {

_stlkbc.talkbacks.updater.update({
mode:'desc',
opentalkback:opts.opentalkback
},function(){_this._afterUpdater();});
};
} else {
_this._afterUpdater();
};
},

_afterUpdater:function(){
this._onEnd();
}
};



Cstlkbc.prototype.userInfo={
userDetails:{
name:'',
location:'',
email:''
},

onInit:function(callback){
var ud=getYnetCookies();
if (ud.isLoggedIn) {
var utbvotes={};
if (ud.tbvts.length>0) {
var tmp=ud.tbvts.split(' ');
for(var i=0;i<tmp.length;i++){
var status=tmp[i].substring(0,1);
if ((status!='*')&&(status!='+')&&(status!='-')) {
status='*';
var talkbackId=tmp[i];
} else {
var talkbackId=tmp[i].substring(1);
};
utbvotes['t'+talkbackId]=status;
};
};
var obj={
isLoggedIn:true,
name:ud.nickName,
location:ud.location,
email:ud.email,
utbvotes:utbvotes
};
} else {
var obj={isLoggedIn:false,utbvotes:{}};
};
this._onInit_AfterAjax(callback,obj);
},
_onInit_AfterAjax:function(callback,obj){
if (obj.error) stlkbc.uee(obj); else {

var _this=this;
_this._isLoggedIn=obj.isLoggedIn;
_this._votedTalkbacks=obj.utbvotes;
if (obj.isLoggedIn) {
_this.userDetails.name=obj.name;
_this.userDetails.location=obj.location;
_this.userDetails.email=obj.email;
};
};
callback();
},
getVotedTalkbacks:function(){
return this._votedTalkbacks;
},
isLoggedIn:function(){
return this._isLoggedIn;
},
setIsLoggedIn:function(status){
this._isLoggedIn=status;
},
_isLoggedIn:false,
_votedTalkbacks:[]
};


Cstlkbc.prototype.recmm={
onInit:function(){

this._votedTalkbacks=stlkbc.userInfo.getVotedTalkbacks();
},



updateContentDiv:function(tid){

var _this=this;
if (!stlkbc.userInfo.isLoggedIn()) {

_this._showRecmmTalkbackDiv(tid,'div');
} else {
var tbstatus=_this._getVotedTalkbackStatus(tid);
if (tbstatus!=false) {
_this._showRecmmTalkbackDiv(tid,'div');
if (tbstatus=='+') _this._disableRecmmGif(tid);
if (tbstatus=='-') _this._disableBadmmGif(tid);
};
};
},

getPendingTidRecmm:function(tid){
if (typeof(this._pendingRecmms[tid])!='undefined') {
if (this._pendingRecmms[tid]) {
return 'p';
} else {
return 'm';
};
} else {
return false;
};
},


doit:function(tid,isrecmm){

var _this=this;
var _stlkbc=stlkbc;
if (!_this._waitingForAjax) {
var tbstatus=_this._getVotedTalkbackStatus(tid);
var cancelPrev=(((tbstatus=='+')&&(!isrecmm))||((tbstatus=='-')&&(isrecmm)));
if (_stlkbc.userInfo.isLoggedIn()) {

if ((tbstatus===false)||(cancelPrev)||tbstatus=='*') {
if (cancelPrev) {

tbstatus='*';
_this._votedTalkbacks['t'+tid]=false;
} else {

_this._votedTalkbacks['t'+tid]=tbstatus=(isrecmm)?'+':'-';
};

_this._showRecmmTalkbackDiv(tid,'ajaxloader');

_this._waitingForAjax=true;
_stlkbc.util.ajax(_stlkbc.getAjaxUrl(['recmm',_stlkbc.articleId,tid,_stlkbc.talkbackType,(isrecmm?1:0)],true),function(obj){
_this._waitingForAjax=false;
_this._doit_afterAjax(obj,tid,isrecmm,tbstatus,cancelPrev);
});
};
} else {

_this._pendingRecmms[tid]=isrecmm;
_this._showRecmmTalkbackDiv(tid,'logindiv');
};
};
},
_waitingForAjax:false,
_pendingRecmms:{},

_doit_afterAjax:function(obj,tid,isrecmm,tbstatus,cancelPrev){
if (!stlkbc.g('isIframe')) {

var _stlkbc=stlkbc;
var _this=this;
if (obj.error) {
_stlkbc.uee(obj);
obj.status='notloggedin';
};
_this._showRecmmTalkbackDiv(tid,((obj.status=='notloggedin')?'logindiv':'div'));
if (obj.status=='notloggedin') {

_this._pendingRecmms[tid]=isrecmm;
_stlkbc.userInfo.setIsLoggedIn(false);
} else {

if (cancelPrev) {
_this._enableRecmmGif(tid);
_this._enableBadmmGif(tid);
} else if (tbstatus=='+') {
_this._disableRecmmGif(tid);
} else if (tbstatus=='-') {
_this._disableBadmmGif(tid);
};
if (obj.status=='ok') {

var newts=_stlkbc.talkbacks.getRow(tid).ts+(isrecmm?1:-1);
_stlkbc.talkbacks.getRow(tid).ts=newts;
_stlkbc.gt(tid,'trecmmtsdiv').innerHTML=''+newts;
if (cancelPrev) {
_stlkbc.gt(tid,'trecmmdeftxt').innerHTML=_stlkbc.g('txtRecmmThisTalkback');
} else {
_stlkbc.gt(tid,'trecmmdeftxt').innerHTML=_stlkbc.g('txtRecmmThankYou');
};
};
};
};
},








_showRecmmTalkbackDiv:function(tid,showdiv){
if (!stlkbc.g('isIframe')) {

var _stlkbc=stlkbc;
_stlkbc.gt(tid,'trecmmdiv').style.display=(showdiv=='div')?'block':'none';
_stlkbc.gt(tid,'trecmmlogindiv').style.display=(showdiv=='logindiv')?'block':'none';
_stlkbc.gt(tid,'trecmmajaxloader').style.display=(showdiv=='ajaxloader')?'block':'none';
};
},

_disableRecmmGif:function(tid){
stlkbc.gt(tid,'trecmmgif').src='/images/stlkbcrecmmg.gif';
},
_disableBadmmGif:function(tid){
stlkbc.gt(tid,'tbadmmgif').src='/images/stlkbcbadmmg.gif';
},
_enableRecmmGif:function(tid){
stlkbc.gt(tid,'trecmmgif').src='/images/stlkbcrecmm.gif';
},
_enableBadmmGif:function(tid){
stlkbc.gt(tid,'tbadmmgif').src='/images/stlkbcbadmm.gif';
},

_getVotedTalkbackStatus:function(tid){
if (typeof(this._votedTalkbacks['t'+tid])!='undefined') {
return this._votedTalkbacks['t'+tid];
} else {
return false;
};
},
_votedTalkbacks:{}
};


Cstlkbc.prototype.talkbacks={

getRow:function(tid){
return this._rows[tid];
},

isRowExists:function(tid){
return (typeof(this._rows[tid])!='undefined');
},

iterateRows:function(callback){

var _this=this;
for(var k in _this._rows){
callback(_this._rows[k]);
};
},

addRow:function(tid,row){
this._rows[tid]=row;
},

clearRows:function(){
this._rows=[];
},


setTalkbackAdvertTid:function(tid){
this._talkbackadvert_tid=tid;
},


talkbackOpenClose:function(tid,confirmedClosing){
if (typeof(confirmedClosing)=='undefined') var confirmedClosing=false;

var _this=this;
var _stlkbc=stlkbc;

_stlkbc.pcardMenu.close();

if (!_stlkbc.curOpts.allopen) {
var row=_this._rows[tid];
if (row.isContentDivShown) {

if (!confirmedClosing) {

stlkbcreply.hide(tid,false,function(isok){if (isok) _this.talkbackOpenClose(tid,true);});
} else {

_stlkbc.gt(tid,'tsurrdiv').style.display='block';
_stlkbc.gt(tid,'tcontentdiv').style.display='none';
if (_this._talkbackadvert_tid==tid) {

_stlkbc.gt(tid,'tadvert').style.display='none';
_this._talkbackadvert_tid=false;
};

row.isContentDivShown=false;
};
} else {


if (!row.isContentDivLoaded) {
_stlkbc.gt(tid,'tcontentdiv').innerHTML=_stlkbc.rowtemplate.getContentdivContent(row,false);

_stlkbc.gt(tid,'tadvert').style.display='block';
_stlkbc.getAdvertDivContent(''+tid+'tadvert','talkback'); 
row.isContentDivLoaded=true;
};

_stlkbc.gt(tid,'tsurrdiv').style.display='none';
_stlkbc.gt(tid,'tcontentdiv').style.display='block';

_this._talkbackadvert_tid=tid;

if (row.load_content) {



row.load_content=false;
_stlkbc.gt(tid,'ttextcont').innerHTML=_stlkbc.ge('textcontajaxloader').innerHTML;
_stlkbc.util.ajax(_stlkbc.getAjaxUrl(['loadcontent',_stlkbc.articleId,_stlkbc.talkbackType,''+tid]),function(obj){
if (obj.error) {
_stlkbc.uee(obj);
_stlkbc.gt(tid,'ttextcont').innerHTML='';
} else {
_stlkbc.gt(tid,'ttextcont').innerHTML=obj.text;
};
});
}; 

_stlkbc.recmm.updateContentDiv(tid);

_stlkbc.tracker.update({opentalkback:tid});

row.isContentDivShown=true;
};
};
if (_stlkbc.g('isIframe')) {
adjustParentIframeHeight();
};
},
_rows:[],
_talkbackadvert_tid:false
};


Cstlkbc.prototype.talkbacks.updater={


getServerPageNum:function(){
return ((this._serverpagenum==false)?0:this._serverpagenum);
},


update:function(opts,onEnd){
var _stlkbc=stlkbc;
if (_stlkbc.g('isIframe')) {
var _onEnd=onEnd;
onEnd=function(){
_onEnd();
adjustParentIframeHeight();
};
};

var _this=this;
var stlkbctalkbacks=_stlkbc.talkbacks;
var stlkbcutil=_stlkbc.util;

var newOpts=stlkbcutil.objectExtendClone(_stlkbc.curOpts,opts);
var oldOpts=stlkbcutil.objectClone(_stlkbc.curOpts);
if ((newOpts.mode==oldOpts.mode)&&(newOpts.allopen==oldOpts.allopen)) {

if ((newOpts.opentalkback!=false)&&(stlkbctalkbacks.isRowExists(newOpts.opentalkback))) {

_stlkbc.tracker.update(newOpts);

var row=stlkbctalkbacks.getRow(newOpts.opentalkback);
if (!row.isContentDivShown) {

stlkbctalkbacks.talkbackOpenClose(newOpts.opentalkback);
};

stlkbcutil.scrollToElt(_stlkbc.gt(newOpts.opentalkback,'tcontentdiv'));

newOpts.opentalkback=false;
newOpts.opentalkbackpage=false;

_stlkbc.curOpts=newOpts;
return onEnd();

};
if ((newOpts.paintAnti!=oldOpts.paintAnti)||(newOpts.paintPro!=oldOpts.paintPro)) {


_stlkbc.tracker.update(newOpts);

_stlkbc.tbheader.updateAntiProRadio(newOpts.paintPro,newOpts.paintAnti);

var anticolor=newOpts.paintAnti?_stlkbc.g('antiDivBackgroundColor'):'#000000';
var procolor=newOpts.paintPro?_stlkbc.g('proDivBackgroundColor'):'#000000';

var antifontweight=newOpts.paintAnti?'bold':'normal';
var profontweight=newOpts.paintPro?'bold':'normal';

var csstext=[
' div.stlkbcsurrcolpro{color:'+procolor+';font-weight:'+profontweight+';} ',
' div.stlkbcsurrcolanti{color:'+anticolor+';font-weight:'+antifontweight+';} '
].join('');

var stylesheet=_stlkbc.gs();
if (typeof(stylesheet.cssText)!='undefined') stylesheet.cssText=csstext;
else _stlkbc.gs().ownerNode.innerHTML=csstext;
_stlkbc.gs().disabled=false;

_stlkbc.curOpts=newOpts;
return onEnd();

};
if (
(newOpts.paintAnti==oldOpts.paintAnti)&&(newOpts.paintPro==oldOpts.paintPro) 
&&(newOpts.opentalkback==false) 
&&(newOpts.nextrows==false)&&(newOpts.prevrows==false) 
) {


_stlkbc.curOpts=newOpts;
return onEnd();

};
};


stlkbcreply.hideAll(function(isok){
if (isok) {
_this._update_afterStlkbcReplyConfirmation(newOpts,onEnd);
} else {
return onEnd();

};
});
},
_update_afterStlkbcReplyConfirmation:function(newOpts,onEnd){
var _stlkbc=stlkbc;
if (_stlkbc.g('isIframe')) {
var _onEnd=onEnd;
onEnd=function(){
_onEnd();
adjustParentIframeHeight();
};
};

var _this=this;
var stlkbctalkbacks=_stlkbc.talkbacks;
var stlkbctalkbacksview=stlkbctalkbacks.view;

_stlkbc.curOpts=newOpts;

var showCloseAllDiv=((newOpts.mode=='asc')||(newOpts.mode=='desc'));
stlkbctalkbacksview.hideOpenAllDiv(newOpts.allopen,showCloseAllDiv);

_stlkbc.tbheader.chgSelectedTopLink(newOpts.mode);

stlkbctalkbacksview.hideshowAjaxLoader();

_stlkbc.pcardMenu.close();

stlkbctalkbacks.setTalkbackAdvertTid(false);

stlkbctalkbacks.clearRows();

if ((!newOpts.opentalkback)||(newOpts.opentalkbackpage!=false)) {

if (newOpts.nextrows) _this._serverpagenum++; 
else if (newOpts.prevrows) _this._serverpagenum--; 
else if (newOpts.opentalkbackpage!=false) _this._serverpagenum=newOpts.opentalkbackpage 
else _this._serverpagenum=0;
_this._update_afterGotPageNum(newOpts,onEnd);
} else {

if (_this._serverpagenum!=false) {


_this._ftpdonepage=_this._serverpagenum;
_this._ftpdonepagehasmore=_this._serverhasmorepages
};

_this._update_findTalkbackPageNum(newOpts,onEnd,0);
};
},
_serverpagenum:false,
_ftpdonepage:false,
_ftpdonepagehasmore:false,

_update_findTalkbackPageNum:function(newOpts,onEnd,pagenum) {

var _this=this;
var _stlkbc=stlkbc;

if (_this._ftpdonepage===pagenum) {

if (_this._ftpdonepagehasmore) {

pagenum++;
} else {

var obj={rows:[]};
return _this._update_afterAjax(obj,newOpts,onEnd);
};
};
_this._serverpagenum=pagenum;

var withContentparam=(newOpts.allopen?'1':'0');
_stlkbc.util.ajax(_stlkbc.getAjaxUrl([_stlkbc.articleId,newOpts.mode,_stlkbc.talkbackType,pagenum,withContentparam]),function(obj){

for(var i=0;i<obj.rows.length;i++){
if (''+obj.rows[i].id==''+newOpts.opentalkback) {

return _this._update_afterAjax(obj,newOpts,onEnd);
};
};

if (obj.hasmore) {

return _this._update_findTalkbackPageNum(newOpts,onEnd,pagenum+1);
} else {

var obj={rows:[]};
return _this._update_afterAjax(obj,newOpts,onEnd);
};
});
},


_update_afterGotPageNum:function(newOpts,onEnd){

var _this=this;
var _stlkbc=stlkbc;
var withContentparam=(newOpts.allopen?'1':'0');
_stlkbc.util.ajax(_stlkbc.getAjaxUrl([_stlkbc.articleId,newOpts.mode,_stlkbc.talkbackType,_this._serverpagenum,withContentparam]),function(obj){
_this._update_afterAjax(obj,newOpts,onEnd);
});
},


_update_afterAjax:function(obj,newOpts,onEnd){
var _stlkbc=stlkbc;
if (_stlkbc.g('isIframe')) {
var _onEnd=onEnd;
onEnd=function(){
_onEnd();
adjustParentIframeHeight();
};
};

var _this=this;
var stlkbctalkbacks=_stlkbc.talkbacks;
var stlkbctalkbacksview=stlkbctalkbacks.view;
var stlkbcutil=_stlkbc.util;
if (obj.error) {
_stlkbc.uee(obj);
stlkbctalkbacksview.hideshowAjaxLoader();
} else if (obj.rows.length<1) {
_stlkbc.ge('resdiv').innerHTML=_stlkbc.ge('norowsfound').innerHTML;
stlkbctalkbacksview.hideshowAjaxLoader();
} else {


_this._tmphtml=[];

_this._tadvert_num=0;
_this._tadvert_rows=0;
_this._tadvert_fills=[];
_this._open_tids=[];



for(var i=0;i<obj.rows.length;i++){
_this._updateIterator(newOpts,obj.rows[i]);
};


_stlkbc.ge('resdiv').innerHTML=_this._tmphtml.join('');





for(var i=0;i<_this._tadvert_fills.length;i++){
var tadvertfill=_this._tadvert_fills[i];
_stlkbc.getAdvertDivContent(''+tadvertfill[0]+'tadvert',''+tadvertfill[1]);
};


for(var i=0;i<_this._open_tids.length;i++){
_stlkbc.recmm.updateContentDiv(_this._open_tids[i]);
};
_this._serverhasmorepages=obj.hasmore;
stlkbctalkbacksview.hidePrevNextTalkbacks((_this._serverpagenum<1),!_this._serverhasmorepages);
stlkbctalkbacksview.hideshowAjaxLoader();

if ((newOpts.opentalkback!=false)&&(stlkbctalkbacks.isRowExists(newOpts.opentalkback))) {
if (newOpts.allopen) {
stlkbcutil.scrollToElt(_stlkbc.gt(newOpts.opentalkback,'tcontentdiv'));
} else {
if (!stlkbctalkbacks.getRow(newOpts.opentalkback).isContentDivShown) {
stlkbctalkbacks.talkbackOpenClose(newOpts.opentalkback);
};
stlkbcutil.scrollToElt(_stlkbc.gt(newOpts.opentalkback,'tcontentdiv'));
};
};
};

newOpts.opentalkbackpage=_this.getServerPageNum();
_stlkbc.tracker.update(newOpts);
newOpts.opentalkback=false;
newOpts.opentalkbackpage=false;
newOpts.nextrows=false;
newOpts.prevrows=false;
return onEnd();
},
_tmphtml:false,
_tadvert_num:false,
_tadvert_rows:false,
_tadvert_fills:false,
_open_tids:false,
_serverhasmorepages:false,



_updateIterator:function(newOpts,row){

var _this=this;
var _stlkbc=stlkbc;

if (newOpts.allopen) {

var show_tadvertdiv=false;
if (newOpts.allopen) {
if (_this._tadvert_rows==(_stlkbc.g('tadvert_every_howmany_rows')-1)) {
_this._tadvert_fills.push([row.id,_this._tadvert_num]);
_this._tadvert_num++;
_this._tadvert_rows=0;
show_tadvertdiv=true;
} else _this._tadvert_rows++;
};

_this._tmphtml.push(_stlkbc.rowtemplate.getContentdiv(row,true,show_tadvertdiv,false,false));

} else {

this._tmphtml.push(_stlkbc.rowtemplate.getSurrdiv(row,newOpts.mode));

this._tmphtml.push(_stlkbc.rowtemplate.getContentdiv(row,false));


};

if (newOpts.allopen) _this._open_tids.push(row.id);

row.load_content=((row.text=='!%LC')?true:false);
row.isContentDivShown=(newOpts.allopen);
row.iscontentDivLoaded=(newOpts.allopen);
row.uid=row.userid;
row.showtbs=row.bpc_is_display_talkbacks;
_stlkbc.talkbacks.addRow(row.id,row);

}
};



Cstlkbc.prototype.talkbacks.view={





hidePrevNextTalkbacks:function(hideprev,hidenext){

var _stlkbc=stlkbc;
if ((hideprev&&hidenext)!=this._moretalkbackshidden) {
_stlkbc.ge('moretalkbacks').style.display=(hideprev&&hidenext)?'none':'block';
this._moretalkbackshidden=(hideprev&&hidenext);
};
if (!this._moretalkbackshidden) {
if (hideprev!=this._prevtalkbackshidden) {_stlkbc.ge('prevtalkbacks').style.display=hideprev?'none':'block';this._prevtalkbackshidden=hideprev;};
if (hidenext!=this._nexttalkbackshidden) {_stlkbc.ge('nexttalkbacks').style.display=hidenext?'none':'block';this._nexttalkbackshidden=hidenext;};
};
},
_moretalkbackshidden:true,
_nexttalkbackshidden:true,
_prevtalkbackshidden:true,

hideOpenAllDiv:function(hide,showCloseAllDiv){
stlkbc.ge('openalldiv').style.display=hide?'none':'block';
stlkbc.ge('closealldiv').style.display=((hide)&&(showCloseAllDiv))?'block':'none';
},



hideshowAjaxLoader:function(){

var _stlkbc=stlkbc;
var stlkbcutil=_stlkbc.util;
if (!this._ajaxloadershown) {



this._ajaxloadershown=true;
_stlkbc.ge('ajaxloader').style.display='block';
_stlkbc.ge('resdiv').style.display='none';
this.hidePrevNextTalkbacks(true,true);
} else {
this._ajaxloadershown=false;
_stlkbc.ge('ajaxloader').style.display='none';
_stlkbc.ge('resdiv').style.display='block';
if (this._firstajaxshown===false) {
this._firstajaxshown=true;
}; 


};
},
_ajaxloadershown:false,
_firstajaxshown:false
};


Cstlkbc.prototype.tbheader={
onInit:function(onEnd){
var _stlkbc=stlkbc;
var _this=this;
_stlkbc.util.ajax(_stlkbc.getAjaxUrl(['artinfo',_stlkbc.articleId,_stlkbc.talkbackType]),function(obj){
if (obj.error) _stlkbc.uee(obj); else {
_this._artinfo=obj;
if (obj.numTalkbacks>0) {
_this._updateTitleText(obj.numTalkbacks,obj.numParents);
if (obj.numTalkbacks==1) _this._disableTopLink('asc');
if (!obj.hasRecommended) _this._disableTopLink('recmm');
if (!obj.hasInterest) _this._disableTopLink('interest');
if (_stlkbc.isAntiPro) {
_this._updateAntiProSpacer(obj.numAnti,obj.numPro);
};
_this._showTalkbacks();
_this._onInit_afterAjax(onEnd,true);
} else {
if (document.getElementById('TalkBackLinkPopUp')) {
document.getElementById('TalkBackLinkPopUp').style.display= 'none';
};
_this._onInit_afterAjax(onEnd,false);
};
};
});
},
_onInit_afterAjax:function(onEnd,res){
var _this=this;
var _stlkbc=stlkbc;
var stlkbcutil=_stlkbc.util;
if (res) {
if (_stlkbc.g('isTopLinksTooltipEnabled')) {

stlkbcutil.addEvent(_stlkbc.ge('toplinktddesc'),'mouseout',function(e){if(!e)var e=window.event;_this.onTopLinkMouseOut('desc',e);});
stlkbcutil.addEvent(_stlkbc.ge('toplinktddesc'),'mouseover',function(){_this.onTopLinkMouseOver('desc');});
stlkbcutil.addEvent(_stlkbc.ge('toplinktdasc'),'mouseout',function(e){if(!e)var e=window.event;_this.onTopLinkMouseOut('asc',e);});
stlkbcutil.addEvent(_stlkbc.ge('toplinktdasc'),'mouseover',function(){_this.onTopLinkMouseOver('asc');});
stlkbcutil.addEvent(_stlkbc.ge('toplinktdrecmm'),'mouseout',function(e){if(!e)var e=window.event;_this.onTopLinkMouseOut('recmm',e);});
stlkbcutil.addEvent(_stlkbc.ge('toplinktdrecmm'),'mouseover',function(){_this.onTopLinkMouseOver('recmm');});
stlkbcutil.addEvent(_stlkbc.ge('toplinktdinterest'),'mouseout',function(e){if(!e)var e=window.event;_this.onTopLinkMouseOut('interest',e);});
stlkbcutil.addEvent(_stlkbc.ge('toplinktdinterest'),'mouseover',function(){_this.onTopLinkMouseOver('interest');});

stlkbcutil.addOnScrollCallback(function(){_this.hideTopLinkTooltip();});
};
};
onEnd(res);
},
onTopLinkMouseOut:function(mode,e){
if(this._curTHover==mode) {

var tg=stlkbc.ge('toplinktd'+mode);
var reltg=(e.relatedTarget)?e.relatedTarget:e.toElement;
while ((reltg)&&(reltg!=tg)&&(reltg.nodeName!='BODY')) {reltg=reltg.parentNode;};
if (reltg==tg) return;
this.hideTopLinkTooltip();
};
},
onTopLinkMouseOver:function(mode){
var _this=this;
if (_this._curTHover!=mode) {
var _stlkbc=stlkbc;
var elt=_stlkbc.ge('toplinktd'+mode);
var tl=_stlkbc.util.getEltTopLeft(elt);
var eltTop=tl[0];
var eltLeft=tl[1];
var tooltip=_stlkbc.ge('toplinktooltip');
_stlkbc.ge('toplinktooltiptext').innerHTML=_stlkbc.g('txtTopLinkTooltip_'+mode);
tooltip.style.display='block';
tooltip.style.top=eltTop-tooltip.offsetHeight;
tooltip.style.left=eltLeft-Math.round((tooltip.offsetWidth-elt.offsetWidth)/2);
_this._curTHover=mode;
};
},

hideTopLinkTooltip:function(){
if(this._curTHover!=false) {
stlkbc.ge('toplinktooltip').style.display='none';
this._curTHover=false;
};
},
_curTHover:false,
updateAntiProRadio:function(isProFilled,isAntiFilled){
var _stlkbc=stlkbc;

_stlkbc.ge('apradiopro').src=isProFilled?'/images/newsletter_checkbox_checked.gif':'/images/newsletter_checkbox_empty.gif';
_stlkbc.ge('apradioanti').src=isAntiFilled?'/images/newsletter_checkbox_checked.gif':'/images/newsletter_checkbox_empty.gif';
},




_artinfo:false,

chgSelectedTopLink:function(mode){
var _this=this;
var _stlkbc=stlkbc;


if (_this._selectedTopLink!=mode) {
if (_this._selectedTopLink!=false) {

var curcont=_stlkbc.ge('toplinktd'+_this._selectedTopLink).innerHTML;
_stlkbc.ge('toplinktd'+_this._selectedTopLink).innerHTML=_stlkbc.ge('toplinkseldiv'+_this._selectedTopLink).innerHTML;
_stlkbc.ge('toplinkseldiv'+_this._selectedTopLink).innerHTML=curcont;
};

var curcont=_stlkbc.ge('toplinktd'+mode).innerHTML;
_stlkbc.ge('toplinktd'+mode).innerHTML=_stlkbc.ge('toplinkseldiv'+mode).innerHTML;
_stlkbc.ge('toplinkseldiv'+mode).innerHTML=curcont;
_this._selectedTopLink=mode;
};
},
_selectedTopLink:false,
_disableTopLink:function(mode){
var _stlkbc=stlkbc;
var _this=this;
var __disabledTopLinks=_this._disabledTopLinks;
if (!__disabledTopLinks[mode]) {
__disabledTopLinks[mode]=true;
var curcont=_stlkbc.ge('toplinktd'+mode).innerHTML;
_stlkbc.ge('toplinktd'+mode).innerHTML=_stlkbc.ge('toplinkaltdiv'+mode).innerHTML;
_stlkbc.ge('toplinkaltdiv'+mode).innerHTML=curcont;
};
},
_disabledTopLinks:{'asc':false,'desc':false,'recmm':false,'interest':false},
_updateTitleText:function(numTalkbacks,numParents){
var _this=this;
if (stlkbc.talkbackType == stlkbc.constGalleryTalkbackType) {
var txt='לתמונת גלריה זו ';
} else if (stlkbc.talkbackType == stlkbc.constVideoTalkbackType) {
var txt='לסרט זה ';
} else if (stlkbc.talkbackType == stlkbc.constComponentTalkbackType) {
var txt='';
} else {
var txt='לכתבה זו ';
}
if (numTalkbacks==1) {
txt+='התפרסמה תגובה אחת';
} else {
txt+='התפרסמו '+numTalkbacks+' תגובות ב';
if (numParents==1) txt+='דיון אחד';
else txt+='-'+numParents+' דיונים';
};
stlkbc.ge('titletextdiv').innerHTML=txt;
},
_updateAntiProSpacer:function(numAnti,numPro){
var _this=this;
var _stlkbc=stlkbc;

var numTalkbacks=numAnti+numPro;

var pxperletter=9;

var respslen=160;

var pxlenCol1=pxperletter*_stlkbc.g('strlenTxtAntiProCol1');
var pxlenCol2=pxperletter*_stlkbc.g('strlenTxtAntiProCol2');

if (pxlenCol1>pxlenCol2) var pxlenCols=pxlenCol1; else var pxlenCols=pxlenCol2;

var hundredpercentwidth=_stlkbc.g('width')-pxlenCols-respslen;

if (hundredpercentwidth<50) {
_stlkbc.ge('apspprodiv').style.display='none';
_stlkbc.ge('apspantidiv').style.display='none';
} else if (numPro>numAnti) {
_stlkbc.ge('apspprodiv').style.width=hundredpercentwidth;
_stlkbc.ge('apspantidiv').style.width=Math.round(numAnti/numPro*hundredpercentwidth);
} else {
_stlkbc.ge('apspantidiv').style.width=hundredpercentwidth;
_stlkbc.ge('apspprodiv').style.width=Math.round(numPro/numAnti*hundredpercentwidth);
};

_stlkbc.ge('apspprotxt').innerHTML=((numPro==1)?'מגיב&nbsp;אחד':''+numPro+'&nbsp;מגיבים')+'&nbsp;&nbsp;&nbsp;'+Math.round((numPro*100)/numTalkbacks)+'%';
_stlkbc.ge('apspantitxt').innerHTML=((numAnti==1)?'מגיב&nbsp;אחד':''+numAnti+'&nbsp;מגיבים')+'&nbsp;&nbsp;&nbsp;'+Math.round((numAnti*100)/numTalkbacks)+'%';
},
_showTalkbacks:function(){
stlkbc.ge('topheader').style.display='block';
}
};


Cstlkbc.prototype.rowtemplate={

getSurrdiv:function(row,mode){
var _stlkbc=stlkbc;
var rowtitle=row.title;
var rowtc=row.tc;
var rowid=row.id;


var paddingnormal=3;
if (row.LEVEL>1) {






paddingnormal=20;

var tadivbullets='<div style="width:5px;height:7px;"><img width="5" height="7" src="'+_stlkbc.g('imgClosedArrows')+'"/></div>';

var tadivbulletssize=5;
} else {


var tadivbullets=''+rowtc+'.';

var tadivbulletssize=(''+rowtc).length*7+3;
};

var tbulpadopposite=5;

var isTitleBold=false;






var tbSrcTxt='';
if ((stlkbc.g('wapTalkbackSource'))[row.talkback_source]) {
tbSrcTxt=(stlkbc.g('wapTalkbackSource'))[row.talkback_source].txt;
}

var isRowNameLocationGrey=false;
if ((mode!='asc')&&(mode!='desc')) {

var surrcolorclass='';
var surrcolorextrastyle='color:black;';
} else if (_stlkbc.isAntiPro) {

var surrcolorclass=' class="'+((!row.anti_pro)?'stlkbcsurrcolpro':'stlkbcsurrcolanti')+'"';
var surrcolorextrastyle='';
} else {

var surrcolorclass='';
if (row.recommended=='1') {
var surrcolorextrastyle='color:'+_stlkbc.g('recmmDivColor')+';';
isTitleBold=true;
} else if (row.recommended=='0') {
var surrcolorextrastyle='color:'+_stlkbc.g('notrecmmDivColor')+';';
isRowNameLocationGrey=true;
} else var surrcolorextrastyle='color:black;';
};
var surrboldstyle=(isTitleBold?'font-weight:bold;':'');

if (isTitleBold) {
var maxTitleLen=65;
} else {
var maxTitleLen=70;
};
maxTitleLen=maxTitleLen-(2*(row.LEVEL-1));
if (row.text.length==0) {

maxTitleLen=maxTitleLen-4;
};


rowtitle=_stlkbc.util.unescapeHtml(rowtitle);

var spcre=new RegExp(String.fromCharCode(92)+'s');
var rowtitleArr=rowtitle.split(spcre);

var rtal=rowtitleArr.length;
var i=0;
var newRowTitle=[];
var newRowTitleLength=0;
for(i=0;i<rtal;i++){
var rowtitleWord=rowtitleArr[i];
var tmpNewRowTitleLength=newRowTitleLength+rowtitleWord.length+1;
if (tmpNewRowTitleLength>maxTitleLen) {
newRowTitle.push('...');
break;
} else {
newRowTitle.push(rowtitleWord);
newRowTitleLength=tmpNewRowTitleLength;
};
};
rowtitle=newRowTitle.join(' ');
rowtitle=_stlkbc.util.escapeHtml(rowtitle);
if (row.text.length==0) {
rowtitle=rowtitle+_stlkbc.g('txtNoContent');
};

var ocAction="stlkbc.onClickTsurrdiv("+rowid+");";
var oc="onClick='"+ocAction+"'";

return [
"<div id='stlkbc"+rowid+"tsurrdiv' style='width:"+_stlkbc.g('width')+"px;overflow:hidden;'>",
"<table cellspacing='0' cellpadding='0'><tr>",
"<td colspan='2'><div style='height:7px;overflow:hidden;'>&#160;</div></td>",
"</tr><tr>",
"<td valign='top'><div style='width:"+paddingnormal+"px;overflow:hidden;'>&#160;</div></td>",
"<td><div"+surrcolorclass+" "+oc+" style='cursor:pointer;width:"+tadivbulletssize+"px;overflow:hidden;font-size:12px;"+surrcolorextrastyle+surrboldstyle+"'>",
tadivbullets,
"</div></td>",
"<td valign='top'><div "+oc+" style='cursor:pointer;width:"+tbulpadopposite+"px;overflow;hidden;'>&#160;</div></td>",
"<td valign='top'><div"+surrcolorclass+" style='width:"+(_stlkbc.g('width')-paddingnormal-tadivbulletssize-tbulpadopposite)+"px;overflow:hidden;font-size:12px;"+surrcolorextrastyle+surrboldstyle+"'>",
"<span style='cursor:pointer;' "+oc+">"+rowtitle+"</span>",
"</div></td>",
"</tr><tr>",
"<td colspan='3'><div "+oc+" style='cursor:pointer;width:"+(paddingnormal+tadivbulletssize+tbulpadopposite)+"px;overflow:hidden;'>&#160;</div></td>",
"<td valign='top'><div style='width:"+(_stlkbc.g('width')-paddingnormal-tadivbulletssize-tbulpadopposite)+"px;height:14px;overflow:hidden;'>",
this._rownamelocationdate(row.name,row.location,row.the_date,false,0,isRowNameLocationGrey,ocAction,tbSrcTxt),
"</div></td>",
"</tr></table>",
"</div>",
].join('');
},

getContentdiv:function(row,show_contentdiv,show_tadvertdiv,isPreview,isTitleClickable,closeLinkCallback){
if (typeof(isPreview)=='undefined') var isPreview=false;
if (typeof(isTitleClickable)=='undefined') var isTitleClickable=true;
if (typeof(closeLinkCallback)=='undefined') var closeLinkCallback=false;
var ans=[];

ans.push("<div id='stlkbc"+row.id+"tcontentdiv' style='display:"+(show_contentdiv?'block':'none')+";width:"+stlkbc.g('width')+"px;overflow:hidden;'>");
if (show_contentdiv) ans.push(this.getContentdivContent(row,show_tadvertdiv,isPreview,isTitleClickable,closeLinkCallback));
else ans.push('&#160;');
ans.push('</div>');

return ans.join('');
},
getContentdivContent:function(row,show_tadvertdiv,isPreview,isTitleClickable,closeLinkCallback){
if (typeof(isPreview)=='undefined') var isPreview=false;
if (typeof(isTitleClickable)=='undefined') var isTitleClickable=true;
if (typeof(closeLinkCallback)=='undefined') var closeLinkCallback=false;

var _stlkbc=stlkbc;
var _this=this;
var rowid=row.id;
var rowtitle=row.title;
var withcolon=true;
if (row.text.length==0) {
rowtitle+=_stlkbc.g('txtNoContent');
withcolon=false;
};






var tbSrcTxt='';
if ((stlkbc.g('wapTalkbackSource'))[row.talkback_source]) {
tbSrcTxt=(stlkbc.g('wapTalkbackSource'))[row.talkback_source].txt;
}

var paddingnormal=3;
if (isPreview) {
var tcbulletcontent='';
var tcdivbulletssize=15;
isTitleClickable=false;
} else if (row.LEVEL>1) {






paddingnormal=20;
var tcbulletcontent='<img width="5" height="7" src="'+_stlkbc.g('imgClosedArrows')+'"/>';
var tcdivbulletssize=10;
} else {
var tcbulletcontent=''+row.tc+'.';
var tcdivbulletssize=(''+row.tc).length*7+8;
};
var paddingopposite=6;

if (stlkbc.talkbackType != stlkbc.constComponentTalkbackType) {
var merlindivhtml="<div id='stlkbc"+rowid+"tmerlindiv' style='display:none;height:125px;overflow:hidden;margin-top:5px;'><iframe src='"+stlkbc.merlinFrameurl+"' frameborder=no srolling=no style='width:408px;margin:0px;padding:0px;'></iframe></div>";
} else {
var merlindivhtml="";
}

return [
"<div style='height:"+7+"px;overflow:hidden;'>&#160;</div>",
"<div style='background-color:#f1f5fa;'>",
"<div style='height:4px;overflow:hidden;'>&#160;</div>",
"<div style='"+(isTitleClickable?('cursor:pointer;'):'')+"'"+(isTitleClickable?(" onClick='stlkbc.onClickTsurrdiv("+rowid+");'"):'')+">",
"<table width='"+_stlkbc.g('width')+"' cellspacing='0' cellpadding='0'><tr>",
"<td width='"+paddingnormal+"'>&#160;</td>",
"<td width='"+tcdivbulletssize+"' style='font-size:12px;color:black;font-weight:bold;white-space:nowrap;'>"+tcbulletcontent+"</td>",
"<td style='"+(isTitleClickable?('cursor:pointer;'):'')+"font-weight:bold;color:black;font-size:12px;'>"+rowtitle+"</div>",
"<td width='"+paddingopposite+"'>&#160;</td>",
"</tr><tr><td colspan='4'><div style='height:3px;overflow:hidden;'>&#160;</div></td></tr><tr>",
"<td colspan='2'>&#160;</td>",
"<td><div style='width:"+(_stlkbc.g('width')-paddingnormal-tcdivbulletssize-paddingopposite)+"px;height:14px;overflow:hidden;'>"+_this._rownamelocationdate(row.name,row.location,row.the_date,withcolon,row.userid,false,false,tbSrcTxt)+"</div></td>",
"<td>&#160;</td>",
"</tr></table>",
"</div>",
"<table width='"+_stlkbc.g('width')+"' cellspacing='0' cellpadding='0'>",
"<tr>",
"<td width='"+paddingnormal+"'><div style='height:2px;overflow:hidden;'>&#160;</div></td>",
"<td width='"+tcdivbulletssize+"'><div style='height:2px;overflow:hidden;'>&#160;</div></div>",
"<td><div style='width:"+(_stlkbc.g('width')-paddingnormal-tcdivbulletssize-paddingopposite)+";height:2px;overflow:hidden;'>&#160;</div></td>",
"<td width='"+paddingopposite+"'><div style='height:2px;overflow:hidden;'>&#160;</div></td>",
"</tr>",
_this._getContentdivRowtextRow(row,[paddingnormal,tcdivbulletssize,(_stlkbc.g('width')-paddingnormal-tcdivbulletssize-paddingopposite),paddingopposite]),
"<tr><td colspan='4'>",
"<div style='height:15px;overflow:hidden;'>&#160;</div>",
"<div style='text-align:center;overflow:hidden;padding-bottom:5px;display:none;' id='stlkbc"+rowid+"tadvert'>&#160;</div>",
"</td></tr>",
_this._getContentdivRecmmRow(row,paddingopposite,isPreview,closeLinkCallback),
"<tr><td colspan='4'><div style='height:5px;overflow:hidden;'>&#160;</div></td></tr>",
"</table>",
"</div>",
"<div id='stlkbc"+rowid+"treplydiv' style='display:none;'>&#160;</div>",
merlindivhtml
].join('');
},
_getContentdivRowtextRow:function(row,colwidths){
var rowtext=row.text;
var rowid=row.id;
var rowuserid=row.userid;

if ((rowtext.length==4)&&(rowtext=='!%LC')) rowtext='';

if (rowuserid>0) {

if (row.thumb_image_path.length>0) {
var thumbimagepath=row.thumb_image_path;
} else {
var thumbimagepath='/images/stlkbcdefpcardimg.gif';
};
return [
"<tr>",
"<td colspan='2' width='"+(colwidths[0]+colwidths[1])+"'></td>",
"<td valign='top' width='"+colwidths[2]+"' style='color:black;font-size:12px;'><table width='"+colwidths[2]+"' cellspacing='0' cellpadding='0'><tr>",
"<td width='58' valign='top'><div id='stlkbc"+rowid+"tpcardmenutlsrc' style='width:58px;height:55px;overflow:hidden;'><div style='border:1px solid #9aabbd;'>",
"<div style='width:56px;height:53px;overflow:hidden;background-color:white;'>",
"<table cellspacing='0' cellpadding='0'><tr><td><div style='width:2px;overflow:hidden;'>&#160;</div></td>",
"<td valign='top'>",
"<div style='height:2px;overflow:hidden;'>&#160;</div>",
"<div style='height:44px;overflow:hidden;'>",
''+((rowuserid>0)?"<a href='javascript:pcardFocus("+rowuserid+",true);'>":''),
"<img src='"+thumbimagepath+"' border='0' width='52' height='44'/>",
''+((rowuserid>0)?'</a>':''),
"</div>",
"<div style='height:1px;overflow:hidden;'>&#160;</div>",
"<div onClick='stlkbc.onClickPCImageArr("+rowid+");' style='cursor:pointer;height:6px;overflow:hidden;text-align:center;' align='center'><img border='0' src='/images/stlkbcdarr.gif'/></div>",
"</td>",
"<td><div style='width:2px;overflow:hidden;'>&#160;</div></td></tr></table>",
"</div>",
"</div></div></td>",
"<td width='10'><div style='width:10px;overflow:hidden;'>&#160;</div></td>",
"<td width='"+(colwidths[2]-10-58)+"' style='color:black;font-size:12px;' valign='top' id='stlkbc"+rowid+"ttextcont'>"+rowtext+"</td>",
"</tr></table></td>",
"<td><div style='width:"+colwidths[3]+"px;overflow:hidden;'>&#160;</div></td>",
"</tr>"
].join('');
} else {

return [
"<tr>",
"<td colspan='2' width='"+(colwidths[0]+colwidths[1])+"'></td>",
"<td width='"+colwidths[2]+"' valign='top' style='color:black;font-size:12px;' id='stlkbc"+rowid+"ttextcont'>"+rowtext+"</td>",
"<td><div style='width:"+colwidths[3]+"px;overflow:hidden;'>&#160;</div></td>",
"</tr>"
].join('');
};
},
_getContentdivRecmmRow:function(row,paddingopposite,isPreview,closeLinkCallback){
if (typeof(isPreview)=='undefined') var isPreview=false;
if (typeof(closeLinkCallback)=='undefined') var closeLinkCallback=false;
var _stlkbc=stlkbc;
var rowid=row.id;
if (closeLinkCallback!=false) {
var replycont="<div style='padding-"+_stlkbc.g('alignNormal')+":15px;'><a class='index' style='font-weight:bold;' href='"+closeLinkCallback+"'>סגור</a></div>";
} else if (isPreview) {
var replycont='';
} else {
var replycont=[
"<table><tr>",
"<td><div style='width:8px;overflow:hidden;'>&#160;</div></td>",
"<td>",
"<img border='0' src='"+_stlkbc.g('imgSendTalkback')+"'/>",
"</td><td><div style='width:1px;overflow:hidden;'>&#160;</div></td><td>",
"<a class='index' style='font-weight:bold;' href='javascript:stlkbc.replyTalkback("+rowid+",true);'>",
_stlkbc.g('txtReplyNewTalkback'),
"</a>",
"</td><td><div style='width:8px;overflow:hidden;'>&#160;</div></td><td>",
"<a class='index' style='font-weight:bold;' href='javascript:stlkbc.replyTalkback("+rowid+");'>",
_stlkbc.g('txtReplyTalkback'),
"</a>",
"</td>",
"</tr></table>"
].join('');
};

if (!_stlkbc.g('isIframe')) {
var _recommendHtml = [
"<div id='stlkbc"+rowid+"trecmmdiv' style='display:block;'>",
"<table><tr>",
"<td style='font-weight:bold;' id='stlkbc"+rowid+"trecmmdeftxt'>"+_stlkbc.g('txtRecmmThisTalkback')+"</td>",
"<td><a href='javascript:"+(isPreview?'':("stlkbc.recmmTalkback("+rowid+",true)"))+";'><img title='נקודה בעד' alt='נקודה בעד' id='stlkbc"+rowid+"trecmmgif' width='20' height='20' src='/images/stlkbcrecmm.gif' border='0'/></a></td>",
"<td><a href='javascript:"+(isPreview?'':("stlkbc.recmmTalkback("+rowid+",false)"))+";'><img title='נקודה נגד' alt='נקודה נגד' id='stlkbc"+rowid+"tbadmmgif' width='20' height='20' src='/images/stlkbcbadmm.gif' border='0'/></a></td>",
"<td><div style='background-image:url(/images/stlkbccountbg.gif);width:30px;height:20px;overflow:hidden;text-align:center;'><div style='height:2px;overflow:hidden;'>&#160;</div><div id='stlkbc"+rowid+"trecmmtsdiv' style='font-weight:bold;color:black;text-align:center;' dir='ltr'>"+(isPreview?'0':row.ts)+"</div></div></td>",
"</tr></table>",
"</div><div id='stlkbc"+rowid+"trecmmlogindiv' style='display:none;'>",
"<span style='color:black;'>להמלצה הירשמו <a class='index' href='javascript:stlkbc.gotoregpage("+rowid+");'>חינם</a>. רשומים? <a class='index' href='javascript:stlkbc.gotoLogin("+rowid+");'>התחברו</a></span>",
"</div><div id='stlkbc"+rowid+"trecmmajaxloader' style='display:none;'>",
"<img src='/images/ynet_loader_trans.gif'/>",
"</div>"
].join('');
} else {
var _recommendHtml='';
}

return ["<tr>",

"<td colspan='3'>",
"<div style='height:24px;overflow:hidden;'>",
"<table cellspacing='0' cellpadding='0' width='100%'><tr>",
"<td>"+replycont+"</td>",
"<td align='"+_stlkbc.g('alignOpposite')+"'>",
_recommendHtml,
"</td>",
"</tr></table>",
"</div>",
"</td>",
"<td><div style='width:"+paddingopposite+"px;overflow:hidden;'>&#160;</div></td>",
"</tr>"].join('');
},

_rownamelocationdate:function(name,location,the_date,with_colon,userid,isGrey,onClick,tbSrcTxt){

if (typeof(name)=='undefined') var name='';
if (typeof(onClick)=='undefined') var onClick=false;
if (onClick==false) {
var cursorStyle='';
var oc='';
} else {
var cursorStyle='cursor:pointer;';
var oc=" onClick='"+onClick+"'";
};

if (isGrey) {
var greyStyle="color:"+stlkbc.g('notrecmmDivColor')+";";
} else {
var greyStyle=''
};
var tdspacer="<td"+oc+" style='"+cursorStyle+"' width='4'><div style='width:4px;overflow:hidden;'>&#160;</div></td>";
var rnld=["<div style='width:1000px;'><table cellspacing='0' cellpadding='0'><tr>"];
if (name.length>0) {

if ((typeof(userid)!='undefined')&&(userid>0)) {

rnld.push("<td><a href='javascript:pcardFocus("+userid+",true);'>"+name+"</a></td>");
} else {

rnld.push("<td"+oc+" style='"+cursorStyle+greyStyle+"'>"+name+"</td>");
};
};
if (location.length>0) {

if (name.length>0) rnld.push(tdspacer+"<td"+oc+" style='"+cursorStyle+"'>,</td>"+tdspacer);
rnld.push("<td"+oc+" style='"+greyStyle+cursorStyle+"'>"+location+"</td>");
};
if (location.length>0 || name.length>0) rnld.push(tdspacer);


rnld.push("<td"+oc+" style='"+greyStyle+cursorStyle+"'>("+the_date+stlkbc.util.escapeHtml(tbSrcTxt)+")"+(with_colon?':':'')+"</td></tr></table></div>");
return rnld.join('');
}
};



Cstlkbc.prototype.replyControl={
open:function(tid,isAlwaysParent){
if (typeof(isAlwaysParent)=='undefined') var isAlwaysParent=false;
if ((typeof(tid)=='undefined')||(tid<1)) {

var _stlkbc=stlkbc;

_stlkbc.ge('parentreplydiv').style.display='block';
stlkbcreply.show(0,'stlkbcparentreplydiv');
if (stlkbc.talkbackType != stlkbc.constComponentTalkbackType) {
_stlkbc.util.scrollToElt(_stlkbc.ge('parentreplydiv'));
};
if (_stlkbc.g('isIframe')) {
adjustParentIframeHeight();
};
} else {

stlkbc.gt(tid,'treplydiv').style.display='block';

stlkbcreply.show(tid,'stlkbc'+tid+'treplydiv',isAlwaysParent);
stlkbc.util.scrollToElt(stlkbc.gt(tid,'treplydiv'));
if (stlkbc.g('isIframe')) {
adjustParentIframeHeight();
};
};
},
close:function(tid){
if ((typeof(tid)=='undefined')||(tid<1)) {
stlkbc.ge('parentreplydiv').style.display='none';
} else {
stlkbc.gt(tid,'treplydiv').style.display='none';
};
if (stlkbc.g('isIframe')) {
adjustParentIframeHeight();
};
}
};


Cstlkbc.prototype.pcardMenu={
close:function(){
this._tid=0;
stlkbc.ge('pcardmenu').style.display='none';
},
open:function(tid){

if (this._tid!=tid) {

var _stlkbc=stlkbc;
this._tid=tid;
var lt=_stlkbc.util.getEltTopLeft(_stlkbc.gt(tid,'tpcardmenutlsrc'));

if (_stlkbc.g('isDispPcardmenu2') == '1') {
_stlkbc.ge('pcardmenu2').style.display=_stlkbc.talkbacks.getRow(tid).showtbs?'block':'none';
} else {
_stlkbc.ge('pcardmenu2').style.display='none';
};
var elt=_stlkbc.ge('pcardmenu');
elt.style.display='block';
elt.style.top=lt[0]+55;
elt.style.left=lt[1];
} else {
this.close();
};
},
openLink:function(w){
if (this._tid>0) {
var uid=stlkbc.talkbacks.getRow(this._tid).uid;
if (w==1) {
pcardFocus(uid,true);
} else {
pcardFocus(uid,true,true);
};
};
this.close();
},
_tid:0
};

Cstlkbc.prototype.tracker={

setIgnoreOpenTalkbackUrlParam:function(a){
if (typeof(a)=='undefined') {
var a=true;
};
this._ignoreOpenTalkbackUrlParam=a;
},
update:function(opts){
this._encodeOpts(opts);
this._saveCookie();
},
getOpts:function(){
var strdata=this._getStrDataFromUrl();
if (strdata===false) strdata=this._getStrDataFromCookie();
if (strdata!=false) {
if (strdata.charAt(0)!='x') {
strdata=parseInt(strdata);
if (!isNaN(parseInt(strdata))) return {opentalkback:strdata};
} else {
var opts={};
switch (strdata.charAt(1)) {
case '0': opts.mode='asc'; break;
case '1': opts.mode='desc'; break;
case '2': opts.mode='recmm'; break;
case '3': opts.mode='interest'; break;
};
if (strdata.charAt(2)=='1') opts.allopen=true; else if (strdata.charAt(2)=='0') opts.allopen=false;
if (strdata.charAt(3)=='1') opts.paintAnti=true; else if (strdata.charAt(3)=='0') opts.paintAnti=false;
if (strdata.charAt(4)=='1') opts.paintPro=true; else if (strdata.charAt(4)=='0') opts.paintPro=false;
switch (strdata.charAt(5)) {
case '0': opts.autorecmm=false; break;
case '1': opts.autorecmm='p'; break;
case '2': opts.autorecmm='m'; break;
};
var idxa=6;var idxb=strdata.indexOf('s',idxa);
var tmp=strdata.substring(idxa,idxb);
if (tmp!='0') opts.opentalkback=tmp;
var idxa=idxb+1;var idxb=strdata.indexOf('s',idxa);
var tmp=strdata.substring(idxa,idxb);
opts.opentalkbackpage=tmp;
var idxa=idxb+1;var idxb=strdata.indexOf('s',idxa);
var articleId=strdata.substring(idxa,idxb);
if (articleId==stlkbc.articleId) {
return opts;
};
};
};
return false;
},
getUrlParam:function(){
return ''+this._encodedOpts;
},
_getStrDataFromUrl:function(){
var tmp=window.location.href.split('?');
if (tmp.length>1) {
tmp=tmp[1].split('&');
for(var i=0;i<tmp.length;i++){
var t=tmp[i].split('=');
if ((t.length==2)&&((t[0]=='opentalkback')||(t[0]=='ot'))&&(!this._ignoreOpenTalkbackUrlParam)) {
return t[1];
};
};
};
return false;
},
_getStrDataFromCookie:function(){
var ca=document.cookie.split(';');
for(var i=0;i<ca.length;i++) {
var c=ca[i];
while (c.charAt(0)==' ') {
c=c.substring(1,c.length);
};
if (c.indexOf('ynetstlkbct=')==0) {
return c.substring('ynetstlkbct='.length,c.length);
};
};
return false;
},
_saveCookie:function(){

if (stlkbc.g('optsCookieExpire')==0) {
var expires='';
} else {
var date = new Date();
date.setTime(date.getTime()+stlkbc.g('optsCookieExpire'));
var expires='; expires='+date.toGMTString();
};
document.cookie='ynetstlkbct='+this._encodedOpts+expires+'; path=/';
},
_optsget:function(key,def){
if (typeof(this._opts[key])=='undefined') {
return this._opts[key]=def;
} else {
return this._opts[key];
};
},
_encodeOpts:function(opts){
var strdata='x';
stlkbc.util.objectExtend(this._opts,opts);
switch(this._optsget('mode','asc')) {
case 'asc': strdata+='0'; break;
case 'desc': strdata+='1'; break;
case 'recmm': strdata+='2'; break;
case 'interest': strdata+='3'; break;
default: strdata+='0'; break;
};
if (this._optsget('allopen',false)) strdata+='1'; else strdata+='0';
if (this._optsget('paintAnti',false)) strdata+='1'; else strdata+='0';
if (this._optsget('paintPro',false)) strdata+='1'; else strdata+='0';
switch (this._optsget('autorecmm',false)) {
case 'p': strdata+='1'; break;
case 'm': strdata+='2'; break;
default: strdata+='0'; break;
};
var opentalkback=this._optsget('opentalkback',false);
if (opentalkback===false) strdata+='0'; else strdata+=opentalkback;
strdata+='s';
var opentalkbackpage=this._optsget('opentalkbackpage',false);
if (opentalkbackpage===false) strdata+='0'; else strdata+=opentalkbackpage;
strdata+='s';
strdata+=stlkbc.articleId;
strdata+='s';
this._encodedOpts=strdata;
},
_opts:{},
_encodedOpts:'',
_ignoreOpenTalkbackUrlParam:false
};


Cstlkbc.prototype.util={

XMLHttpFactories:[function () {return new XMLHttpRequest()},function () {return new ActiveXObject('Msxml2.XMLHTTP')},function () {return new ActiveXObject('Msxml3.XMLHTTP')},function () {return new ActiveXObject('Microsoft.XMLHTTP')}],
getXMLHTTPObject:function(){
var xmlhttp=false;
for (var i=0;i<this.XMLHttpFactories.length;i++) {
try {xmlhttp = this.XMLHttpFactories[i]();} catch (e) {continue;};
break;
};
return xmlhttp;
},
ajax:function(url,callback,isjson) {
if (typeof(isjson)=='undefined') var isjson=true;
var req=this.getXMLHTTPObject();
if (!req) return;
req.open('GET',url,true);
req.setRequestHeader('User-Agent','XMLHTTP/1.0');

req.setRequestHeader('If-Modified-Since', 'Fri, 31 Dec 1999 00:00:00 GMT');
req.onreadystatechange = function () {
if (req.readyState != 4) return;
if (req.status != 200 && req.status != 304) {
return;
} else {
var fidx=req.responseText.indexOf(' -->');
if (fidx>-1) {
var restxt=req.responseText.slice(fidx+5);
} else {
var restxt=req.responseText;
};
if (isjson) {
try {
var obj=eval('(' + restxt + ')');
} catch (e) {
var obj={error:true,errcode:1,errmsg:'Unknown Error'};
};

callback(obj);
} else {
callback(req);
};
};
};

if (req.readyState==4) return;
req.send(null);
},


objectExtendClone:function(target,extra){var ans=this.objectClone(target);this.objectExtend(ans,extra);return ans;},
objectExtend:function(target,extra){for(var k in extra){target[k]=extra[k];};},
objectClone:function(what){var ans={};for(var k in what){ans[k]=what[k];};return ans;},
objectToArray:function(obj){var ans=[];for(var k in obj){ans.push(obj[k]);};return ans;},


getEltTop:function(elt){
var top=0;
if (elt.offsetParent) {
do {
top+=elt.offsetTop;
} while (elt=elt.offsetParent);
};
return top;
},


getEltTopLeft:function(elt){
var top=0;var left=0;
if (elt.offsetParent) {
do {
top+=elt.offsetTop;
left+=elt.offsetLeft;
} while (elt=elt.offsetParent);
};
return [top,left];
},


scrollToElt:function(elt,attemptNum){
var top=this.getEltTop(elt);
if (typeof(attemptNum)=='undefined') var attemptNum=0;
else attemptNum++;
if ((top<1)&&(attemptNum<20)) {
var _this=this;
setTimeout(function(){_this.scrollToElt(elt,attemptNum);},57);
} else {
for(var i=0;i<this._onScrollCallbacks.length;i++){
this._onScrollCallbacks[i]();
};
document.body.scrollTop=top;
};
}, 

addOnScrollCallback:function(callback){
this._onScrollCallbacks.push(callback);
},
_onScrollCallbacks:[],





addEvent:function(A,B,C){if(A.addEventListener){A.addEventListener(B,C,false);}else if(A.attachEvent){A.attachEvent('on'+B,C);};},


escapeHtml:function(str) {
return str.replace(new RegExp('&','g'),'&amp;').replace(new RegExp('<','g'),'&lt;').replace(new RegExp('>','g'),'&gt;').replace(new RegExp("'",'g'),'&#39;').replace(new RegExp('"','g'),'&quot;').replace(new RegExp('&amp;#036;','g'),'$');
},


unescapeHtml:function(str) {
return str.replace(new RegExp('&amp;','g'),'&').replace(new RegExp('&lt;','g'),'<').replace(new RegExp('&gt;','g'),'>').replace(new RegExp('&#39;','g'),"'").replace(new RegExp('&quot;','g'),'"');
}

};

