Lines 147-202
function Dopopguarantor(link) {
Link Here
|
147 |
var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top'); |
147 |
var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top'); |
148 |
} |
148 |
} |
149 |
|
149 |
|
150 |
function CalculateAge() { |
150 |
function CalculateAge(dateofbirth) { |
151 |
var hint = $("#dateofbirth").siblings(".hint").first(); |
|
|
152 |
hint.html(dateformat); |
153 |
|
154 |
if (dformat == 'metric' && false === CheckDate(document.form.dateofbirth)) { |
155 |
return; |
156 |
} |
157 |
|
158 |
if (!$("#dateofbirth").datepicker( 'getDate' )) { |
159 |
return; |
160 |
} |
161 |
|
162 |
var today = new Date(); |
151 |
var today = new Date(); |
163 |
var dob = new Date($("#dateofbirth").datepicker( 'getDate' )); |
152 |
var dob = Date_from_syspref(dateofbirth) |
164 |
|
153 |
var age = new Object(); |
165 |
var nowyear = today.getFullYear(); |
|
|
166 |
var nowmonth = today.getMonth(); |
167 |
var nowday = today.getDate(); |
168 |
|
154 |
|
169 |
var birthyear = dob.getFullYear(); |
155 |
age.year = today.getFullYear() - dob.getFullYear(); |
170 |
var birthmonth = dob.getMonth(); |
156 |
age.month = today.getMonth() - dob.getMonth(); |
171 |
var birthday = dob.getDate(); |
157 |
var day = today.getDate() - dob.getDate(); |
172 |
|
|
|
173 |
var year = nowyear - birthyear; |
174 |
var month = nowmonth - birthmonth; |
175 |
var day = nowday - birthday; |
176 |
|
158 |
|
177 |
if(day < 0) { |
159 |
if(day < 0) { |
178 |
month = parseInt(month) -1; |
160 |
age.month = parseInt(age.month) -1; |
179 |
} |
|
|
180 |
|
181 |
if(month < 0) { |
182 |
year = parseInt(year) -1; |
183 |
month = 12 + month; |
184 |
} |
161 |
} |
185 |
|
162 |
|
186 |
var age_string; |
163 |
if(age.month < 0) { |
187 |
if (year || month) { |
164 |
age.year = parseInt(age.year) -1; |
188 |
age_string = _('Age: '); |
165 |
age.month = 12 + age.month; |
189 |
} |
|
|
190 |
if (year) { |
191 |
age_string += _(year > 1 ? '%s years ' : '%s year ').format(year); |
192 |
} |
166 |
} |
193 |
|
167 |
|
194 |
if (month) { |
168 |
return age; |
195 |
age_string += _(month > 1 ? '%s months ' : '%s month ').format(month); |
|
|
196 |
} |
197 |
|
198 |
hint.html(age_string); |
199 |
|
200 |
} |
169 |
} |
201 |
|
170 |
|
202 |
$(document).ready(function(){ |
171 |
$(document).ready(function(){ |