  $( function(){
      
      if(parent != window ){
        //to oznacza ze jestesmy w ramce
        $('#leftSlice').remove();
        $('#ListFrame').css( 'margin' , 0 );
      }
      
      ResizeLayout();
      $(window).resize( ResizeLayout );  
      EnableTabControl();
      

      
  
  }); //INIT--------------------------------------------------------------------

  function EnableTabControl(){
  
        $('#IframeControl').draggable({
        axis: 'y',
        helper: 'clone',
         stop: function(event, ui) {
          var h = parseInt(ui.offset.top);
          $('#mainbody').css('overflow', 'hidden');
          var bh = $(window).height();
          var bw = $(window).width();
          var LF = $('#ListFrame');
          var CF = $('#ContentFrame');
          var CI = $('#ContentIframe');
          LF.height( h -15 );
          CF.height( bh - h +10 )
          CI.height( bh - h +10 )
          LF.find('.FrameInner:first').height( h -52)
        }

      
      });
  }

  function ResizeLayout(){
   
    //coby nie bylo paskow przewikania
    
    var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
    if (!is_chrome) $('#mainbody').css('overflow', 'hidden'); //chrome tego nie lubi
    $('body:first').hide();
    var bw = $(window).width();
    var bh = $(window).height();
    $('body:first').show();
    
    var LF = $('#ListFrame');
    var CF = $('#ContentFrame');
    var ls = $('#leftSlice').width();

    LF.width( bw - ls -6 );
    $('#leftSlice').height( bh );

    
    if ( CF.length == 1 ){ //sprawdzamy czy jest wogóle ramka podgladu
      CF.width( bw - ls -5 );
      LF.height( bh / 2 );
      LF.find('.FrameInner:first').height( bh / 2 -38)
      CF.height( bh / 2 - 5 );
      CF.find('iframe').height( bh / 2 - 45)
    }
    else {
      if( $.browser.msie == false )LF.height( bh -2 );
      if( $.browser.msie == false )LF.find('.FrameInner:first').height( bh -40);
    }
    
  }//---------------------------------------------------------------------------

function LoadContent( link ){

    var CF = $('#ContentFrame');
    if ( CF.length == 0 ){
      CF = $('<div id="ContentFrame"><div id="IframeControl"></div><iframe id="ContentIframe" src="loading.htm" frameborder="0">brak obslugi ramek</iframe></div>');
      $('body').append(CF);
      EnableTabControl();
    }
    ResizeLayout();
    CF.find('iframe').attr("src",link);
    return false;
    
  }//---------------------------------------------------------------------------

