/**
* jbasic.js
* author: dirk kirchner
*
* warning: all functions inside this document requires jQuery! ;-)
*/
/**
* jQuery libLoader
*/
var libLoader = {
    
  require: function(l)
  {
        document.write('<script type="text/javascript" src="' + l + '"></script>');
    },
    load: function() 
  {    
        $('script').each( function() {
      if ( $(this).attr('src').indexOf('jbasic.js') != -1 ) 
      {
                var p = $(this).attr('src').replace(/jbasic\.js(\?.*)?$/, '' );        
                var i = $(this).attr('src').split('=')[ 1 ].split(',');        
        for ( var ___i = 0; ___i < i.length; ___i++ )
                  libLoader.require(p + i[ ___i ] + '.js');       
            }
        });
    }
}
libLoader.load();


// if dom ready...
$(document).ready(function() {
   $('#content h5').wrap('<a href="#" class="faq"></a>');
  $('#content div').hide();
  $('a.faq').click().toggle( 
    function () {
      $(this).next().slideDown('100', function () { $(this).prev().removeClass().addClass('faq_active') } );
    },
    function () {
      $(this).next().slideUp('100', function () { $(this).prev().removeClass().addClass('faq') } );
    }
  );
  /**
 
  /*
   management toggle...
  
  $('div.col565lborder div[h5]').each( function () {
    $(this).children('p:eq(2)').before('<div class="mtc"></div><div class="pictureLegend">[ <a href="#">mehr lesen</a> ]</div>');
    $(this).children('p:gt(1)').prependTo( $(this).children('div.mtc') );
    $(this).children('div.mtc').hide();
  });
  $('div.pictureLegend a').click().toggle(
    function() {
      $(this).parent().prev().slideDown('slow', function () {
        $(this).next().children().text('einklappen');
      });
    },
    function() {
      $(this).parent().prev().slideUp('slow', function () { 
        $(this).next().children().text('mehr lesen');
      });
    }
  );
 */
  
  /**
  * thickbox trick...
  */
  var now = new Date();
  if( now.getYear() == '108' || now.getYear() == '2008' ) 
  {
    $('a.thickbox').attr('href', 'https://meine.norisbank.de/mod/WebObjects/nb.woa').removeClass('thickbox');        
  }
  else
  {
    $('a.thickbox').attr('href', ( self.location.href.indexOf('?') != -1 ? self.location.href.substring(0, self.location.href.indexOf('?') ) : '' ) + '#TB_inline?height=520&amp;width=734&amp;inlineId=hiddenModalContent');
  }
    
   

 
   
    function mP(v){
        var arr = v.toString().split('');
        var r = '';
        for (var i = 0; i < arr.length; i++) 
            r += i != arr.length - 3 ? arr[i] : '.' + arr[i];
        return r;
    }
    

    
    function myK(x){
        x = x.toString();
        if (x < 100) 
            return x.split('')[0] + ',' + x.split('')[1];
        else 
            return x.split('')[0] + x.split('')[1] + ',' + x.split('')[2];
    }
});
