
<!--
var unique = 0;
var acceptMsg = 0;
var NStateEl;
var loadState = 0;

var connect = 0;
var errorconnect = 1;
var receive = 2;
ayAudio[connect] = "sounds/connect.wav";
ayAudio[errorconnect] = "sounds/errorconnect.wav";
ayAudio[receive] = "sounds/recvmsg.wav";

var defbgColor = document.bgColor;
var defnotifybgColor = "";
function loadNotificationState() {
	NStateEl = document.getElementById('NotificationState');
	PStateEl = document.getElementById('NotificationPlace');
}
function chgbgcolor(c,n) {
	n += 1;
	document.bgColor=c;
	var intval = (n < 20) ? 500 : 25;
	c = (n % 2) ? 'red' : defbgColor;
	var t = setTimeout("chgbgcolor('"+c+"',"+n+");",intval);
	if(acceptMsg || n > 40) {
		clearTimeout(t);
		document.bgColor=defbgColor;
	}
}
function blinkit() {
	chgbgcolor('red',0);
}
function chgnotifybgcolor(c,n) {
	n += 1;
	NStateEl.style.color=c;
	var intval = (n < 20) ? 500 : 25;
	c = (n % 2) ? 'red' : defnotifybgColor;
	var t = setTimeout("chgnotifybgcolor('"+c+"',"+n+");",intval);
	if(acceptMsg || n > 40) {
		clearTimeout(t);
		NStateEl.style.color=defnotifybgColor;
	}
}
function blinknotify() {
	defnotifybgColor = NStateEl.style.color; //background
	chgnotifybgcolor('red',0);
}
function wctr_sleep(url) {
	document.location = url;
}
function dounique() { var date = new Date() ; return date.getTime() ; }
function receiveMsg(El) {
	acceptMsg = 0;
	playAudio(receive);
	if(NStateEl) {
		NStateEl.innerHTML = 'Receive';
		NStateEl.style.color = 'blue';
		if(El.blinkmode == 'background') {
			blinkit();
		} else {
			blinknotify();
		}
	}
	if(El) {
		if(El.notify_view_place) {
			eval(El.notify_view_place.name + '.location.reload();');
		}
		if(El.reload_url) {
			setTimeout("wctr_sleep('"+El.reload_url+"');",10000);
		}
	}
	loadState = 1;
}
function connectMsg() {
	playAudio(connect);
	if(NStateEl) {
		NStateEl.innerHTML = 'Connecting...';
		NStateEl.style.color = 'blue';
	}
	loadState = 1;
}
function errconnMsg() {
	playAudio(errorconnect);
	if(NStateEl) {
		NStateEl.innerHTML = 'Error Connection';
		NStateEl.style.color = 'red';
	}
	loadState = 1;
}
function clearStMsg() {
	stopAudio(receive);
	loadState = 0;
}
function connectedMsg() {
	if(NStateEl) {
		NStateEl.innerHTML = 'Connected';
		NStateEl.style.color = 'green';
	}
}
function image_animation() {
	var initiate = this.width;
	if(loadState == 1) {
		clearStMsg();
	}
	if(initiate == 4) {
		receiveMsg(this);
		this.state = 4;
	} else if(initiate == 2) {
		if(this.state == 1) {
			connectMsg();
		} else {
			connectedMsg();
		}
		this.state = 2;
	} else {
		//if(this.state != 1)
			errconnMsg();
		this.state = 1;
	}
}
//-->
