// 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=2;

	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=0;

var procent=20;



var start = new Date(2011,12-1,01,00,00);/*format YYYY, MM-1, DD, HH, MM*/

var start_time=start.getTime();



var end = new Date(2012, 01-1, 31, 00, 00);

var end_time=end.getTime();  

	$(function () {

			// if you have Date objects

				$('#countdown').countdown({until: end, 

					layout: '{dn} <span class="text">{dl}</span> {hn} <span class="text">{hl}</span> {mn} <span class="text">{ml}</span> {sn} <span class="text">{sl}</span>'});

			});



/*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");

	});

}


