// AUTHORIZATION ON ITOGI PAGE /////////////////////////////////////////////////////////////////////////
 function setAuthorization_itogi()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if (req.readyState == 4) {
                      document.getElementById('authorizator').innerHTML = req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
              req.send( null );
          }
 } 

 function setAuthorization_itogi2()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if (req.readyState == 4) {
                      document.getElementById('authorizator').innerHTML = req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi2.php', true);
              req.send( null );
          }
 }
 function setAuthorization_media()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if (req.readyState == 4) {
                      document.getElementById('authorizator').innerHTML = req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorizationMedia.php', true);
              req.send( null );
          }
 }

 function setAuthorizationWithPurse()
 {
 /*
          if(document.getElementById('authorizator_popup')) 
          {
            if( document.getElementById('authorizator_popup').style.display == 'block' )
            {
              document.getElementById('authorizator_popup').innerHTML     = '';
              document.getElementById('authorizator_popup').style.display = 'none';
              return;            
            }
          }
          else
          {
              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if (req.readyState == 4) {
                      document.getElementById('authorizator').innerHTML = req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorizationWithPurse.php', true);
              req.send( null );
          } 
 */
 }

 function authorizationUser_itogi(USER_NAME, USER_PASSWORD)
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() {
              if(req.readyState == 4) 
              { 
                if( req.responseJS.FINISH == 1 )
                {
                    var s = location.href;
                    var re = /#[^#]*$/;
                    var result = re.test(location.href);
                    if(result)
                    {
                        s = s.replace(re, "");

                        location.href = s;
                    }

                    window.location.href = s;
                }
                else
                {
                    document.getElementById('err_USER_NAME').innerHTML = ((req.responseJS.MESS.USER_NAME)?(req.responseJS.MESS.USER_NAME):(''));
                    document.getElementById('err_USER_PASSWORD').innerHTML = ((req.responseJS.MESS.USER_PASSWORD)?(req.responseJS.MESS.USER_PASSWORD):(''));
                    if( req.responseJS.MESS.USER_CANT_LOGIN )
                      alert(req.responseJS.MESS.USER_CANT_LOGIN);                    
                }
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
          req.send( { USER_NAME: USER_NAME, USER_PASSWORD: USER_PASSWORD, activator: 'authorizationUser' } );
 }
 function exitUser_itogi()
 {  
          document.getElementById('authorizator_popup').innerHTML     = '';
          document.getElementById('authorizator_popup').style.display = 'none';

          var req = new JsHttpRequest();
          req.onreadystatechange = function() {
              if(req.readyState == 4) 
              {
                //document.getElementById('authorizator').innerHTML = req.responseText;
                window.location.href = location.href;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
          req.send( { activator: 'exitUser' } );
 }
 function showRegistrationForm_itogi()
 {
          
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              document.getElementById('authorizator_popup').style.display = 'block';

              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if(req.readyState == 4) 
                  {
                    document.getElementById('authorizator_popup').innerHTML = req.responseText+'<div style="clear:both; height:1px;"><!--BR--></div><a class="greyLinkt" style="float:right" href="javascript:closeFormPopup()">Закрыть</a>';
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
              req.send( { navigator: 'registrationForm' } );
          }
 }
/* function registrationUser_itogi()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() {
              if(req.readyState == 4) 
              {
                if( req.responseJS.FINISH == 0 )                  
                {
                    document.getElementById('err_REG_USER_BIRTHDAY'   ).innerHTML = ((req.responseJS.MESS.REG_USER_BIRTHDAY   )?(req.responseJS.MESS.REG_USER_BIRTHDAY   ):(''));
                    document.getElementById('err_REG_USER_LOGIN'      ).innerHTML = ((req.responseJS.MESS.REG_USER_LOGIN      )?(req.responseJS.MESS.REG_USER_LOGIN      ):(''));
                    document.getElementById('err_REG_USER_PASSWORD'   ).innerHTML = ((req.responseJS.MESS.REG_USER_PASSWORD   )?(req.responseJS.MESS.REG_USER_PASSWORD   ):(''));
                    document.getElementById('err_REG_USER_PASSWORD2'  ).innerHTML = ((req.responseJS.MESS.REG_USER_PASSWORD2  )?(req.responseJS.MESS.REG_USER_PASSWORD2  ):(''));
                    document.getElementById('err_REG_USER_FIRST_NAME' ).innerHTML = ((req.responseJS.MESS.REG_USER_FIRST_NAME )?(req.responseJS.MESS.REG_USER_FIRST_NAME ):(''));
                    document.getElementById('err_REG_USER_LAST_NAME'  ).innerHTML = ((req.responseJS.MESS.REG_USER_LAST_NAME  )?(req.responseJS.MESS.REG_USER_LAST_NAME  ):(''));
                    document.getElementById('err_REG_USER_EMAIL'      ).innerHTML = ((req.responseJS.MESS.REG_USER_EMAIL      )?(req.responseJS.MESS.REG_USER_EMAIL      ):(''));
                    document.getElementById('err_REG_USER_COMPANY'    ).innerHTML = ((req.responseJS.MESS.REG_USER_COMPANY    )?(req.responseJS.MESS.REG_USER_COMPANY    ):(''));
                    document.getElementById('err_REG_USER_SPECIALITY' ).innerHTML = ((req.responseJS.MESS.REG_USER_SPECIALITY )?(req.responseJS.MESS.REG_USER_SPECIALITY ):(''));
                    document.getElementById('err_REG_USER_FILE'       ).innerHTML = ((req.responseJS.MESS.REG_USER_FILE       )?(req.responseJS.MESS.REG_USER_FILE       ):(''));
                    document.getElementById('err_REG_USER_SEX'        ).innerHTML = ((req.responseJS.MESS.REG_USER_SEX        )?(req.responseJS.MESS.REG_USER_SEX        ):(''));
                    document.getElementById('err_REG_USER_COUNTRY'    ).innerHTML = ((req.responseJS.MESS.REG_USER_COUNTRY    )?(req.responseJS.MESS.REG_USER_COUNTRY    ):(''));
                    document.getElementById('err_REG_USER_CITY'       ).innerHTML = ((req.responseJS.MESS.REG_USER_CITY       )?(req.responseJS.MESS.REG_USER_CITY       ):(''));
                }
                else
                {
                    closeFormPopup()            ;
                    alert(req.responseJS.FINISH);
                }
              }
          }

          var SEX;
          if( document.REG_USERS.REG_USER_SEX[0].checked )
            SEX = document.REG_USERS.REG_USER_SEX[0].value;
          else
              if( document.REG_USERS.REG_USER_SEX[1].checked )
                SEX = document.REG_USERS.REG_USER_SEX[1].value;

          req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
          req.send( {  
                      REG_USER_BIRTHDAY    : document.getElementById('REG_USER_BIRTHDAY'   ).value ,
                      REG_USER_LOGIN       : document.getElementById('REG_USER_LOGIN'      ).value ,
                      REG_USER_PASSWORD    : document.getElementById('REG_USER_PASSWORD'   ).value ,
                      REG_USER_PASSWORD2   : document.getElementById('REG_USER_PASSWORD2'  ).value ,
                      REG_USER_FIRST_NAME  : document.getElementById('REG_USER_FIRST_NAME' ).value ,
                      REG_USER_LAST_NAME   : document.getElementById('REG_USER_LAST_NAME'  ).value ,
                      REG_USER_EMAIL       : document.getElementById('REG_USER_EMAIL'      ).value ,
                      REG_USER_COMPANY     : document.getElementById('REG_USER_COMPANY'    ).value ,
                      REG_USER_SPECIALITY  : document.getElementById('REG_USER_SPECIALITY' ).value ,
                      REG_USER_FILE        : document.getElementById('REG_USER_FILE')              ,
                      REG_USER_SEX         : SEX                                                   ,
                      REG_USER_COUNTRY     : document.getElementById('REG_USER_COUNTRY').value     ,
                      REG_USER_CITY        : document.getElementById('REG_USER_CITY').value        ,
                      activator            : 'registrationUser'
                    } );
 }*/


function getRadioGroupValue(radioGroupObj)
{                
     for (var i=0; i < radioGroupObj.length; i++)
       if (radioGroupObj[i].checked) return radioGroupObj[i].value;
                 
     return null;        
}



function registrationUser_itogi()
{
         document.getElementById('register_result').innerHTML = '';
         
         login        = document.getElementById('REG_USER_LOGIN').value;
         email        = document.getElementById('REG_USER_EMAIL').value;
         firstname    = document.getElementById('REG_USER_FIRST_NAME').value;
         lastname     = document.getElementById('REG_USER_LAST_NAME').value;
         sex          = getRadioGroupValue(document.REG_USERS.REG_USER_SEX);
         
         var req = new JsHttpRequest();
         req.onreadystatechange = function()
         {
             if(req.readyState == 4)             
             {
               if(req.responseJS.ok == 0)
               {
                 document.getElementById('register_result').innerHTML = req.responseJS.error;
                 return;
               }
               else
               {
                 document.getElementById('REG_USER_LOGIN').value = '';
                 document.getElementById('REG_USER_EMAIL').value = '';
                 document.getElementById('REG_USER_FIRST_NAME').value = '';
                 document.getElementById('REG_USER_LAST_NAME').value = '';

                 document.getElementById('register_result').innerHTML = req.responseText;

               }
             }
         }
         req.open('POST', '/ajax/authorization/register_via_email.php', true);
         req.send( { login       :login       ,
                     email       :email       ,
                     firstname   :firstname   ,
                     lastname    :lastname    ,
                     sex         :sex         
                 } );                                                             
}


 function showProfileForm2()
 {

          document.getElementById('authorizator_popup').style.display = 'block';
          document.getElementById('authorizator_popup').innerHTML = '<div style="color:white; background:#396391; padding:3px; font-weight:bold; font-size:10px;"><a style="font-weight:bold; float:right; color:white; text-decoration:none;" href="javascript:closeFormPopup()">X</a>Редактирование профайла</div>';

 }

 function showProfileForm_itogi()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              document.getElementById('authorizator_popup').style.display = 'block';
              document.getElementById('authorizator_popup').innerHTML = '<div style="color:white; background:#396391; padding:3px; font-weight:bold; font-size:10px;"><a style="font-weight:bold; float:right; color:white; text-decoration:none;" href="javascript:closeFormPopup()">X</a>Редактирование профайла</div>';

              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if(req.readyState == 4) 
                  {
                    document.getElementById('authorizator_popup').innerHTML += req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
              req.send( { navigator: 'profileForm' } );
          }
 }

 function saveProfileUser_itogi()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                if( req.responseJS.FINISH == 0 )                  
                {
                    document.getElementById('err_PROFILE_USER_BIRTHDAY'   ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_BIRTHDAY   )?(req.responseJS.MESS.PROFILE_USER_BIRTHDAY   ):(''));
                    document.getElementById('err_PROFILE_USER_LOGIN'      ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_LOGIN      )?(req.responseJS.MESS.PROFILE_USER_LOGIN      ):(''));
                    document.getElementById('err_PROFILE_USER_FIRST_NAME' ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_FIRST_NAME )?(req.responseJS.MESS.PROFILE_USER_FIRST_NAME ):(''));
                    document.getElementById('err_PROFILE_USER_LAST_NAME'  ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_LAST_NAME  )?(req.responseJS.MESS.PROFILE_USER_LAST_NAME  ):(''));
                    document.getElementById('err_PROFILE_USER_EMAIL'      ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_EMAIL      )?(req.responseJS.MESS.PROFILE_USER_EMAIL      ):(''));
                    document.getElementById('err_PROFILE_USER_COMPANY'    ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_COMPANY    )?(req.responseJS.MESS.PROFILE_USER_COMPANY    ):(''));
                    document.getElementById('err_PROFILE_USER_SPECIALITY' ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_SPECIALITY )?(req.responseJS.MESS.PROFILE_USER_SPECIALITY ):(''));
                    document.getElementById('err_PROFILE_USER_FILE'       ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_FILE       )?(req.responseJS.MESS.PROFILE_USER_FILE       ):(''));
                    document.getElementById('err_PROFILE_USER_SEX'        ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_SEX        )?(req.responseJS.MESS.PROFILE_USER_SEX        ):(''));
                    document.getElementById('err_REG_USER_COUNTRY'        ).innerHTML = ((req.responseJS.MESS.REG_USER_COUNTRY        )?(req.responseJS.MESS.REG_USER_COUNTRY        ):(''));
                    document.getElementById('err_REG_USER_CITY'           ).innerHTML = ((req.responseJS.MESS.REG_USER_CITY           )?(req.responseJS.MESS.REG_USER_CITY           ):(''));
                }
                else
                {
                    setAuthorization()           ;
                    closeFormPopup()             ;
                    alert(req.responseJS.FINISH) ;
                }
              }
          }

          var SEX;
          if( document.PROFILE_USERS.PROFILE_USER_SEX[0].checked )
            SEX = document.PROFILE_USERS.PROFILE_USER_SEX[0].value;
          else
              if( document.PROFILE_USERS.PROFILE_USER_SEX[1].checked )
                SEX = document.PROFILE_USERS.PROFILE_USER_SEX[1].value;

          req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
          req.send( { PROFILE_USER_BIRTHDAY    : document.getElementById('PROFILE_USER_BIRTHDAY'   ).value ,
                      PROFILE_USER_LOGIN       : document.getElementById('PROFILE_USER_LOGIN'      ).value ,
                      PROFILE_USER_FIRST_NAME  : document.getElementById('PROFILE_USER_FIRST_NAME' ).value ,
                      PROFILE_USER_LAST_NAME   : document.getElementById('PROFILE_USER_LAST_NAME'  ).value ,
                      PROFILE_USER_EMAIL       : document.getElementById('PROFILE_USER_EMAIL'      ).value ,
                      PROFILE_USER_COMPANY     : document.getElementById('PROFILE_USER_COMPANY'    ).value ,
                      PROFILE_USER_SPECIALITY  : document.getElementById('PROFILE_USER_SPECIALITY' ).value ,
                      PROFILE_USER_FILE        : document.getElementById('PROFILE_USER_FILE')              ,
                      PROFILE_USER_SEX         : SEX                                                       ,
                      REG_USER_COUNTRY         : document.getElementById('REG_USER_COUNTRY').value         ,
                      REG_USER_CITY            : document.getElementById('REG_USER_CITY').value            ,
                      activator                : 'saveProfile'
                    } );
 }
 function changeProfilePassword_itogi()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                if( req.responseJS.FINISH == 0 )                  
                {
                    document.getElementById('err_PROFILE_USER_PASSWORD').innerHTML = ((req.responseJS.MESS.PROFILE_USER_PASSWORD)?(req.responseJS.MESS.PROFILE_USER_PASSWORD):(''));
                    document.getElementById('err_PROFILE_USER_PASSWORD2' ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_PASSWORD2)?(req.responseJS.MESS.PROFILE_USER_PASSWORD2):(''));
                }
                else
                {
                    closeFormPopup()             ;
                    alert(req.responseJS.FINISH) ;
                }
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
          req.send( {  
                      PROFILE_USER_PASSWORD    : document.getElementById('PROFILE_USER_PASSWORD').value ,
                      PROFILE_USER_PASSWORD2   : document.getElementById('PROFILE_USER_PASSWORD2').value ,
                      activator                : 'changePassword'
                    } );
 }
 function rememberPasswordForm_itogi()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              document.getElementById('authorizator_popup').style.display = 'block';

              var req = new JsHttpRequest();
              req.onreadystatechange = function() 
              {
                  if(req.readyState == 4) 
                  {
                    document.getElementById('authorizator_popup').innerHTML = req.responseText+'<div style="clear:both; height:1px;"><!--BR--></div><a class="greyLinkt" style="float:right" href="javascript:closeFormPopup()">Закрыть</a>';
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxRememberPasswordItogi.php', true);
              req.send( null );
          }
 }
 function rememberPassword_itogi(EMAIL)
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                if( req.responseJS.COMPLITE != 0 )
                {                                    
                  document.getElementById('authorizator_popup').innerHTML  = '<div style="color:white; background:#396391; padding:1px; font-weight:bold; font-size:10px;"><a style="font-weight:bold; float:right; color:white; text-decoration:none;" href="javascript:closeFormPopup()">X</a>Напоминание пароля</div>';
                  document.getElementById('authorizator_popup').innerHTML += '<div style="text-align:center; padding:3px">'+req.responseJS.COMPLITE+'</div>';
                }
                else
                {
                    if( req.responseJS.ERR )
                      document.getElementById('err_REMEMBER_EMAIL').innerHTML = ((req.responseJS.ERR)?(req.responseJS.ERR):(''));
                }
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxAuthorizationItogi.php', true);
          req.send( { Email: EMAIL } );
 } 


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
 
 
 
 
 
 function setAuthorization()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if (req.readyState == 4) {
                      document.getElementById('authorizator').innerHTML = req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
              req.send( null );
          }
 } 
 function authorizationUser(USER_NAME, USER_PASSWORD)
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() {
              if(req.readyState == 4) 
              { 
                if( req.responseJS.FINISH == 1 )
                  window.location.href = location.href;
                else
                {
                    document.getElementById('err_USER_NAME').innerHTML = ((req.responseJS.MESS.USER_NAME)?(req.responseJS.MESS.USER_NAME):(''));
                    document.getElementById('err_USER_PASSWORD').innerHTML = ((req.responseJS.MESS.USER_PASSWORD)?(req.responseJS.MESS.USER_PASSWORD):(''));
                    if( req.responseJS.MESS.USER_CANT_LOGIN )
                      alert(req.responseJS.MESS.USER_CANT_LOGIN);                    
                }
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
          req.send( { USER_NAME: USER_NAME, USER_PASSWORD: USER_PASSWORD, activator: 'authorizationUser' } );
 }
 function exitUser()
 {  
          document.getElementById('authorizator_popup').innerHTML     = '';
          document.getElementById('authorizator_popup').style.display = 'none';

          var req = new JsHttpRequest();
          req.onreadystatechange = function() {
              if(req.readyState == 4) 
              {
                document.getElementById('authorizator').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
          req.send( { activator: 'exitUser' } );
 }
 function showRegistrationForm()
 {
          
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              document.getElementById('authorizator_popup').style.display = 'block';
              document.getElementById('authorizator_popup').innerHTML = '<div style="color:white; background:#396391; padding:3px; font-weight:bold; font-size:10px;"><a style="font-weight:bold; float:right; color:white; text-decoration:none;" href="javascript:closeFormPopup()">X</a>Регистрация за 2 секунды</div>';

              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if(req.readyState == 4) 
                  {
                    document.getElementById('authorizator_popup').innerHTML += req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
              req.send( { navigator: 'registrationForm' } );
          }
 }
 function registrationUser()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() {
              if(req.readyState == 4) 
              {
                if( req.responseJS.FINISH == 0 )                  
                {
                    document.getElementById('err_REG_USER_BIRTHDAY'   ).innerHTML = ((req.responseJS.MESS.REG_USER_BIRTHDAY   )?(req.responseJS.MESS.REG_USER_BIRTHDAY   ):(''));
                    document.getElementById('err_REG_USER_LOGIN'      ).innerHTML = ((req.responseJS.MESS.REG_USER_LOGIN      )?(req.responseJS.MESS.REG_USER_LOGIN      ):(''));
                    document.getElementById('err_REG_USER_PASSWORD'   ).innerHTML = ((req.responseJS.MESS.REG_USER_PASSWORD   )?(req.responseJS.MESS.REG_USER_PASSWORD   ):(''));
                    document.getElementById('err_REG_USER_PASSWORD2'  ).innerHTML = ((req.responseJS.MESS.REG_USER_PASSWORD2  )?(req.responseJS.MESS.REG_USER_PASSWORD2  ):(''));
                    document.getElementById('err_REG_USER_FIRST_NAME' ).innerHTML = ((req.responseJS.MESS.REG_USER_FIRST_NAME )?(req.responseJS.MESS.REG_USER_FIRST_NAME ):(''));
                    document.getElementById('err_REG_USER_LAST_NAME'  ).innerHTML = ((req.responseJS.MESS.REG_USER_LAST_NAME  )?(req.responseJS.MESS.REG_USER_LAST_NAME  ):(''));
                    document.getElementById('err_REG_USER_EMAIL'      ).innerHTML = ((req.responseJS.MESS.REG_USER_EMAIL      )?(req.responseJS.MESS.REG_USER_EMAIL      ):(''));
                    document.getElementById('err_REG_USER_COMPANY'    ).innerHTML = ((req.responseJS.MESS.REG_USER_COMPANY    )?(req.responseJS.MESS.REG_USER_COMPANY    ):(''));
                    document.getElementById('err_REG_USER_SPECIALITY' ).innerHTML = ((req.responseJS.MESS.REG_USER_SPECIALITY )?(req.responseJS.MESS.REG_USER_SPECIALITY ):(''));
                    document.getElementById('err_REG_USER_FILE'       ).innerHTML = ((req.responseJS.MESS.REG_USER_FILE       )?(req.responseJS.MESS.REG_USER_FILE       ):(''));
                    document.getElementById('err_REG_USER_SEX'        ).innerHTML = ((req.responseJS.MESS.REG_USER_SEX        )?(req.responseJS.MESS.REG_USER_SEX        ):(''));
                    document.getElementById('err_REG_USER_COUNTRY'    ).innerHTML = ((req.responseJS.MESS.REG_USER_COUNTRY    )?(req.responseJS.MESS.REG_USER_COUNTRY    ):(''));
                    document.getElementById('err_REG_USER_CITY'       ).innerHTML = ((req.responseJS.MESS.REG_USER_CITY       )?(req.responseJS.MESS.REG_USER_CITY       ):(''));
                    document.getElementById('err_REG_USER_SITE'       ).innerHTML = ((req.responseJS.MESS.REG_USER_SITE       )?(req.responseJS.MESS.REG_USER_SITE       ):(''));
                    document.getElementById('err_REG_USER_VKONTAKTE'  ).innerHTML = ((req.responseJS.MESS.REG_USER_VKONTAKTE  )?(req.responseJS.MESS.REG_USER_VKONTAKTE  ):(''));
                }
                else
                {
                    closeFormPopup()            ;
                    alert(req.responseJS.FINISH);
                }
              }
          }

          var SEX;
          if( document.REG_USERS.REG_USER_SEX[0].checked )
            SEX = document.REG_USERS.REG_USER_SEX[0].value;
          else
              if( document.REG_USERS.REG_USER_SEX[1].checked )
                SEX = document.REG_USERS.REG_USER_SEX[1].value;

          req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
          req.send( {  
                      REG_USER_BIRTHDAY    : document.getElementById('REG_USER_BIRTHDAY'   ).value ,
                      REG_USER_LOGIN       : document.getElementById('REG_USER_LOGIN'      ).value ,
                      REG_USER_PASSWORD    : document.getElementById('REG_USER_PASSWORD'   ).value ,
                      REG_USER_PASSWORD2   : document.getElementById('REG_USER_PASSWORD2'  ).value ,
                      REG_USER_FIRST_NAME  : document.getElementById('REG_USER_FIRST_NAME' ).value ,
                      REG_USER_LAST_NAME   : document.getElementById('REG_USER_LAST_NAME'  ).value ,
                      REG_USER_EMAIL       : document.getElementById('REG_USER_EMAIL'      ).value ,
                      REG_USER_COMPANY     : document.getElementById('REG_USER_COMPANY'    ).value ,
                      REG_USER_SPECIALITY  : document.getElementById('REG_USER_SPECIALITY' ).value ,
                      REG_USER_FILE        : document.getElementById('REG_USER_FILE')              ,
                      REG_USER_SEX         : SEX                                                   ,
                      REG_USER_COUNTRY     : document.getElementById('REG_USER_COUNTRY').value     ,
                      REG_USER_CITY        : document.getElementById('REG_USER_CITY').value        ,
                      REG_USER_SITE        : document.getElementById('REG_USER_SITE').value        ,
                      REG_USER_VKONTAKTE   : document.getElementById('REG_USER_VKONTAKTE').value   ,
                      activator            : 'registrationUser'
                    } );
 }

 function showProfileForm()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              document.getElementById('authorizator_popup').style.display = 'block';
              // document.getElementById('authorizator_popup').innerHTML = '<div style="color:white; background:#396391; padding:3px; font-weight:bold; font-size:10px;"><a style="font-weight:bold; float:right; color:white; text-decoration:none;" href="javascript:closeFormPopup()">X</a>Редактирование профайла</div>';

              var req = new JsHttpRequest();
              req.onreadystatechange = function() {
                  if(req.readyState == 4) 
                  {
                    document.getElementById('authorizator_popup').innerHTML = req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
              req.send( { navigator: 'profileForm' } );
          }
 }
 
 function saveProfileUser()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                if( req.responseJS.FINISH == 0 )                  
                {
                    document.getElementById('err_PROFILE_USER_BIRTHDAY'   ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_BIRTHDAY   )?(req.responseJS.MESS.PROFILE_USER_BIRTHDAY   ):(''));
                    document.getElementById('err_PROFILE_USER_LOGIN'      ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_LOGIN      )?(req.responseJS.MESS.PROFILE_USER_LOGIN      ):(''));
                    document.getElementById('err_PROFILE_USER_FIRST_NAME' ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_FIRST_NAME )?(req.responseJS.MESS.PROFILE_USER_FIRST_NAME ):(''));
                    document.getElementById('err_PROFILE_USER_LAST_NAME'  ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_LAST_NAME  )?(req.responseJS.MESS.PROFILE_USER_LAST_NAME  ):(''));
                    document.getElementById('err_PROFILE_USER_EMAIL'      ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_EMAIL      )?(req.responseJS.MESS.PROFILE_USER_EMAIL      ):(''));
                    document.getElementById('err_PROFILE_USER_COMPANY'    ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_COMPANY    )?(req.responseJS.MESS.PROFILE_USER_COMPANY    ):(''));
                    document.getElementById('err_PROFILE_USER_SPECIALITY' ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_SPECIALITY )?(req.responseJS.MESS.PROFILE_USER_SPECIALITY ):(''));
                    document.getElementById('err_PROFILE_USER_FILE'       ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_FILE       )?(req.responseJS.MESS.PROFILE_USER_FILE       ):(''));
                    document.getElementById('err_PROFILE_USER_SEX'        ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_SEX        )?(req.responseJS.MESS.PROFILE_USER_SEX        ):(''));
                    document.getElementById('err_REG_USER_COUNTRY'        ).innerHTML = ((req.responseJS.MESS.REG_USER_COUNTRY        )?(req.responseJS.MESS.REG_USER_COUNTRY        ):(''));
                    document.getElementById('err_REG_USER_CITY'           ).innerHTML = ((req.responseJS.MESS.REG_USER_CITY           )?(req.responseJS.MESS.REG_USER_CITY           ):(''));
                    document.getElementById('err_REG_USER_SITE'       ).innerHTML = ((req.responseJS.MESS.REG_USER_SITE       )?(req.responseJS.MESS.REG_USER_SITE       ):(''));
                    document.getElementById('err_REG_USER_VKONTAKTE'  ).innerHTML = ((req.responseJS.MESS.REG_USER_VKONTAKTE  )?(req.responseJS.MESS.REG_USER_VKONTAKTE  ):(''));
                }
                else
                {
                    setAuthorization()           ;
                    closeFormPopup()             ;
                    alert(req.responseJS.FINISH) ;
                }
              }
          }

          var SEX;
          if( document.PROFILE_USERS.PROFILE_USER_SEX[0].checked )
            SEX = document.PROFILE_USERS.PROFILE_USER_SEX[0].value;
          else
              if( document.PROFILE_USERS.PROFILE_USER_SEX[1].checked )
                SEX = document.PROFILE_USERS.PROFILE_USER_SEX[1].value;

          req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
          req.send( { PROFILE_USER_BIRTHDAY    : document.getElementById('PROFILE_USER_BIRTHDAY'   ).value ,
                      PROFILE_USER_LOGIN       : document.getElementById('PROFILE_USER_LOGIN'      ).value ,
                      PROFILE_USER_FIRST_NAME  : document.getElementById('PROFILE_USER_FIRST_NAME' ).value ,
                      PROFILE_USER_LAST_NAME   : document.getElementById('PROFILE_USER_LAST_NAME'  ).value ,
                      PROFILE_USER_EMAIL       : document.getElementById('PROFILE_USER_EMAIL'      ).value ,
                      PROFILE_USER_COMPANY     : document.getElementById('PROFILE_USER_COMPANY'    ).value ,
                      PROFILE_USER_SPECIALITY  : document.getElementById('PROFILE_USER_SPECIALITY' ).value ,
                      PROFILE_USER_FILE        : document.getElementById('PROFILE_USER_FILE')              ,
                      PROFILE_USER_SEX         : SEX                                                       ,
                      REG_USER_COUNTRY         : document.getElementById('REG_USER_COUNTRY').value         ,
                      REG_USER_CITY            : document.getElementById('REG_USER_CITY').value            ,
                      REG_USER_SITE        : document.getElementById('REG_USER_SITE').value        ,
                      REG_USER_VKONTAKTE   : document.getElementById('REG_USER_VKONTAKTE').value   ,
                      activator                : 'saveProfile'
                    } );
 }
 function changeProfilePassword()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                if( req.responseJS.FINISH == 0 )                  
                {
                    document.getElementById('err_PROFILE_USER_PASSWORD').innerHTML = ((req.responseJS.MESS.PROFILE_USER_PASSWORD)?(req.responseJS.MESS.PROFILE_USER_PASSWORD):(''));
                    document.getElementById('err_PROFILE_USER_PASSWORD2' ).innerHTML = ((req.responseJS.MESS.PROFILE_USER_PASSWORD2)?(req.responseJS.MESS.PROFILE_USER_PASSWORD2):(''));
                }
                else
                {
                    closeFormPopup()             ;
                    alert(req.responseJS.FINISH) ;
                }
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxAuthorization.php', true);
          req.send( {  
                      PROFILE_USER_PASSWORD    : document.getElementById('PROFILE_USER_PASSWORD').value ,
                      PROFILE_USER_PASSWORD2   : document.getElementById('PROFILE_USER_PASSWORD2').value ,
                      activator                : 'changePassword'
                    } );
 }
 function rememberPasswordForm()
 {
          if( document.getElementById('authorizator_popup').style.display == 'block' )
          {
            document.getElementById('authorizator_popup').innerHTML     = '';
            document.getElementById('authorizator_popup').style.display = 'none';
            return;            
          }
          else
          {
              document.getElementById('authorizator_popup').style.display = 'block';
              document.getElementById('authorizator_popup').innerHTML = '<div style="color:white; background:#396391; padding:1px; font-weight:bold; font-size:10px;"><a style="font-weight:bold; float:right; color:white; text-decoration:none;" href="javascript:closeFormPopup()">X</a>Напоминание пароля</div>';

              var req = new JsHttpRequest();
              req.onreadystatechange = function() 
              {
                  if(req.readyState == 4) 
                  {
                    document.getElementById('authorizator_popup').innerHTML += req.responseText;
                  }
              }

              req.open('POST', '/ajax/mainPage/ajaxRememberPassword.php', true);
              req.send( null );
          }
 }
 function rememberPassword(EMAIL)
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                if( req.responseJS.COMPLITE != 0 )
                {                                    
                  document.getElementById('authorizator_popup').innerHTML  = '<div style="color:white; background:#396391; padding:1px; font-weight:bold; font-size:10px;"><a style="font-weight:bold; float:right; color:white; text-decoration:none;" href="javascript:closeFormPopup()">X</a>Напоминание пароля</div>';
                  document.getElementById('authorizator_popup').innerHTML += '<div style="text-align:center; padding:3px">'+req.responseJS.COMPLITE+'</div>';
                }
                else
                {
                    if( req.responseJS.ERR )
                      document.getElementById('err_REMEMBER_EMAIL').innerHTML = ((req.responseJS.ERR)?(req.responseJS.ERR):(''));
                }
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxRememberPassword.php', true);
          req.send( { Email: EMAIL } );
 }
 
 
 
 
 
 
 
 
 function setBlackPanel()
 { 
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                document.getElementById('blackPanelPlace').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxBlackPanel.php', true);
          req.send( null );
 }
 function setSearcherForm()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                document.getElementById('searchPlace').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxSearcher.php', true);
          req.send( null );
 }
 function setSostavSubscribeForm()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                document.getElementById('sostavSubscribeForm').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxSostavSubscribeForm.php', true);
          req.send( null );
 }
 function setInformerGlossary()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function(){
              if(req.readyState == 4) 
                document.getElementById('informerGlossary').innerHTML = req.responseText;
          }

          req.open('POST', '/ajax/mainPage/ajaxInformerGlossary.php', true);
          req.send( null );
 }
 function setInformerForum()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                document.getElementById('informerForum').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxInformerForum.php', true);
          req.send( null );
 }
 function setInformerTender()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                document.getElementById('informerTender').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxInformerTender.php', true);
          req.send( null );
 } 
 function setInformerJob()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                document.getElementById('informerJob').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxInformerJob.php', true);
          req.send( null );
 } 
 function setInformerRedTram()
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                document.getElementById('informerRedTram').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/news/ajaxRedTramMaiPage.php', true);
          req.send( null );
 } 

 function searchSinchrone()
 {

       if(sForm.action == '/prints/')
       {
         sForm.INDEX_DATA.value=sForm.q.value;
         sForm.atext.value='';
       }

       if(sForm.action=='/movies/')
       {
         sForm.atext.value=sForm.q.value;
         sForm.INDEX_DATA.value='';       
       }

       return true;
 } 

 function pressSearchTab2(id)
 {

          for(i = 1; i <= 4; i++)
          {
            name = 'ts' + i;
            document.getElementById(name).className = 'searchButOut';
          }

          id.className = 'searchButOver';

          if(id.id == 'ts1')
          {
            sForm.action = '/search/';
          }

          if(id.id == 'ts2')
          {
            sForm.action='/movies/';
            sForm.atext.value=sForm.q.value;
          }

          if(id.id == 'ts3')
          {
            sForm.action='/prints/';
            sForm.INDEX_DATA.value=sForm.q.value; 
          }
          
          
          if(id.id == 'ts4')
          {
            sForm.action='/blogs/search/';
          }

 }

 function pressSearchTab(id)
 {
          if( document.getElementById('searchTypeLink_text') )
            document.getElementById('searchTypeLink_text').className   = 'searchTypeLinks';

          if( document.getElementById('searchTypeLink_prints') )
            document.getElementById('searchTypeLink_prints').className = 'searchTypeLinks';

          if( document.getElementById('searchTypeLink_video') )
            document.getElementById('searchTypeLink_video').className  = 'searchTypeLinks';

          if( document.getElementById('searchTypeLink_blogs') )
            document.getElementById('searchTypeLink_blogs').className  = 'searchTypeLinks';
          
          if( document.getElementById(id) )
            document.getElementById(id).className  = 'searchTypeLinksOn';

          if(id == 'searchTypeLink_text')
          {
            sForm.action = '/search/';
          }

          if(id == 'searchTypeLink_prints')
          {
            sForm.action='/prints/';
            sForm.INDEX_DATA.value=sForm.q.value; 
          }
          
          if(id == 'searchTypeLink_video')
          {
            sForm.action='/movies/';
            sForm.atext.value=sForm.q.value;
          }
          
          if(id == 'searchTypeLink_blogs')
          {
            sForm.action='/blogs/search/';
          }
 }
 function closeFormPopup()
 {
          document.getElementById('authorizator_popup').innerHTML = '';
          document.getElementById('authorizator_popup').style.display = 'none';
 }
 function setCalendar(year, month, day)
 {
          if( year == startYear && month == startMonth && !day )
            day = startDay;

          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if (req.readyState == 4) 
              {
                  document.getElementById('calendarArea').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxCalendar.php', true);
          req.send( { day: day, month: month, year: year } );
 }



 function setSubnavigation(IDSUBNAV)
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) {
                document.getElementById('subnavigationPlace').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/mainPage/ajaxSubnavigation.php', true);
          req.send( { IDSUBNAV: IDSUBNAV } ); 
 }

 function activateVideo(activator)
 {
          var req = new JsHttpRequest();
          req.onreadystatechange = function() 
          {
              if(req.readyState == 4) 
              {
                if( activator == 'activateVideo' )
                {
                  alert('Видео активировано!');
                  document.getElementById('activateVideoArea').innerHTML = req.responseText;
                }
                else
                    document.getElementById('activateVideoArea').innerHTML = req.responseText;
              }
          }

          req.open('POST', '/ajax/admin/ajaxVideoActivate.php', true);
          req.send( { activator: activator } ); 
 }
