<?php
  ///////////////////////////////////////////////////
  //2012 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("lang/".$lang.".php")) include "lang/".$lang.".php";
     else include "lang/ru.php";

  $title=$titlepage=$TEXT['meet-help2'];

  require_once "config.php";
  require_once "utils/top_meet_otv.php";

  if(empty($_GET['add'])) $_GET['add'] = 0;
  if(!isset($button)) $button = $TEXT['btn-next'];
  if(!isset($action2)) $action2 = "meet_ed_otv.php";
  if(!isset($action3)) $action3 = "meet_edit_usr.php";
  if($_GET['add'] == 2) $action = $action3;
   else $action = $action2;

   if($result2['administrator'] == "1")
       {
       $adm_date = "";
       $adm_vis = "(".$TEXT['meet-admin'].")";
       }
     else  
        {
         $adm_date = " WHERE tbl_meet_event.usr_id='".$result2['usr_id']."' ";
         $adm_vis = "";
        }
?>
<script type="text/javascript" language="JavaScript" src="lang/calendar2-<?php echo $lang; ?>.js"></script>
<form enctype='multipart/form-data' name="rprt" action=<?php echo $action; ?> method=post>
<table class="table" border="0" cellpadding="0" cellspacing="0" width="87%">
<tr>
    <td>
       <?php
       $dog = "@";

  $query = "SELECT
