<%
	/**
	 * Created by The eXo Platform SARL
	 * Author : Tran The Trong
	 *					trongtt@gmail.com
	 * Aug 11, 2006
	 * version: $Id$
	 */
%>
<%
	boolean showCloseButton =	uicomponent.isShowCloseButton();
	String popupId = uicomponent.getId();
	String rsId = popupId;
	if(popupId.indexOf('-')>0){
		rsId = popupId.substring(0,popupId.lastIndexOf('-'));
	} 	

	String title = rsId;
	def component = uicomponent.getUIComponent();
	if (component != null) {
		title = _ctx.appRes(rsId + ".title."+ org.exoplatform.webui.application.WebuiRequestContext.stripUUIDSuffix(component.getId()));
	}
	
	def width = uicomponent.getWindowWidth();
	def height = uicomponent.getWindowHeight() - 40;
	def String widthStyle = "";
	def String heightStyle = "";
	if(width > 0) widthStyle = "width:" + width + "px;";
	if(height < 0) height = null;
	String show = "none";
	def rcontext = _ctx.getRequestContext();
  def module = rcontext.getJavascriptManager().require("SHARED/uiPopupWindow", "uiPopupWindow");
	if(uicomponent.isShow()) {
	   module.addScripts("uiPopupWindow.show('$popupId', $uicomponent.showMask, null, $height);");
	} else if (rcontext.useAjax()) {
	   module.addScripts("uiPopupWindow.hide('$popupId', $uicomponent.showMask, null, $height);");
	}
%>

<div class="UIPopupWindow uiPopup UIDragObject NormalStyle" exo:minWidth="200" exo:minHeight="200" id="$popupId" style="$widthStyle display: $show;">
	<div class="popupHeader clearfix">
		<%if (showCloseButton) {%>
			<a class="uiIconClose pull-right" title="<%=_ctx.appRes("UIPopupWindow.Close")%>" onclick="<%=uicomponent.event(uicomponent.getCloseEvent())%>"></a>
		<% } %>
		<span class="PopupTitle popupTitle"><%=_ctx.appRes(rsId + ".title."+ title)%></span>
	</div>
	<div class="PopupContent popupContent"><% uicomponent.renderChildren(); %></div>
	
	<%if (uicomponent.isResizable()) {%>
		<span class="uiIconResize pull-right uiIconLightGray"></span>
	<%}%>
</div>
