function geriSayim() {
	
	
	var hedefId = "";
	
	var BackColor		= "white";
	var ForeColor		= "black";
	var TargetDate		= "12/31/2020 5:00 AM";
	var DisplayFormat	= "%%H%%:%%M%%:%%S%%";
	var CountActive		= true;
	var FinishMessage	= "<span style=\"font-size:15px;display:block;text-align:center;text-decoration:blink;\">İhale Tamamlandı</span>";
	var CountStepper	= -1;
	var LeadingZero		= true;
	var NowDate			= "";
	var gsecs 			= "";
	var redirect		= true;
	var redirectUrl		= window.location;

	
	
	this.setZaman		= setZaman;
	this.setHedefId		= setHedefId;
	this.setFormat		= setFormat;
	this.setFinishMessage = setFinishMessage;
	this.setRedirect	= setRedirect;
	this.setRedirectUrl	= setRedirectUrl;
	this.getHedefZaman	= getHedefZaman;
	
	this.calcage		= calcage;
	this.CountBack		= CountBack;
	this.sayacBasla		= sayacBasla;
	this.sayacBitir		= sayacBitir;
	
	function setRedirectUrl(url) {
		redirectUrl = url;
	}
	
	function setRedirect(drm) {
		redirect = drm;
	}
	
	function setFinishMessage(msg) {
		FinishMessage = msg;
	}
	
	function setHedefId(id) {
		hedefId = id;
	}
	
	function setFormat(format) {
		DisplayFormat = format;
	}
	
	function setZaman(hzaman,szaman) {
		TargetDate	= hzaman;
		NowDate		= szaman;
		
		CountStepper = Math.ceil(CountStepper);
		
		if (CountStepper == 0) CountActive = false;
		
		SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
		
		var dthen	= new Date(TargetDate);
		var dnow	= new Date(NowDate);
		
		//console.log(dthen,dnow);
		
		if(CountStepper>0) {var ddiff = new Date(dnow-dthen);} else {var ddiff = new Date(dthen-dnow);}
		
		gsecs = Math.floor(ddiff.valueOf()/1000);
	}
	
	function getHedefZaman() {
		return TargetDate;
	}
	
	function sayacBasla() {
		CountActive=true;
		CountBack(gsecs);
	}	
	function sayacBitir() {
		CountActive=false;
	}

	function calcage (secs, num1, num2) {
		s = ((Math.floor(secs/num1))%num2).toString();
		if (LeadingZero && s.length < 2) s = "0" + s;
		return s;
	}
	
	function CountBack(secs) {
		
		//console.log(this.type);
		
		if (secs < 1) {
			CountActive = false;
			
			YUC.asyncRequest('POST', "/ccron/ihale_kontrol", 
			{success:function(o){
				
				document.getElementById(hedefId).innerHTML=FinishMessage;
				
				if (redirect) {
					setTimeout(function() {window.location=redirectUrl;} ,2500);

				}
				
			}},"");
            
		  	return false;
        }
	  	
	  	DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
		DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
		DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
		DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));
		
		if (document.getElementById(hedefId)!=undefined) document.getElementById(hedefId).innerHTML = DisplayStr;
		
		//console.log(this.CountActive);
		
		if (CountActive) setTimeout( function() {	CountBack((secs+CountStepper),hedefId); } , SetTimeOutPeriod);
	}
		
		
}






	




