var ResizeIframe = {    
  wrapperId : "tinc_content",
  containers : [],
                
  resize : function ( oDoc, sId ) 
  {
    var iframeDoc = oDoc.getElementById( sId ).contentWindow.document;
    if ( iframeDoc == null ) return;
    //if ( this.containers[sId] ) return;
    //this.containers[sId] = true;
    
    // Images which are delivered by tinc jobs need to be routed over the proxy for the content modules
    /*var imgs = iframeDoc.getElementsByTagName( "img" );
    for ( var i = 0; i < imgs.length; i++ )
    {
      if ( imgs[i].src.indexOf( "/tinc" ) != -1 && imgs[i].src.indexOf( "/spicon") == -1 ) 
      {
        imgs[i].src = '/xml/wfxdirect/proxy' + top.application.getUserApplication().getJSessionId() + '?' + imgs[i].src.substring( imgs[i].src.indexOf( '?' ) + 1 );
      }
    }*/
    
    if ( window.addEventListener )
    {
      var pv = iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue;
      var height = iframeDoc.body.clientHeight
      + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "margin-top" ) )
      + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "margin-bottom" ) )
      + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "padding-top" ) )
      + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "padding-bottom" ) );
    } else if ( window.attachEvent ) {
      var wrapper = iframeDoc.getElementById( this.wrapperId );
      if ( wrapper == null ) return;
      wrapper.style.height = "0px"; 
      var bodystyle = iframeDoc.body.style;
      var height = wrapper.offsetHeight + wrapper.offsetTop + 1;
    }
    oDoc.getElementById( sId ).setAttribute("height", height);    
  }
};

