var wroot="http://www.curriculumdigitale.it/";
var serverUrlChat="http://www.curriculumdigitale.it/ajax.checkinvito.php";
var cod_area="kairos_curriculumdigitale";
var id_utente="";
function checkInvito() {
var data="cod_area="+cod_area+"&id_utente="+id_utente;
var objAjax = new Ajax.Request(
serverUrlChat,
{method: 'get', parameters: data, onComplete: invitoChecked}
);
}
function invitoChecked(ObjReq) {
var resultText = ObjReq.responseText;
var result = resultText.parseJSON();
if (typeof result.stanza!="undefined" && typeof result.id_host!="undefined" && result.id_host!="undefined" && result.stanza!=0 && result.stanza!="undefined") {
var butns='';
var mittente=""+result.id_host+"";
var content=''+result.data_invito+'
Hai ricevuto un invito in chat nella stanza: '+result.stanza+'
da '+mittente+'';
content+='';
if (wObjList['wChat']!=null) {
var w0=$('wChat');
var el=document.getElementsByClassName("w_content",w0.parentNode);
el[0].innerHTML=content;
$('wChat_btns').innerHTML=butns;
} else {
var name="wChat";
var title="Invito in chat";
var w=new Window();
w.top=getTop();
w.id=name;
w.width=400;
w.height=200;
w.title=title;
w.content=content;
w.buttons=butns;
w.show();
}
}
}
function startCheckInvito() {
setInterval("checkInvito()",10000);
}
Event.observe(window,"load",startCheckInvito,false);