-function check_right_number_format(input_name) {
-// if(thpoint) {
-// if(thpoint == ','){
-// var thnumbers = input_name.value.split(',');
-// thnumbers[thnumbers.length-1] = thnumbers[thnumbers.length-1].substring((thnumbers[thnumbers.length-1].lastIndexOf(".") !== -1 ? thnumbers[thnumbers.length-1].lastIndexOf(".") : thnumbers[thnumbers.length-1].length), 0);
-// }
-// else{
-// var thnumbers = input_name.value.split('.');
-// thnumbers[thnumbers.length-1] = thnumbers[thnumbers.length-1].substring((thnumbers[thnumbers.length-1].lastIndexOf(",") !== -1 ? thnumbers[thnumbers.length-1].lastIndexOf(",") : thnumbers[thnumbers.length-1].length), 0);
-// }
-//
-// for(var i = 0; i < thnumbers.length; i++) {
-// if(i == 0 && thnumbers[i].length > 3) {
-// return show_alert_and_focus(input_name, wrongNumberFormat);
-// }
-// if(i > 0 && thnumbers[i].length != 3) {
-// return show_alert_and_focus(input_name, wrongNumberFormat);
-// }
-// }
-// }
- if(decpoint == thpoint) {
- return show_alert_and_focus(input_name, wrongNumberFormat);
- }
- if(decpoint == ',') {
- var decnumbers = input_name.value.split(',');
- }
- else {
- var decnumbers = input_name.value.split('.');
- }
- if(decnumbers.length == 2) {
- if(decnumbers[1].length > 2) {
- return show_alert_and_focus(input_name, wrongNumberFormat);
- }
- }
- else {
- if(decnumbers.length > 2) {
- return show_alert_and_focus(input_name, wrongNumberFormat);
- }
- if(!thpoint) {
- if(decnumbers[0].match(/\D/)) {
- return show_alert_and_focus(input_name, wrongNumberFormat);
- }
- }
- }
+function focussable(e) {
+ return e && e.name && e.type != 'hidden' && e.type != 'submit' && e.disabled != true;
+}
+
+function set_cursor_to_first_element(){
+ var df = document.forms;
+ for (var f = 0; f < df.length; f++)
+ for (var i = 0; i < df[f].length; i++)
+ if (focussable(df[f][i]))
+ try { df[f][i].focus(); return } catch (er) { }
+}
+
+function getElementByIndirectName(name){
+ var e = document.getElementsByName(name)[0];
+ if (e) return document.getElementsByName(e.value)[0];