/********************************************************
Dialog ProgressButton
********************************************************/

function ProgressButton(/*String*/ startTextOptional, /*String*/ stopTextOptional, /*boolean*/ hideOnStopOptional)
{
	var startText = "";
	if (null!=startTextOptional && (typeof startTextOptional)!='undefined') startText = startTextOptional;

	var stopText = "";	
	if (null!=stopTextOptional && (typeof stopTextOptional)!='undefined') stopText = stopTextOptional;
	
	var hideOnStop = true;
	if (null!=hideOnStopOptional && (typeof hideOnStopOptional)!='undefined') hideOnStop = hideOnStopOptional;
	
	var START_IMAGE_SRC = "lib/onorex/widget/progressButton/images/progress_start.gif";
	var START_IMAGE_WIDTH  = 15;
	var START_IMAGE_HEIGHT = 15;
	var IMAGE_ID = "ProgressButton_"+ random();
	var TEXT_ID = "ProgressButtonText_"+ random();
	
	var STOP_IMAGE_SRC = "lib/onorex/widget/progressButton/images/progress_stop.gif";
	var STOP_IMAGE_WIDTH  = 15;
	var STOP_IMAGE_HEIGHT = 15;
	
	var INACTIVE_IMAGE_SRC = "lib/onorex/widget/progressButton/images/progress_inactive.gif";
	var INACTIVE_IMAGE_WIDTH  = 15;
	var INACTIVE_IMAGE_HEIGHT = 15;
	
	var __html__ = "<img src='"+INACTIVE_IMAGE_SRC+"' width='"+INACTIVE_IMAGE_WIDTH+"' height='"+INACTIVE_IMAGE_HEIGHT+"' id='"+IMAGE_ID+"'>&nbsp;<span id='"+TEXT_ID+"' style='color:gray;font-size:smaller'></span>";
	document.write(__html__);
	
	var progressImage = document.getElementById(IMAGE_ID);
	var progressText =  document.getElementById(TEXT_ID);

	this.start = function()
	{
		progressImage.src = START_IMAGE_SRC;
		progressImage.width = START_IMAGE_WIDTH;
		progressImage.height = START_IMAGE_HEIGHT;
		progressText.innerHTML = startText;
		this.show();
	}
	
	this.stop = function()
	{
		if (hideOnStop)
		{
			this.hide();
		}
		else
		{
			progressImage.src = STOP_IMAGE_SRC;
			progressImage.width = STOP_IMAGE_WIDTH;
			progressImage.height = STOP_IMAGE_HEIGHT;
			progressText.innerHTML = stopText;
			this.show();
		}
	}
	
	this.show = function()
	{
		progressImage.style.visibility = 'visible';
		progressText.style.visibility = 'visible';
	}
	
	this.hide = function()
	{
		progressImage.style.visibility = 'hidden';
		progressText.style.visibility = 'hidden';
	}
	
	this.inactive = function()
	{
		progressImage.src = INACTIVE_IMAGE_SRC;
		progressImage.width = INACTIVE_IMAGE_WIDTH;
		progressImage.height = INACTIVE_IMAGE_HEIGHT;
		this.show();
	}

	this.hide();
}
/********************************************************/
