
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();
	setTimeout("objPopUp.showPopUp()",100);
	count_interval = setInterval("objPopUp.getCountdown()",1000);
}



function startAniLogo(){
	flyer.startAni();
}

// javascript:startAniLogo()

var flyer = {
	doScroll : true,
	speed : 10,
	step : 1,
	increase : 1.05,
	refObj : false,
	currX : 124,
	
	startAni : function(){
		flyer.refObj = document.getElementById("logo");
		flyer.refObj.style.marginLeft = '124px';
		flyer.step = 1;
		flyer.currX = 124;
		flyer.scrollLoop();
	},
	
	scrollLoop : function(){
		if(flyer.checkScrCondition() ){
			//flyer.currX ++;
			flyer.accelerate();
			flyer.currX += parseInt(flyer.step); 
			//flyer.currX = flyer.currX * this.increase; 
			flyer.refObj.style.marginLeft = flyer.currX+'px';
			setTimeout("flyer.scrollLoop()",this.speed);
		}
		else{
			flyer.refObj.style.marginLeft = '124px';
		}
	},

	accelerate : function(){
		tmp = flyer.step * flyer.increase; 
		flyer.step = tmp;
		return tmp;
	},
	
	checkScrCondition : function(){
		if(this.doScroll==false) return false;
		if(flyer.currX >1000){
			flyer.doScroll = false;
			return false;
		}
	return true;
	}
}



