Вход Регистрация
Файл: js/al/join.js
Строк: 1473
<?php
var Join = {
  
show: function(el) {
    if (!
isVisible(el)) slideDown(el150);
  },
  
hide: function(el) {
    if (
isVisible(el)) slideUp(el150);
  },

  
scrollnode: function() {
    return 
browser.msie6 pageNode window;
  },
  
scrollResize: function(epp) {
    if (
browser.mobile && !browser.safari_mobile) return;

    var 
de document.documentElementst scrollGetY();

    if (
pp === true) {
      
cur.nextButtonTop getXY(cur.nextButtonWrap)[1];
      if (
browser.msie6cur.nextButtonTop += st;
    }
    var 
needDock cur.resultShown && (st lastWindowHeight cur.nextButtonTop cur.nextButtonHeight);
    if (
needDock && !cur.docked) {
      
cur.nextButton.className 'fixed';
      if (
browser.msie6) {
        
bodyNode.appendChild(cur.nextButton);
        
= {type'resize'};
      }
      
cur.docked true;
    } else if (!
needDock && cur.docked) {
      
cur.nextButton.className '';
      if (
browser.msie6) {
        
cur.nextButtonWrap.appendChild(cur.nextButton);
      }
      
cur.docked false;
    }
    if (
cur.docked && && e.type == 'resize') {
      if (
browser.msie6) {
        
cur.nextButton.style.left getXY(ge('content'))[0] + 'px';
      } else {
        
cur.nextButton.style.left = (ge('page_layout').offsetLeft ge('content').offsetLeft) + 'px';
        
setTimeout(Join.nextResetStyle0);
      }
    }

    var 
ch window.innerHeight || de.clientHeight || bodyNode.clientHeight;

    if (!
cur.resultShown || !cur.moreLink || !isVisible(cur.moreLink)) return;
    if (
st ch cur.moreLink.offsetTop) {
      
Join.showMore();
    }
  },
  
nextResetStyle: function() {
    
cur.nextButton.style.left '';
  },
  
initScroll: function() {
    
extend(cur, {
      
nextButtonge('join_' cur.section '_next'),
      
nextButtonWrapge('join_' cur.section '_next_wrap'),
      
imgElge('join_' cur.section '_img'),
      
rowsElge('join_' cur.section '_rows'),
      
moreLinkge('join_' cur.section '_more'),
      
noneWrapge('join_' cur.section '_none_wrap'),
      
noneElge('join_' cur.section '_none'),
      
resultElge('join_' cur.section '_result')
    });
    
cur.nextButtonHeight getSize(cur.nextButton)[1];
    
cur.nextButtonWrap.style.height cur.nextButtonHeight 'px';
    
cur.resultShown isVisible(cur.resultEl);
    
Join.scrollResize(falsetrue);

    
addEvent(Join.scrollnode(), 'scroll'Join.scrollResize);
    
addEvent(window'resize'Join.scrollResize);
    
cur.destroy.push(function(c) {
      
removeEvent(Join.scrollnode(), 'scroll'Join.scrollResize);
      
removeEvent(window'resize'Join.scrollResize);
      if (
browser.msie6c.nextButtonWrap.appendChild(c.nextButton);
    })
  },

  
showMore: function() {
    if (!
isVisible('join_' cur.section '_rows')) return;
    var 
params extend(cur.params, {fromcur.from});
    
ajax.post('join.php'params, {
      
showProgressJoin.showMoreProgress,
      
hideProgressJoin.hideMoreProgress,
      
onDoneJoin.showRows.pbind(false),
      
cache1
    
});
  },
  
showRows: function(fromStartrowsfrompreload) {
    
cur.from from;
    if (
fromStart) {
      if (!
rows) return Join.showNone(getLang('join_no_found_' cur.section), true);
      
val(cur.rowsElrows);
      if (
preload && preload[0]) {
        var 
params extend(cur.params, {fromcur.from});
        
ajax.preload('join.php'paramspreload);
        
show(cur.moreLink);
      } else {
        
hide(cur.moreLink);
      }
    } else {
      
val(cur.rowsElval(cur.rowsEl) + rows);
      
hide(cur.moreLink);
      var 
params extend(cur.params, {fromcur.from});
      
ajax.post('join.php'params, {
        
cache1,
        
onDone: function(rows) {
          (
rows show hide)(cur.moreLink);
        }
      });
    }
    
show(cur.resultEl);
    
hide(cur.imgEl);
    
val(cur.noneElgetLang('join_select_' cur.section '_after'));
    
cur.noneEl.style.visibility '';
    
hide('join_' cur.section '_none_prg');
    
cur.resultShown true;
    
val('join_next_step'getLang('join_next_step'));
    
//show(cur.nextButtonWrap);
    
Join.scrollResize(falsetrue);
  },
  
showNone: function(textnoSkipLabel) {
    
show(cur.noneWrapcur.imgEl);
    
val(cur.noneEltext);
    
cur.noneEl.style.visibility '';
    
hide('join_' cur.section '_none_prg');
    
hide(cur.resultEl);
    
cur.resultShown false;
    
val('join_next_step'getLang((noSkipLabel === true) ? 'join_next_step' 'join_skip_' cur.section));
    
//hide(cur.nextButtonWrap);
    
Join.scrollResize(falsetrue);
  },

  
init: function(sectionselData) {
    
selectsData.setCountries(selData.countries_list);
    for (var 
i in selData.countries) {
      
selectsData.setCountryInfo(iselData.countries[i]);
    }
    for (var 
i in selData.cities) {
      
selectsData.setCityInfo(iselData.cities[i]);
    }
    if (
selData.universities) {
      for (var 
i in selData.universities) {
        
selectsData.setUniversityInfo(iselData.universities[i]);
      }
    }
    if (
selData.faculties) {
      for (var 
i in selData.faculties) {
        
selectsData.setFacultyInfo(iselData.faculties[i]);
      }
    }
    
cur.section section;
    var 
upd = (section == 'school') ? Join.updateSchool Join.updateUniversity;
    
cur.cityUpdated selData.city;

    
cur.uiYear = new Dropdown(ge(section '_year'), selData.years, {
      
width160,
      
placeholdergetLang('year_ph'),
      
zeroPlaceholdertrue,
      
placeholderColor'#777',
      
selectedItems: [selData.year],
      
onChange: function(value) {
        if (
intval(value)) {
          
Join.tipHide(cur.section '_year_tip');
        }
        
upd();
      }
    });
    if (
section == 'school') {
      
cur.uiClass = new ClassSelect(ge('school_class'), ge('school_class_row'), {
        
showJoin.show,
        
hideJoin.hide,
        
width160,
        
placeholdergetLang('class_ph'),
        
zeroPlaceholdertrue,
        
placeholderColor'#777',
        
countryselData.country,
        
schoolselData.school,
        
school_classselData.cur_class,
        
onChangeupd
      
});
      
cur.uiSchool = new SchoolHintSelect(ge('school_school'), ge('school_school_row'), {
        
show: function(el) {
          
Join.show(el);
          if (
cur.cityUpdated) {
            
cur.cityUpdated false;
            
setTimeout(Join.focusWithoutDropdown0);
          }
        },
        
hide: function(el) {
          
Join.hide(el);
          
Join.tipHide('school_school_tip');
        },
        
width160,
        
schoolselData.school_val,
        
cityselData.city,
        
placeholdergetLang('school_ph'),
        
zeroPlaceholdertrue,
        
placeholderColor'#777',
        
forceEnableCustom: -1,
        
classSelectcur.uiClass,
        
onChange: function(value) {
          if (
intval(value)) {
            
Join.show('school_year_row');
            
Join.yearTip();
            
Join.tipHide('school_school_tip');
          } else {
            
Join.hide('school_year_row');
            
Join.tipHide('school_year_tip');
          }
          
upd();
        }
      });
    } else {
      
cur.uiChair = new ChairSelect(ge('university_chair'), ge('university_chair_row'), {
        
showJoin.show,
        
hideJoin.hide,
        
width160,
        
placeholdergetLang('chair_ph'),
        
zeroPlaceholdertrue,
        
placeholderColor'#777',
        
chairselData.chair,
        
facultyselData.faculty,
        
onChangeupd
      
});
      
cur.uiFaculty = new FacultySelect(ge('university_faculty'), ge('university_faculty_row'), {
        
showJoin.show,
        
hideJoin.hide,
        
width160,
        
placeholdergetLang('faculty_ph'),
        
zeroPlaceholdertrue,
        
placeholderColor'#777',
        
facultyselData.faculty,
        
universityselData.university,
        
chairSelectcur.uiChair,
        
onChangeupd
      
});
      
cur.uiUniversity = new UniversitySelect(ge('university_university'), ge('university_university_row'), {
        
show: function(el) {
          
Join.show(el);
          if (
cur.cityUpdated) {
            
cur.cityUpdated false;
            
setTimeout(Join.focusWithoutDropdown0);
          }
        },
        
hide: function(el) {
          
Join.hide(el);
          
Join.tipHide('university_university_tip');
        },
        
width160,
        
placeholdergetLang('university_ph'),
        
zeroPlaceholdertrue,
        
placeholderColor'#777',
        
universityselData.university,
        
cityselData.city,
        
facultySelectcur.uiFaculty,
        
onChange: function(value) {
          if (
intval(value)) {
            
Join.show('university_year_row');
            
Join.yearTip();
            
Join.tipHide('university_university_tip');
          } else {
            
Join.hide('university_year_row');
            
Join.tipHide('university_year_tip');
          }
          
upd();
        }
      });
    }
    
cur.uiCity = new CitySelect(ge(section '_city'), ge(section '_city_row'), {
      
show: function(el) {
        
setTimeout(function() {
          if (!
intval(cur.uiCity.val())) {
            
Join.tipShow(cur.section '_city_tip''join_' cur.section '_city_tip', [-15, -523], 'join_phone_tt');
          }
        }, 
0);
        
Join.show(el);
      },
      
hide: function(el) {
        
Join.tipHide(cur.section '_city_tip');
        
Join.hide(el);
      },
      
width160,
      
placeholdergetLang('city_ph'),
      
zeroPlaceholdertrue,
      
placeholderColor'#777',
      
cityselData.city_val,
      
countryselData.country,
      
schoolSelect: (section == 'school') ? cur.uiSchool false,
      
universitySelect: (section == 'university') ? cur.uiUniversity false,
      
onChange: function(value) {
        if (
intval(value)) {
          
Join.tipHide(cur.section '_city_tip');
        } else if (
intval(cur.uiCountry.val())) {
          
Join.tipShow(cur.section '_city_tip''join_' cur.section '_city_tip', [-15, -523], 'join_phone_tt');
        }
        
cur.cityUpdated true;
        
upd();
      }
    });
    
cur.uiCountry = new CountrySelect(ge(section '_country'), ge(section '_country_row'), {
      
showJoin.show,
      
hideJoin.hide,
      
width160,
      
placeholdergetLang('country_ph'),
      
zeroPlaceholdertrue,
      
placeholderColor'#777',
      
countryselData.country_val,
      
citySelectcur.uiCity,
      
classSelect: (section == 'school') ? cur.uiClass false,
      
onChangeupd
    
});
    if (
isVisible(cur.section '_year_row')) {
      
setTimeout(Join.yearTip0);
    }

    
cur.params = {actsection '_load'yearselData.year};
    if (
section == 'school') {
      
extend(cur.params, {schoolselData.schoolclsselData.cur_class});
    } else {
      
extend(cur.params, {universityselData.universityfacultyselData.facultychairselData.chair});
    }
    if (
cur.preload[0]) {
      
ajax.preload('join.php'extend(cur.params, {fromcur.from}), cur.preload);
    }
    
Join.initScroll();
  },
  
focusWithoutDropdown: function() {
    var 
dd = (cur.section == 'school') ? cur.uiSchool cur.uiUniversity;
    if (!
intval(cur.uiCity.val()) || intval(dd.val())) return;
    
dd.focusSelf true;
    
dd.focus();
    
dd.select.hide();
    
Join.tipShow(cur.section '_' cur.section '_tip''join_' cur.section '_tip', [-15, (cur.section == 'school') ? -52 : -363], 'join_' cur.section '_tt');
  },
  
yearTip: function() {
    if (
intval(cur.uiYear.val())) {
      
Join.tipHide(cur.section '_year_tip');
    } else {
      
Join.tipShow(cur.section '_year_tip''join_' cur.section '_year_tip', [-15, -363], 'join_year_tt');
    }
  },

  
showProgress: function() {
    if (
isVisible(cur.resultEl)) {
      var 
summary ge('join_' cur.section '_summary');
      if (!
summary.lastChild || !hasClass(summary.lastChild'progress_inline')) {
        
summary.appendChild(ce('span', {className'progress_inline join_summary_prg'}));
      }
    } else {
      
show('join_' cur.section '_none_prg');
      
cur.noneEl.style.visibility 'hidden';
    }
  },
  
hideProgress: function() {
    if (
isVisible(cur.resultEl)) {
      var 
summary ge('join_' cur.section '_summary');
      if (
summary.lastChild && hasClass(summary.lastChild'progress_inline')) {
        
re(summary.lastChild);
      }
    } else {
      
cur.noneEl.style.visibility '';
      
hide('join_' cur.section '_none_prg');
    }
  },

  
updateSchool: function() {
    if (!
intval(cur.uiCountry.val())) {
      return 
Join.showNone(getLang('join_select_school_city'));
    } else if (!
intval(cur.uiCity.val())) {
      
ajax.post('join.php', {act'city_last'countrycur.uiCountry.val(), citycur.uiCity.val()});
      return 
Join.showNone(getLang('join_select_school_city'));
    } else if (!
intval(cur.uiSchool.val())) {
      
ajax.post('join.php', {act'city_last'countrycur.uiCountry.val(), citycur.uiCity.val()});
      return 
Join.showNone(getLang('join_select_school'));
    } else if (!
intval(cur.uiYear.val())) {
      
ajax.post('join.php', {act'school_last'schoolcur.uiSchool.val(), clscur.uiClass.val()});
      return 
Join.showNone(getLang('join_select_school_year'));
    }
    
cur.params = {act'school_load'schoolcur.uiSchool.val(), yearcur.uiYear.val(), clscur.uiClass.val()};
    
ajax.post('join.php'cur.params, {
      
showProgressJoin.showProgress,
      
hideProgressJoin.hideProgress,
      
onDoneJoin.showRows.pbind(true),
      
cache1
    
});
  },
  
updateUniversity: function() {
    if (!
intval(cur.uiCountry.val())) {
      return 
Join.showNone(getLang('join_select_university_city'));
    } else if (!
intval(cur.uiCity.val())) {
      
ajax.post('join.php', {act'city_last'countrycur.uiCountry.val(), citycur.uiCity.val()});
      return 
Join.showNone(getLang('join_select_university_city'));
    } else if (!
intval(cur.uiUniversity.val())) {
      
ajax.post('join.php', {act'city_last'countrycur.uiCountry.val(), citycur.uiCity.val()});
      return 
Join.showNone(getLang('join_select_university'));
    } else if (!
intval(cur.uiYear.val())) {
      
ajax.post('join.php', {act'university_last'universitycur.uiUniversity.val(), facultycur.uiFaculty.val(), chaircur.uiChair.val()});
      return 
Join.showNone(getLang('join_select_university_year'));
    }
    
cur.params = {act'university_load'universitycur.uiUniversity.val(), facultycur.uiFaculty.val(), chaircur.uiChair.val(), yearcur.uiYear.val()};
    
ajax.post('join.php'cur.params, {
      
showProgressJoin.showProgress,
      
hideProgressJoin.hideProgress,
      
onDoneJoin.showRows.pbind(true),
      
cache1
    
});
  },

  
clearAjaxCache: function() {
    for (var 
i in ajaxCache) {
      if (/^/
join.php#/.test(i)) {
        
delete(ajaxCache[i]);
      }
    }
  },
  
go: function(elsection) {
    return 
nav.go('/join?act=' sectionfalse, {showProgresslockButton.pbind(el), hideProgressunlockButton.pbind(el)});
  },
  
skip: function(elev) {
    var 
prg ce('div', {className'progress fl_r join_skip_prg'}), prnt el.parentNode;
    return 
nav.go(elev, {
      
showProgress: function() {
        if (
el.parentNode == prntprnt.replaceChild(prgel);
      },
      
hideProgress: function() {
        if (
prg.parentNode == prntprnt.replaceChild(elprg);
      }
    });
  },

  
addFriend: function(elmid) {
    var 
params = (cur.section == 'school') ? {schoolcur.uiSchool.val(), clscur.uiClass.val()} : {universitycur.uiUniversity.val(), facultycur.uiFaculty.val(), chaircur.uiChair.val};
    
ajax.post('join.php'extend(params, {act'add_friend'midmidyearcur.uiYear.val(), hashcur.hash}), {
      
showProgresslockButton.pbind(el),
      
hideProgressunlockButton.pbind(el),
      
onDone: function() {
        
show(geByClass1('join_request'el.parentNode.parentNode));//'join_request' + mid
        
hide(el.parentNode);//'join_add' + mid
        
Join.clearAjaxCache();
      },
      
onFail: function(text) {
        if (!
text) return;

        
showFastBox(getLang('global_error'), text);
        return 
true;
      }
    });
  },
  
removeFriend: function(elmid) {
    var 
prg ce('span', {className'progress_inline'}), prnt el.parentNode;
    
ajax.post('join.php', {act'remove_friend'midmidhashcur.hash}, {
      
showProgress: function() {
        if (
el.parentNode == prntprnt.replaceChild(prgel);
      },
      
hideProgress: function() {
        if (
prg.parentNode == prntprnt.replaceChild(elprg);
      },
      
onDone: function() {
        
show(geByClass1('button_blue'el.parentNode.parentNode));//'join_add' + mid
        
hide(el.parentNode);//'join_request' + mid
        
Join.clearAjaxCache();
      }
    })
  },

  
addFriendLogged: function(btnmidhash) {
    
ajax.post('al_friends.php', {act'add'midmidhashhashfrom'fb_sign'}, {
      
onDone: function() {
        
hide('join_add'+mid);
        
show('join_request'+mid);
      },
      
showProgresslockButton.pbind(btn),
      
hideProgressunlockButton.pbind(btn)
    });
  },

  
removeFriendLogged: function(elmidhash) {
    var 
prg ce('span', {className'progress_inline'}), prnt el.parentNode;
    
ajax.post('al_friends.php', {act'remove'midmidhashhashfrom'fb_sign'}, {
      
onDone: function() {
        
show('join_add'+mid);
        
hide('join_request'+mid);
      },
      
showProgress: function() {
        if (
el.parentNode == prntprnt.replaceChild(prgel);
      },
      
hideProgress: function() {
        if (
prg.parentNode == prntprnt.replaceChild(elprg);
      },
    });
  },

  
phoneDone: function(phonecntr) {
    var 
phoneEl ge('join_phone');
    if (
cur.uiPhoneCountry) {
      
cur.uiPhoneCountry.val(cntrtrue);
    }
    
val(phoneElphone);
    
phoneEl.readOnly true;
    if (
cur.uiPhoneCountry) {
      
cur.uiPhoneCountry.disable(true);
      
addClass('join_phone_table''join_readonly_wrap');
    }
    
addClass(phoneEl'join_readonly');
    
show('join_code_submit''join_other_phone');
    
hide('join_phone_submit');
    
slideDown('join_code_row'150elfocus.pbind('join_code'));
    if (
isVisible('join_submit_result')) slideUp('join_submit_result'150);
    
Join.initPhoneCode();
  },
  
checkStatus: function(phonecntr) {
    var 
box curBox(), shprg box box.showProgress lockButton.pbind('join_send_phone'), hdprg box box.hideProgress unlockButton.pbind('join_send_phone');
    if (!
cur.checkingStatus) {
      
shprg();
      
cur.checkingStatus 1;
      
cur.destroy.push(function() {
        
clearTimeout(cur.checkingTimer);
        
hdprg();
      });
    } else if (
cur.checkingStatus 0) {
      
shprg();
      
cur.checkingStatus 1;
    } else {
      ++
cur.checkingStatus;
      if (
cur.checkingStatus 4) {
        
cur.checkingStatus = -1;
        
hdprg();
        return 
Join.phoneDone(phonecntr);
      }
    }
    
cur.checkingTimer setTimeout(ajax.post('join.php', {act'phone_check'}, {
      
onDone: function(ok) {
        if (
ok || cur.checkingStatus 3) {
          
cur.checkingStatus = -1;
          
hdprg();
          return 
Join.phoneDone(phonecntr);
        }
        
cur.checkingTimer setTimeout(Join.checkStatus.pbind(phonecntr), 2000);
      },
      
onFail: function(text) {
        
cur.checkingStatus = -1;
        
hdprg();
        if (!
text) return Join.phoneDone(phonecntr);

        
Join.showMsg('join_submit_result'textelfocus.pbind('join_phone'));
        return 
true;
      }
    }), 
1000);
  },
  
submitPhone: function(force) {
    if (!
force && buttonLocked('join_send_phone')) return;

    var 
phoneEl ge('join_phone'), phone Join.getPhone(), phoneInputVal val('join_phone'), email val('join_email'), cntr cur.uiPhoneCountry cur.uiPhoneCountry.val_full() : false;
    if (
phoneEl.disabled) return elfocus('join_code');

    
ajax.post('join.php', {act'phone'phonephoneemailemailhashcur.hash}, {
      
showProgresslockButton.pbind('join_send_phone'),
      
hideProgressunlockButton.pbind('join_send_phone'),
      
onDone: function(needCheckboxBodystrong) {
        
Join.askPassword('','');
        if (
needCheck) {
          
lockButton('join_send_phone');
          
setTimeout(Join.submitPhone.pbind(true), 1000);
          return;
        }

        
Join.phoneDone(phoneInputValcntr);

      },
      
onFail: function(text) {
        if (!
text) return;

        
Join.showMsg('join_submit_result'textelfocus.pbind('join_phone'));
        return 
true;
      }
    });
  },
  
updateStrength: function() {
    var 
pwd val('join_pass'), level = -1pwds = ['qwerty''йцукен''gfhjkm''пароль''password''abc123''fuckyou''123abc''baseball''football''soccer''monkey''liverpool''princess''jordan''slipknot''superman''iloveyou'];
    if (
pwd != pwd.replace(/s/g'')) {
      
val('join_pass'pwd pwd.replace(/s/g''));
      
elfocus('join_pass');
    }
    if (
pwd.length 6) {
      
level 0;
    } else if (
pwd.match(/^d+$/) || indexOf(pwdspwd) >= || pwd.substr(-1).match(/d/) && pwds.indexOf(pwd.substr(0pwd.length 1)) >= 0) {
      
level 1;
    } else {
      var 
groups = [/[^a-z]/g, /[^0-9]/g], cnts = [], big 0;
      for (var 
0groups.lengthc; ++i) {
        var 
pwd.replace(groups[i], '').length;
        if (
l) {
          if (
1) ++big;
          
cnts.push({groupicntl});
        }
      }
      if (
cnts.length 3) {
        if (
cnts[cnts.length 1].group != groups.length && big 2) {
          
level 2;
        }
      }
      if (
big || cnts.length && cnts[cnts.length 1].group == groups.length 1) {
        
level 4;
      }
      if (
level && big 1) {
        var 
symbs pwd.replace(groups[groups.length 1], '');
        if (
symbs.length && symbs.replace(new RegExp(escapeRE(symbs.charAt(0)), 'g'), '').length) {
          
level 4;
        }
      }
      if (
level 0) {
        
level 3;
      }
      if (
level && level && pwd.length 13) ++level;
    }
    
ge('join_about_pass').className 'join_pwd_level' level;
    
ge('join_pass_strength').innerHTML pwd getLang('join_pwd_level' level) : '&nbsp;';
    
setQuickLoginData((cur.fbSign && cur.fbValid) ? cur.fbEmail Join.getPhone(), pwd, {paramscur.joinParams});
  },
  
initPhoneCode: function() {
    if (
cur.codeForm) return;
    
setQuickLoginData(Join.getPhone(), '', {paramscur.joinParams});
    var 
el utilsNode.appendChild(ce('div', {innerHTML'
<form method="POST" action="' 
vk.loginscheme '://login.vk.com/?act=check_code&_origin=' locProtocol '//' locHost '" id="join_code_form" name="join_code_form" target="join_code_frame">
  <input type="hidden" name="email" id="join_code_phone" />
  <input type="hidden" name="code" id="join_code_code" />
  <input type="hidden" name="captcha_sid" id="join_code_sid" />
  <input type="hidden" name="captcha_key" id="join_code_key" />
</form>
<iframe id="join_code_frame" name="join_code_frame"></iframe>
'
}));
    
cur.codeForm ge('join_code_form');
    
cur.codeFrame ge('join_code_frame');
  },
  
initPhoneCountry: function(countriescountry) {
    
cur.countries countries;
    
cur.defCountry country;
    
cur.uiPhoneCountry = new Dropdown(ge('join_phone_country'), cur.countries, {
      
selectedItemscountry,
      
autocompletetrue,
      
width134,
      
multiselectfalse,
      
onChange: function(v) {
        var 
ph ge('join_phone'), pref ge('join_phone_prefix').firstChildcode cur.uiPhoneCountry.val_full()[3];
        
debugLog(v);
        if (
ph.readOnly || === || === '0' || === '' || === false || === undefined) {
          var 
val(pref);
          if (
code == c) return;
          for (var 
0cur.countries.lengthl; ++i) {
            if (
cur.countries[i][3] == c) {
              return 
cur.uiPhoneCountry.val(cur.countries[i]);
            }
          }
          return 
cur.uiPhoneCountry.val(cur.defCountrytrue);
        }
        
val(prefcode);
        
setTimeout(elfocus.pbind(ph), 0);
      }
    });
    if (
ge('join_phone').readOnly) {
      
cur.uiPhoneCountry.disable(true);
    }
    
cur.destroy.push(cur.uiPhoneCountry.destroy.bind(cur.uiPhoneCountry));
  },
  
getPhone: function() {
    var 
phone trim(val('join_phone')), prefix trim(val((ge('join_phone_prefix') || {}).firstChild) || '');
    return 
prefix phone;
  },
  
submitPhoneCode: function() {
    if (!
cur.codeForm || buttonLocked('join_send_code')) return;

    var 
code trim(val('join_code')).replace(/[^a-z0-9]/g'');
    if (
code.length 4) {
      return 
notaBene('join_code');
    }
    if (
code == '0593') {
      return 
Join.showMsg('join_submit_result'getLang('join_sorry_code'), elfocus.pbind('join_code'falsefalse));
    }
    
val('join_code_phone'Join.getPhone());
    
val('join_code_code'code);
    
lockButton('join_send_code')
    
cur.codeForm.submit();
  },
  
askPassword: function(hashsureBox) {
    if (
curBox()) curBox().hide();
    
show('join_pass_submit''join_accept_terms');
    
hide('join_other_phone''join_code_submit''join_phone_submit');

    
slideDown('join_pass_row'150elfocus.pbind('join_pass'));
    if (
isVisible('join_submit_result')) slideUp('join_submit_result'150);
  },
  
askCaptcha: function(siddif) {
    if (!
cur.codeForm) return;
    
unlockButton('join_send_code');
    
window.badCodeBox showCaptchaBox(siddifwindow.badCodeBox, {onSubmit: function(sidkey) {
      
val('join_code_sid'sid);
      
val('join_code_key'key);
      
cur.codeForm.submit();
    }, 
onHide: function() { window.badCodeBox false; }});
  },
  
submitPasswordSure: function() {
    
showFastBox(getLang('join_new_page_sure_title'), '<div class="join_sure_new_page">' getLang('join_new_page_sure') + '</div>'getLang('join_new_page_sure_submit'), Join.submitPassword.pbind(-1), getLang('global_cancel'));
  },
  
submitPassword: function(toAlreadyfbLoginTo) {
    if (
buttonLocked('join_send_pass') && !cur.submitOnSign) return;

    if (
fbLoginTo === true) {
      var 
pass '000000';
    } else {
      var 
pass val('join_pass');
      if (
pass.length 6) return notaBene('join_pass');
    }

    var 
email val('join_email'
    if (
cur.sureBoxText && toAlready !== && toAlready !== -1) {
      
showFastBox({titlegetLang('join_sure_detach'), hideButtonstruewidth430noCloseButtontruebodyStyle'padding: 16px 14px 5px'}, cur.sureBoxText).changed true;
      
ge('join_submit_old').style.position ge('join_submit_new').style.position 'relative';
      return;
    }
    
cur.joinParams.join_to_already intval(toAlready);
    if (
cur.fbSign && !cur.fbSigned) {
      
cur.submitOnSign 1;
      return 
lockButton('join_send_pass');
    }

    if (!
window._oldOnLoginFailed) {
      
window._oldOnLoginFailed onLoginFailed;
      
window._oldOnLoginDone onLoginDone;
      
cur.destroy.push(function() {
        
onLoginFailed _oldOnLoginFailed;
        
onLoginDone _oldOnLoginDone;
        
_oldOnLoginFailed false;
        
_oldOnLoginDone false;
      });
    }
    
onLoginFailed = function(code) {
      if (
code === -1) {
        
location.href location.href.replace(/^http:/, 'https:');
      } else {
        
ajax.post('join.php', {act'done'passpassemailemailphonelogin}, {onDone: function() {
          
nav.go('/feed'undefined, {params:{_ref:'login'}});
        }, 
onFail: function() {
          
topError('Error Registration');
        }});
      }
    };
    
onLoginDone nav.go.pbind('/feed')
    if (
cur.fbSign && (cur.fbValid || fbLoginTo === true)) {
      var 
login cur.fbEmail;
      
cur.joinParams['fb_id'] = cur.fbId;
    } else {
      var 
login Join.getPhone();
    }
    
submitQuickLoginForm(loginpass, {prg'join_send_pass'paramscur.joinParams});
  },

  
showMsg: function(idtexthandler) {
    var 
el ge(id);
    
val(eltext);
    if (
isVisible(el)) {
      
animate(el, {backgroundColor'#F4EBBD'}, 100animate.pbind(el, {backgroundColor'#F9F6E7'}, 2000));
      
handler();
    } else {
      
slideDown(el100handler);
    }
  },
  
codeFailed: function(triesLeft) {
    if (
curBox()) curBox().hide();
    
unlockButton('join_send_code');
    var 
text getLang('join_wrong_code');
    
triesLeft intval(triesLeft);
    if (
triesLeft 0) {
      
text getLang('join_code_failed');
    } else if (
triesLeft && triesLeft 6) {
      
text += '<br>' getLang('join_tries_left').replace('{count}''<b>' triesLeft '</b>');
    }
    
Join.showMsg('join_submit_result'textelfocus.pbind('join_code'));
    if (
window._oldOnLoginFailedonLoginFailed _oldOnLoginFailed;
  },
  
submitCode: function() {
    if (
buttonLocked('join_send_code')) return;

    var 
code val('join_code');
    if (
code.length 8) return notaBene('join_code');

    if (!
window._oldOnLoginFailed) {
      
window._oldOnLoginFailed onLoginFailed;
      
cur.destroy.push(function() {
        
onLoginFailed _oldOnLoginFailed;
        
_oldOnLoginFailed false;
      });
    }
    
onLoginFailed = function(code) {
      if (
code === -1) {
        
location.href location.href.replace(/^http:/, 'https:');
      } else {
        
Join.codeFailed();
      }
    };
    
submitQuickLoginForm(Join.getPhone(), code, {prg'join_send_code'})
  },
  
noCode: function() {
    var 
prg ce('span', {className'progress_inline'}), el ge('join_resend'), prnt el.parentNode;
    
ajax.post('join.php', {act'resend'hashcur.hash}, {
      
showProgress: function() {
        if (
el.parentNode == prntprnt.replaceChild(prgel);
      },
      
hideProgress: function() {
        if (
prg.parentNode == prntprnt.replaceChild(elprg);
      },
      
onDone: function(texthtmlbtncancel) {
        if (
html && btn) {
          
hide('join_submit_result');
          
showFastBox({titletextwidth430noCloseButtontrue}, htmlbtnJoin.callcancel).changed true;
        } else if (
html) {
          
hide('join_submit_result');
          
showFastBox({titletextwidth430}, html);
        } else {
          
Join.showMsg('join_submit_result'text);
        }
      }
    });
  },
  
changePhone: function() {
    var 
phoneEl ge('join_phone');
    
phoneEl.readOnly false;
    
removeClass(phoneEl'join_readonly');
    if (
cur.uiPhoneCountry) {
      
cur.uiPhoneCountry.disable(false);
      
cur.uiPhoneCountry.val(cur.uiPhoneCountry.val(), true);
      
removeClass('join_phone_table''join_readonly_wrap');
    }
    
show('join_phone_submit');
    
hide('join_code_submit''join_other_phone');
    
slideUp('join_code_row'150);
    
elfocus('join_phone');
  },
  
call: function() {
    
ajax.post('join.php', {act'call'hashcur.hash}, {progresscurBox().progressonDone: function(text) {
      
curBox().hide();
      
Join.showMsg('join_submit_result'text);
    }});
  },

  
activeTab: function(el) {
    var 
el.parentNode.parentNode;
    for (var 
p.firstChildii.nextSibling) {
      if (
i.className == 'active_link') {
        
i.className '';
      }
    }
    
el.parentNode.className 'active_link';
  },

  
tipShow: function(elkeyshiftaddClass) {
    
el ge(el);
    var 
showTT = function() {
      
showTooltip(el, {
        
text'<div class="join_finish_tt_pointer"></div>' getLang(key),
        
slideX15,
        
className'join_finish_tt' + (addClass ? (' ' addClass) : ''),
        
shiftshift,
        
forcetouptrue,
        
onCreateremoveEvent.pbind(el'mouseout')
      });
    }
    if (
vk.loaded) {
      
setTimeout(showTT0);
    } else {
      
addEvent(window'load'showTT);
    }
  },
  
tipHide: function(el) {
    
el ge(el);
    if (
el && el.tt && el.tt.hideel.tt.hide();
  },
  
phoneTip: function(fb) {
    if (
ge('join_phone').readOnly) return;
    return 
Join.tipShow('join_phone_wrap''join_phone_tip', [-147fb ? -89 : -953], 'join_phone_tt');
  },
  
codeTip: function() {
    if (
ge('join_code').readOnly || cur.strongCode 0) return;
    return 
Join.tipShow('join_code_wrap'cur.strongCode 'join_code_voice_tip' 'join_code_tip', [-147, -823]);
  },
  
passTip: function() {
    return 
Join.tipShow('join_pass_wrap''join_pass_tip', [-147, -823]);
  },
  
switchToDefSign: function(hashobj) {
    
ajax.post('join.php', {act'logout'hashhashnoredir1},{
      
onDone: function() {
        
showBox('join.php', {act'box'fromnav.strLoc}, {}, event);
      },
      
showProgresslockButton.pbind(obj),
      
hideProgressunlockButton.pbind(obj)
    });
  }
};

try{
stManager.done('join.js');}catch(e){}
?>
Онлайн: 0
Реклама