﻿msgTime=3;  // seconds msg reminder is shown
chanceMsg=1; // msg will be shown 1 in X times (put 1 for everytime)

var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"
msgCount=0;
function reshowMsg(){
    msgCount=0;
    initMsg();
}
function initMsg(){
	if(!ns && !ie && !w3) return;
	if(ie)		msgDiv=eval('document.all.demoModeDiv.style');
	else if(ns)	msgDiv=eval('document.layers["demoModeDiv"]');
	else if(w3)	msgDiv=eval('document.getElementById("demoModeDiv").style');
	//randMsg=Math.ceil(Math.random()*chanceMsg);
        if (ie||w3)
        {
            msgDiv.visibility="visible";
            msgDiv.display="block";
        }
        else
            msgDiv.visibility ="show";
	/*if(randMsg==1)*/ showMsg();
}
function showMsg(){
if(msgCount<msgTime*10){
    msgCount+=1;
	if (ie){documentWidth  =truebody().offsetWidth/2+truebody().scrollLeft-20;
	documentHeight =truebody().offsetHeight/2+truebody().scrollTop-20;}	
	else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
	documentHeight=window.innerHeight/2+window.pageYOffset-20;} 
	else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
	documentHeight=self.innerHeight/2+window.pageYOffset-20;} 
	
	msgDiv.left=documentWidth-200+calunit;
	msgDiv.top =documentHeight-200+calunit;
	setTimeout("showMsg()",100);}
	else 
	closeMsg();
}
function closeMsg(){
if (ie||w3)
msgDiv.display="none";
else
msgDiv.visibility ="hide";
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

onload=initMsg;

