/**		info-flyer		**/

var shutTimer = false;
var timeDown = 10;
var timeDownMilli = timeDown*1000;

classPopUp = function(){
	this.style = document.getElementById("popUpDiv").style;
	this.myName = 'Insert Name here';
	this.el = document.getElementById("popUpDiv");
	//this.el.onclick = this.shutPopUp;
	this.el.onmouseover = this.clearTimer;
	this.el.onmouseout = this.autoShut;
	this.fl_timer = false;
	this.fl_countdown = false;
}

classPopUp.prototype.showPopUp = function(){
	this.style.visibility = 'visible';
	this.autoShut();
}

classPopUp.prototype.autoShut = function(){
	if(! objPopUp.fl_timer){
		shutTimer = setTimeout("objPopUp.shutPopUp()",timeDownMilli);
		objPopUp.fl_timer = true;
		objPopUp.countTime = timeDown;
		objPopUp.fl_countdown = true;
	}
}

classPopUp.prototype.clearTimer = function(){
	if(objPopUp.fl_timer){
		clearTimeout(shutTimer);
		document.getElementById("countdownDiv").innerHTML = 'x';
		objPopUp.fl_countdown = false;
		objPopUp.fl_timer = false;
		//@document.getElementById("contentDiv").innerHTML += 'cleared! ';
	}

}

classPopUp.prototype.shutPopUp = function(){
	objPopUp.clearTimer();
	objPopUp.style.visibility = 'hidden';
	objPopUp.fl_timer = false;
}

classPopUp.prototype.getCountdown = function(){
	if(objPopUp.fl_countdown){
		if(this.countTime>0) this.countTime --; 
		document.getElementById("countdownDiv").innerHTML = this.countTime;
	}
}



function initPopUp(){
	objPopUp = new classPopUp();
	if (! document.getElementById("countdownDiv")) return false;
	setTimeout("objPopUp.showPopUp()",100);
	count_interval = setInterval("objPopUp.getCountdown()",1000);
}


window.onload = initPopUp;



