function AZTimer(timeToExpire, timer) {
	this.timeToExpire = timeToExpire;
	this.timer = timer;
	this.isHidden = true;
};

AZTimer.prototype.newTime= function(newTime) {
	if (this.timeToExpire < 1) {
		this.timeToExpire = newTime;
		if (this.timeToExpire < 0) {
			this.isHidden = false;
		} else {
			this.isHidden = true;
		}
		this.displayTimer();
	} else {
		this.timeToExpire = newTime;
	}
};

AZTimer.prototype.displayTimer = function() {
	if (this.isHidden) {
		$("#basketExpire").show();
		this.isHidden = false;
	}
	this.timeToExpire -= this.timer;
	if (this.timeToExpire > 0) {
		$("#basketExpire").html(STR_EXPR+' '+getTimerString(this.timeToExpire));
		setTimeout("timeToExpireBasket.displayTimer()", this.timer*1000) 
	} else {
		$("#basketExpire").html(STR_EXPRIRED);
	}
};


function getTimerString(timeRemaining) {

 //store the current ms remaining in a variable named _root.temp
 //the amount of days left
 var temp = timeRemaining;
 var daysleft = Math.floor(temp/86400);

 //adjust temp to leave remaining hours, minutes, seconds
 temp = temp -(daysleft*86400);

 //calculate the amount of hours remaining
 var hoursleft = Math.floor(temp/3600);

 //adjust temp to leave the remaining minutes and seconds
 temp = temp-(hoursleft*3600);

 //the amount of minutes remaining
 var minsleft = Math.floor(temp/60);
 //adjust _root.temp to leave only the remaining seconds
 temp = temp-(minsleft*60);

 //seconds remaining
 secsleft = Math.floor(temp);
 if (secsleft < 10) {
	secsleft = '0'+secsleft;
 }

 return /*hoursleft + ":" +*/ minsleft + ":" + secsleft;

};