// JavaScript Document
/**************************
var dinamic=1//
1 the content is refreshing dinamically
0 the content is not refreshing, you must specifi the value for progressbar by hand
var procent=45;
if the dinamic is 0 then here you can specify the progressbar value
var start// the start time
var end// the end time
****************/
var dinamic=1;
var procent=50;
var start = new Date(2009,10-1,11,19,0);/*format YYYY, MM-1, DD, HH, MM*/
var start_time=start.getTime();
var end = new Date(2009, 12-1, 1, 19, 48);
var end_time=end.getTime();
$(function () {
// if you have Date objects
$('#countdown').countdown({until: end,
layout: '{dn} {dl} {hn} {hl} {mn} {ml} {sn} {sl}'});
});
/*content reloadings*/
if (dinamic==1)
{
var auto_refresh = setInterval(
function()
{
var current = new Date();
var current_time=current.getTime();
var time_max=(end_time-start_time);
var time_elapsed=(current_time-start_time);
var procent_to_calculate=(time_elapsed*100)/time_max;
var procent=procent_to_calculate.toFixed(0);
if (current_time>end_time)
procent=100;
$(function(){
// Progressbar
$("#progressbar").progressbar({
value: procent
});
$("#procent").html(procent+"% Done");
});
}
, 1000);
}
else
{
$(function(){
// Progressbar
$("#progressbar").progressbar({
value: procent
});
$("#procent").html(procent+"% Done");
});
}