
adTime=2;  // seconds ad reminder is shown


var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"
var adDiv;
adCount=0;


function initMsg(messageText){
	if(!ns && !ie && !w3) return;
	
	document.getElementById("tdMessageText").innerText = messageText;
	
	if(ie)		adDiv=eval('document.all.messageDiv.style');
	else if(ns)	adDiv=eval('document.layers["messageDiv"]');
	else if(w3)	adDiv=eval('document.getElementById("messageDiv").style');
	  
	    if (ie||w3)
	    {
			adDiv.visibility="visible";
			adDiv.display="";
        }
        else
        adDiv.visibility ="show";
        
	
	adCount=0;
	showMsg();
	
}


function showMsg(){
if(adCount<adTime*100){
	adCount+=1;
	if (ie)
	{	
		documentWidth  =truebody().offsetWidth+truebody().scrollLeft-20;
		documentHeight =truebody().offsetHeight+truebody().scrollTop-20;
	} 
	else if (ns){
			documentWidth=window.innerWidth+window.pageXOffset-20;
			documentHeight=window.innerHeight+window.pageYOffset-20;
			} 
	else if (w3)
	{		documentWidth=self.innerWidth+window.pageXOffset-20;
			documentHeight=self.innerHeight+window.pageYOffset-20;
	} 
	
	
	
	adDiv.left=documentWidth-(document.getElementById("messageDiv").clientWidth*1)-4+calunit;
	//adDiv.left = 4+calunit;
	adDiv.top =documentHeight-(document.getElementById("messageDiv").clientHeight*1)+8+calunit;
	
	
		
	setTimeout("showMsg()",10);
	
	}
	else 
	{
		closeMsg();
		
	}
	
}

function closeMsg(){
	
	adCount=0;
	
	if (adDiv != null)
	{
		if (ie||w3)
		adDiv.display="none";
		else
		adDiv.visibility ="hide";
	}
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