function votePerPost(id,year,voiceType)
{
         eventOverOutVoteNull(id);
         var req = new JsHttpRequest();
         req.onreadystatechange = function() 
         {
             if(req.readyState == 4) 
               document.getElementById('postVote_'+id).innerHTML = req.responseText;                 
         }

         req.open('POST', '/ajax/postsVoting.php', true);
         req.send( {id:id, year:year, voiceType:voiceType});

}
 
function eventOverOutVoteNull(U)
{         
         id = document.getElementById('postVote_' + U);
         idVote = document.getElementById('postVote_' + U + '_vote');
         UID = document.getElementById(U);

         idVote.style.display = 'none';
         id.style.display = 'block';

         UID.onmouseout = 'null';
         UID.onmouseover = 'null';
}


////// PayPosts

function deletePost()
{
         if(!confirm('Удалить это сообщение?'))
           return;

         year      = document.getElementById('year').value;
         
         post_id   = document.getElementById('post_id').value;

         var req = new JsHttpRequest();

         req.onreadystatechange = function() 
         {
             if (req.readyState == 4) 
             {
                 document.getElementById(name).innerHTML = req.responseText; // req.responseJS.content;

                 name = 'buyEditPostDivArea_' + post_id;
                 document.getElementById(name).innerHTML = '<a href="javascript: openEditPostDiv(' + year + ', ' + post_id + ', false); window.location.href = window.location.href;" style="font-size: 11px; background: #eaeaea; padding: 3px 5px 5px 5px;"><span id="buyEditPostDivLinkTitle_' + post_id + '" style="font-size: 11px;">закрыть</span></a>';
             }
         }

         req.open('POST', '/ajax/news/ajaxNewsPostsEdit.php', true);

         req.send( { 
                     activator: 'deletePost', 
                     year : year, 
                     post_id : post_id  
                   } );

}

