var scripturl = "http://www.capsulis-conseil.com/cgi-bin/wihchat.pl";
var chattext = "";
var chaturl = "";
var chatclose = "";
var date = new Date();
var counter = date.getTime();
var loopcount = 1;
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() + 1);
document.cookie = 'WUMcheck=' + counter + '; expires=' + nextyear.toGMTString() + '; path=/';

function WUMimage() {
	document.write ('<a href="javascript: void(0)" onClick="javascript: WUMchatwindow()"><img src="' +
				scripturl + '?action=cookie' +
				"&date=" + counter +
				"&useragent=" + escape(navigator.userAgent) +
				"&page=" + escape(document.location) +
				"&referer=" + escape(document.referrer) +
				"&usertime=" + escape(date.toString()) +
				'" name=WUMchat border=0"></a>');
	setTimeout("WUMloop()",30000);
}

function WUMmonitor() {
	myImage = new Image();
	myImage.src = scripturl + '?action=cookie' +
				"&date=" + counter +
				"&useragent=" + escape(navigator.userAgent) +
				"&page=" + escape(document.location) +
				"&referer=" + escape(document.referrer) +
				"&usertime=" + escape(date.toString());
	counter++;
	loopcount++;
	if (loopcount < 30) {setTimeout("WUMmonitor()",30000)}
}

function WUMloop() {
	document.WUMchat.src = scripturl + "?action=cookie"+
				"&date=" + counter +
				"&useragent=" + escape(navigator.userAgent) +
				"&page=" + escape(document.location) +
				"&referer=" + escape(document.referrer) +
				"&usertime=" + escape(date.toString());
	counter++;
	loopcount++;
	if (loopcount < 30) {setTimeout("WUMloop()",30000)}
	setTimeout("WUMcheckchat()",2000);
}

function WUMgetCookie(NameOfCookie) {
	if (document.cookie.length > 0) {
		begin = document.cookie.indexOf(NameOfCookie+'=');
		if (begin != -1) {
			begin += NameOfCookie.length+1;
			end = document.cookie.indexOf(';', begin);
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end));
		}
	}
	return null;
}

function WUMcheckchat() {
	if (WUMgetCookie('chatme') == 1) WUMchatme();
}

//change
function WUMchatme() {
	document.cookie = 'chatme=0; expires=' + nextyear.toGMTString() + '; path=/';
	var myWindow = window.open('', 'ChatAlert', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=250,height=200');
	myWindow.document.open();
	var txt = ("<HTML><HEAD><TITLE>Chat</TITLE></HEAD>\n");
	txt += ("<BODY BGCOLOR='white'>\n");
	txt += ("<font face='Arial, Helvetica' size=-1 color='black'>" + chattext + "<br><br>\n");
	txt += ("<center><a href='javascript: void(0)' onClick=\"window.open(\'" + scripturl + "?action=chat\',\'WUMchatwindow\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=450\'); window.close()\">" + chaturl + "</a><br><br>\n");
	txt += ("<a href='javascript: void(0)' onClick='window.close()'>" + chatclose + "</a></center>\n");
	txt += ("<script>setTimeout('closeme()',30000);function closeme(){window.close()}\</script\>\n");
	txt += ("</BODY></HTML>\n");
	myWindow.document.write(txt);
	myWindow.document.close();
}

function WUMchatwindow() {
	chat = window.open(scripturl + '?action=chat','WUMchatwindow' + counter,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=450');
}
WUMmonitor();
