function CountDown (countdown,oContainer,oConf) {
   this.container=oContainer;
   this.countdown=countdown;
   this.cfg={
      formatday:'d.',
      formatdays:'d.',
      formathour:'#h# hod #m# min #s# s'
   };
 	if (oConf!=undefined) {
		for (i in this.cfg) {
			if (oConf[i]!==undefined) {
				this.cfg[i]=oConf[i];
			};
		};
	};
   
   this.format=function(seccount) {
      var t=seccount;
      var days= Math.floor(t/(3600*24));
      t=t-(days*3600*24);
   	var hod = Math.floor(t/3600);
   	t=t-(hod*3600);
   	var min = Math.floor(t/60);
      t=t-(min*60);
   	var sec = t;
   	var h=new String(hod);
   	var m=new String(min);
   	var s=new String(sec);
   	if (h.length==1) {var hh="0"+h;} else {	var hh=h;};
   	if (m.length==1) {var mm="0"+m;} else {	var mm=m;};
   	if (s.length==1) {var ss="0"+s;} else {	var ss=s;};
      var outh=this.cfg.formathour;
   	outh=outh.replace("#hh#",hh);
   	outh=outh.replace("#mm#",mm);
   	outh=outh.replace("#ss#",ss);
   	outh=outh.replace("#h#",h);
   	outh=outh.replace("#m#",m);
   	outh=outh.replace("#s#",s);
      if (days>0) {
         if (days==1) {
         	return days+' '+this.cfg.formatday+' '+outh;
         } else {
         	return days+' '+this.cfg.formatdays+' '+outh;
         }
      } else {
      	return outh;
      }
   };

   this.tick=function() {
      this.countdown=this.countdown-1;
      if (this.countdown==0) {
         window.location.reload(true);
      }
      this.container.innerHTML=this.format(this.countdown);
   }

     
}
