Index: /main/trunk/model-cols-dev/peijones/transform/pages/about.xsl
===================================================================
--- /main/trunk/model-cols-dev/peijones/transform/pages/about.xsl	(revision 24628)
+++ /main/trunk/model-cols-dev/peijones/transform/pages/about.xsl	(revision 24629)
@@ -186,4 +186,5 @@
 				imageURL = imageURL.replace(/\\/gi, "/");
 				imageURL = imageURL.replace(/%5C/gi, "/");
+				
 				imageURL = imageURL.substring(imageURL.indexOf("sites"));
 				
Index: /main/trunk/model-cols-dev/peijones/transform/pages/document.xsl
===================================================================
--- /main/trunk/model-cols-dev/peijones/transform/pages/document.xsl	(revision 24628)
+++ /main/trunk/model-cols-dev/peijones/transform/pages/document.xsl	(revision 24629)
@@ -23,39 +23,4 @@
 		</xsl:choose>
 	</xsl:variable>
-
-	<!-- set page title -->
-	<xsl:template name="pageTitle"><gslib:documentTitle/></xsl:template>
-
-	<!-- set page breadcrumbs -->
-	<xsl:template name="breadcrumbs">
-		<gslib:siteLink/><gslib:rightArrow/> 
-		<gslib:collectionNameLinked/><gslib:rightArrow/> 
-		<a>
-			<xsl:attribute name="href">
-				<xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="$collName"/>&amp;d=<xsl:value-of select="/page/pageResponse/document/documentNode[1]/@nodeID"/>&amp;dt=<xsl:value-of select="/page/pageResponse/document/documentNode/@docType"/>&amp;p.a=b&amp;p.s=<xsl:value-of select="/page/pageResponse/service/@name"/>
-			</xsl:attribute>
-			<xsl:variable name="documentTitleVar">
-				<gslib:documentTitle/>
-			</xsl:variable>
-			<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.document')"/>
-		</a>
-	</xsl:template>
-	
-	<xsl:template match="/">
-		<xsl:choose>
-			<!-- if this is the realistic books version of the page -->
-			<xsl:when test="$bookswitch = 'flashxml'">
-				<html>
-					<body>
-						<xsl:apply-templates select="/page/pageResponse/document"/>
-					</body>
-				</html>
-			</xsl:when>
-			<!-- if this is the regular version of the page -->
-			<xsl:otherwise>
-				<xsl:apply-imports/>
-			</xsl:otherwise>
-		</xsl:choose>
-	</xsl:template>
 
 	<!-- the page content -->
@@ -74,5 +39,5 @@
 		</div>
 
-		<input type="button" value="Add a Note!" style="margin-left:30px;" onclick="AddNote();" />
+		<input type="button" value="Tag Photo!" style="margin-left:30px;" onclick="AddNote();" />
 		<script type="text/javascript">
 			<xsl:text disable-output-escaping="yes">
@@ -85,10 +50,19 @@
 					var callback =
 					{
-						success: function(response){},
+						success: function(response)
+						{
+							var updateCallback = 
+							{
+								success: function(response){},
+								failed: function(){}
+							};
+							
+							var updateURL = gs.siteMetadata.siteURL.replace("8080","9090") + gs.xsltParams.library_name + "?a=s&amp;sa=c";
+							YAHOO.util.Connect.asyncRequest("GET", updateURL, updateCallback);
+						},
 						failed: function(){},
-						timeout: 5000
 					};
 					
-					var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=remove-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=dc.Creator&amp;metapos=" + note.id;
+					var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=remove-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=gsimg.photoNote";
 					YAHOO.util.Connect.asyncRequest("GET", url, callback);
 					return true;
@@ -99,42 +73,46 @@
 					var callback = 
 					{
-						success: function(response){},
+						success: function(response)
+						{
+							var updateCallback = 
+							{
+								success: function(response){},
+								failed: function(){}
+							};
+							
+							var updateURL = gs.siteMetadata.siteURL.replace("8080","9090") + gs.xsltParams.library_name + "?a=s&amp;sa=c";
+							YAHOO.util.Connect.asyncRequest("GET", updateURL, updateCallback);
+						},
 						failed: function(){},
-						timeout: 5000
 					};
 					
 					var jsonVal = '{"caption":"' + note.text + '", "area":{"x":' + note.rect.left + ', "y":' + note.rect.top + ', "width":' + note.rect.width + ', "height":' + note.rect.height + '}}';
-					var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=set-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=dc.Creator&amp;metavalue=" + jsonVal + "&amp;metapos=" + note.id;
-					YAHOO.util.Connect.asyncRequest("GET", url, callback);
+					var saveURL = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=set-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=gsimg.photoNote&amp;metavalue=" + jsonVal + "&amp;metapos=" + ((note &amp;&amp; note.id &amp;&amp; note.id &gt; 0) ? note.id - 1 : posCount);
+					YAHOO.util.Connect.asyncRequest("GET", saveURL, callback);
+					
 					return 1;
 				}				
 				
