<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib uri="infoglue-management" prefix="management" %>
<%@ taglib uri="infoglue-content" prefix="content" %>
<%@ taglib uri="infoglue-common" prefix="common" %>
<%@ taglib uri="infoglue-page" prefix="page" %>
<%@ taglib uri="infoglue-structure" prefix="structure" %>

<page:pageContext id="pc"/>

<structure:componentPropertyValue id="headline" propertyName="Headline" useInheritance="false"/>
<content:assetUrls id="imageUrls" propertyName="Image" useInheritance="false"/>
<c:if test="${empty mediaUrl}">
	<content:assetUrls id="flashUrls" propertyName="Flash" useInheritance="false"/>	
</c:if>
<content:content id="highlightArticle" propertyName="Highlight article" useInheritance="false"/>
<structure:pageUrl id="readMorePageUrl" propertyName="ReadMorePage" contentId="${highlightArticle.id}" useInheritance="false"/>

<div class="cssbox">  
	<h2 class="cssbox_head"><c:out value="${headline}" default="No title or headline" escapeXml="false"/></h2>
	<div class="cssbox_body" style="padding: 0px; margin: 0px; height: 158px;">
		<center>
			<c:choose>
				<c:when test="${not empty imageUrls}">
					
					<content:assetUrl id="scriptUrl" contentId="${pc.componentLogic.infoGlueComponent.contentId}" assetKey="fadeScript"/>
					<c:set var="scriptLinkTag"><script src="<c:out value="${scriptUrl}"/>" type="text/javascript"></script></c:set>
					<page:htmlHeadItem value="${scriptLinkTag}"/>

					<script type="text/javascript">
					
						var fadeimages=new Array()
						
						<c:forEach var="imageUrl" items="${imageUrls}" varStatus="status">
							//<c:out value="${status.count}"/> - <c:out value="${status.index}"/>
							fadeimages[<c:out value="${status.count - 1}"/>]=["<c:out value="${imageUrl}"/>", "<c:out value="${readMorePageUrl}"/>", ""] //plain image syntax
						</c:forEach>
						 
						var fadebgcolor="white"
						new fadeshow(fadeimages, 203, 154, 0, 3000, 1, "R")

					</script>
				</c:when>
				<c:otherwise>
					<embed width="178" height="158" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="<c:out value="${flashUrl}"/>" play="true" loop="true" menu="true" alt="Highlight image"></embed>
				</c:otherwise>
			</c:choose>
		</center>
	</div> 
	<c:choose>
		<c:when test="${readMorePageUrl != null}">
			<div class="cssbox_blue_footer"><a href="<c:out value="${readMorePageUrl}"/>">Read more</a></div> 
		</c:when>
		<c:otherwise>
			<div class="cssbox_white_footer"></div> 
		</c:otherwise>
	</c:choose>
</div>