function openEditPostDiv(year, post_id, reload)
{
         name = 'buyEditPostDiv_' + post_id;

         link_title = 'buyEditPostDivLinkTitle_' + post_id;

         if(document.getElementById(name).style.display == 'block')
         {
            document.getElementById(name).style.display = 'none';
            document.getElementById(link_title).innerHTML = 'редактировать';
            return;
         }

         document.getElementById(name).style.display = 'block';

         var req = new JsHttpRequest();
         req.onreadystatechange = function() {
             if (req.readyState == 4) {
                 document.getElementById(name).innerHTML = req.responseText; // req.responseJS.content;
                 document.getElementById(link_title).innerHTML = 'закрыть';
             }
         }

         req.open('POST', '/ajax/news/ajaxNewsPostsEdit.php', true);

         req.send( { year : year, post_id : post_id } );

         // loading_showPosts_with_edit();
}

function sendEditPostPayment()
{
         year      = document.getElementById('year').value;
         post_id   = document.getElementById('post_id').value;

         activator = 'payPost';

         name = 'buyEditPostDiv_' + post_id;

         var req = new JsHttpRequest();

         req.onreadystatechange = function() 
         {
             if (req.readyState == 4) 
             {
                 document.getElementById(name).innerHTML = req.responseText; //req.responseJS.content;
             }
         }

         req.open('POST', '/ajax/news/ajaxNewsPostsEdit.php', true);

         req.send( { activator: activator, year : year, post_id : post_id } );
}

