<%@ page language="java" buffer="100kb" %>
<%@ page import="vkc.view.*" %>

<%@ taglib uri="struts-html"  prefix="html"  %>
<%@ taglib uri="struts-bean"  prefix="bean"  %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="vkc-taglib"   prefix="vkc" 	 %>

<vkc:init/>

<html:html locale="true">

<head>
    <meta http-equiv="content-type"  content="text/html; charset=iso-8859-1" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="pragma"        content="no-cache" />
    <meta http-equiv="expires"       content="0" />
    <meta http-equiv="robots"        content="index" />
    <meta http-equiv="robots"        content="follow" />

    <title><vkc:message key="vkc" /></title>

	<vkc:cssinclude />

	<script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>
	
	<script type="text/javascript">
    window.name = "SHOWVERSIONS";
	var currentChange = -1;

	function focusNextChange() {		
	    if ((window.parent.COMPAREDOCUMENTS.document.anchors.length - 1) > currentChange) {
			if (currentChange > -1) {
				window.parent.COMPAREDOCUMENTS.document.getElementById(window.parent.COMPAREDOCUMENTS.document.anchors[currentChange].name).className = 'color_diff_different';
			}
			
			currentChange++;						
			var elemName = window.parent.COMPAREDOCUMENTS.document.anchors[currentChange].name;	
			window.parent.COMPAREDOCUMENTS.document.getElementById(elemName).className = "color_diff_higlight";
			window.parent.COMPAREDOCUMENTS.location.hash = "#" + elemName;	
		}			
	} 
	
	function focusPreviousChange() {
		if (currentChange < 0) {
		    currentChange = 0;
		}
		
		if (currentChange > 0) {
			window.parent.COMPAREDOCUMENTS.document.getElementById(window.parent.COMPAREDOCUMENTS.document.anchors[currentChange].name).className = 'color_diff_different';
			currentChange--;			
			var elemName = window.parent.COMPAREDOCUMENTS.document.anchors[currentChange].name;
			window.parent.COMPAREDOCUMENTS.document.getElementById(elemName).className = "color_diff_higlight";
			window.parent.COMPAREDOCUMENTS.location.hash = "#" + elemName;
		}
	} 
  </script>
</head>
<body  id="showversions" valign="top" marginwidth="0" marginheight="0">
<html:form action="/showVersions" method="post">
<bean:define id="form" name="showVersionsForm" type="vkc.view.form.ShowVersionsForm" scope="request"/>
<bean:define id="firstVersion" name="form" property="firstVersion" type="vkc.db.entities.VKCDocument"/>
<bean:define id="secondVersion" name="form" property="secondVersion" type="vkc.db.entities.VKCDocument"/>
<bean:define id="firstDocumentIcon" name="firstVersion" property="documentIcon" type="java.lang.String"/>
<bean:define id="secondDocumentIcon" name="secondVersion" property="documentIcon" type="java.lang.String"/>

<html:hidden property="documentId"/>
<html:hidden property="categoryId"/>
<html:hidden property="sourcePageId"/>
<logic:notEmpty name="form" property="targetId">
  <html:hidden property="targetId"/>
</logic:notEmpty>
<logic:notEmpty name="form" property="subTargetId">
  <html:hidden property="subTargetId"/>
</logic:notEmpty>

<logic:iterate id="id" name="form" property="selectedDocuments" type="java.lang.String">
  <html:hidden property="selectedDocuments" name="form" value='<%=String.valueOf(id)%>'/>
</logic:iterate>

<table valign="top" width="100%"  cellspacing="0" cellpadding="0" border="0">
  <tr>
	<td width="50%" valign="top" class="color_diff_title">
	  <table  cellspacing="0" cellpadding="0" border="0">
	    <tr>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="10" alt=""/></td>
	      <td><b><vkc:message key="vkc.title"/>:</b></td>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="5" alt=""/></td>
	      <td><vkc:img page='<%="/templates/${template.name}" + firstDocumentIcon%>' alt=""/></td>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="5" alt=""/></td>
	      <td><vkc:displaydocument name="firstVersion" style="font-weight:normal;" target="_blank"><vkc:write name="firstVersion" property="title"/></vkc:displaydocument></td>
	    </tr>
	  </table>
	</td>
	<td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="1" alt=""/></td>
	<td width="50%" valign="top" class="color_diff_title">
	  <table  cellspacing="0" cellpadding="0" border="0">
	    <tr>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="10" alt=""/></td>
	      <td><b><vkc:message key="vkc.title"/>:</b></td>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="5" alt=""/></td>
	      <td><vkc:img page='<%="/templates/${template.name}" + secondDocumentIcon%>' alt=""/></td>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="5" alt=""/></td>
	      <td><vkc:displaydocument name="secondVersion" style="font-weight:normal;" target="_blank"><vkc:write name="secondVersion" property="title"/></vkc:displaydocument></td>
	    </tr>
	  </table>
	</td>
	<td><a href='javascript:focusPreviousChange();'><vkc:img page="/templates/${template.name}/gfx/button-previous.gif" alt="" border="0" titleKey="vkc.tooltip.gotoprevious"/></a></td>
  </tr>
  <tr>
	<td width="50%" valign="top" class="color_diff_title">
	  <table  cellspacing="0" cellpadding="0" border="0">
	    <tr>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="10" alt=""/></td>
	      <td><b><vkc:message key="vkc.document.version"/>:</b></td>
	      <td><vkc:write name="firstVersion" property="versionNo"/></td>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="15"/></td>
	      <td><b><vkc:message key="vkc.author"/>:&nbsp;</b><vkc:write name="firstVersion" property="authorName"/></td>
	    </tr>
	  </table>
	</td>
	<td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="1" alt=""/></td>
	<td width="50%" valign="top" class="color_diff_title">
	  <table  cellspacing="0" cellpadding="0" border="0">
	    <tr>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" height="1" width="10" alt=""/></td>
	      <td><b><vkc:message key="vkc.document.version"/>:</b></td>
	      <td><vkc:write name="secondVersion" property="versionNo"/></td>
	      <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="15"/></td>
	      <td><b><vkc:message key="vkc.author"/>:&nbsp;</b><vkc:write name="secondVersion" property="authorName"/></td>
	    </tr>
	  </table>
	</td>
	<td><a href='javascript:focusNextChange();'><vkc:img page="/templates/${template.name}/gfx/button-next.gif" alt="" border="0" titleKey="vkc.tooltip.gotonext"/></a></td>
  </tr> 
</table>
</html:form>
</body>
</html:html>