<script type="text/javascript">  
  function setScrollBar()
  {     
    try {      
      var elementWorkingArea = document.getElementById('UIWorkingArea');          
      var parent = document.getElementById('TabContainerParent'); 
      if(parent!=null) {
        var elements  = eXo.core.DOMUtil.findDescendantsByClass(parent,"div", "UITabContent"); 
        if(elements!=null) {      
	  			    for(i=0;i<elements.length;i++) {    
	    			    var obj = elements[i];        
	    			    if(obj.style.display!="none") {
	      			    var height = obj.offsetHeight;           
	      			    if(height>430) {
	      			  	  //obj.style.height="470px";
	      				     obj.style.height=elementWorkingArea.offsetHeight-50+"px";
	        			    obj.style.overflow="auto";
	     	       }
	  				     }
					     }
				    } 
      }     
    }
    catch(err) {}
  } 
  window.setTimeout('setScrollBar',1000); 
</script>
<%
  import org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer;
  def rcontext = _ctx.getRequestContext();
  def jsManager = rcontext.getJavascriptManager(); 
  jsManager.addOnLoadJavascript("setScrollBar()");
  if(uicomponent.isShowViewFile() && !uicomponent.isJcrEnable()) {
%>
<div class="UIResizableBlock" style="padding:10px;">
	<%if(uicomponent.isDisplayOptionBlockPanel()) {%>
    <div style="display: block;float:left; width: 70%;">
  <%}%>
	<div class="UITabPane" id="$uicomponent.id">
		  <div class="TabPaneContent">
		    <div class="WorkingAreaWithHelp">
		      <div class="UIHorizontalTabs">
		        <div class="LeftHorizontalTabs">
			     	  <div class="RightHorizontalTabs">
			     	    <div class="CenterHorizontalTabs">
					        <div class="TabsContainer">
					          <%
					            for(uiChild in uicomponent.getChildren()) {
					              String style = "NormalTab" ;
					              String tabId = uiChild.getId();		
					              if(tabId.indexOf("OptionBlock")>=0)	continue;	              
					              String paneId = uicomponent.getId();
					              if(uiChild.isRendered()) style = "SelectedTab" ;
					          %>
					            <div class="UITab NormalTabStyle">
					              <div class="$style">
					                <div class="LeftTab">
					                  <div class="RightTab">                
					                  <div id="$tabId" class="MiddleTab" onClick="<%=uicomponent.event("ChangeTab"  ,tabId)%>"><%=_ctx.appRes("UITabPane.title." + uiChild.getId());%></div>
					                  </div>
					                </div>
					              </div>
					            </div>              
					          <%}%>
					        </div>
					      </div>
					    </div>
					  </div>
		      </div>
		      <div class="UITabContentContainer" id="TabContainerParent">
		        <%
		          for(uiChild in uicomponent.getChildren()) { 
		            String display = "none" ;
		            if(uiChild.isRendered()) display="block" ;
		            println "<div class=\"UITabContent\" id=\"UITabContent\" style=\"display: $display;overflow:auto;\">" ;
		            uicomponent.renderUIComponent(uiChild) ;
		            println "</div>" ;
		          }
		        %>
		      </div>  
		    </div>  
		  </div>  
		</div> 
	</div>
<%

  if(uicomponent.isDisplayOptionBlockPanel()) {
    for(uiChild in uicomponent.getChildren()) { 
      String width = "30%";	  
      if(uiChild.getId().indexOf("OptionBlock")<0) continue;
      String display = "block" ;	     	
      println "<div style=\"display: $display;float:left; width: $width;\">" ;
      uicomponent.renderUIComponent(uiChild) ;
      println "</div>" ;
    }
    print "<div style=\"clear: both;\"><span></span></div>";
  }
%>

<%
  } else { 
    if(uicomponent.isDocumentNode() && uicomponent.isDisplayOptionBlockPanel()) {	
      print "<div id=\"$uicomponent.id\" style=\"padding:8px;\">";	    
      for(uiChild in uicomponent.getChildren()) {		      
        if(uiChild.getId()=="UIDocumentWithTree") continue;
        String width = "70%";	  
        if(uiChild.getId() != "UIDocumentInfo") {
          width = "30%";
        }
        String display = "none" ;		   		
        if(uiChild.isRendered() || uiChild.getId().indexOf("OptionBlock")>=0) display="block" ;		     	
        println "<div style=\"display: $display;float:left; width: $width;\">" ;
        uicomponent.renderUIComponent(uiChild) ;
        println "</div>" ;
      }		
      print "</div>"; 
    } else {			
      print "<div id=\"$uicomponent.id\">";	
      uicomponent.renderChild("UIDocumentInfo") ;
      print "</div>";
    }
  }
%>	
