function GetPage($res = '')
{
    $table = mysql_fetch_array(mysql_query("SELECT GROUP_CONCAT(`name`) FROM `work_activities` WHERE actived = 1 AND all_limit = 1"));
    $data = '
	<div id="dialog-form">
	    <fieldset>
	    	<legend>ძირითადი ინფორმაცია</legend>
            <!-- ID -->
			<input type="hidden" id="lang_id" value="' . $res['id'] . '" />
	    	<table class="dialog-form-table">
			    <tr>
					<td style="width: 170px;"><label for="project_id">პროექტი</label></td>
					<td>
						<select id="project_id" style="width: 174px;">' . GetProject($res['project_id']) . '</select>
					</td>
				</tr>
			    <tr>
					<td style="width: 170px;"><label for="name">სახელი</label></td>
					<td>
						<input type="text" id="name" value="' . $res['name'] . '" />
					</td>
				</tr>
			    <tr>
					<td style="width: 170px;"><label for="pay">ანაზღაურებადი/არა ანაზღაურებადი</label></td>
					<td>
						<select id="pay" style="width: 174px;">' . GetPay($res['pay']) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="type">კატეგორია</label></td>
					<td>
						<select id="type" style="width: 174px;">' . GetShitType($res['work_activities_cat_id']) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="color">ფერი</label></td>
					<td>
						<input type="color" id="color" value="' . $res['color'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="color">ხანგრძლივობა</label></td>
					<td>
						<input type="text" id="timer" value="' . $res['timer'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="limit">ლიმიტი</label></td>
					<td>
						<input type="number" min="1" id="limit" value="' . $res['limit'] . '" style="width: 50px;" /> <button id="add_limit">დამატება</button> <div id="mylimits">' . $table[0] . '</div>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="date_checker">დროის შემოწმება</label></td>
					<td>
						<input type="checkbox" id="date_checker" ' . ($res['date_checker'] == '1' ? 'checked' : "") . ' />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="comment">კომენტარი</label></td>
					<td>
						<textarea  id="comment" style="resize: vertical;">' . $res['comment'] . '</textarea>
					</td>
				</tr>
						    <tr><td colspan="2">
						    <div id="button_area">
                            	<button id="add_button1">დამატება</button>
                            	<button id="delete_button1">წაშლა</button>
                            </div>
						    <table class="display" id="activiti">
                                <thead>
                                    <tr id="datatable_header">
                                        <th>ID</th>
                                        <th style="width: 48%;">დასაწყისი</th>
                                        <th style="width: 48%;">დასასრული</th>
                                    	<th class="check">#</th>
                                    </tr>
                                </thead>
                                <thead>
                                    <tr class="search_header">
                                        <th class="colum_hidden">
                                            <input type="text" name="search_category" value="ფილტრი" class="search_init" />
                                        </th>
                                        <th>
                                            <input type="text" name="search_category" value="ფილტრი" class="search_init" />
                                        </th>
                                        <th>
                                            <input type="text" name="search_category" value="ფილტრი" class="search_init" />
                                        </th>
                                        <th>
                                        	<div class="callapp_checkbox">
                                                <input type="checkbox" id="check-all1" name="check-all" />
                                                <label for="check-all1"></label>
                                            </div>
                                        </th>
                                    </tr>
                                </thead>
                            </table>
						    
						    
						    </td></tr>
			</table>
        </fieldset>
    </div>
    ';
    return $data;
}
        if ($detail_id == '') {
            AddDetail($project_id, $cycle_id, $work_shift_id, $num);
        } else {
            UpDetail($detail_id, $project_id, $cycle_id, $work_shift_id, $num);
        }
        break;
    case 'disable':
        $id = $_REQUEST['id'];
        DisableCycle($id);
        break;
    case 'delete_detail':
        $id = $_REQUEST['id'];
        DisableDetail($id);
        break;
    case 'get_project':
        $data['page'] = GetProject('');
        break;
    default:
        $error = 'Action is Null';
}
$data['error'] = $error;
echo json_encode($data);
/* ******************************
 *	Category Functions
* ******************************
*/
function check_name($name)
{
    $res = mysql_num_rows(mysql_query("SELECT * FROM work_cycle WHERE `name` = '{$name}' AND actived = 1"));
    return $res;
}