function JSProgressBar(parent, width, height)
{
	//шкала
	var div = document.createElement("div");	
	div.style.width  = 0;
	div.style.height = height;
	div.style.border = '0px';
	div.style.background = 'url(pbbg.gif) repeat-x top left';

		
	if(parent == null)
	{
		var rootdiv =  document.createElement("div");
		rootdiv.appendChild(div);
	
		document.writeln(rootdiv.innerHTML);
	}
	else if((typeof(parent)).toLowerCase() == 'string')
	{
		var obj = document.getElementById(parent);
		obj.appendChild(div);
	}
	else
	{
		parent.appendChild(div);
	};		
		
	this.scale    = div;
	this.width    = width;
	this.height   = height;
	
	this.curwidth = 0;

	this.reset  = function()
							{
							var dhtmlobj  = this.scale
							this.curwidth = 0;
							dhtmlobj.style.width = 0;
							window.clearInterval(this.timer);
							};
	this.stop =   function()
							{
							window.clearInterval(this.timer);
							};

	this.start =  function(speed, step)
									{
									step = step?step:1;
									var dhtmlobj   = this.scale
									var jsobwraper = this;
									this.timer     = window.setInterval(function()
																				{
																				if(jsobwraper.curwidth < jsobwraper.width){																																
																					dhtmlobj.style.width = jsobwraper.curwidth;
																					jsobwraper.curwidth += step;
																				}else{
																					dhtmlobj.style.width = jsobwraper.width;
																					window.clearInterval(jsobwraper.timer);
																				};										
																				}, 
																				speed);
									};
									
	this.step  =    function(persent)
									{	
									var step;								
									var dhtmlobj  = this.scale
									persent = parseInt(persent);
									if(!persent || persent < 0 || persent > 100){
											return false;
									};
									step = this.width * persent / 100;										
									dhtmlobj.style.width = step;
									return true;
									};									
};