Вход Регистрация
Файл: js/al/reg.js
Строк: 521
<?php
function initRegSteps(step) {

extend(cur, {
  
module'regstep',

  
animFx.Transitions.sineInOut,

  
stepstep,
  
stepsGlassge('reg_steps_s'),
  
stepsPointge('reg_point'),
  
stepsWrapge('reg_steps_c')
});
extend(cur, {
  
stepsGlassContentgeByClass1('content'cur.stepsGlass),
  
stepsContentgeByClass1('content'cur.stepsWrap),
  
move: function(to_step) {
    if (
to_step == (cur.moving cur.m_to cur.step)) {
      if (!
cur.moving) {
        
nav.setLoc('regstep' cur.step);
      }
      return;
    }
    if (!
cur.moving) {
      
cur.m_height cur.stepsWrap.offsetHeight 2;
      
cur.m_g = (cur.step 1) * 115;
      
cur.m_c = (cur.step) * 632;
      
cur.m_cur cur.step;
      
cur.moving setInterval(function() {
        
cur.m_time += 13;
        if (
cur.anim_v) {
          if (
cur.m_time cur.v_time) {
            
cur.m_height cur.m_to_height;
            
cur.anim_v false;
            if (
cur.anim_h = (cur.m_to_c != cur.m_c)) {
              for (var 
1<= 3; ++i) {
                
show('reg_step' '_c');
                if (
browser.opera_mobile) {
                  
ge('reg_step' +'_c').style.visibility 'visible';
                } else {
                  
ge('reg_step' +'_c').style.height 'auto';
                }
              }
            }
            
cur.m_time -= cur.v_time;
          } else {
            
cur.m_height cur.anim(cur.m_timecur.m_from_heightcur.m_to_height cur.m_from_heightcur.v_time);
          }
          
cur.stepsWrap.style.height cur.m_height 'px';
        }
        if (
cur.anim_h) {
          if (
cur.m_time cur.h_time) {
            
cur.m_g cur.m_to_g;
            
cur.m_c cur.m_to_c;
            
cur.anim_h false;
            
cur.anim_v = (cur.m_to_height != cur.m_height);
            
cur.m_time -= cur.h_time;
          } else {
            
cur.m_g cur.anim(cur.m_timecur.m_from_gcur.m_to_g cur.m_from_gcur.h_time);
            
cur.m_c cur.anim(cur.m_timecur.m_from_ccur.m_to_c cur.m_from_ccur.h_time);
          }
          
cur.stepsContent.style.marginLeft cur.m_c 'px';

          
cur.stepsGlass.style.marginLeft cur.m_g 'px';
          
cur.stepsGlassContent.style.marginLeft = (-cur.m_g 2) + 'px';

          
cur.m_cur Math.floor(cur.m_g 115) + 1;
          if (
cur.m_to <= cur.m_cur && cur.m_cur cur.m_next) {
            
removeClass(ge('reg_step' cur.m_next), 'passed');
            --
cur.m_next;
          }
          if (
cur.m_to cur.m_cur && cur.m_cur == cur.m_next) {
            
addClass(ge('reg_step' cur.m_next), 'passed');
            ++
cur.m_next;
          }

          
cur.stepsPoint.style.marginLeft = (cur.m_g 47) + 'px';
        }
        if (!
cur.anim_v && !cur.anim_h) {
          
cur.step cur.m_to;
          
nav.setLoc('regstep' cur.step);
          
clearInterval(cur.moving);
          
cur.moving false;
          for (var 
1<= 3; ++i) {
            if (
cur.step) {
              if (
browser.opera_mobile) {
                
ge('reg_step' +'_c').style.visibility 'hidden';
              } else {
                
ge('reg_step' +'_c').style.height '10px';
              }
            } else if (
cur.step) {
              
hide('reg_step' '_c');
            }
          }
          
cur.stepsWrap.style.height 'auto';
          
cur.stepsContent.style.width = (cur.step 632) + 'px';
          
cur.stepsWrap.style.overflow 'visible';
          if (
cur.step == && ge('inv_password')) elfocus('inv_password');
        }
      }, 
13);
    }
    
cur.m_time 0;
    
cur.m_to to_step;

    
cur.m_next cur.m_cur;

    
cur.m_from_height cur.m_height;

    var 
to_node ge('reg_step' cur.m_to '_c');
    
to_node.style.position 'absolute';
    
to_node.style.left '-5000px';
    
show(to_node);
    
cur.m_to_height geByClass1('borders'to_node).offsetHeight;

    
cur.m_from_g cur.m_g;
    
cur.m_to_g = (cur.m_to 1) * 115;
    
cur.m_from_c cur.m_c;
    
cur.m_to_c = (cur.m_to) * 632;
    
cur.anim_v = (cur.m_to_height cur.m_height);
    
cur.stepsWrap.style.height cur.m_height 'px';
    
cur.stepsWrap.style.overflow 'hidden';
    
cur.stepsContent.style.width '5000px';

    
to_node.style.position 'static';
    
to_node.style.left 'auto';
    if (
cur.anim_h = (cur.m_to_height <= cur.m_height)) {
      for (var 
1<= 3; ++i) {
        
show('reg_step' '_c');
        if (
browser.opera_mobile) {
          
ge('reg_step' +'_c').style.visibility 'visible';
        } else {
          
ge('reg_step' +'_c').style.height 'auto';
        }
      }
    }
    
cur.h_time Math.abs(cur.m_to_c cur.m_c) * 5// horizontal
    
cur.v_time Math.abs(cur.m_to_height cur.m_height) / 2// vertical
    
if (cur.h_time 500cur.h_time 500;
    if (
cur.v_time 500cur.v_time 500;
  },

  
finish: function(hash) {
    
ajax.post('register.php', {act'finish'hashhash}, {progress'step3_progress'});
  },

  
uploadPhoto: function() {
    
hide('photo_error');
    
show('upload_progress');
    
document.upload.submit();
    
setTimeout('ge('photo').blur(); ge('photo').disabled = true;'0);
  },
  
uploadSucceed: function(serverphotohashurl) {
    var 
tmp vkImage();
    
tmp.src url;

    
cur.updatePhoto = function() {
      if (
tmp.height) {
        
ge('photo_file').innerHTML '<input id="photo" class="inputFile" type="file" onchange="cur.uploadPhoto()" name="photo" />';
        
hide('upload_progress');
        var 
reg_photo ge('reg_photo');
        if (
reg_photo.firstChild.tagName.toLowerCase() == 'img') {
          
animate(reg_photo, {heighttmp.height 'px'}, 200, function() {
            
ge('reg_photo').innerHTML '<img src="' url '" />';
          });
        } else {
          
animate(reg_photo.firstChild.firstChild, {height: (tmp.height 2) + 'px'}, 200, function() {
            
ge('reg_photo').innerHTML '<img src="' url '" />';
          });
        }
      } else {
        
setTimeout(cur.updatePhoto100);
      }
    }
    
cur.updatePhoto();

    
cur.photo = [serverphotohash];
  },
  
uploadError: function(text) {
    
ge('photo_error').innerHTML text;
    
show('photo_error');
    
hide('upload_progress');
    
ge('photo_file').innerHTML '<input id="photo" class="inputFile" type="file" onchange="cur.uploadPhoto()" name="photo" />';
  }
});

for (var 
1<= 3; ++i) {
  if (
cur.step) {
    if (
browser.opera_mobile) {
      
ge('reg_step' +'_c').style.visibility 'hidden';
    } else {
      
ge('reg_step' +'_c').style.height '10px';
    }
  } else if (
cur.step) {
    
hide('reg_step' '_c');
  }
}

cur.stepsContent.style.width = (cur.step 632) + 'px';
cur.stepsWrap.style.overflow 'visible';
cur.m_height cur.stepsWrap.offsetHeight 2;
cur.m_g = (cur.step 1) * 115;
cur.m_c = (cur.step) * 632;
cur.stepsPoint.style.marginLeft = (cur.m_g 47) + 'px';
show(cur.stepsPoint);
cur.stepsGlass.style.marginLeft cur.m_g 'px';
cur.stepsGlassContent.style.marginLeft = (-cur.m_g 2) + 'px';
show(cur.stepsGlass);
cur.stepsContent.style.marginLeft cur.m_c 'px';
show(cur.stepsContent);

selectsData.setCountries(cur.selData.countries_list);
for (var 
i in cur.selData.countries) {
  
selectsData.setCountryInfo(icur.selData.countries[i]);
}
for (var 
i in cur.selData.cities) {
  
selectsData.setCityInfo(icur.selData.cities[i]);
}
for (var 
i in cur.selData.universities) {
  
selectsData.setUniversityInfo(icur.selData.universities[i]);
}
for (var 
i in cur.selData.faculties) {
  
selectsData.setFacultyInfo(icur.selData.faculties[i]);
}

var 
slide_show = function(elemspeed) {
  if (!
isVisible(elem)) slideDown(elemspeed || 150);
}
var 
slide_hide = function(elemspeed) {
  if (
isVisible(elem)) slideUp(elemspeed || 150);
}

var 
uiSexuiBDayuiBMonthuiBYearuiCountryuiCity;

var 
uiChairuiFacultyuiUniversityuiUCityuiUCountry;
var 
uiEducationFormuiEducationStatusuiGrad;

var 
uiSchooluiSCityuiSCountry;
var 
uiClassuiSchoolStartYearuiSchoolFinishYearuiSchoolGradYear;

cur.getLastDay = function(yearmonth) {
  if (
month == 2) {
    if (
year == 0) {
      return 
29;
    } else {
      return 
28;
    }
  } else if (
month && ((month && month == 0) || (month && month == 1))) {
    return 
30;
  }
  return 
31;
}

cur.genDays = function(yearmonth) {
  var 
result = [[0cur.lang.profileEdit_main_sel_bday+':']], last cur.getLastDay(yearmonth);
  for (var 
1<= last; ++i) {
    
result.push([i'']);
  }
  return 
result;
},

uiSex = new Dropdown(ge('sex'), cur.selData.sexes, {
  
width225,
  
multiselectfalse,
  
selectedItemscur.selData.sex,
  
onChange: function(val) {
    
val intval(val);
    if (
val) {
      
ge('birth_date_label').innerHTML langSex(valcur.lang.birth_date_label);
    }
  }
});

var 
updDays = function(yearmonth) {
  if (
uiBDay.val() > cur.getLastDay(yearmonth)) {
    
uiBDay.clear();
  }
  
uiBDay.setData(cur.getLastDay(yearmonth));
}

uiBDay = new Dropdown(ge('bday'), cur.genDays(cur.selData.byearcur.selData.bmonth), {
  
width60,
  
multiselectfalse,
  
selectedItemscur.selData.bday
});

uiBMonth = new Dropdown(ge('bmonth'), cur.selData.bmonths, {
  
width95,
  
multiselectfalse,
  
selectedItemscur.selData.bmonth,
  
onChange: function(value) {
    
updDays(uiBYear.val(), value);
  }
});

uiBYear = new Dropdown(ge('byear'), cur.selData.byears, {
  
width60,
  
multiselectfalse,
  
selectedItemscur.selData.byear,
  
onChange: function(value) {
    
updDays(valueuiBMonth.val());
  }
});

uiClass = new ClassSelect(ge('s_class'), ge('s_class_row'), {
  
width200,
  
countrycur.selData.s_country[0],
  
schoolcur.selData.school,
  
school_classcur.selData.s_class
});

uiSchool = new SchoolSelect(ge('school'), ge('school_container'),
                            
ge('school_type'), ge('selectSchoolType'), {
  
width200,
  
type_width87,
  
with_type_width108,
  
showslide_show,
  
hideslide_hide,
  
typescur.selData.school_types,
  
schoolcur.selData.school,
  
citycur.selData.s_city[0],
  
classSelectuiClass,
  
onChange: function(value) {
    if (
intval(value)) {
      
slide_show('school_details'300);
    } else {
      
slide_hide('school_details'300);
    }
    
uiClass.clear();
    
uiSchoolStartYear.clear();
    
uiSchoolFinishYear.clear();
    
uiSchoolGradYear.clear();
  }
});

uiEducationForm = new EducationFormSelect(ge('edu_form'), ge('edu_form_row'), {
  
width200,
  
countrycur.selData.u_country[0],
  
universitycur.selData.university,
  
edu_formcur.selData.edu_form
});

uiEducationStatus = new EducationStatusSelect(ge('edu_status'), ge('edu_status_row'), {
  
width200,
  
countrycur.selData.u_country[0],
  
universitycur.selData.university,
  
edu_statuscur.selData.edu_status
});

uiChair = new ChairSelect(ge('chair'), ge('chair_row'), {
  
width200,
  
showslide_show,
  
hideslide_hide,
  
chaircur.selData.chair,
  
facultycur.selData.faculty
});

uiFaculty = new FacultySelect(ge('faculty'), ge('faculty_row'), {
  
width200,
  
showslide_show,
  
hideslide_hide,
  
progressBarge('uni_progress'),
  
facultycur.selData.faculty,
  
universitycur.selData.university,
  
chairSelectuiChair
});

uiUniversity = new UniversitySelect(ge('university'), ge('university_container'), {
  
width200,
  
showslide_show,
  
hideslide_hide,
  
progressBarge('uni_progress'),
  
universitycur.selData.university,
  
citycur.selData.u_city[0],
  
facultySelectuiFaculty,
  
eduFormSelectuiEducationForm,
  
eduStatusSelectuiEducationStatus,
  
onChange: function(value) {
    if (
intval(value)) {
      
slide_show('university_details'300);
    } else {
      
slide_hide('university_details'300);
    }
    
uiEducationForm.clear();
    
uiEducationStatus.clear();
    
uiGrad.clear();
  }
});

uiUCity = new CitySelect(ge('u_city'), ge('u_city_row'), {
  
width200,
  
showslide_show,
  
hideslide_hide,
  
progressBarge('uni_progress'),
  
citycur.selData.u_city,
  
countrycur.selData.u_country[0],
  
universitySelectuiUniversity
});

uiSCity = new CitySelect(ge('s_city'), ge('s_city_row'), {
  
width200,
  
showslide_show,
  
hideslide_hide,
  
progressBarge('school_progress'),
  
citycur.selData.s_city,
  
countrycur.selData.s_country[0],
  
schoolSelectuiSchool
});

uiCity = new CitySelect(ge('city'), ge('city_row'), {
  
width225,
  
showslide_show,
  
hideslide_hide,
  
citycur.selData.city,
  
countrycur.selData.country[0],
  
onChange: function(value) {
    
value intval(value);
    if (
value) {
      var 
cnfull uiCountry.val_full(), ctfull uiCity.val_full();
      if (!
intval(uiUCity.val())) {
        
uiUCountry.val(cnfulltrue);
        
uiUCity.val(ctfulltrue);
      }
      if (!
intval(uiSCity.val())) {
        
uiSCountry.val(cnfulltrue);
        
uiSCity.val(ctfulltrue);
      }
    }
  }
});

uiUCountry = new CountrySelect(ge('u_country'), ge('u_country_row'), {
  
width200,
  
showslide_show,
  
hideslide_hide,
  
progressBarge('uni_progress'),
  
countrycur.selData.u_country,
  
eduFormSelectuiEducationForm,
  
eduStatusSelectuiEducationStatus,
  
citySelectuiUCity
});

uiSCountry = new CountrySelect(ge('s_country'), ge('s_country_row'), {
  
width200,
  
showslide_show,
  
hideslide_hide,
  
progressBarge('school_progress'),
  
countrycur.selData.s_country,
  
classSelectuiClass,
  
citySelectuiSCity
});

uiCountry = new CountrySelect(ge('country'), ge('country_row'), {
  
width225,
  
showslide_show,
  
hideslide_hide,
  
progressBarge('city_progress'),
  
countrycur.selData.country,
  
citySelectuiCity,
  
onChange: function(value) {
    
value intval(value);
    if (
value) {
      var 
full uiCountry.val_full();
      if (!
intval(uiUCountry.val())) {
        
uiUCountry.val(fulltrue);
      }
      if (!
intval(uiSCountry.val())) {
        
uiSCountry.val(fulltrue);
      }
    }
  }
});

uiGrad = new Dropdown(ge('grad'), cur.selData.graduations, {
  
width200,
  
autocompletetrue,
  
placeholderColor'#000',
  
placeholdercur.lang.select_year_not_selected,
  
noResultcur.lang.select_year_not_found,
  
selectedItemscur.selData.grad,
  
onChange: function(value) {
    if (!
intval(value)) {
      
uiGrad.clear();
    }
  }
});

uiSchoolStartYear = new Dropdown(ge('s_start'), cur.selData.start_years, {
  
width200,
  
autocompletetrue,
  
placeholderColor'#000',
  
placeholdercur.lang.select_year_not_selected,
  
noResultcur.lang.select_year_not_found,
  
selectedItemscur.selData.s_start,
  
onChange: function(value) {
    if (!
intval(value)) {
      
uiSchoolStartYear.clear();
    }
  }
});

uiSchoolFinishYear = new Dropdown(ge('s_fin'), cur.selData.finish_years, {
  
width200,
  
autocompletetrue,
  
placeholderColor'#000',
  
placeholdercur.lang.select_year_not_selected,
  
noResultcur.lang.select_year_not_found,
  
selectedItemscur.selData.s_finish,
  
onChange: function(value) {
    if (!
intval(value)) {
      
uiSchoolFinishYear.clear();
    }
  }
});

uiSchoolGradYear = new Dropdown(ge('s_grad'), cur.selData.finish_years, {
  
width200,
  
autocompletetrue,
  
placeholderColor'#000',
  
placeholdercur.lang.select_year_not_selected,
  
noResultcur.lang.select_year_not_found,
  
selectedItemscur.selData.s_grad,
  
onChange: function(value) {
    if (!
intval(value)) {
      
uiSchoolGradYear.clear();
    }
  }
});

ge('step1_save').onclick = function() {
  var 
fnameRaw trim(ge('fname').value), lnameRaw trim(ge('lname').value);
  var 
name cleanName(fnameRawlnameRaw);
  
fname name[0];
  
lname name[1];

  var 
sex intval(ge('sex').value);
  if (!
fname || fname.length fnameRaw.length) {
    
scrollToTop(0);
    return 
notaBene('fname');
  }
  if (!
lname || lname.length lnameRaw.length) {
    
scrollToTop(0);
    return 
notaBene('lname');
  }
  if (!
sex) {
    
scrollToTop(0);
    return 
uiSex.showDefaultList();
  }
  var 
params = {
    
act'save_general',
    
countryge('country').value,
    
cityge('city').value,
    
fnamefname,
    
lnamelname,
    
sexge('sex').value,
    
bdayge('bday').value,
    
bmonthge('bmonth').value,
    
byearge('byear').value,
    
hashge('reghash').value
  
};
  
ajax.post('register.php'params, {progress'step1_progress'onDone: function() {
    
cur.selData.fname fname;
    
cur.selData.lname lname;
    
setTimeout(show.pbind('rs_skip1'), 300);
    
nav.go('/regstep2');
  }});
}

ge('step2_save').onclick = function() {
  var 
addFields = function() {
    var 
result arguments[0];
    for (var 
1arguments.lengthi++) {
      var 
name arguments[i];
      var 
value ge(name).value;
      if (
intval(value)) {
        
result[name] = value;
      }
    }
    return 
result;
  }
  var 
addTextFields = function() {
    var 
result arguments[0];
    for (var 
1arguments.lengthi++) {
      var 
name arguments[i];
      var 
value ge(name).value;
      if (
value.length) {
        
result[name] = value;
      }
    }
    return 
result;
  }
  var 
params = {act'save_education'hashge('reghash').value};
  
params addFields(params's_country''s_city''school''school_type''s_class''s_start''s_fin''s_grad''u_country''u_city''university''faculty''chair''edu_form''edu_status''grad');
  
params addTextFields(params'school_custom''university_custom''faculty_custom''chair_custom');
  
ajax.post('register.php'params, {progress'step2_progress'});
}

ge('step3_save').onclick = function() {
  
ajax.post('register.php', {
    
act'set_photo',
    
servercur.photo[0],
    
photocur.photo[1],
    
hashge('reghash').value,
    
phashcur.photo[2]
  }, {
progress'step3_progress'});
}

cur.destroy.push(function() {
  
each([uiCountryuiCityuiChairuiFacultyuiUniversityuiUCityuiUCountry,
        
uiEducationFormuiEducationStatusuiGraduiSchooluiSCityuiSCountry,
        
uiClassuiSchoolStartYearuiSchoolFinishYearuiSchoolGradYear],
    
Selector.prototype.destroy
  
);
  
cleanElems(
    
'step1_save''step2_save''step3_save''reg_step1_c''reg_step2_c',
    
'reg_step3_c''uni_progress''school_progress''city_progress'
  
);
});

cur.nav.push(function(changed) {
  if (!
changed[0]) return false;
  var 
changed[0].match(/regstep(d)/i);
  if (!
m) return;
  
delete(changed[0]);
  if (!
isEmpty(changed)) return;

  var 
step intval(m[1]);
  if (
step 1) {
    if (!
cur.selData.fname) {
      
elfocus('fname');
      return 
false;
    } else if (!
cur.selData.lname) {
      
elfocus('lname');
      return 
false;
    }
  }
  if (
step || step 3) {
    
setTimeout(function() {
      
nav.go('regstep1');
    }, 
0);
  } else {
    
cur.move(step);
    
document.title document.title;
  }
  return 
false;
});

}

var 
Reg = {
}

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