All pastes #71842 Raw Edit

Keloran

public javascript v1 · immutable
#71842 ·published 2006-06-26 06:30 UTC
rendered paste body
/*	This launches the php script to check the mail, and if there is some sends it to the message script	so that a new message can appear in the message bar.*/var mail=new Object();mail.Mailbox=function(userId, checkTime){	this.userId=userId;	this.checkTime=(checkTime) ? this.reloadMail() : this.defaultReloadMail();		if (!this.userId){		this.noMail();	} else {		this.checkMail();	}}mail.Mailbox.prototype.checkMail=function(){	var checker=new net.ContentLoader("libs/ajax.php?action=checkmail&userid="+this.userId,this.gotMail(), this.noMail(), null, "text/html");}mail.Mailbox.prototype.gotMail=function(){	this.mailNum=this.req.responseText;		if (!this.mailNum || this.mailNum=='0'){		var newMail=new msg.Message("mailMsg0"+msgId, "You have "+this.mailNum+" messages", null, null, "images/msg_mail.png");				this.reloadMail();	} else {		this.noMail();		this.reloadMail();	}		msgId++;}mail.Mailbox.prototype.noMail=function(){	if (!this.userId){		var notLogged=new msg.Message("noLog0"+msgId, "You are not logged in");	} else {		var zeroMail=new msg.Message("noMail0"+msgId, "You have no new mail");	}}mail.Mailbox.prototype.reloadMail=function(){	setTimeout("this.checkMail()", this.checkTime*1000);}mail.Mailbox.prototype.defaultReloadMail=function(){	setTimeout("this.checkMail()", 1000000);}