-<script type="text/javascript">//<![CDATA[
-{literal}
-function removeObject(id, pref)
-{
- document.getElementById(id).style.display = "none";
- document.forms.prof_annu[pref + "[removed]"].value = "1";
-}
-
-function restoreObject(id, pref)
-{
- document.getElementById(id).style.display = '';
- document.forms.prof_annu[pref + "[removed]"].value = "0";
-}
-
-function getAddressElement(adrid, adelement)
-{
- return document.forms.prof_annu["addresses[" + adrid + "][" + adelement + "]"];
-}
-
-function checkCurrentAddress(newCurrent)
-{
- var hasCurrent = false;
- var i = 0;
- while (getAddressElement(i, 'pub') != null) {
- var radio = getAddressElement(i, 'current');
- var removed = getAddressElement(i, 'removed');
- if (removed.value == "1" && radio.checked) {
- radio.checked = false;
- } else if (radio.checked && radio != newCurrent) {
- radio.checked = false;
- } else if (radio.checked) {
- hasCurrent = true;
- }
- i++;
- }
- if (!hasCurrent) {
- i = 0;
- while (getAddressElement(i, 'pub') != null) {
- var radio = getAddressElement(i, 'current');
- var removed = getAddressElement(i, 'removed');
- if (removed.value != "1") {
- radio.checked= true;
- return;
- }
- i++;
- }
- }
-}
-
-function removeAddress(id, pref)
-{
- removeObject(id, pref);
- checkCurrentAddress(null);
- if (document.forms.prof_annu[pref + '[datemaj]'].value != '') {
- document.getElementById(id + '_grayed').style.display = '';
- }
-}
-
-function restoreAddress(id, pref)
-{
- document.getElementById(id + '_grayed').style.display = 'none';
- checkCurrentAddress(null);
- restoreObject(id, pref);
-}
-
-function addAddress()
-{
- var i = 0;
- while (getAddressElement(i, 'pub') != null) {
- i++;
- }
- $("#add_adr").before('<div id="addresses_' + i + '_cont"></div>');
- Ajax.update_html('addresses_' + i + '_cont', 'profile/ajax/address/' + i, checkCurrentAddress);
-}
-
-function addTel(id)
-{
- var i = 0;
- var adid = 'addresses_' + id;
- var tel = adid + '_tel_';
- while (document.getElementById(tel + i) != null) {
- i++;
- }
- $('#' + adid + '_add_tel').before('<div id="' + tel + i + '" style="clear: both"></div>');
- Ajax.update_html(tel + i, 'profile/ajax/tel/' + id + '/' + i);
-}
-
-function validGeoloc(id, pref)
-{
- document.getElementById(id + '_geoloc').style.display = 'none';
- document.getElementById(id + '_geoloc_error').style.display = 'none';
- document.getElementById(id + '_geoloc_valid').style.display = 'none';
- document.forms.prof_annu[pref + "[parsevalid]"] = "1";
- document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
- attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
- function() { document.forms.prof_annu[pref + "[text]"].blur(); });
- document.forms.prof_annu[pref + "[text]"].className = '';
-}
-
-function validAddress(id, pref)
-{
- document.getElementById(id + '_geoloc').style.display = 'none';
- document.getElementById(id + '_geoloc_error').style.display = 'none';
- document.getElementById(id + '_geoloc_valid').style.display = 'none';
- document.forms.prof_annu[pref + "[parsevalid]"] = "0";
- attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
- function() { document.forms.prof_annu[pref + "[text]"].blur(); });
- document.forms.prof_annu[pref + "[text]"].className = '';
-}
-
-{/literal}
-//]]></script>
-
-{foreach key=i item=adr from=$addresses}