-				function getNotes(count)
+				function getNotes()
 				{
-					var callback = 
-					{
-						success: function(response)
-						{
-							if(response.responseText.search(/\w/) == -1)
-							{
-								return;
-							}
-							posCount++;
-							
-							var jsonObj = eval("(" + response.responseText + ")");
-							var newNote = new PhotoNote(jsonObj.caption, this.count, new PhotoNoteRect(jsonObj.area.x,jsonObj.area.y,jsonObj.area.width,jsonObj.area.height));
-							newNote.onsave = saveFunction;
-							newNote.ondelete = deleteFunction;
-							notes.AddNote(newNote);
-							getNotes(this.count + 1);
-						},
-						failed: function(){},
-						timeout: 5000
-					};
-					
-					var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=get-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=dc.Creator&amp;metapos=" + count;
-					//var url = gs.siteMetadata.siteURL.replace("8080","9090") + "cgi-bin/metadata-server.pl?a=get-metadata&amp;site=localsite&amp;c=" + gs.cgiParams.c + "&amp;d=" + gs.cgiParams.d + "&amp;metaname=[dc.Title]";
-					callback.count = count;
-					YAHOO.util.Connect.asyncRequest("GET", url, callback);
+					if(gs.variables.photoNotes == null || gs.variables.photoNotes == undefined)
+					{
+						console.log("No photo notes");
+						return;
+					}
+					
+					for(var i = 0; i &lt; gs.variables.photoNotes.length; i++)
+					{
+						var note = gs.variables.photoNotes[i];
+						if(!note)
+						{
+							continue;
+						}
+						var newNote = new PhotoNote(note.caption, i+1, new PhotoNoteRect(note.area.x,note.area.y,note.area.width,note.area.height));
+						newNote.onsave = saveFunction;
+						newNote.ondelete = deleteFunction;
+						notes.AddNote(newNote);
+					}
+					posCount = gs.variables.photoNotes.length - 1;
 				}
                 
@@ -147,5 +125,5 @@
                     newNote.Select();
                 }
-				getNotes(0);
+				window.onload = getNotes;
 			</xsl:text>
 		</script>
@@ -236,228 +214,4 @@
 	</xsl:template>
 	
