doStart = function(hashid){

    document.getElementById('progress').innerHTML = "Initialization...";

    new Ajax.Request(
    		'../site/ajaxscripts/substr/start_process.php?hashfile='+hashid,
	    	{
		        asynchronous: true,
		        evalScripts: true,
		        method: 'get'
		    }
    );
       setTimeout('doRefresh("'+hashid+'")', 300);
}


doStop = function(id)
{
    new Ajax.Request(
    		'/view/ajaxscripts/substr/stop_process.php?id='+id,
		    {
		        asynchronous: true,
		        evalScripts: true,
				method: 'get'
		    }
    );

}


doRefresh = function(hashid)
{
	new Ajax.Request(
	    '../site/ajaxscripts/substr/refresh.php?hashfile='+hashid,
	    {
	        asynchronous: true,
	        evalScripts: true,
	        method: 'get',
	        onComplete: function(transport){
	            if(transport.responseText != 'Done'){
					if(transport.responseText == '100%')
						{
							document.getElementById('progress').innerHTML = "Proccesing done...";
						}else{
							document.getElementById('progress').innerHTML = transport.responseText;
						}
		       	   setTimeout('doRefresh("'+hashid+'")', 300);
		        }else{ window.location.href='/view/subtract_a_from_b.php?done=' + hashid;}
			}
	    }
    );
}