public function removeWindows($pid)
 {
     if (!empty($pid)) {
         $this->loadPID($pid);
         $c = $this->countWindows();
         if ($c != 0) {
             // remove process id from windows
             $winID = $this->getProcessWindows();
             for ($i = 0; $i < $c; $i++) {
                 $w = new api_wintask();
                 $w->setID($winID);
                 $w->getWindow();
                 $w->closeWindow();
             }
             // reset array
             if (is_array($_SESSION['pid'][$this->app_id]['WIN_ID'])) {
                 $_SESSION['pid'][$this->app_id]['WIN_ID'] = array();
                 return true;
             }
         }
     }
 }
         // create window
         $win_task->setAppParams($_GET['app_params']);
         echo $win_task->getJavaScript();
         // get JS code
         $apiProcess = new api_winprocess();
         $apiProcess->assignWindow($win_task);
         $pid = $apiProcess->newProcess();
     }
     break;
 case 'destroy':
     if (!empty($_GET['id'])) {
         $win_task = new api_wintask();
         $win_task->setID(filter::num($_GET['id']));
         $win_task->getWindow();
         //echo '<script>alert("'.$win_task->getParam('process_id').'");</script>';
         $win_task->closeWindow();
     }
     break;
 case 'sessiondestroy':
     session_destroy();
     break;
 case 'restore':
     $c = count($_SESSION['tasks']);
     $js_code = '';
     $win_tasks = new api_wintask();
     $c = $win_tasks->countWindows();
     if ($c != 0) {
         foreach ($_SESSION['tasks'] as $key => $value) {
             if ($key != 1) {
                 $win_task = new api_wintask();
                 $win_task->setID($_SESSION['tasks'][$key]['id']);