function sendEditPostData()
{
         text = document.getElementById('text').value;

         if(!text.length)
         {
           document.getElementById('textError').innerHTML = 'введите текст сообщения';
           return false;
         }
         
         year          = document.getElementById('year').value;
         
         post_id       = document.getElementById('post_id').value;

         AUDIO_EMBED   = document.getElementById('AUDIO_EMBED').value;  

         name = 'buyEditPostDiv_' + post_id;

         deleteImage = 0;

         if(document.getElementById('dropPostImage'))
         {
           if(document.getElementById('dropPostImage').checked)
             deleteImage = 1;
         }
         
         var req = new JsHttpRequest();

         req.onreadystatechange = function() 
         {
             if (req.readyState == 4) 
             {
                 document.getElementById(name).innerHTML = req.responseText; //req.responseJS.content;

                 name = 'buyEditPostDivArea_' + post_id;
                 document.getElementById(name).innerHTML = '<a href="javascript: openEditPostDiv(' + year + ', ' + post_id + ', false); window.location.href = window.location.href;" style="font-size: 11px; background: #eaeaea; padding: 3px 5px 5px 5px;"><span id="buyEditPostDivLinkTitle_' + post_id + '" style="font-size: 11px;">закрыть</span></a>';
             }
         }

         req.open('POST', '/ajax/news/ajaxNewsPostsEdit.php', true);

         req.send( { 
                     activator: 'savePost', 
                     year : year, 
                     post_id : post_id , 
                     text : text , 
                     AUDIO_EMBED : AUDIO_EMBED,
                     imagePost : document.getElementById('imagePost'),
                     deleteImage : deleteImage
                   } );

}





