/////////
function doSubscribe() {
          var the_frm=document.getElementById('frm_subs');
          //return false;          
          var the_pid=(typeof(the_frm.parent_id)!='undefined')?the_frm.parent_id.value:0;
          var the_sect=(typeof(the_frm.sect_id)!='undefined')?the_frm.sect_id.value:0;          
          var the_email=(typeof(the_frm.email)!='undefined')?the_frm.email.value:'';
          if (the_email==''||the_email==subs_string) {
              //document.getElementById('subs_result').innerHTML=subs_string;
              //p1.showPopup('p1');
              alert(subs_string);
              return false;
          }
          var req = new JsHttpRequest();
          req.onreadystatechange = function() {
            if (req.readyState>3) {
              if (req.responseJS) {
                    var i=''+(req.responseJS.id||'');
                    var c=''+(req.responseJS.code||'');
                    var res=''+(req.responseJS.result||'');
                    if (res!='') {
                        //document.getElementById('subs_result').innerHTML=res;
                        //p1.showPopup('p1');
                        alert(res); // +'='+i+'='+c
                        return false;
                    }
              }
            }
          }
          req.caching=true;
          req.open(script_method,subs_url,true);
          req.send({'form':the_frm,'parent_id':the_pid,'sect_id':the_sect,'email':the_email,'mode':'subsys'});
          return false;
}

/////////
function sendMess(murl,frm,rdiv) {
    var the_frm=frm;
    if (typeof(script_method)=='undefined') script_method='POST';
    var mtext=(typeof(the_frm.text)!='undefined')?the_frm.text.value:'';
    var mname=(typeof(the_frm.name)!='undefined')?the_frm.name.value:'';
    var mrecipe=(typeof(the_frm.recipe)!='undefined')?the_frm.recipe.value:'';
    var mrecipn=(typeof(the_frm.recipn)!='undefined')?the_frm.recipn.value:'';
    if (mtext=='') return false;
    if (mname=='') return false;
    if (mess_link&&(mrecipe==''||mrecipn=='')) return false;
    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState>0) {
           if (req.responseJS) {
              var res=''+(req.responseJS.result||'');
              if (res!='') {
                 document.getElementById(rdiv).innerHTML=res;
              }
              return false;
           }
        }
    }
    req.caching=false;
    req.open(script_method,murl,true);
    req.send({'form':the_frm,'uid':mess_uid,'name':mname,'recipe':mrecipe,'recipn':mrecipn,'text':mtext,'mode':'subsys'});
    return false;
}

/////////
function sendFAQ(murl,frm,rdiv) {
    var the_frm=frm;
    if (typeof(script_method)=='undefined') script_method='POST';
    var mtext=(typeof(the_frm.text)!='undefined')?the_frm.text.value:'';
    var mname=(typeof(the_frm.name)!='undefined')?the_frm.name.value:'';
    var memail=(typeof(the_frm.email)!='undefined')?the_frm.email.value:'';
    if (mname=='') { alert('Введите Ваше имя!'); return false; }
    if (mtext=='') { alert('Введите вопрос!'); return false; }
    //document.getElementById(rdiv).innerHTML=document.getElementById('loading').innerHTML;
    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState>1) {
           if (req.responseJS) {
              var res=''+(req.responseJS.result||'');
              if (res!='') {
                 document.getElementById(rdiv).innerHTML=res;
              }
              return false;
           }
        }
    }
    req.caching=false;
    req.open(script_method,murl,true);
    req.send({'form':the_frm,'name':mname,'email':memail,'text':mtext,'mode':'subsys'});
    return false;
}

/////////
function sendError(msg,url,ln) {
         if (typeof(script_method)=='undefined') script_method='POST';
         if (typeof(error_url)=='undefined') error_url='/ru/mail/1/subsys.html';
         var strValues = "?errMsg=" + escape(msg);
         strValues += "&errLine=" + ln;
         strValues += "&queryString=" + escape(location.search);
         strValues += "&Url=" + escape(location.pathname);
         strValues += "&HTTPRef=" + escape(document.referrer);
         error_url+=strValues;
         var req = new JsHttpRequest();
         req.onreadystatechange = function() {
            if (req.readyState == 4) {
              if (req.responseJS) {
                    var res=''+(req.responseJS.result||'');
                    if (res!='') {
                        //alert(res);
                        return false;
                    }
              }
            }
          }
          req.caching=false;
          req.open(script_method,error_url+strValues,true);
          req.send({'error':1,'mode':'subsys'});
          return false;
}
try { window.onerror=sendError; }  catch(er) {}

