<%--
  ADOBE CONFIDENTIAL

  Copyright 2012 Adobe Systems Incorporated
  All Rights Reserved.

  NOTICE:  All information contained herein is, and remains
  the property of Adobe Systems Incorporated and its suppliers,
  if any.  The intellectual and technical concepts contained
  herein are proprietary to Adobe Systems Incorporated and its
  suppliers and may be covered by U.S. and Foreign Patents,
  patents in process, and are protected by trade secret or copyright law.
  Dissemination of this information or reproduction of this material
  is strictly forbidden unless prior written permission is obtained
  from Adobe Systems Incorporated.
--%>
<%@page import="javax.jcr.PathNotFoundException"%>
<%@page session="false" %>
<%@page import="com.day.cq.dam.api.s7dam.constants.S7damConstants,
				com.day.cq.dam.api.Rendition,
				com.day.cq.dam.video.VideoConstants,
				javax.jcr.Node,
				java.util.StringTokenizer,
				java.util.HashMap,
				java.util.Iterator,
				java.util.Map,
				org.apache.sling.api.resource.ValueMap,
				java.util.Map.Entry,
				java.util.TreeMap,
				com.day.cq.dam.commons.util.UIHelper" %>
<%

    Iterator<Rendition> it = listRenditions.iterator();
    
    Map<String, Map<String, String>> renditions = new HashMap<String, Map<String, String>>();
    Map<String, Map<String, String>> userrenditions = new HashMap<String, Map<String, String>>();
    Map<String, Map<String, String>> thumbnailrenditions = new HashMap<String, Map<String, String>>();

	Boolean isUGC = false;

    for (;it.hasNext ();) {
        Rendition rend = it.next ();

      	//Do not show text and xml renditions in asset detail view
        if(rend != null && (rend.getName().equals("cqdam.metadata.xml") 
                || rend.getName().equals("cqdam.text.txt"))) {
            continue;
        }

        //Check for the proxy renditions
        boolean isProxyRendition = false;
        Node rendNode =  rend.adaptTo(Node.class);
        if(rendNode != null) {

	        boolean hiddenRendition = false;//To hide some rendition created for internal use i.e. Scene7 PTIFF
	        Node rendContent = null;
	        if(rendNode.hasNode("jcr:content")){
	            rendContent = rendNode.getNode("jcr:content");
	            if(rendContent.hasProperty("rendition.handler.id")){
	                if(!rendContent.getProperty("rendition.handler.id").getValue().getString().equals("jcr.default")){
	                    isProxyRendition = true;
	                }
	            }
	            
	            //To hide Dynamic Media optimized image from static rendition
	            if(S7damConstants.PN_S7_PTIFF_RENDITION_NAME.equals(rendNode.getName())){
	                hiddenRendition = true;
	            }
	        }

            String rendPath = rendNode.getPath();
	        String href =  rendPath;
	        if (rend.getResourceType().equals("cq:Page")){
	            href = rendPath +".html";
	        }
	        if(isProxyRendition){
	            href = "/libs/dam/gui/components/admin/resources/white_1x1.png";
	        }
	        if(rend!=null){
	        	Boolean isVideoPreset = false;
	            Boolean hasHTMLType = false;
	            String name = "";
	            String bitrate = "";
	            String width = "";
	            String height = "";
	            String type = "";
	            String rendName = rend.getName();
	            long rendSize = 0;
	            
	            StringTokenizer st = new StringTokenizer(rendName, ".");
	            String[] shots = new String[st.countTokens()];
	            int i = 0;
	            while(st.hasMoreTokens()){
	                shots[i++] = st.nextToken();
	            }
	            
	            if (shots.length == 0) {
	                continue;
	            } else if (shots.length == 1) {
	                name = shots[0];
	            } else if(shots.length > 1){
	                name = shots[0] + " " + shots[1];
	            }
	            
	            if(rendContent.hasNode("metadata")){
	                Node rendMetadata = rendContent.getNode("metadata");
	                hasHTMLType = rendMetadata.hasProperty("htmlType");
	                if(rendMetadata.hasProperty("width") && rendMetadata.hasProperty("height")){
	                    width = rendMetadata.getProperty("width").getString();
	                    height = rendMetadata.getProperty("height").getString();
	                }
	                else if(rendMetadata.hasProperty("tiff:ImageWidth") && rendMetadata.hasProperty("tiff:ImageLength")){
	                    width = rendMetadata.getProperty("tiff:ImageWidth").getString();
	                    height = rendMetadata.getProperty("tiff:ImageLength").getString();
	                }
		            if(isProxyRendition){
	                  if(rendMetadata.hasProperty("width") && rendMetadata.hasProperty("height")){
	//                       width = rendMetadata.getProperty("width").getString();
	//                       height = rendMetadata.getProperty("height").getString();
	                        
	                        if(width.equals("0")) {                            
	                            int w = originalWidth * Integer.parseInt(height) / originalHeight;
	                            width = Integer.toString(w);
	                        }
	                        
	                        if(height.equals("0")) {
	                            int h = originalHeight * Integer.parseInt(width) / originalWidth;
	                            height = Integer.toString(h);
	                        }                        
	                    }
	                }
		            
		            if (rendMetadata.hasProperty("videoEncodingPresetPath")) {
		            	isVideoPreset = true;
		            }
		            
	                if (rendMetadata.hasProperty(VideoConstants.PN_VIDEO_BITRATE)) {
	                    bitrate = rendMetadata.getProperty(VideoConstants.PN_VIDEO_BITRATE).getString();
	                    if (!bitrate.equals("")) {
	                        bitrate += "kbps";
	                    }
	                }
		            
	            } else if (shots.length > 4) {
	            	String width_ = shots[shots.length - 3];
	            	String height_ = shots[shots.length - 2];
	            	
	            	if(width_.matches("[0-9]+") && height_.matches("[0-9]+")) {
	                    width = width_;                 
	                    height = height_;
	            	}
	            } 
	            
	            String mimeType = rend.getMimeType();
	            
	            if (rendName.equals("original")) {
	                type = contentPath.substring(contentPath.lastIndexOf(".") + 1);
	            } else {
	                int index = rendName.lastIndexOf(".");
	                if (index > 0) {
	                    type = rendName.substring(index + 1);
	                }
	            }
	            String unencodedName = name;
	            int unencodedLen = name.length();
	            int typeLength = cfg.get("mimetypelength", Integer.class) != null ? cfg.get("mimetypelength", Integer.class) : 4;
	            String displayType = type;
	            if (displayType.length() > typeLength) {
	                displayType = displayType.substring(0,typeLength-1)+"..";
	            }
	            //for Scene7 Proxy Rendition of MP4 video or dynamic thumnbails, webImage
	            if ((displayType.equalsIgnoreCase("mp4")
                        || displayType.equalsIgnoreCase("webm")
                        || displayType.equalsIgnoreCase("png")
                        || displayType.equalsIgnoreCase("jpeg"))
                                && isProxyRendition) {
	                href = rendPath;
	            }
	            
	            int nameLength = cfg.get("namelength", Integer.class) != null ? cfg.get("namelength", Integer.class) : 16;
	            name = xssAPI.encodeForHTML(name);
	            String displayName = name;
	            if (displayName.indexOf("thumbnail") != -1) {
	                displayName = i18n.get("Thumbnail");
	            } else if (displayName.indexOf("web") != -1) {
	                displayName = i18n.get("Web");
	            } else if (displayName.startsWith("cq5dam")) {
	                displayName = displayName.substring("cq5dam".length() + 1).trim();
	            } else if (displayName.startsWith("cqdam video")) {
	                displayName = i18n.get("Video");
	            }
	            if(unencodedLen > nameLength) {
	                displayName = xssAPI.encodeForHTML(unencodedName.substring(0,nameLength-3))+"...";
	            }
	
	            if (!hiddenRendition) {
	                
	                Map<String, String> rendInfo = new HashMap<String, String>();
	                rendInfo.put("rendName", rendName);
	                String mimetype = rend.getMimeType();
	                String finalLabel = rendName;
	                rendInfo.put("mimeType", mimetype);
	                rendInfo.put("href", href);
	                rendInfo.put("path", rendPath);
	                rendSize = rend.getSize();
	                String size = UIHelper.getSizeLabel(rendSize, slingRequest);
	                rendInfo.put("rendSize", size);
	                
	                /*
	                
	                ENCODES – lists the videos encoded through our system
	                UPLOADS – lists the videos manually uploaded to the system including the ORIGINAL
	                THUMBNAILS – lists the static image thumbnails
	
	                */               
	                boolean isUserGenerated = false;
					boolean isOriginal = rendName.equals("original"); 
					String widxhei = "";
	               
	                 //todo: is there a better way to determine this?
	                 if (!width.equals("")) {
	                     widxhei = width + "x" + height;
	                 } else if(!hasHTMLType){
	                     isUserGenerated = true;
	                     isUGC = true;
	                 }
	
	                 rendInfo.put("finalLabel", rendName.equals("original") ? "" : finalLabel);
	                 rendInfo.put("dimension", rendName.equals("original") ? "" : widxhei);
	                 rendInfo.put("bitrate", rendName.equals("original") ? "" : bitrate);
	                 rendInfo.put("type", rendName.equals("original") ? "" : displayType);
	                 rendInfo.put("isVideoPreset", isVideoPreset.toString());
	
	                 String key = (rendName); 
	                 Boolean isImage = mimetype.startsWith("image");                              
	                 //if video and user uploaded, add to list of video
	                 if (isUserGenerated && !isImage && !isOriginal){
	                     userrenditions.put(key, rendInfo);
	                     //if just our normal encoded rendition, add to rendition list
	                 }else if(!isImage){
	                     renditions.put(key, rendInfo);
	                     //if something else, just put in the general pool of 'thumbnails'
	                 }else{
	                     thumbnailrenditions.put(key, rendInfo);
	                 }
	            }
	        }
	    } else {
	    	
	    	Asset parentasset = rend.getAsset();
	    	String damScene7Type = parentasset.getMetadataValueFromJcr("dam:scene7Type");
	    	boolean isRemoteAsset = false;

	    	if(damScene7Type != null && !(damScene7Type.equals("Video") || damScene7Type.equals("MasterVideo"))){
	    		continue;
	    	}
	    	//todo: for now, just checking this but we need <></>o have a unified vision on how to determine this
	    	if (damScene7Type != null && !damScene7Type.isEmpty()){
	    	    isRemoteAsset = true;
            }
            String finalPath = rend.getPath();
            if (isRemoteAsset){
	    	    //finalPath = rend.getPath();
            }

	    	Map<String, String> rendInfo = new HashMap();
            ValueMap rendition = rend.getProperties();

            if(rendition.get("height") == null || rendition.get("width") == null || rendition.get("bitrate") == null) {
                log.error("Invalid rendition encountered for " + rend.getPath());
                continue;
            }
            
            String rendName = rend.getName();
            rendInfo.put("href", rend.getPath());
            rendInfo.put("path", rend.getPath());
            long rendSize = rend.getSize();
            String size = UIHelper.getSizeLabel(rendSize, slingRequest);
            rendInfo.put("rendSize", size);
            rendInfo.put("type", rendition.get("displaytype").toString());
            rendInfo.put("isVideoPreset", "true");
            rendInfo.put("bitrate", (int)(Double.parseDouble(rendition.get("bitrate").toString())/1000) + "kbps");
            rendInfo.put("dimension", rendition.get("width").toString() + "x" + rendition.get("height").toString());
            rendInfo.put("mimeType", rendition.get("mimetype").toString());
            rendInfo.put("rendName", rendition.get("fullname").toString());
            rendInfo.put("isIps", "true");
 
            renditions.put(rendName, rendInfo);
	    }
	}
    
    if (renditions.size() != 0) {
        // sort and list the rendition list
        Map<String, Map<String, String>> sortedRenditions = new TreeMap<String, Map<String, String>>(renditions);
        // CQ-28620 Renditions Rail is not listing renditions in the correct order. Make original as the first entry above rendition subtitle and highlight the default rendition displayed on asset
        // details page
        Rendition defaultViewRendition = UIHelper.getBestfitRendition(asset,1280);
        String defaultViewRenditionName = "";
        if (null != defaultViewRendition) {
            defaultViewRenditionName = defaultViewRendition.getName();
        }
        Iterator entries = sortedRenditions.entrySet().iterator();

        while (entries.hasNext()) {
            Entry entry = (Entry) entries.next();
            Map<String, String> val = (HashMap<String, String>)entry.getValue();            

            if (val.get("rendName").equals("original")) {

            	AttrBuilder attrSpStatic = new AttrBuilder(request, xssAPI);
                if (!isVideo && val.get("rendName").equals(defaultViewRenditionName)) {
                    attrSpStatic.add("title", xssAPI.encodeForHTMLAttr(val.get("rendName")));
                    attrSpStatic.add("class", "each-rendition rendition-active");
                } else {
                    attrSpStatic.add("title", xssAPI.encodeForHTMLAttr(assetOrigName));
                    attrSpStatic.add("class", "each-rendition");
                }
                attrSpStatic.add("style", "font-size:1.09rem");

                attrSpStatic.add("data-type", xssAPI.encodeForHTMLAttr(val.get("mimeType")));
                attrSpStatic.add("href", xssAPI.getValidHref(val.get("href")));
                attrSpStatic.add("data-path", xssAPI.encodeForHTMLAttr(val.get("path")));

                String nameVal = xssAPI.encodeForHTML(i18n.get("original","asset metadata"));
                String rendSizeVal = xssAPI.encodeForHTML(val.get("rendSize"));
                String dimensionVal = xssAPI.encodeForHTML(originalDimension);
                String bitrateVal = xssAPI.encodeForHTML(StringUtils.isEmpty(originalBitrate) ? (StringUtils.isEmpty(originalFormat) ? "- " : originalFormat) :
                        originalBitrate + (StringUtils.isEmpty(originalFormat) ? "" : ", " + originalFormat));

%>
			    <span <%= attrSpStatic.build() %>>
				<a>
					<table class="renddetailstrip aem-asset-rendition-item">
						<tr>
                            <td class="name" colspan="2">
                                    <span><%= nameVal %></span>
                            </td>
						</tr>
						<tr>
							<td class="rendsize">
                                    <span><%= rendSizeVal %></span>
							</td>
                                <td class="dimension"><%= dimensionVal %></td>
                                <td class="type"><%= bitrateVal %></td>
						</tr>
					</table>
				</a>
			</span>
        <%
            }
        }
        
        %>

  <span class="colorpalette-headings aem-asset-rendition-item aem-asset-rendition-item--header Encodes-test"><%=xssAPI.encodeForHTML(i18n.get("Encodes"))%></span>

	<%
            entries = sortedRenditions.entrySet().iterator();
        	while (entries.hasNext()) {
            Entry entry = (Entry) entries.next();
            
            Map<String, String> val = (HashMap<String, String>)entry.getValue();

                if (!val.get("rendName").equals("original") && val.get("isVideoPreset").equals("false")) {

	        	String displTitle = val.get("rendName");
	        	if(displTitle.indexOf("cqdam.") == 0) {
	        		displTitle = assetName + "-" + val.get("dimension") + "-" + val.get("bitrate").replace("kbps", "k") + "." + val.get("type").toLowerCase(); 
	        	} else {
	        		displTitle = assetName + "." + val.get("rendName");
	        	}
                    AttrBuilder attrSpStatic = new AttrBuilder(request, xssAPI);
                    attrSpStatic.add("title", xssAPI.encodeForHTMLAttr(displTitle));
                    attrSpStatic.add("data-type", xssAPI.encodeForHTMLAttr(val.get("mimeType")));
                    attrSpStatic.add("href", xssAPI.getValidHref(val.get("href")));
                    attrSpStatic.add("data-path", xssAPI.encodeForHTMLAttr(val.get("path")));
                    attrSpStatic.add("data-videoPreset", val.get("isVideoPreset"));
                    attrSpStatic.add("class", "each-rendition");
                    attrSpStatic.add("style", "font-size:1.09rem");
        	
                    String typeVal = xssAPI.encodeForHTML(val.get("type"));
                    String dimensionVal = xssAPI.encodeForHTML( val.get("dimension"));
                    String bitrateVal = xssAPI.encodeForHTML(val.get("bitrate"));
        	%>

                    <span <%= attrSpStatic.build() %>>
                        <a>
                            <table class="renddetailstrip aem-asset-rendition-item">
                                <tr>
                                    <td class="name" colspan="2">
                                        <span class="type"><%= typeVal %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="rendsize">
                                        <span><%= xssAPI.encodeForHTMLAttr(val.get("rendSize")) %></span>
                                    </td>
                                    <td class="videodimension"><%= dimensionVal %></td>
                                    <td class="bitrate"><%= bitrateVal %></td>
                                </tr>
                            </table>
                        </a>
                    </span>
    	<%
                }
            }

// ------ dynamic video renditions
            entries = sortedRenditions.entrySet().iterator();
            while (entries.hasNext()) {
                Entry entry = (Entry) entries.next();

                Map<String, String> val = (HashMap<String, String>)entry.getValue();
                if (!val.get("rendName").equals("original") && val.get("isVideoPreset").equals("true")) {
                    String displTitle = val.get("rendName");
                    if(val.get("isIps") == null) {
                        if(displTitle.indexOf("cqdam.") == 0 || val.get("isIps") != null) {
                            displTitle = assetName + "-" + val.get("dimension") + "-" + val.get("bitrate").replace("kbps", "k") + "." + val.get("type").toLowerCase();
                        } else {
                            displTitle = assetName + "." + val.get("rendName");
                        }
                    }
                    
                    AttrBuilder attrSpStatic = new AttrBuilder(request, xssAPI);
                    attrSpStatic.add("title", xssAPI.encodeForHTMLAttr(displTitle));
                    attrSpStatic.add("data-type", xssAPI.encodeForHTMLAttr(val.get("mimeType")));
                    attrSpStatic.add("href", xssAPI.getValidHref(val.get("href")));
                    attrSpStatic.add("data-path", xssAPI.encodeForHTMLAttr(val.get("path")));
                    attrSpStatic.add("data-videoPreset", val.get("isVideoPreset"));
                    attrSpStatic.add("class", "each-rendition encodes-avs-item");
                    attrSpStatic.add("style", "font-size:1.09rem");

                    String typeVal = xssAPI.encodeForHTML(val.get("type"));
                    String dimensionVal = xssAPI.encodeForHTML( val.get("dimension"));
                    String bitrateVal = xssAPI.encodeForHTML(val.get("bitrate"));

        %>
                    <span <%= attrSpStatic.build() %>>
        <a>
            <table class="renddetailstrip aem-asset-rendition-item">
                <tr>                            
                    <td class="name" colspan="2">
                                <span class="type"><%= typeVal %></span>
                    </td>
                </tr>
				<tr>
					<td class="rendsize">
					    <span><%= xssAPI.encodeForHTMLAttr(val.get("rendSize")) %></span>
					</td>
                    <td class="videodimension"><%= dimensionVal %></td>
                    <td class="bitrate"><%= bitrateVal %></td>
				</tr>
            </table>
        </a>
    </span>
    <%

            }
        }
    }
    
    //USER RENDITIONS
    if (userrenditions.size() != 0) {
        // sort and list the rendition list
        Map<String, Map<String, String>> usersortedRenditions = new TreeMap<String, Map<String, String>>(userrenditions);        
        Iterator userentries = usersortedRenditions.entrySet().iterator();
        while (userentries.hasNext()) {
            Entry entry = (Entry) userentries.next();
            Map<String, String> val = (HashMap<String, String>)entry.getValue();
            
        }
        Rendition defaultViewRendition = UIHelper.getBestfitRendition(asset,1280);
        String defaultViewRenditionName = "";
        if (null != defaultViewRendition) {
            defaultViewRenditionName = defaultViewRendition.getName();
        }
        %>

   <span class="colorpalette-headings aem-asset-rendition-item aem-asset-rendition-item--header"><%=xssAPI.encodeForHTML(i18n.get("Uploads"))%></span>

    	<%
            
            userentries = usersortedRenditions.entrySet().iterator();
        while (userentries.hasNext()) {
            Entry entry = (Entry) userentries.next();
            Map<String, String> val = (HashMap<String, String>)entry.getValue();
            if (!val.get("rendName").equals("original")) {
                AttrBuilder attrSpStatic = new AttrBuilder(request, xssAPI);
                attrSpStatic.add("title", xssAPI.encodeForHTMLAttr(assetName + "." + val.get("rendName")));
                attrSpStatic.add("data-type", xssAPI.encodeForHTMLAttr(val.get("mimeType")));
                attrSpStatic.add("href", xssAPI.getValidHref(val.get("href")));
                attrSpStatic.add("data-path", xssAPI.encodeForHTMLAttr(val.get("path")));
                attrSpStatic.add("data-isugc", isUGC);

                attrSpStatic.add("class", "each-rendition");
                attrSpStatic.add("style", "font-size:1.09rem");

                String nameVal = xssAPI.encodeForHTML(val.get("finalLabel"));
                String rendSizeVal = xssAPI.encodeForHTML( val.get("rendSize"));
                String dimensionVal = xssAPI.encodeForHTML( val.get("dimension"));
                String bitrateVal = xssAPI.encodeForHTML(StringUtils.isEmpty(val.get("bitrate")) ?
                        (StringUtils.isEmpty(val.get("type")) ? VAL_UNKNOWN + " " : val.get("type")) :
                        val.get("bitrate") + (StringUtils.isEmpty(val.get("type")) ? "" : ", " + val.get("type")));

        %>
                <span <%= attrSpStatic.build() %>>
            <a>
                <table class="renddetailstrip aem-asset-rendition-item">
                    <tr>                            
                        <td class="name" colspan="2">
                                    <span class="type col1presetname"><%= nameVal %></span>
                        </td>
	                </tr>
					<tr>
                        <td class="rendsize">
                                    <span><%= rendSizeVal %></span>
                        </td>
                                <td class="videodimension"><%= dimensionVal %></td>
                                <td class="type"><%= bitrateVal %></td>
					</tr>
                </table>
            </a>
        </span>
        <%
                                                         }
        }
    }
    
    //thumbnailrenditions RENDITIONS
    if (thumbnailrenditions.size() != 0) {
        // sort and list the rendition list
        Map<String, Map<String, String>> thumbsortedRenditions = new TreeMap<String, Map<String, String>>(thumbnailrenditions);        
        Iterator userentries = thumbsortedRenditions.entrySet().iterator();
        while (userentries.hasNext()) {
            Entry entry = (Entry) userentries.next();
            Map<String, String> val = (HashMap<String, String>)entry.getValue();
            
        }
        Rendition defaultViewRendition = UIHelper.getBestfitRendition(asset,1280);
        String defaultViewRenditionName = "";
        if (null != defaultViewRendition) {
            defaultViewRenditionName = defaultViewRendition.getName();
        }
        %>

 <span class="colorpalette-headings aem-asset-rendition-item aem-asset-rendition-item--header"><%=xssAPI.encodeForHTML(i18n.get("Thumbnails"))%></span>

        <%
            
            userentries = thumbsortedRenditions.entrySet().iterator();
        while (userentries.hasNext()) {
            Entry entry = (Entry) userentries.next();
            Map<String, String> val = (HashMap<String, String>)entry.getValue();
            if (!val.get("rendName").equals("original")) {
        
        	String displTitle = val.get("rendName");
        	if(displTitle.indexOf("cq5dam.") == 0) {
        		displTitle = assetName + "-" + val.get("dimension") + "." + val.get("type").toLowerCase(); 
        	} else {
        		displTitle = assetName + "." + displTitle;
        	}
            AttrBuilder attrSpStatic = new AttrBuilder(request, xssAPI);
            attrSpStatic.add("title", xssAPI.encodeForHTMLAttr(displTitle));
            attrSpStatic.add("data-type", xssAPI.encodeForHTMLAttr(val.get("mimeType")));
            attrSpStatic.add("href", xssAPI.getValidHref(val.get("href")));
            attrSpStatic.add("data-path", xssAPI.encodeForHTMLAttr(val.get("path")));

            attrSpStatic.add("class", "each-rendition");
            attrSpStatic.add("style", "font-size:1.09rem");

            String nameVal = xssAPI.encodeForHTML(StringUtils.isEmpty(val.get("dimension")) ? val.get("rendName") : val.get("type"));
            String rendSizeVal = xssAPI.encodeForHTML(val.get("rendSize"));
            String dimensionVal = xssAPI.encodeForHTML( val.get("dimension"));
            String bitrateVal = StringUtils.isEmpty(val.get("bitrate")) ?
                    (StringUtils.isEmpty(val.get("type")) ? VAL_UNKNOWN + " " : val.get("type")) :
                    val.get("bitrate") + (StringUtils.isEmpty(val.get("type")) ? "" : ", " + val.get("type"));
            bitrateVal = xssAPI.encodeForHTMLAttr(bitrateVal);
		%>
            <span <%= attrSpStatic.build() %>>
                <a>
                    <table class="renddetailstrip aem-asset-rendition-item">
                        <tr>                            
                            <td class="name" colspan="2">
                                <span class="type col1presetname"><%= nameVal %></span>
                            </td>
		                </tr>
						<tr>
	                        <td class="rendsize">
	                            <span><%= rendSizeVal %></span>
	                        </td>
                            <td class="videodimension"><%= dimensionVal %></td>
							<td class="type"><%= bitrateVal %></td>
						</tr>
                    </table>
                </a>
            </span>
            <%
			}
        }
    }
    %>

        <script>
			$(".colorpalettedata").data("isDMRendition", <%=isVideo%>);       
        </script>
</nav>