// 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 authorizationUser_itogi(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_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;
              }
          }

          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 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 showProfileForm_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_popup').style.display = 'block';
                    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: 'profileForm' } );
          }
 }

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
 
 
 
 
 
 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 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 } ); 
 }
