<!-- Countdown in Java Script .. Cameron Gregory http://www.bloke.com/
// permission to use and modify as long as you leave these 4 comment
// lines in tact and unmodified.
// http://www.bloke.com/javascript/Countdown/
speed=1000;
len=40;
tid = 0;
num=0;
clockA = new Array();
timeA = new Array();
formatA = new Array();
dd = new Date();
var d,x;

function doDate(x) {
  for (i=0;i<num;i++) {
    dt = new Date();
    if (timeA[i] != 0) {
      v1 = Math.round(( timeA[i] - dt )/1000) ;
      if (v1 < 0) {
        document.getElementById("phCountDown").innerText = "Nepoznato";
        return;
      }
      if (formatA[i] ==4 ) {
        sec = v1%60;
	    v1 = Math.floor( v1/60);
	    min = v1 %60 ;
	    v1 = Math.floor(v1 / 60);
	    hour = v1 %24 ;
	    day = Math.floor(v1 / 24);
	    //clockA[i].date.value = day+(day==1?"day ":"days ")+hour+(hour==1?"hour ":"hours ")+min+(min==1?"min ":"mins ")+sec+(sec==1?"sec ":"secs ")
	    var dashboardEl = document.getElementById("phCountDown");
	    if (dashboardEl != null) {
            dashboardEl.innerHTML = (day>0?day + "d ":"") + (hour>0?hour + "h ":"") + (min>0?min + "m ":"") + sec + "s ";
        }
        var dashboardElBig = document.getElementById("phCountDownBig");
        if (dashboardElBig != null) {
            dashboardElBig.innerHTML = day + "d " + hour + "h " + min + "m " + sec + "s ";
        }
        //document.getElementById("phCountDown").innerText = day + "d " + hour + "h " + min+"m " + sec + "s ";
        
      }
    }
  }
  tid=window.setTimeout("doDate()",speed);
}

function start(d,format) {
  clockA[num] = x
  timeA[num] = new Date(d);
  formatA[num] = format;
  if (num == 0)  
    tid=window.setTimeout("doDate()",speed);
  num++;
}

function Countdown(t) {
  start(t,4);
}

// end-->

