<%@ page language="java" buffer="100kb" errorPage="/common/error.jsp"%>

<%@ page import="vkc.view.*" %>

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

<vkc:init/>
<html:html locale="true">
<head>
	<base target="_parent">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="cache" content="no-cache">
    <meta http-equiv="expires" content="0">

    <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 = "COMPAREDOCUMENTS";
    var associatedTabId = <%=TabId.DOCUMENT_TAB%>;

    function init() {     
      	setAnchor();      	
    }

	function setAnchor() {
		<logic:present parameter="anchor">
			<bean:parameter id="anchor2" name="anchor"/>
			this.location.hash = '<%=anchor2%>';
		</logic:present>
	}

    function openUserInfoWindow( id ) {
        var w = 800;
        var h = 600;
        var leftPosition = screen.width/2  - w/2;
        var topPosition  = screen.height/2 - h/2;
        var settings ='height=' + h + ', width=' + w + ', top=' + topPosition + ', left=' + leftPosition;
        settings += ',scrollbars=yes,resizable';
        settings += ',toolbar=no, location=no, directories=no, status=true, menubar=no';
        var win = window.open( '<vkc:rewrite page="/displayUserInfo.do"/>?userId=' + id, 'USERINFO_MAINVIEW', settings );
        win.focus();                              
    }
    </script>
</head>
<body onload="init();" marginwidth="5" marginheight="0" topmargin="0" bottommargin="5" leftmargin="5" rightmargin="5">
<html:form action="/compareDocuments" method="post">
<bean:define id="form" name="compareDocumentsForm" type="vkc.view.form.CompareDocumentsForm"/>
<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 width="100%" border="0" cellpadding="5">
  <logic:iterate id="oldBlock" indexId="index" name="form" property="outOld" type="java.lang.String">
  <bean:define id="newBlock" name="form" property='<%="outNew[" + index + "]" %>'/>

  <logic:equal name="form" property='<%="sameBlock[" + index + "]" %>' value="true">
  <tr align="left" valign="top">
	<td width="50%" valign="top"><vkc:write name="oldBlock" renderNewLine="true" filter="true"/></td>
    <td width="50%" valign="top"><vkc:write name="newBlock" renderNewLine="true" filter="true"/></td>
  </tr>
  </logic:equal>

  <logic:notEqual name="form" property='<%="sameBlock[" + index + "]" %>' value="true">
  <tr align="left" id='<%= index %>' valign="top" class="color_diff_different" width="100%">
	<td width="50%" valign="top"><a name='<%= index %>'></a><vkc:write name="oldBlock" renderNewLine="true" filter="true"/></td>
	<td width="50%" valign="top"><vkc:write name="newBlock" renderNewLine="true" filter="true"/></td>
  </tr>
  </logic:notEqual>
  </logic:iterate>
  
  <vkc:hline colspan="3" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5"/>
  
  <tr>
    <td align="left" nowrap="nowrap">
      <vkc:button property="action.back" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.back"/></vkc:button>
    </td>
  </tr>			 
</table>
</html:form>
</body>
</html:html>