Вход Регистрация
Файл: js/al/profile_edit_edu.js
Строк: 1175
<?php
var ProfileEditorEdu = {

  
init: function() {
    
cur.globalCounter 0;
    
cur.unisCount 0;
    
cur.shoolsCount 0;

    
cur.addBox null;
    
cur.addedItems = {universities: {}, faculties: {}, chairs: {}, schools: {}};
  },

  
genOneRow: function(prefixfieldidlabelparamsadditional) {
    var 
key prefix '_' field id;
    if (!
params) {
      
params '';
    }
    if (!
additional) {
      
additional '';
    }
    return 
'<div class="pedit_edu_row" id="row_' key '">' +
              
'<div class="label fl_l ta_r">' label '</div>' +
              
'<div class="labeled fl_l"><input id="' key '" name="' key '" ' params '/></div>' +
           
additional '</div>';
  },

  
genUniRow: function(uni_idno_delete) {
    var 
delete_link no_delete '' '<a class="fl_r" onclick="ProfileEditorEdu.deleteUniversity(' uni_id ')">' getLang('global_delete') + '</a>';
    return 
ce('div', {
      
className'pedit_edu_big_row',
      
id'uni' uni_id,
      
innerHTML'<div id="uni_content' uni_id '">' +
        
this.genOneRow('u''country'uni_idgetLang('select_country'), '',
        
'<img src="/images/upload.gif" id="u_progress' uni_id '" />' delete_link) +
        
this.genOneRow('u''city'uni_idgetLang('select_city')) +
        
this.genOneRow('u''university'uni_idgetLang('select_university'), '',
        
'<span class="add_item_link fl_l" id="u_add_uni_to_db' uni_id '"><b><a href="" onclick="return ProfileEditorEdu.addUniversityToDB(' uni_id ')">' getLang('profileEdit_uni_not_in_db') + '</a></b></span>') +
        
this.genOneRow('u''faculty'uni_idgetLang('select_faculty'), '',
        
'<span class="add_item_link fl_l" id="u_add_fac_to_db' uni_id '"><b><a href="" onclick="return ProfileEditorEdu.addFacultyToDB(' uni_id ')">' getLang('profileEdit_fac_not_in_db') + '</a></b></span>') +
        
this.genOneRow('u''chair'uni_idgetLang('select_chair'), '',
        
'<span class="add_item_link fl_l" id="u_add_chair_to_db' uni_id '"><b><a href="" onclick="return ProfileEditorEdu.addChairToDB(' uni_id ')">' getLang('profileEdit_chair_not_in_db') + '</a></b></span>') +
        
'<div id="u_details' uni_id '" style="display: none">' +
          
this.genOneRow('u''edu_form'uni_idgetLang('select_eduform')) +
          
this.genOneRow('u''edu_status'uni_idgetLang('select_edustatus')) +
          
this.genOneRow('u''graduation'uni_idgetLang('select_graduation')) +
        
'</div></div>' +
        
'<div class="deleted" id="uni_deleted' uni_id '"><div></div>' +
          
'<a class="fl_r" onclick="ProfileEditorEdu.restoreUniversity(' uni_id ')">' getLang('global_dont_delete') + '</a>' +
        
'</div><div class="separator"><div></div></div>'
    
}, {display'none'});
  },

  
get_by_id: function(elemid) {
    if (
elem.id == id) {
      return 
elem;
    }
    for (var 
0elem.childNodes.length; ++i) {
      var 
result this.get_by_id(elem.childNodes[i], id);
      if (
result) {
        return 
result;
      }
    }
    return 
false;
  },

  
initUniRow: function(unielem) {
    var 
elem ? function(id) { return ProfileEditorEdu.get_by_id(elemid); } : ge;
    
uni.uiEducationForm = new EducationFormSelect(g('u_edu_form' uni.id), g('row_u_edu_form' uni.id), {
      
width200,
      
countryuni.country,
      
universityuni.university,
      
edu_formuni.edu_form
    
});
    
uni.uiEducationStatus = new EducationStatusSelect(g('u_edu_status' uni.id), g('row_u_edu_status' uni.id), {
      
width200,
      
countryuni.country,
      
universityuni.university,
      
edu_statusuni.edu_status
    
});
    
uni.uiGraduation = new Dropdown(g('u_graduation' uni.id), cur.selData.graduations, {
      
width200,
      
autocompletetrue,
      
placeholdergetLang('select_year_not_selected'),
      
placeholderColor'#000',
      
noResultgetLang('select_year_not_found'),
      
selectedItemsuni.graduation,
      
onChange: function(value) {
        if (!
intval(value)) {
          
uiGraduation.clear();
        }
      }
    });

    
uni.uiChair = new ChairSelect(g('u_chair' uni.id), g('row_u_chair' uni.id), {
      
width200,
      
progressBar'u_progress' uni.id,
      
facultyuni.faculty,
      
chairuni.chair,
  
//    ignoreVoidList: (uni.country > 3),
      
onEnableCustomChange: function(enable) {
        var 
country uni.uiCountry uni.uiCountry.val() : uni.country;
        var 
chair uni.uiChair uni.uiChair.val() : uni.chair;
        if ((
uni.showAddChair = (!enable && country 3)) && !intval(chair)) {
          
show('u_add_chair_to_db' uni.id);
        } else {
          
hide('u_add_chair_to_db' uni.id);
        }
      },
      
onChange: function(value) {
        if (!
intval(value)) {
          if (
uni.showAddChair) {
            
show('u_add_chair_to_db' uni.id);
          }
        } else {
          
hide('u_add_chair_to_db' uni.id);
        }
      }
    });
    
uni.uiFaculty = new FacultySelect(g('u_faculty' uni.id), g('row_u_faculty' uni.id), {
      
width200,
      
progressBar'u_progress' uni.id,
      
universityuni.university,
      
facultyuni.faculty,
      
chairSelectuni.uiChair,
  
//    ignoreVoidList: (uni.country > 3),
      
onEnableCustomChange: function(enable) {
        var 
country uni.uiCountry uni.uiCountry.val() : uni.country;
        var 
faculty uni.uiFaculty uni.uiFaculty.val() : uni.faculty;
        if ((
uni.showAddFaculty = (!enable && country 3)) && !intval(faculty)) {
          
show('u_add_fac_to_db' uni.id);
        } else {
          
hide('u_add_fac_to_db' uni.id);
        }
      },
      
onChange: function(value) {
        if (!
intval(value)) {
          if (
uni.showAddFaculty) {
            
show('u_add_fac_to_db' uni.id);
          }
        } else {
          
hide('u_add_fac_to_db' uni.id);
        }
      }
    });
    
uni.uiUniversity = new UniversitySelect(g('u_university' uni.id), g('row_u_university' uni.id), {
      
width200,
      
progressBar'u_progress' uni.id,
      
cityuni.city,
      
universityuni.university,
      
eduFormSelectuni.uiEducationForm,
      
eduStatusSelectuni.uiEducationStatus,
      
facultySelectuni.uiFaculty,
  
//    ignoreVoidList: (uni.country > 3),
      
onEnableCustomChange: function(enable) {
        var 
country uni.uiCountry uni.uiCountry.val() : uni.country;
        var 
university uni.uiUniversity uni.uiUniversity.val() : uni.university;
        if ((
uni.showAddUni = (!enable && country 3)) && !intval(university)) {
          
show('u_add_uni_to_db' uni.id);
        } else {
          
hide('u_add_uni_to_db' uni.id);
        }
      },
      
onChange: function(value) {
        if (!
intval(value)) {
          
hide('u_details' uni.id);
          if (
uni.showAddUni) {
            
show('u_add_uni_to_db' uni.id);
          }
        } else {
          
show('u_details' uni.id);
          
hide('u_add_uni_to_db' uni.id);
        }
        
uni.uiEducationForm.clear();
        
uni.uiEducationStatus.clear();
        
uni.uiGraduation.clear();
      }
    });
    
uni.uiCity = new CitySelect(g('u_city' uni.id), g('row_u_city' uni.id), {
      
width200,
      
progressBar'u_progress' uni.id,
      
countryuni.country,
      
cityuni.city_val,
      
universitySelectuni.uiUniversity,
      
maxItemsShown: function(query_length) {
        return (
query_length 6) ? 500 350;
      }
    });
    
uni.uiCountry = new CountrySelect(g('u_country' uni.id), g('row_u_country' uni.id), {
      
width200,
      
progressBar'u_progress' uni.id,
      
countryuni.country_val,
      
eduFormSelectuni.uiEducationForm,
      
eduStatusSelectuni.uiEducationStatus,
      
citySelectuni.uiCity,
      
onChange: function(value) {
  
//      var new_options = {ignoreVoidList: intval(value) > 3};
  //      uni.uiUniversity.setOptions(new_options);
  //      uni.uiFaculty.setOptions(new_options);
  //      uni.uiChair.setOptions(new_options);
      
}
    });

    
g('uni' uni.id).style.display 'block';
    if (
uni.university) {
      
g('u_details' uni.id).style.display 'block';
    }

    return 
uni;
  },

  
genOneSchoolRow: function(id) {
    var 
key 's_school' id;
    return 
'<div class="pedit_edu_row" id="row_' key '"><div class="label fl_l ta_r">' getLang('select_school') + '</div>' +
             
'<div class="labeled fl_l">' +
               
// '<div class="school_type_row" id="row_s_school_type' + id + '"><input id="s_school_type' + id + '" name="s_school_type' + id + '" /></div>' +
               
'<div class="school_row"><input id="' key '" name="' key '" /></div>' +
             
'</div>' +
             
'<span class="add_item_link fl_l" id="s_add_school_to_db' id '"><b><a onclick="ProfileEditorEdu.addSchoolToDB(' id ')">' getLang('profileEdit_school_not_in_db') + '</a></b></span>' +
           
'</div>';
  },

  
genSchoolRow: function(school_id) {
    return 
ce('div', {
      
className'pedit_edu_big_row',
      
id'school' school_id,
      
innerHTML'<div id="school_content' school_id '">' +
        
this.genOneRow('s''country'school_idgetLang('select_country'), '',
        
'<img src="/images/upload.gif" id="s_progress' school_id '" />' +
        
'<a class="fl_r" onclick="ProfileEditorEdu.deleteSchool(' school_id ')">' getLang('global_delete') + '</a>') +
        
this.genOneRow('s''city'school_idgetLang('select_city')) +
        
this.genOneSchoolRow(school_id) +
        
'<div id="s_details' school_id '" style="display: none">' +
          
this.genOneRow('s''start'school_idgetLang('select_start_year')) +
          
this.genOneRow('s''finish'school_idgetLang('select_finish_year')) +
          
this.genOneRow('s''graduation'school_idgetLang('select_graduation')) +
          
this.genOneRow('s''class'school_idgetLang('select_class')) +
          
this.genOneRow('s''spec'school_id '_custom'getLang('select_spec'), 'type="text" class="text"') +
        
'</div></div>' +
        
'<div class="deleted" id="school_deleted' school_id '"><div></div>' +
          
'<a class="fl_r" onclick="ProfileEditorEdu.restoreSchool(' school_id ')">' getLang('global_dont_delete') + '</a>' +
        
'</div><div class="separator"><div></div></div>'
    
}, {display'none'});
  },

  
initSchoolRow: function(schoolelem) {
    var 
elem ? function(id) { return ProfileEditorEdu.get_by_id(elemid); } : ge;
    
school.uiClass = new ClassSelect(g('s_class' school.id), g('row_s_class' school.id), {
      
width200,
      
countryschool.country,
      
schoolschool.school,
      
school_classschool.school_class
    
});
    var 
yearSelect = function(input_iddataselected) {
      var 
result = new Dropdown(g(input_id), data, {
        
width200,
        
autocompletetrue,
        
placeholdergetLang('select_year_not_selected'),
        
placeholderColor'#000',
        
noResultgetLang('select_year_not_found'),
        
selectedItemsselected,
        
onChange: function(value) {
          if (!
intval(value)) {
            
result.clear();
          }
        }
      });
      return 
result;
    }
    
school.uiStart yearSelect('s_start' school.idcur.selData.start_yearsschool.start);
    
school.uiFinish yearSelect('s_finish' school.idcur.selData.finish_yearsschool.finish);
    
school.uiGraduation yearSelect('s_graduation' school.idcur.selData.finish_yearsschool.graduation);
    if (!
school.spec) {
      
school.spec '';
    }
    
g('s_spec' school.id '_custom').value school.spec;

    
// school.uiSchool = new SchoolSelect(g('s_school' + school.id), g('row_s_school' + school.id), g('s_school_type' + school.id), g('row_s_school_type' + school.id), {
    
school.uiSchool = new SchoolHintSelect(g('s_school' school.id), g('row_s_school' school.id), {
      
width200,
      
progressBar's_progress' school.id,
      
/*type_width: 87,
      with_type_width: 108,
      types: cur.selData.school_types,
      type: school.school_type,*/
      
cityschool.city,
      
schoolschool.school,
      
classSelectschool.uiClass,
  
//    ignoreVoidList: (school.country > 3),
      
onEnableCustomChange: function(enable) {
        var 
country school.uiCountry school.uiCountry.val() : school.country;
        var 
school_id school.uiSchool school.uiSchool.val() : school.school;
        if ((
school.showAddSchool = (!enable && country 3)) && !intval(school_id)) {
          
show('s_add_school_to_db' school.id);
        } else {
          
hide('s_add_school_to_db' school.id);
        }
      },
      
onChange: function(value) {
        if (!
intval(value)) {
          
hide('s_details' school.id);
          if (
school.showAddSchool) {
            
show('s_add_school_to_db' school.id);
          }
        } else {
          
show('s_details' school.id);
          
hide('s_add_school_to_db' school.id);
        }
        
school.uiClass.clear();
        
school.uiStart.clear();
        
school.uiFinish.clear();
        
school.uiGraduation.clear();
        
ge('s_spec' school.id '_custom').value '';
      }
    });
    
school.uiCity = new CitySelect(g('s_city' school.id), g('row_s_city' school.id), {
      
width200,
      
progressBar's_progress' school.id,
      
countryschool.country,
      
cityschool.city_val,
      
schoolSelectschool.uiSchool,
      
maxItemsShown: function(query_length) {
        return (
query_length 6) ? 500 350;
      }
    });
    
school.uiCountry = new CountrySelect(g('s_country' school.id), g('row_s_country' school.id), {
      
width200,
      
progressBar's_progress' school.id,
      
countryschool.country_val,
      
classSelectschool.uiClass,
      
citySelectschool.uiCity,
      
onChange: function(value) {
  
//      school.uiSchool.setOptions({ignoreVoidList: intval(value) > 3});
      
}
    });

    
g('school' school.id).style.display 'block';
    if (
school.school) {
      
g('s_details' school.id).style.display 'block';
    }

    return 
school;
  },

  
genAddRow: function(fieldlabeladditional) {
    if (!
additional) {
      
additional '';
    }
    return 
'<div class="pedit_edu_row" id="row_' field '">' +
              
'<div class="label fl_l ta_r">' label '</div>' +
              
'<div class="labeled fl_l"><input id="' field '" name="' field '" /></div>' +
           
additional '</div>';
  },

  
// initer returns additional CitySelect params, like schoolSelect or universitySelect.
  
addObjectToDB: function(country_valrowsiniterhandler) {
    var 
addBox cur.addBox;
    
addBox.setOptions({onHide: function() {}});
    
addBox.content('<div id="adding_to_db" class="profileEditor">' +
                     
this.genAddRow('add_country'getLang('select_country')) +
                     
this.genAddRow('add_city'getLang('select_city')) + rows +
                   
'</div>');
    
addBox.removeButtons();
    
addBox.addButton(getLang('global_cancel'), function() { addBox.hide(); }, 'no');
    
addBox.addButton(getLang('global_done'), handler);
    var 
citySelectParams extend({
      
width200,
      
progressBar'add_box_progress',
      
maxItemsShown: function(query_length) {
        return (
query_length 6) ? 500 350;
      }
    }, 
initer());
    
addBox.uiAddCity = new CitySelect(ge('add_city'), ge('row_add_city'), citySelectParams);
    
addBox.uiAddCountry = new CountrySelect(ge('add_country'), ge('row_add_country'), {
      
width200,
      
progressBar'add_box_progress',
      
countrycountry_val,
      
citySelectaddBox.uiAddCity
    
});
  },

  
addToDB: function(objid) {
    
cur.addBox showBox('al_profileEdit.php', {act'a_add_' obj '_box'idid});
    return 
false;
  },

  
addUniversityToDB: function(id) {
    return 
this.addToDB('university'id);
  },

  
addFacultyToDB: function(id) {
    return 
this.addToDB('faculty'id);
  },

  
addChairToDB: function(id) {
    return 
this.addToDB('chair'id);
  },

  
addSchoolToDB: function(id) {
    return 
this.addToDB('school'id);
  },


  
addUniversity: function() {
    if (
cur.unisCount >= 9) {
      return 
false;
    }
    var 
new_uni = {
      
id: -(++cur.globalCounter),
      
countrycur.primary_uni.country,
      
country_valcur.primary_uni.country_val,
      
citycur.primary_uni.city,
      
city_valcur.primary_uni.city_val
    
};
    
ge('unis').appendChild(this.genUniRow(new_uni.id));
    
new_uni this.initUniRow(new_uni);
    
cur.unis.push(new_uni);
    ++
cur.unisCount;
    if (
cur.unisCount >= 9) {
      
hide('add_uni_link');
    }
    
show('unis');
    return 
false;
  },

  
addSchool: function() {
    if (
cur.schoolsCount >= 7) {
      return 
false;
    }
    var 
new_school = {
      
id: -(++cur.globalCounter),
      
countrycur.primary_uni.country,
      
country_valcur.primary_uni.country_val,
      
citycur.primary_uni.city,
      
city_valcur.primary_uni.city_val
    
};
    
ge('schools').appendChild(this.genSchoolRow(new_school.id));
    
new_school this.initSchoolRow(new_school);
    if (!
cur.schools.length) { // else cannot add schools if there are no schools yet
      
cur.schools = new Array();
    }
    
cur.schools.push(new_school);
    ++
cur.schoolsCount;
    if (
cur.schoolsCount >= 7) {
      
hide('add_school_link');
    }
    return 
false;
  },

  
getIndex: function(dataid) {
    for (var 
0data.length; ++i) {
      if (
data[i].id == id) {
        return 
i;
      }
    }
    return 
false;
  },

  
deleteUniversity: function(id) {
    --
cur.unisCount;
    
show('add_uni_link');
    if (
intval(ge('u_university' id).value) || (id 0)) {
      
hide('uni_content' id);
      
ge('uni_deleted' id).firstChild.innerHTML getLang('profileEdit_uni_will_be_deleted');
      
show('uni_deleted' id);
    } else {
      var 
index this.getIndex(cur.unisid);
      
cur.unis[index] = cur.unis[cur.unis.length 1];
      
cur.unis.pop();
      
ge('uni' id).parentNode.removeChild(ge('uni' id));
      if (
cur.unis.length == 0) {
        
hide('unis');
      }
    }
    return 
false;
  },

  
restoreUniversity: function(id) {
    if (
cur.unisCount >= 9) {
      return 
false;
    }
    
hide('uni_deleted' id);
    
show('uni_content' id);
    ++
cur.unisCount;
    if (
cur.unisCount >= 9) {
      
hide('add_uni_link');
    }
    return 
false;
  },

  
deleteSchool: function(id) {
    --
cur.schoolsCount;
    
show('add_school_link');
    if (
intval(ge('s_school' id).value) || (id 0)) {
      
hide('school_content' id);
      
ge('school_deleted' id).firstChild.innerHTML getLang('profileEdit_school_will_be_deleted');
      
show('school_deleted' id);
    } else {
      var 
index this.getIndex(cur.schoolsid);
      
cur.schools[index] = cur.schools[cur.schools.length 1];
      
cur.schools.pop();
      
ge('school' id).parentNode.removeChild(ge('school' id));
      if (
cur.schools.length == 0) {
        
this.addSchool();
      }
    }
    return 
false;
  },

  
restoreSchool: function(id) {
    if (
cur.schoolsCount >= 7) {
      return 
false;
    }
    
hide('school_deleted' id);
    
show('school_content' id);
    ++
cur.schoolsCount;
    if (
cur.schoolsCount >= 7) {
      
hide('add_school_link');
    }
    return 
false;
  },

  
addFields: function() {
    var 
params arguments[0];
    var 
prefix arguments[1];
    var 
key arguments[2];
    var 
id arguments[3];
    for (var 
4arguments.length; ++i) {
      if (
intval(ge(prefix '_' arguments[i] + id).value)) {
        
params[key arguments[i]] = ge(prefix '_' arguments[i] + id).value;
      }
    }
    return 
params;
  },

  
addTextFields: function() {
    var 
params arguments[0];
    var 
prefix arguments[1];
    var 
key arguments[2];
    var 
id arguments[3];
    for (var 
4arguments.length; ++i) {
      if (
ge(prefix '_' arguments[i] + id).value.length) {
        
params[key arguments[i]] = ge(prefix '_' arguments[i] + id).value;
      }
    }
    return 
params;
  },

  
addUniParams: function(paramsunikey) {
    
params[key 'id'] = uni.id;
    if (
isVisible('uni_content' uni.id) && intval(ge('u_university' uni.id).value)) {
      
params this.addFields(params'u'keyuni.id'country''city''university',
                                                   
'faculty''chair''edu_form',
                                                   
'edu_status''graduation');

      
params this.addTextFields(params'u'key 'custom_'uni.id '_custom''university',
                                                                               
'faculty',
                                                                               
'chair');
    } else if (
uni.id 0) {
      
params[key 'deleted'] = 1;
    }
    return 
params;
  },

  
addSchoolParams: function(paramsschoolkey) {
    
params[key 'id'] = school.id;
    if (
isVisible('school_content' school.id) && intval(ge('s_school' school.id).value)) {
      
params this.addFields(params's'keyschool.id'country''city''school',
                                                      
'start''finish',
                                                      
'graduation''class');
      
params this.addTextFields(params's'key 'custom_'school.id '_custom''school',
                                                                                  
'spec');
    } else if (
school.id 0) {
      
params[key 'deleted'] = 1;
    }
    return 
params;
  },

  
saveEducation: function(btn) {
    var 
doneHandler false;
    if (
isVisible('uni')) {
      var 
params = {act'a_save_education_uni'};
      
params this.addUniParams(paramscur.primary_uni'primary_uni');
      for (var 
0cur.unis.length; ++i) {
        
params this.addUniParams(paramscur.unis[i], 'uni' i);
      }

      
doneHandler = function(response) {
        var 
to_remove = [];
        var 
all_unis ge('unis');
        for (var 
0cur.unis.length; ++i) {
          var 
new_uni response['res' i];
          if (
intval(new_uni.id)) {
            
cur.unis[i] = this.updateUni(cur.unis[i], new_uniall_unis);
          } else {
            
to_remove.push(i);
          }
        }
        for (var 
0to_remove.length; ++i) {
          var 
index to_remove[i];
          
ge('uni' cur.unis[index].id).parentNode.removeChild(ge('uni' cur.unis[index].id));
          
cur.unis[index] = cur.unis[cur.unis.length 1];
          for (var 
1to_remove.length; ++j) {
            if (
to_remove[j] == cur.unis.length 1) {
              
to_remove[j] = index;
            }
          }
          
cur.unis.pop();
        }
        if (!
cur.unis.length) {
          
hide('unis');
        }
        
cur.unisCount cur.unis.length;
        if (
cur.unisCount >= 9) {
          
hide('add_uni_link');
        } else {
          
show('add_uni_link');
        }
        
cur.primary_uni this.updateUni(cur.primary_uniresponse['res-1'], ge('primary_uni'), true);
      }
    } else {
      var 
params = {act'a_save_education_school'};
      for (var 
0cur.schools.length; ++i) {
        
params this.addSchoolParams(paramscur.schools[i], 'school' i);
      }

      
doneHandler = function(response) {
        var 
to_remove = [];
        for (var 
0cur.schools.length; ++i) {
          var 
new_school response['res' i];
          if (
intval(new_school.id)) {
            
cur.schools[i] = this.updateSchool(cur.schools[i], new_schoolge('schools'));
          } else {
            
to_remove.push(i);
          }
        }
        for (var 
0to_remove.length; ++i) {
          var 
index to_remove[i];
          
ge('school' cur.schools[index].id).parentNode.removeChild(ge('school' cur.schools[index].id));
          
cur.schools[index] = cur.schools[cur.schools.length 1];
          for (var 
1to_remove.length; ++j) {
            if (
to_remove[j] == cur.schools.length 1) {
              
to_remove[j] = index;
            }
          }
          
cur.schools.pop();
        }
        
cur.schoolsCount cur.schools.length;
        if (
cur.schoolsCount >= 7) {
          
hide('add_school_link');
        } else {
          
show('add_school_link');
        }
        if (!
cur.schoolsCount) {
          
this.addSchool();
        }
      }
    }
    
params.hash ge('hash').value;

    
ajax.post('al_profileEdit.php'params, {
      
onDone: function (uni_data) {
        
doneHandler.call(ProfileEditorEduuni_data);
        
ProfileEditor.showMsg(getLang('profileEdit_unis_saved'));
      },
      
showProgresslockButton.pbind(btn),
      
hideProgressunlockButton.pbind(btn)
    });
    return 
false;
  },

  
updateUni: function(old_uninew_uniparentno_delete) {
    if (
old_uni.uiUniversity.val() == -&& new_uni.university.id) {
      
selectsData.addUniversity(old_uni.uiCity.val(), [new_uni.university.idnew_uni.university.name]);
      if (
new_uni.faculty.id) {
        
selectsData.setUniversityInfo(new_uni.university.id, {completed_faculties0faculties: [[new_uni.faculty.idnew_uni.faculty.name]]});
        if (
new_uni.chair.id) {
          
selectsData.setFacultyInfo(new_uni.faculty.id, {completed_chairs0chairs: [[new_uni.chair.idnew_uni.chair.name]]});
        } else {
          
selectsData.setFacultyInfo(new_uni.faculty.id, {completed_chairs0chairs: []});
        }
      } else {
        
selectsData.setUniversityInfo(new_uni.university.id, {completed_faculties0faculties: []});
      }
    } else if (
old_uni.uiFaculty.val() == -&& new_uni.faculty.id) {
      
selectsData.addFaculty(new_uni.university.id, [new_uni.faculty.idnew_uni.faculty.name]);
      if (
new_uni.chair.id) {
        
selectsData.setFacultyInfo(new_uni.faculty.id, {completed_chairs0chairs: [[new_uni.chair.idnew_uni.chair.name]]});
      } else {
        
selectsData.setFacultyInfo(new_uni.faculty.id, {completed_chairs0chairs: []});
      }
    } else if (
old_uni.uiChair.val() == -&& new_uni.chair.id) {
      
selectsData.addChair(new_uni.faculty.id, [new_uni.chair.idnew_uni.chair.name]);
    }

    
old_uni.country old_uni.uiCountry.val();
    
old_uni.country_val old_uni.uiCountry.val_full();
    
old_uni.city old_uni.uiCity.val();
    
old_uni.city_val old_uni.uiCity.val_full();
    
old_uni.university new_uni.university.id;
    
old_uni.faculty new_uni.faculty.id;
    
old_uni.chair new_uni.chair.id;
    
old_uni.edu_form old_uni.uiEducationForm.val();
    
old_uni.edu_status old_uni.uiEducationStatus.val();
    
old_uni.graduation old_uni.uiGraduation.val();

    var 
new_elem this.genUniRow(new_uni.idno_delete);
    var 
old_elem ge('uni' old_uni.id);
    
old_uni.id new_uni.id;
    
new_uni this.initUniRow(old_uninew_elem);
    
parent.replaceChild(new_elemold_elem);

    return 
new_uni;
  },

  
updateSchool: function(old_schoolnew_schoolparent) {
    if (
old_school.uiSchool.val() == -&& new_school.school.id) {
      
selectsData.addSchool(old_school.uiCity.val(), [new_school.school.idnew_school.school.name]);
    }

    
old_school.country old_school.uiCountry.val();
    
old_school.country_val old_school.uiCountry.val_full();
    
old_school.city old_school.uiCity.val();
    
old_school.city_val old_school.uiCity.val_full();
    
old_school.school new_school.school.id;
    
old_school.start old_school.uiStart.val();
    
old_school.finish old_school.uiFinish.val();
    
old_school.graduation old_school.uiGraduation.val();
    
old_school.school_class old_school.uiClass.val();
    
old_school.spec ge('s_spec' old_school.id '_custom').value;

    var 
new_elem this.genSchoolRow(new_school.id);
    var 
old_elem ge('school' old_school.id);
    
old_school.id new_school.id;
    
new_school this.initSchoolRow(old_schoolnew_elem);
    
parent.replaceChild(new_elemold_elem);

    return 
new_school;
  },

  
uniChanged: function(uni) {
    return !
isVisible('uni_content' uni.id) ||
           
uni.country != uni.uiCountry.val() || uni.city != uni.uiCity.val() ||
           
uni.university != uni.uiUniversity.val() || uni.faculty != uni.uiFaculty.val() ||
           
uni.chair != uni.uiChair.val() || uni.edu_form != uni.uiEducationForm.val() ||
           
uni.edu_status != uni.uiEducationStatus.val() || uni.graduation != uni.uiGraduation.val();
  },

  
schoolChanged: function(school) {
    return !
isVisible('school_content' school.id) ||
           
school.country != school.uiCountry.val() || school.city != school.uiCity.val() ||
           
school.school != school.uiSchool.val() || school.start != school.uiStart.val() ||
           
school.finish != school.uiFinish.val() || school.graduation != school.uiGraduation.val() ||
           
school.school_class != school.uiClass.val() || school.spec != ge('s_spec' school.id '_custom').value;
  }
};

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