-	<!-- Highlight annotations if requested -->
-	<xsl:template match="annotation">
-		<xsl:choose>
-			<xsl:when test="/page/pageRequest/paramList/param[@name='hl' and @value='on']">
-				<span class="termHighlight"><xsl:value-of select="."/></span>
-			</xsl:when>
-			<xsl:otherwise>
-				<span class="noTermHighlight"><xsl:value-of select="."/></span>
-			</xsl:otherwise>
-		</xsl:choose>
-	</xsl:template>
-	
-	<!-- This template is used to display the document content -->
-	<xsl:template match="documentNode" mode="document">
-		<a name="{@nodeID}"><xsl:text> </xsl:text></a>
-		<!-- Section header -->
-		<table class="sectionHeader"><tr>
-			<!-- Expand/collapse button -->
-			<td class="headerTD">
-				<img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">			
-					<xsl:attribute name="src">
-						<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
-					</xsl:attribute>
-				</img>
-			</td>
-			
-			<!-- Automatic section number -->
-			<td class="headerTD">
-				<p>
-					<xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
-					
-					<xsl:if test="util:hashToSectionId(@nodeID)">
-						<span class="sectionNumberSpan">
-							<xsl:value-of select="util:hashToSectionId(@nodeID)"/>
-							<xsl:text> </xsl:text>
-						</span>
-					</xsl:if>
-                    <!-- Display the title for the section regardless of whether automatic section numbering is turned on -->
-					<span class="sectionTitle"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/></span>
-				</p>
-			</td>
-			
-			<!-- "back to top" link -->
-			<xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
-				<td class="backToTop headerTD">
-					<a href="#top">
-						<xsl:text disable-output-escaping="yes">&#9650;</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
-					</a>
-				</td>
-			</xsl:if>
-		</tr></table>
-		
-		<!-- Section text -->
-		<div id="doc{@nodeID}" class="sectionContainer" style="display:block;">		
-			<xsl:for-each select="nodeContent">
-				<xsl:for-each select="node()">
-					<xsl:choose>
-						<xsl:when test="not(name())">
-							<xsl:value-of select="." disable-output-escaping="yes"/>
-						</xsl:when>
-						<xsl:otherwise>
-							<xsl:apply-templates select="."/>
-						</xsl:otherwise>
-					</xsl:choose>
-				</xsl:for-each>
-			</xsl:for-each>
-			<xsl:if test="documentNode">
-				<xsl:apply-templates select="documentNode" mode="document"/>
-			</xsl:if>
-		</div>	
-
-	</xsl:template>
-
-	<!-- This template is used to display the table of contents -->
-	<xsl:template match="documentNode" mode="TOC">
-
-		<!-- check if this is the currently selected table of contents item -->
-		<xsl:variable name="isCurrent" select="nodeContent"/>
-
-		<!-- formulate the link -->
-		<xsl:variable name="contentsLink">
-			<xsl:value-of select='$library_name'/>?a=d&amp;c=<gslib:collectionNameShort/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if>&amp;sib=1
-		</xsl:variable>
-
-		<ul>
-			<table><tr>
-				<!-- The expand/collapse button (not displayed for the top level node) -->
-				<xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle'">
-					<td>
-						<xsl:choose>
-							<xsl:when test="not(nodeContent and not(documentNode))">
-								<img id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
-									<xsl:attribute name="src">
-										<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
-									</xsl:attribute>
-								</img>
-							</xsl:when>
-							<xsl:otherwise>
-								<xsl:attribute name="class">emptyIcon</xsl:attribute>
-							</xsl:otherwise>
-						</xsl:choose>
-					</td>
-				</xsl:if>
-				
-				<!-- The chapter/page icon -->
-				<td>
-					<img>
-						<xsl:if test="nodeContent and not(documentNode)">
-							<xsl:attribute name="class">leafNode</xsl:attribute>
-						</xsl:if>
-						
-						<xsl:attribute name="src">
-							<xsl:choose>
-								<xsl:when test="nodeContent and not(documentNode)">
-									<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/> 
-								</xsl:when>
-								<xsl:otherwise>
-									<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/>
-								</xsl:otherwise>
-							</xsl:choose>
-						</xsl:attribute>
-					</img>
-				</td>
-				
-				<!-- The section name, links to the section in the document -->
-				<td>				
-					<a>
-						<xsl:attribute name="href">#<xsl:value-of select="@nodeID"/></xsl:attribute>
-						<xsl:if test="util:hashToSectionId(@nodeID)">
-							<xsl:value-of select="util:hashToSectionId(@nodeID)"/>
-							<xsl:text> </xsl:text>
-						</xsl:if>
-						<xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
-					</a>
-				</td>
-			</tr></table>
-		
-			<!-- display any child items -->		
-			<xsl:if test="documentNode">
-				<li id="toc{@nodeID}" style="display:block;">
-					<xsl:apply-templates select="documentNode" mode="TOC"/>
-				</li>
-			</xsl:if>
-			
-		</ul>
-	</xsl:template>
-	
-	<!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
-	<xsl:template match="documentNode" mode="flashxml">
-		<xsl:text disable-output-escaping="yes">
-			&lt;Section&gt;
-			&lt;Description&gt;
-			&lt;Metadata name="Title"&gt;
-		</xsl:text>
-		<xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
-		<xsl:text disable-output-escaping="yes">
-			&lt;/Metadata&gt;
-			&lt;/Description&gt;
-		</xsl:text>
-		
-		<xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
-				
-		<xsl:if test="documentNode">
-			<xsl:apply-templates select="documentNode" mode="flashxml"/>
-		</xsl:if>
-				
-		<xsl:text disable-output-escaping="yes">
-			&lt;/Section&gt;
-		</xsl:text>
-	</xsl:template>
-	
-	<xsl:template name="externalPage">
-		<xsl:param name="external"/>
-		<xsl:variable name="go_forward_link">
-			<a>
-				<xsl:attribute name="href">
-					<xsl:value-of select="$external"/>
-				</xsl:attribute>
-				<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
-			</a>
-		</xsl:variable>
-		<h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
-		<p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
-	</xsl:template>
-
-	<xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
-	
-	<xsl:template name="viewOptions">
-		<table class="viewOptions"><tr>
-			<!-- Realistic books link -->
-			<xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
-				<td>
-					<img>
-						<xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'realistic_books_image')"/></xsl:attribute>
-					</img>
-					<input id="rbOption" type="checkbox" onclick="bookInit();" class="optionCheckBox"/>
-				</td>
-			</xsl:if>
-			
-			<!-- Highlight on/off button -->
-			<xsl:if test="/page/pageRequest/paramList/param[@name = 'p.a']/@value = 'q' and count(//annotation) > 0">
-				<td>
-					<img>
-						<xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'highlight_image')"/></xsl:attribute>
-					</img>
-					<input id="highlightOption" type="checkbox" class="optionCheckBox">
-						<xsl:choose>
-							<xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
-								<xsl:attribute name="onclick">
-									<xsl:text>removeHighlight();</xsl:text>
-								</xsl:attribute>
-								<xsl:attribute name="checked">true</xsl:attribute>
-							</xsl:when>
-							<xsl:otherwise>
-								<xsl:attribute name="onclick">
-									<xsl:text>addHighlight();</xsl:text>
-								</xsl:attribute>
-							</xsl:otherwise>
-						</xsl:choose>
-					</input>
-				</td>
-			</xsl:if>
-		</tr></table>	
-	</xsl:template>
 </xsl:stylesheet>
 