tbl_users.user_id,
tbl_users.org_id,
tbl_users.room,
tbl_users.familiya,
tbl_users.name,
tbl_users.otchestvo,
tbl_users.mail,
tbl_users.phone_mob,
tbl_users.phone_int,
tbl_users.phone_city,
tbl_users.photo,
tbl_dolzhnost.dolzhnost,
tbl_domain.domain,
tbl_city.city,
tbl_street.street,
tbl_house.house,
tbl_organizaciya.organizaciya,
tbl_upravlenie.upravlenie,
tbl_otdel.otdel 
FROM tbl_users 
JOIN tbl_dolzhnost ON tbl_users.dol_id=tbl_dolzhnost.dol_id 
JOIN tbl_domain ON tbl_users.dom_id=tbl_domain.dom_id 
JOIN tbl_city ON tbl_users.city_id=tbl_city.city_id 
JOIN tbl_street ON tbl_users.str_id=tbl_street.str_id 
JOIN tbl_house ON tbl_users.house_id=tbl_house.house_id 
JOIN tbl_organizaciya ON tbl_users.org_id=tbl_organizaciya.org_id 
JOIN tbl_upravlenie ON tbl_users.upr_id=tbl_upravlenie.upr_id 
JOIN tbl_otdel ON tbl_users.otd_id=tbl_otdel.otd_id 
WHERE user_id = '".$result2['usr_id']."'";
  $users = mysql_query($query);
         if(!$users) puterror($TEXT['error-tbl2']);
            $user = mysql_fetch_array($users,MYSQL_ASSOC);
               $room = $user['room'];
               $familiya = $user['familiya'];
               $name = $user['name'];
               $otchestvo = $user['otchestvo'];
               $mail = $user['mail'];
               $phone_mob = $user['phone_mob'];
               $phone_int = $user['phone_int'];
               $phone_city = $user['phone_city'];
               $res_dol = $user['dolzhnost'];
               $res_dom = $user['domain'];
               $email = $mail.$dog.$res_dom;
               $res_cit = $user['city'];
               $res_str = $user['street'];
               $res_hou = $user['house'];
               $res_org = $user['organizaciya'];
               $res_upr = $user['upravlenie'];
               $res_otd = $user['otdel'];
               $usr_id = $result2['usr_id'];
	           $org_id = $user['org_id'];

                 if(!empty($user['photo']) && $user['photo']!="-") $result_image = "<tr valign=top><td width='15%' rowspan='12'>&nbsp;&nbsp;&nbsp;&nbsp;<img alt='картинка' width='130' height='185' src='personal/".$user['photo']."' /></td></tr>";
                   else $result_image = "";

                   if(!empty($res_cit) && $res_cit!=="-"){$cit = "&nbsp;".$TEXT['user-city']."&nbsp;".$res_cit.",&nbsp;";}
                    else $cit = "";

                   if(!empty($res_str) && $res_str!=="-"){$str = $TEXT['user-str']."&nbsp;".$res_str.",&nbsp;";}
                     else $str = "";

                   if(!empty($res_hou) && $res_hou!=="-"){$hou = $TEXT['user-home']." ".$res_hou;}
                     else $hou = "";

                   if(!empty($room) && $room!=="-"){$rum = ",&nbsp;".$TEXT['user-room']." ".$room;}
                     else $rum = "";

             echo "<fieldset class='zayavka2' >";
             echo " <legend align='left' class='about'>".$TEXT['support10']."&nbsp;".$adm_vis."</legend>";
             echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'> ";
              echo $result_image;
               if(!empty($familiya)) echo "<tr><td width='80%' class='texttableusrtit'>$familiya&nbsp; $name&nbsp; $otchestvo</td></tr>";
                  if($cit!=="" || $str !== "" || $hou !== "" || $rum !== "")  echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-adrr']."<span class='texttableusr'>".$cit."".$str."".$hou."".$rum."</span></td></tr>";
                  if(!empty($res_org)) echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-org']."<span class='texttableusr'>&nbsp;$res_org</span></td></tr>";
                   if(!empty($res_upr) && $res_upr!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-upr']."<span class='texttableusr'>&nbsp;$res_upr</span></td></tr>";
                    if(!empty($res_otd) && $res_otd!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-otd']."<span class='texttableusr'>&nbsp;$res_otd</span></td></tr>";
                     if(!empty($res_dol) && $res_dol!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['search-dol']."<span class='texttableusr'>&nbsp;$res_dol</span></td></tr>";
                      if(!empty($phone_mob) && $phone_mob!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-tel-mob']."<span class='texttableusr'>&nbsp;$phone_mob</span></td></tr>";
                       if(!empty($phone_city) && $phone_city!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-tel-city']."<span class='texttableusr'>&nbsp;$phone_city</span></td></tr>";
                        if(!empty($phone_int) && $phone_int!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-tel-int']."<span class='texttableusr'>&nbsp;$phone_int</span></td></tr>";
                         if(!empty($mail) && $res_dom!=="-") echo "<tr valign=top><td width='80%' class='about'>".$TEXT['user-e-mail']."&nbsp;<a href=mailto:$email><span class='texttableusr'>$email</span></a></td></tr>";
                           echo "</table></fieldset>";

      echo "</td>";
   echo "</tr>";
   echo "<tr>";
      echo "<td><hr />";
     echo "<table align='center' border='0' width='95%' cellpadding='0' cellspacing='0'>";

     if($_GET['add'] == 1)
     {
      echo "<tr>";
      echo "<td>";
         echo "<fieldset class='zayavka' >";
         echo "<legend align='left' title=".$TEXT['support3'].">".$TEXT['support12']."</legend>";
          echo "<table align='center' border='0' width='100%' cellpadding='0' cellspacing='0'>";
             echo "<tr><td align='right' width='15%' class='support'>&nbsp;</td><td class='support' width='50%' align='left'>&nbsp;</td>";
             ?>
         <td align='center' width='15%' rowspan="13"><br /><br />
        <a href="javascript:inserttags('<span%20class=&quot;fntbld&quot;>','</span>')" title="<?php echo $TEXT['new-tag1']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/bold.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntit&quot;>','</span>')" title="<?php echo $TEXT['new-tag2']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/italic.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntunderline&quot;>','</span>')" title="<?php echo $TEXT['new-tag3']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/underline.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntzacherknuto&quot;>','</span>')" title="<?php echo $TEXT['new-tag4']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/linetrough.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<sup>','</sup>')" title="<?php echo $TEXT['new-tag6']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/sup.png" align=middle /></a>
        <a href="javascript:inserttags('<sub>','</sub>')" title="<?php echo $TEXT['new-tag5']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/sub.png" align=middle /></a>
        <a href="javascript:inserttags('<p>','</p>')" title="<?php echo $TEXT['new-tag7']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/paragraf.png" align=middle /></a>
        <a href="javascript:inserttags('<hr />','')" title="<?php echo $TEXT['new-tag8']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/hr.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<span%20class=&quot;buttonbkg&quot;>','</span>')" title="<?php echo $TEXT['new-tag38']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/btn.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntbldzag&quot;>','</span>')" title="<?php echo $TEXT['new-tag16'].$TEXT['new-tag17']; ?>"><img alt="font16" src="admin/img/fontsize16.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntbldzag2&quot;>','</span>')" title="<?php echo $TEXT['new-tag16'].$TEXT['new-tag18']; ?>"><img alt="font18" src="admin/img/fontsize18.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;zagolovok&quot;>','</span>')" title="<?php echo $TEXT['new-tag16'].$TEXT['new-tag19']; ?>"><img alt="font20" src="admin/img/fontsize20.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<span%20class=&quot;fntyellow&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag35']; ?>"><img alt="text-yellow" src="admin/img/textcolor-yellow.png" align=middle border=0 /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntred&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag21']; ?>"><img alt="text-red" src="admin/img/textcolor-red.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntgreen&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag22']; ?>"><img alt="text-green" src="admin/img/textcolor-green.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntblue&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag23']; ?>"><img alt="text-blue" src="admin/img/textcolor-blue.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckgreen&quot;>','</span>')" title="<?php echo $TEXT['new-tag31']; ?>"><img alt="marc-green" src="admin/img/marck-green.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckorange&quot;>','</span>')" title="<?php echo $TEXT['new-tag29']; ?>"><img alt="marc-orange" src="admin/img/marck-orange.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckyellow&quot;>','</span>')" title="<?php echo $TEXT['new-tag30']; ?>"><img alt="marc-yellow" src="admin/img/marck-yellow.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckgray&quot;>','</span>')" title="<?php echo $TEXT['new-tag28']; ?>"><img alt="marc-grey" src="admin/img/marck-grey.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<p%20class=&quot;console&quot;><img%20class=&quot;tipsimg&quot;%20alt=&quot;console&quot;%20src=&quot;admin/img/cmd.png&quot; />','</p>')" title="<?php echo $TEXT['new-tag24']; ?>"><img alt="console" src="admin/img/console.png" align=middle /></a>
        <a href="javascript:inserttags('<p%20class=&quot;tips&quot;><img%20class=&quot;tipsimg&quot;%20alt=&quot;tips&quot;%20src=&quot;admin/img/note.png&quot; />','</p>')" title="<?php echo $TEXT['new-tag26']; ?>"><img alt="tips" src="admin/img/tips-pic.png" align=middle /></a>
        <a href="javascript:inserttags('<p%20class=&quot;textfilecont&quot;><img%20class=&quot;tipsimg&quot;%20alt=&quot;text&quot;%20src=&quot;admin/img/text.png&quot; />','</p>')" title="<?php echo $TEXT['new-tag25']; ?>"><img alt="text" src="admin/img/text-pic.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;tooltip&quot;>место%20для%20слова<span>то%20что%20будет%20всплывать,%20очень%20кратко','<small></small></span></span>')" title="<?php echo $TEXT['new-tag27']; ?>"><img alt="baloon" src="admin/img/note-pic.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('&ldquo;','&rdquo;')" title="<?php echo $TEXT['new-tag15']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/quote1.png" align=middle /></a>
        <a href="javascript:inserttags('&laquo;','&raquo;')" title="<?php echo $TEXT['new-tag15']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/quote2.png" align=middle /></a>
        <a href=# onClick="window.open('../../support/know_add_mailform.php','ee','top=<?php echo $TEXT['about-top']; ?>,left=<?php echo $TEXT['about-left']; ?>,width=<?php echo $TEXT['about-width']; ?>,height=<?php echo $TEXT['about-height']; ?>,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,directories=no')" title="<?php echo $TEXT['new-tag13']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/email.png" align=middle /></a>
        <a href=# onClick="window.open('../../support/know_add_linkform.php','ee','top=<?php echo $TEXT['about-top']; ?>,left=<?php echo $TEXT['about-left']; ?>,width=<?php echo $TEXT['about-width']; ?>,height=<?php echo $TEXT['about-height']; ?>,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,directories=no')" title="<?php echo $TEXT['new-tag14']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/url.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<ul>','</ul>')" title="<?php echo $TEXT['new-tag11']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/list.png" align=middle /></a>
        <a href="javascript:inserttags('<li>','</li>')" title="<?php echo $TEXT['new-tag12']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/listelement.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('%20:smile:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/smile.png" align=middle /></a>
        <a href="javascript:inserttags('%20:tongue:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/tongue.png" align=middle /></a>
        <a href="javascript:inserttags('%20:wink:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/wink.png" align=middle /></a>
        <a href="javascript:inserttags('%20:wassat:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/wassat.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('%20:sad:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/sad.png" align=middle /></a>
        <a href="javascript:inserttags('%20:crying:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/crying.png" align=middle /></a>
        <a href="javascript:inserttags('%20:angry:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/angry.png" align=middle /></a>
        </td>
         <?php
            echo "</tr>";
            echo "<tr>";
               echo "<td width='15%' class='support22'>&nbsp;".$TEXT['meet-name']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=70 maxlength=255 type=text name=meet_name >";
               echo "</td>";
             echo "</tr>";
             echo "<tr><td width='15%' class='support22'>&nbsp;".$TEXT['meet-title2']."&#58;&nbsp;</td>";
                 echo "<td width='50%' class='support' align='left'>";
                   echo "<select class='support' name='room_id'>";
                   $query = "SELECT room_id, room_name FROM `tbl_meet_room` WHERE `room_visible` = 'yes' ORDER BY position, room_name ";
                    $tema_tmp = mysql_query($query);
                     if(!$tema_tmp) puterror($TEXT['error-tbl48']);
                      while($meet_room = mysql_fetch_array($tema_tmp,MYSQL_ASSOC))
                       {
                       $chk = "<option value=".$meet_room['room_id'].">".$meet_room['room_name']."</option>";
                       echo $chk;
                       }
                 echo "</select>";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td width='15%' class='support22'>&nbsp;".$TEXT['search-date']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=10 maxlength=10 type=text name=data >";
               ?>
                   <script type="text/javascript" language="JavaScript">
                    var o_cal = new tcal ({
                    // form name
                     'formname': 'rprt',
                      // input name
                      'controlname': 'data'
                    });
                 </script>
              <?php
              echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td width='15%' class='support22'>&nbsp;".$TEXT['meet-time1']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=2 maxlength=2 type=text name=timestart >&#58;<input class='support' size=2 maxlength=2 type=text name=timestartmin >";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td width='15%' class='support22'>&nbsp;".$TEXT['meet-time2']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=2 maxlength=2 type=text name=timestop >&#58;<input class='support' size=2 maxlength=2 type=text name=timestopmin >";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td width='30%' class='support22'>&nbsp;".$TEXT['meet-color']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><select name=color_line>
                    <option value='black' selected >".$TEXT['meet-color4']."
                    <option value='green' >".$TEXT['meet-color1']."
                    <option value='blue' >".$TEXT['meet-color2']."
                    <option value='grey' >".$TEXT['meet-color3']."
                    <option value='brown' >".$TEXT['meet-color5']."
                    <option value='red' >".$TEXT['meet-color6']."
                    <option value='yellow' >".$TEXT['meet-color7']."
                    </select>";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td width='15%' class='support22'>&nbsp;".$TEXT['meet-text']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><textarea cols='70' rows='10' name=message ></textarea>";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td width='15%' class='support22'>&nbsp;".$TEXT['meet-view']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input type=checkbox name=visible >";
               echo "</td>";
             echo "</tr>";
             echo "<tr><td width='15%' class='support22'>&nbsp;</td><td class='support' width='50%' >&nbsp;</td></tr>";
             echo "<tr>";
               echo "<td width='15%' class='support22'>&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class=button type=submit value='".$button."'></td></tr>";
             echo "</tr>";
             echo "<tr><td width='15%' class='support22'>&nbsp;</td><td class='support' width='50%' >&nbsp;";
               echo "<input type=hidden name=org_id value='".$org_id."'>";
               echo "<input type=hidden name=old_org_id value='".$org_id."'>";
               echo "</td></tr>";
          echo "</table>";
       echo "</fieldset>";
      echo "</td>";
     echo "</tr>";
     }
   if($_GET['add'] == 2)
     {
      $query_z1 = "SELECT * FROM tbl_meet_event WHERE evnt_id='".$_GET['evnt_id']."' ";
      $zayavka1 = mysql_query($query_z1);
       if(!$zayavka1) puterror($TEXT['error-tbl49']);
        if(mysql_num_rows($zayavka1) > 0)
        {
         while($zay1 = mysql_fetch_array($zayavka1,MYSQL_ASSOC))
         {
          $m_name = $zay1['meet_name'];
          $message1 = $zay1['meet_descr'];
          $c_line = $zay1['meet_color'];
          $m_data = $zay1['meet_data'];
          $s_time= $zay1['time_start'];
          $e_time = $zay1['time_stop'];
          $s_time_m= $zay1['time_start_min'];
          $e_time_m = $zay1['time_stop_min'];
          $evt_id = $zay1['evnt_id'];
          $rm_id = $zay1['room_id'];

          if($zay1['meet_visible']=='yes') $meet_vis_chk="checked";
            else $meet_vis_chk="";
         }
       }
       $user_name = "";
       $query_z2 = "SELECT
           tbl_meet_users.*,
           tbl_users.familiya,
           tbl_users.name,
           tbl_users.otchestvo,
           tbl_users.user_id
           FROM tbl_meet_users
           JOIN tbl_users ON tbl_meet_users.usr_id=tbl_users.user_id
           WHERE tbl_meet_users.evnt_id='".$_GET['evnt_id']."' ";
      $zayavka2 = mysql_query($query_z2);
       if(!$zayavka2) puterror($TEXT['error-tbl50']);
        if(mysql_num_rows($zayavka2) > 0)
        {
         while($zay2 = mysql_fetch_array($zayavka2,MYSQL_ASSOC))
         {
          $user_name .= "<a class='support24' href=# onClick=\"window.open('user.php?user_id=".$zay2['user_id']."','popup','top=".$TEXT['user-top'].",left=".$TEXT['user-left'].",width=".$TEXT['user-width'].",height=".$TEXT['user-height'].",status=no,scrollbars=no,location=no,menubar=no,toolbar=no')\" title = ".$TEXT['global-usr'].">".$zay2['familiya']." ".$zay2['name']." ".$zay2['otchestvo']."</a><br />";
          }
       }
      echo "<tr>";
      echo "<td>";
         echo "<fieldset class='zayavka' >";
         echo "<legend align='left' title=".$TEXT['support3'].">".$TEXT['support12']."</legend>";
          echo "<table align='center' border='0' width='100%' cellpadding='0' cellspacing='0'>";
             echo "<tr><td  width='15%' class='support22'>&nbsp;</td><td class='support' width='50%' align='left'>&nbsp;</td>";
             ?>
         <td align='center' width='10%' rowspan="13"><br /><br />
        <a href="javascript:inserttags('<span%20class=&quot;fntbld&quot;>','</span>')" title="<?php echo $TEXT['new-tag1']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/bold.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntit&quot;>','</span>')" title="<?php echo $TEXT['new-tag2']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/italic.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntunderline&quot;>','</span>')" title="<?php echo $TEXT['new-tag3']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/underline.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntzacherknuto&quot;>','</span>')" title="<?php echo $TEXT['new-tag4']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/linetrough.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<sup>','</sup>')" title="<?php echo $TEXT['new-tag6']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/sup.png" align=middle /></a>
        <a href="javascript:inserttags('<sub>','</sub>')" title="<?php echo $TEXT['new-tag5']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/sub.png" align=middle /></a>
        <a href="javascript:inserttags('<p>','</p>')" title="<?php echo $TEXT['new-tag7']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/paragraf.png" align=middle /></a>
        <a href="javascript:inserttags('<hr />','')" title="<?php echo $TEXT['new-tag8']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/hr.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<span%20class=&quot;buttonbkg&quot;>','</span>')" title="<?php echo $TEXT['new-tag38']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/btn.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntbldzag&quot;>','</span>')" title="<?php echo $TEXT['new-tag16'].$TEXT['new-tag17']; ?>"><img alt="font16" src="admin/img/fontsize16.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntbldzag2&quot;>','</span>')" title="<?php echo $TEXT['new-tag16'].$TEXT['new-tag18']; ?>"><img alt="font18" src="admin/img/fontsize18.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;zagolovok&quot;>','</span>')" title="<?php echo $TEXT['new-tag16'].$TEXT['new-tag19']; ?>"><img alt="font20" src="admin/img/fontsize20.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<span%20class=&quot;fntyellow&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag35']; ?>"><img alt="text-yellow" src="admin/img/textcolor-yellow.png" align=middle border=0 /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntred&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag21']; ?>"><img alt="text-red" src="admin/img/textcolor-red.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntgreen&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag22']; ?>"><img alt="text-green" src="admin/img/textcolor-green.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;fntblue&quot;>','</span>')" title="<?php echo $TEXT['new-tag20'].$TEXT['new-tag23']; ?>"><img alt="text-blue" src="admin/img/textcolor-blue.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckgreen&quot;>','</span>')" title="<?php echo $TEXT['new-tag31']; ?>"><img alt="marc-green" src="admin/img/marck-green.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckorange&quot;>','</span>')" title="<?php echo $TEXT['new-tag29']; ?>"><img alt="marc-orange" src="admin/img/marck-orange.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckyellow&quot;>','</span>')" title="<?php echo $TEXT['new-tag30']; ?>"><img alt="marc-yellow" src="admin/img/marck-yellow.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20id=&quot;marobj&quot;%20class=&quot;fntmarckgray&quot;>','</span>')" title="<?php echo $TEXT['new-tag28']; ?>"><img alt="marc-grey" src="admin/img/marck-grey.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<p%20class=&quot;console&quot;><img%20class=&quot;tipsimg&quot;%20alt=&quot;console&quot;%20src=&quot;admin/img/cmd.png&quot; />','</p>')" title="<?php echo $TEXT['new-tag24']; ?>"><img alt="console" src="admin/img/console.png" align=middle /></a>
        <a href="javascript:inserttags('<p%20class=&quot;tips&quot;><img%20class=&quot;tipsimg&quot;%20alt=&quot;tips&quot;%20src=&quot;admin/img/note.png&quot; />','</p>')" title="<?php echo $TEXT['new-tag26']; ?>"><img alt="tips" src="admin/img/tips-pic.png" align=middle /></a>
        <a href="javascript:inserttags('<p%20class=&quot;textfilecont&quot;><img%20class=&quot;tipsimg&quot;%20alt=&quot;text&quot;%20src=&quot;admin/img/text.png&quot; />','</p>')" title="<?php echo $TEXT['new-tag25']; ?>"><img alt="text" src="admin/img/text-pic.png" align=middle /></a>
        <a href="javascript:inserttags('<span%20class=&quot;tooltip&quot;>место%20для%20слова<span>то%20что%20будет%20всплывать,%20очень%20кратко','<small></small></span></span>')" title="<?php echo $TEXT['new-tag27']; ?>"><img alt="baloon" src="admin/img/note-pic.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('&ldquo;','&rdquo;')" title="<?php echo $TEXT['new-tag15']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/quote1.png" align=middle /></a>
        <a href="javascript:inserttags('&laquo;','&raquo;')" title="<?php echo $TEXT['new-tag15']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/quote2.png" align=middle /></a>
        <a href=# onClick="window.open('../../support/know_add_mailform.php','ee','top=<?php echo $TEXT['about-top']; ?>,left=<?php echo $TEXT['about-left']; ?>,width=<?php echo $TEXT['about-width']; ?>,height=<?php echo $TEXT['about-height']; ?>,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,directories=no')" title="<?php echo $TEXT['new-tag13']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/email.png" align=middle /></a>
        <a href=# onClick="window.open('../../support/know_add_linkform.php','ee','top=<?php echo $TEXT['about-top']; ?>,left=<?php echo $TEXT['about-left']; ?>,width=<?php echo $TEXT['about-width']; ?>,height=<?php echo $TEXT['about-height']; ?>,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,directories=no')" title="<?php echo $TEXT['new-tag14']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/url.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('<ul>','</ul>')" title="<?php echo $TEXT['new-tag11']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/list.png" align=middle /></a>
        <a href="javascript:inserttags('<li>','</li>')" title="<?php echo $TEXT['new-tag12']; ?>"><img alt="<?php echo $TEXT['pic']; ?>" src="admin/img/listelement.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('%20:smile:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/smile.png" align=middle /></a>
        <a href="javascript:inserttags('%20:tongue:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/tongue.png" align=middle /></a>
        <a href="javascript:inserttags('%20:wink:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/wink.png" align=middle /></a>
        <a href="javascript:inserttags('%20:wassat:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/wassat.png" align=middle /></a>
        <br />
        <a href="javascript:inserttags('%20:sad:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/sad.png" align=middle /></a>
        <a href="javascript:inserttags('%20:crying:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/crying.png" align=middle /></a>
        <a href="javascript:inserttags('%20:angry:%20','')"><img alt="<?php echo $TEXT['pic']; ?>" src="img/angry.png" align=middle /></a>
        </td><td  class='support' ><?php echo $TEXT['meet-invite2']; ?></td>
         <?php
            echo "</tr>";
            echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;".$TEXT['meet-name']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=70 maxlength=255 type=text name=meet_name value='".$m_name."' >";
               echo "</td><td  class='meetdesc'  rowspan='10'>".$user_name."</td>";
             echo "</tr>";
             echo "<tr><td  width='15%' class='support22'>&nbsp;".$TEXT['meet-title2']."&#58;&nbsp;</td>";
                 echo "<td width='50%' class='support' >";
                   echo "<select class='support' name='room_id'>";
                   $query = "SELECT room_id, room_name FROM `tbl_meet_room` WHERE `room_visible` = 'yes' ORDER BY position, room_name ";
                    $tema_tmp = mysql_query($query);
                     if(!$tema_tmp) puterror($TEXT['error-tbl48']);
                      while($meet_room = mysql_fetch_array($tema_tmp,MYSQL_ASSOC))
                       {
                        if($meet_room['room_id'] == $rm_id) $chk = "<option selected value=".$meet_room['room_id'].">".$meet_room['room_name']."</option>";
                         else $chk = "<option value=".$meet_room['room_id'].">".$meet_room['room_name']."</option>";
                       echo $chk;
                       }
                 echo "</select>";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;".$TEXT['search-date']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=10 maxlength=10 type=text name=data value='".$m_data."' >";
               ?>
                   <script type="text/javascript" language="JavaScript">
                    var o_cal = new tcal ({
                    // form name
                     'formname': 'rprt',
                      // input name
                      'controlname': 'data'
                    });
                 </script>
              <?php
              echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;".$TEXT['meet-time1']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=2 maxlength=2 type=text name=timestart value='".$s_time."' >&#58;<input class='support' size=2 maxlength=2 type=text name=timestartmin value='".$s_time_m."' >";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;".$TEXT['meet-time2']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class='support' size=2 maxlength=2 type=text name=timestop value='".$e_time."' >&#58;<input class='support' size=2 maxlength=2 type=text name=timestopmin value='".$e_time_m."' >";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;".$TEXT['meet-color']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' >";
               ?>
               <select name=color_line>
             <option value="green" <?php if($c_line == "green") echo "selected"?>><?php echo $TEXT['meet-color1']; ?>
             <option value="blue" <?php if($c_line == "blue") echo "selected"?>><?php echo $TEXT['meet-color2']; ?>
             <option value="grey" <?php if($c_line == "grey") echo "selected"?>><?php echo $TEXT['meet-color3']; ?>
             <option value="black" <?php if($c_line == "black") echo "selected"?>><?php echo $TEXT['meet-color4']; ?>
             <option value="brown" <?php if($c_line == "brown") echo "selected"?>><?php echo $TEXT['meet-color5']; ?>
             <option value="red" <?php if($c_line == "red") echo "selected"?>><?php echo $TEXT['meet-color6']; ?>
             <option value="yellow" <?php if($c_line == "yellow") echo "selected"?>><?php echo $TEXT['meet-color7']; ?>
                 </select>
        <?php
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;".$TEXT['meet-text']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><textarea cols='70' rows='10' name=message >".$message1."</textarea>";
               echo "</td>";
             echo "</tr>";
             echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;".$TEXT['meet-view']."&#58;&nbsp;</td>";
               echo "<td class='support' width='50%' ><input type=checkbox name=visible ".$meet_vis_chk.">";
               echo "</td>";
             echo "</tr>";
             echo "<tr><td  width='15%' class='support22'>&nbsp;</td><td class='support' width='50%' >&nbsp;</td></tr>";
             echo "<tr>";
               echo "<td  width='15%' class='support22'>&nbsp;</td>";
               echo "<td class='support' width='50%' ><input class=button type=submit value='".$button."'></td></tr>";
             echo "</tr>";
             echo "<tr><td  width='15%' class='support22'>&nbsp;</td><td class='support' width='50%' >&nbsp;";
               echo "<input type=hidden name=org_id value='".$org_id."'>";
               echo "<input type=hidden name=old_org_id value='".$org_id."'>";
               echo "<input type=hidden name=evnt_id value='".$evt_id."'>";
               echo "</td><td  class='support'><a href='meet_mail.php?evnt_id=".$_GET['evnt_id']."&amp;org_id=".$org_id."' title='".$TEXT['meet-invite3-tit']."' >".$TEXT['meet-invite3']."</a></td></tr>";
          echo "</table>";
       echo "</fieldset>";
      echo "</td>";
     echo "</tr>";
     }

     echo "<tr align='left'>
     <td width='100%' class='support'><br />".$TEXT['support44']."</td>
     </tr>
     <tr align='left'>
     <td width='100%' ><hr width='80%' align='left' />";

      $query_z = "SELECT
          tbl_meet_event.evnt_id,
          tbl_meet_event.room_id,
          tbl_meet_event.meet_name,
          tbl_meet_event.meet_visible,
          YEAR(tbl_meet_event.meet_data) AS meet_year,
          MONTH(tbl_meet_event.meet_data) AS meet_month,
          DAY(tbl_meet_event.meet_data) AS meet_day,
          tbl_meet_event.time_start,
          tbl_meet_event.time_stop,
          tbl_meet_event.time_start_min,
          tbl_meet_event.time_stop_min,
          tbl_meet_room.room_name
          FROM tbl_meet_event
          JOIN tbl_meet_room ON tbl_meet_room.room_id=tbl_meet_event.room_id
          $adm_date
          ORDER BY tbl_meet_event.meet_data, tbl_meet_room.room_name, tbl_meet_event.time_start";
      $zayavka = mysql_query($query_z);
       if(!$zayavka) puterror($TEXT['error-tbl49']);
        if(mysql_num_rows($zayavka) > 0)
        {
         while($zay = mysql_fetch_array($zayavka,MYSQL_ASSOC))
         {
          if($zay['meet_visible']=='yes') $meet_vis="<a href=meet_hide.php?evnt_id=".$zay['evnt_id']." title='".$TEXT['meet-hide']."'><img alt='".$TEXT['meet-hide']."' src='img/show.png' height='16' width='16' align='top' /></a>";
            else $meet_vis="<a href=meet_show.php?evnt_id=".$zay['evnt_id']." title='".$TEXT['meet-show']."'><img alt='".$TEXT['meet-show']."' src='img/hide.png' height='16' width='16' align='top' /></a>";

          $meet_del="<a href=meet_del.php?evnt_id=".$zay['evnt_id']." title='".$TEXT['meet-delete']."'><img alt='".$TEXT['meet-delete']."' src='img/drop.png' height='16' width='16' align='top' /></a>";
          $tema_full = $zay['meet_name'];
          $date_day = $zay['meet_day'];
          $date_month = $zay['meet_month'];
          $date_year = $zay['meet_year'];
          $year = $TEXT['year'];
          if($zay['meet_year'] == "" || $zay['meet_year'] == "0") $data_r = "---";
            else $data_r = $date_day." ".$month[$date_month]." ".$date_year." ".$year." (".$TEXT['meet-with'].$zay['time_start'].":".$zay['time_start_min'].$TEXT['meet-to'].$zay['time_stop'].":".$zay['time_stop_min'].")";

        echo "<a class='support_search' href='meet_otv.php?evnt_id=".$zay['evnt_id']."&amp;add=2' title='".$TEXT['support44']."'> ".$data_r.", ".$TEXT['meet-name'].": ".$tema_full.", ".$TEXT['meet-title2']." - ".$zay['room_name']."</a>&nbsp;".$meet_vis."&nbsp;".$meet_del."<hr width='80%' align='left' />";
         }
        } else echo "<span class='support_search'>".$TEXT['no-zay']."</span>";

     echo "</td>
     </tr>
     </table>
   </td>
   </tr>
</table>
</form>";

  require_once "utils/bottom_search.php";
?>