changeset 0:3e62083dbcbf

First commit. This project comes from LGServer. We removed the framework icefaces. Now, LGServices uses just JSP and jquery.
author "jurzua <jurzua@mpiwg-berlin.mpg.de>"
date Thu, 23 Apr 2015 15:46:01 +0200
parents
children 1af9d7db348e
files pom.xml src/main/java/de/mpiwg/gazetteer/bo/DBEntry.java src/main/java/de/mpiwg/gazetteer/bo/LGBranch.java src/main/java/de/mpiwg/gazetteer/bo/LGFile.java src/main/java/de/mpiwg/gazetteer/bo/SearchRulesFile.java src/main/java/de/mpiwg/gazetteer/bo/Sequence.java src/main/java/de/mpiwg/gazetteer/dataverse/DVDataDepositAPI.java src/main/java/de/mpiwg/gazetteer/dataverse/DVFileAccessAPI.java src/main/java/de/mpiwg/gazetteer/dataverse/DVMetadataAPI.java src/main/java/de/mpiwg/gazetteer/dataverse/DataverseUtils.java src/main/java/de/mpiwg/gazetteer/dataverse/MultipartUtility.java src/main/java/de/mpiwg/gazetteer/dataverse/bo/Dataverse.java src/main/java/de/mpiwg/gazetteer/dataverse/bo/Study.java src/main/java/de/mpiwg/gazetteer/dataverse/bo/VDCUser.java src/main/java/de/mpiwg/gazetteer/db/DBBook.java src/main/java/de/mpiwg/gazetteer/db/DBSection.java src/main/java/de/mpiwg/gazetteer/rest/AbstractServletMethod.java src/main/java/de/mpiwg/gazetteer/rest/GetFileText.java src/main/java/de/mpiwg/gazetteer/rest/GetSectionMetadata.java src/main/java/de/mpiwg/gazetteer/rest/GetSectionText.java src/main/java/de/mpiwg/gazetteer/rest/GetTable4File.java src/main/java/de/mpiwg/gazetteer/rest/GetUser.java src/main/java/de/mpiwg/gazetteer/rest/SaveNewText.java src/main/java/de/mpiwg/gazetteer/rest/SaveText.java src/main/java/de/mpiwg/gazetteer/rest/TextServlet.java src/main/java/de/mpiwg/gazetteer/rest/UtilsServlet.java src/main/java/de/mpiwg/gazetteer/scripts/SectionsIndex.java src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java src/main/java/de/mpiwg/gazetteer/utils/DBService.java src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java src/main/java/de/mpiwg/gazetteer/utils/FileManager.java src/main/java/de/mpiwg/gazetteer/utils/HTTPUtils.java src/main/java/de/mpiwg/gazetteer/utils/HibernateUtil.java src/main/java/de/mpiwg/gazetteer/utils/JSONUtils.java src/main/java/de/mpiwg/gazetteer/utils/PropertiesUtils.java src/main/java/de/mpiwg/gazetteer/utils/SelectableObject.java src/main/java/de/mpiwg/gazetteer/utils/exceptions/GazetteerException.java src/main/java/de/mpiwg/gazetteer/utils/exceptions/NoAuthorizedException.java src/main/java/de/mpiwg/gazetteer/utils/exceptions/VersioningException.java src/main/java/de/mpiwg/web/jsp/AbstractJSPPage.java src/main/java/de/mpiwg/web/jsp/ApplicationBean.java src/main/java/de/mpiwg/web/jsp/BranchPage.java src/main/java/de/mpiwg/web/jsp/CreateFilePage.java src/main/java/de/mpiwg/web/jsp/DataPaginator.java src/main/java/de/mpiwg/web/jsp/HomePage.java src/main/java/de/mpiwg/web/jsp/JSPProxy.java src/main/java/de/mpiwg/web/jsp/SearchPage.java src/main/java/de/mpiwg/web/jsp/SessionBean.java src/main/java/de/mpiwg/web/jsp/utils/CharsetFilter.java src/main/java/de/mpiwg/web/jsp/utils/SessionCollectorListener.java src/main/java/de/mpiwg/web/search/SortSectionByAdminType.java src/main/java/de/mpiwg/web/search/SortSectionByAuthor.java src/main/java/de/mpiwg/web/search/SortSectionByBookId.java src/main/java/de/mpiwg/web/search/SortSectionByBookName.java src/main/java/de/mpiwg/web/search/SortSectionByDynasty.java src/main/java/de/mpiwg/web/search/SortSectionByEdition.java src/main/java/de/mpiwg/web/search/SortSectionById.java src/main/java/de/mpiwg/web/search/SortSectionByLevel1.java src/main/java/de/mpiwg/web/search/SortSectionByPeriod.java src/main/java/de/mpiwg/web/search/SortSectionByStartPage.java src/main/java/de/mpiwg/web/search/SortSectionByVolume.java src/main/resources/config.properties src/main/resources/hibernate.cfg.xml src/main/resources/log4j.properties src/main/webapp/WEB-INF/web.xml src/main/webapp/componentes/headContent.jsp src/main/webapp/componentes/paginator.jsp src/main/webapp/componentes/template.jsp src/main/webapp/methods/adminTypeAutocomplete.jsp src/main/webapp/methods/dynastyAutocomplete.jsp src/main/webapp/methods/getDataverseForm.jsp src/main/webapp/methods/level1Autocomplete.jsp src/main/webapp/methods/searchAutocomplete.jsp src/main/webapp/methods/sectionIdAutocomplete.jsp src/main/webapp/methods/sectionTableDetails.jsp src/main/webapp/pages/branchPage.jsp src/main/webapp/pages/createFile.jsp src/main/webapp/pages/home.jsp src/main/webapp/pages/search.jsp src/main/webapp/proxy.jsp src/main/webapp/resources/css/style.css src/main/webapp/resources/images/arrow-ff.gif src/main/webapp/resources/images/arrow-first.gif src/main/webapp/resources/images/arrow-fr.gif src/main/webapp/resources/images/arrow-last.gif src/main/webapp/resources/images/arrow-next.gif src/main/webapp/resources/images/arrow-previous.gif src/main/webapp/resources/images/branch_details_16.png src/main/webapp/resources/images/branch_details_32.png src/main/webapp/resources/images/delete_16.png src/main/webapp/resources/images/down_16.png src/main/webapp/resources/images/down_20.png src/main/webapp/resources/images/edit_16.png src/main/webapp/resources/images/edit_32.png src/main/webapp/resources/images/edit_branch_16.png src/main/webapp/resources/images/edit_branch_32.png src/main/webapp/resources/images/filter_16.png src/main/webapp/resources/images/filter_24.png src/main/webapp/resources/images/more_info_16.png src/main/webapp/resources/images/new_branch_16.png src/main/webapp/resources/images/new_branch_32.png src/main/webapp/resources/images/publish_16.png src/main/webapp/resources/images/publish_32.png src/main/webapp/resources/images/search_16.png src/main/webapp/resources/images/search_32.png src/main/webapp/resources/images/search_64.png src/main/webapp/resources/images/show_16.png src/main/webapp/resources/images/show_32.png src/main/webapp/resources/images/up_16.png src/main/webapp/resources/images/up_20.png src/main/webapp/resources/js/bootstrap.min.js src/main/webapp/resources/js/general.js src/main/webapp/resources/js/jquery.min.js src/main/webapp/resources/js/proxyMethods.js
diffstat 114 files changed, 11546 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pom.xml	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,208 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>de.mpiwg</groupId>
+  <artifactId>LGServices</artifactId>
+  <packaging>war</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>LGServices Maven Webapp</name>
+  <url>http://maven.apache.org</url>
+
+
+	
+	<dependencies>
+	
+	    <dependency>
+            <groupId>cl.talca</groupId>
+            <artifactId>hashMapping</artifactId>
+            <version>1.0</version>
+        </dependency>		
+		<!-- 
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>javax.servlet-api</artifactId>
+			<version>3.0-alpha-1</version>
+			<scope>provided</scope>
+		</dependency>
+		 -->
+		<dependency>
+			<groupId>javax.servlet.jsp</groupId>
+			<artifactId>jsp-api</artifactId>
+			<version>2.2.1-b03</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.el</groupId>
+			<artifactId>el-api</artifactId>
+			<version>2.2.1-b04</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>jstl</artifactId>
+			<version>1.2</version>
+		</dependency>
+		
+		<!-- 
+		<dependency>
+		  <groupId>jstl</groupId>
+		  <artifactId>jstl</artifactId>
+		  <version>1.2</version>
+		  <scope>compile</scope>
+		</dependency>
+		
+		<dependency>
+		  <groupId>taglibs</groupId>
+		  <artifactId>standard</artifactId>
+		  <version>1.1.2</version>
+		  <scope>compile</scope>
+		</dependency>
+		 -->
+
+		<!-- REST API - jersey -->
+		
+		<dependency>
+			<groupId>org.apache.tomcat</groupId>
+			<artifactId>tomcat-servlet-api</artifactId>
+			<version>7.0.59</version>
+			<scope>provided</scope>
+		</dependency>
+		
+		<dependency>
+			<groupId>commons-fileupload</groupId>
+			<artifactId>commons-fileupload</artifactId>
+			<version>1.3.1</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<version>1.6.4</version>
+		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+			<version>1.2.17</version>
+		</dependency>
+		
+	
+		<dependency>
+			<groupId>asm</groupId>
+			<artifactId>asm</artifactId>
+			<version>3.3.1</version>
+		</dependency>
+		<!-- Others -->		
+	
+		<dependency>
+			<groupId>commons-lang</groupId>
+			<artifactId>commons-lang</artifactId>
+			<version>2.6</version>
+		</dependency>
+		<dependency>
+			<groupId>org.json</groupId>
+			<artifactId>json</artifactId>
+			<version>20090211</version>
+		</dependency>
+		<!-- hibernate -->
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-core</artifactId>
+			<version>4.3.8.Final</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-entitymanager</artifactId>
+			<version>4.3.8.Final</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-c3p0</artifactId>
+			<version>4.3.8.Final</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>c3p0</groupId>
+			<artifactId>c3p0</artifactId>
+			<version>0.9.1.2</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.6</version>
+		</dependency>
+							
+	</dependencies>	
+	
+
+	<build>
+		<finalName>LGServices</finalName>
+		<resources>
+			<resource>
+				<filtering>false</filtering>
+				<directory>src/main/resources</directory>
+			</resource>
+			<resource>
+				<filtering>false</filtering>
+				<directory>src/main/java</directory>
+				<includes>
+					<include>**</include>
+				</includes>
+				<excludes>
+					<exclude>**/*.java</exclude>
+				</excludes>
+			</resource>
+		</resources>
+
+		<plugins>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.3.2</version>
+				<configuration>
+					<source>1.7</source>
+					<target>1.7</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.tomcat.maven</groupId>
+				<artifactId>tomcat7-maven-plugin</artifactId>
+				<version>2.2</version>
+			</plugin>
+
+			<plugin>
+				<groupId>org.mortbay.jetty</groupId>
+				<artifactId>maven-jetty-plugin</artifactId>
+				<version>6.1.10</version>
+				<configuration>
+					<scanIntervalSeconds>10</scanIntervalSeconds>
+					<stopKey>foo</stopKey>
+					<stopPort>9999</stopPort>
+				</configuration>
+				<executions>
+					<execution>
+						<id>start-jetty</id>
+						<phase>pre-integration-test</phase>
+						<goals>
+							<goal>run</goal>
+						</goals>
+						<configuration>
+							<scanIntervalSeconds>0</scanIntervalSeconds>
+							<daemon>true</daemon>
+						</configuration>
+					</execution>
+					<execution>
+						<id>stop-jetty</id>
+						<phase>post-integration-test</phase>
+						<goals>
+							<goal>stop</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+
+		</plugins>
+
+	</build>
+
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/bo/DBEntry.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,119 @@
+package de.mpiwg.gazetteer.bo;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
+public abstract class DBEntry {
+	
+	private static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy-HH:mm");
+	
+	public DBEntry(){}
+	
+	@Id
+    @GeneratedValue(strategy = GenerationType.TABLE)
+    @Column(name="id")
+    protected Long id;
+	
+	@Temporal(TemporalType.TIMESTAMP)
+    @Column(name="creationDate")
+	private Date creationDate;
+	
+	@Temporal(TemporalType.TIMESTAMP)
+    @Column(name="lastChangeDate")
+	private Date lastChangeDate;
+	
+	public boolean isPersistent(){
+	    	if(this.getId() == null){
+	    		return false;
+	    	}else{
+	    		return true;
+	    	}	
+    }
+	
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+	
+	public Date getCreationDate() {
+		return creationDate;
+	}
+
+	public void setCreationDate(Date creationDate) {
+		this.creationDate = creationDate;
+	}
+
+	public Date getLastChangeDate() {
+		return lastChangeDate;
+	}
+
+	public void setLastChangeDate(Date lastChangeDate) {
+		this.lastChangeDate = lastChangeDate;
+	}
+
+	public String getFomattedLastChange(){
+		if(this.lastChangeDate != null)
+			return DATE_FORMAT.format(this.lastChangeDate);
+		return null;
+	}
+	
+	public String getFomattedCreation(){
+		if(this.creationDate != null)
+			return DATE_FORMAT.format(this.creationDate);
+		return null;
+	}
+	
+	
+	public String getInfo(){
+		if(isPersistent()){
+			StringBuilder sb = new StringBuilder("id=" + id);
+			
+			if(creationDate != null){
+				sb.append(", creation date=" + creationDate);
+			}
+			
+			if(lastChangeDate != null){
+				sb.append(", last change=" + lastChangeDate);
+			}				
+			return sb.toString();	
+		}
+		return new String();
+	}
+	
+	@Override
+    public boolean equals(Object object) {
+        // TODO: Warning - this method won't work in the case the id fields are not set
+        if (!(object instanceof DBEntry)) {
+            return false;
+        }
+        DBEntry other = (DBEntry) object;
+        
+        if(this.id != null && other.id != null && this.id.longValue() == other.id.longValue())
+        	return true;
+        
+        return false;
+    }
+	
+	@Override
+	public String toString(){
+		StringBuilder sb = new StringBuilder();
+		sb.append(this.getClass().toString());
+		sb.append(" [id=" + this.id + "] ");
+		return sb.toString();
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/bo/LGBranch.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,263 @@
+package de.mpiwg.gazetteer.bo;
+
+import java.io.Serializable;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.json.JSONArray;
+
+import cl.maps.duplex.DuplexKey;
+import de.mpiwg.gazetteer.dataverse.DataverseUtils;
+import de.mpiwg.gazetteer.db.DBBook;
+import de.mpiwg.gazetteer.db.DBSection;
+import de.mpiwg.gazetteer.utils.DBService;
+import de.mpiwg.gazetteer.utils.DataProvider;
+
+
+@Entity
+@Table(name="Branch")
+@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
+public class LGBranch extends DBEntry implements Cloneable, Serializable {
+	private static final long serialVersionUID = 7805209462045170778L;
+	
+
+	@Column(name="sectionId")
+	private Long sectionId;
+	
+	@Column(name="userId")
+	private Long userId;
+	
+	@Column(name="contributors")
+	private String contributors = "[]";
+
+	@Column(name="label")
+	private String label;
+	
+	@Column(name="description")
+	private String description;
+	
+	@Column(name="currentLastFileId")
+	private Long currentLastFileId;
+
+	@Transient
+	private List<Long> contributorsList;
+	
+	@Transient
+	private String contributorsLabel;
+	
+	@Transient
+	private DBBook book;
+	
+	@Transient
+	private DBSection section;
+	
+	@Transient
+	private boolean transientDataLoaded = false;
+	
+	@Transient
+	private boolean published = false;
+	
+	public void loadTransientData(){
+		try {
+			this.section = DBService.getSectionWithContent(sectionId);
+			this.book = section.getBook();
+			this.transientDataLoaded = true;
+			this.published = atLeastOneFilePublished();
+		} catch (SQLException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	public boolean atLeastOneFilePublished(){
+		
+		List<LGFile> files = DataProvider.getInstance().getAllFiles(this.id);
+		for(LGFile file : files){
+			if(file.getDvId() != null){
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public boolean isTransientDataLoaded() {
+		return transientDataLoaded;
+	}
+
+
+
+	public Object clone() throws CloneNotSupportedException {
+		 LGBranch clone = (LGBranch)super.clone();
+		 clone.setContributorsList(new ArrayList<Long>(clone.getContributorsList()));
+		 clone.book = this.book;
+		 return clone;
+	}
+	 
+	 
+	
+	public boolean hasContributor(Long userId){
+		for(Long id : getContributorsList()){
+			if(id.equals(userId)){
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public List<Long> getContributorsList(){
+		if(contributorsList == null){
+			reloadContributorsList();
+		}
+		return contributorsList;
+	}
+	
+	public List<String> getContributorsNameList(){
+		List<String> list = new ArrayList<String>();
+		for(Long userId : getContributorsList()){
+			list.add(DataverseUtils.getUsername(userId));
+		}
+		return list;
+	}
+	
+	public String getUsername(){
+		if(this.userId != null){
+			return DataverseUtils.getUsername(this.userId);
+		}
+		return null;
+	}
+	
+	private void reloadContributorsList(){
+		this.contributorsList = new ArrayList<Long>();
+		try {
+			JSONArray array = new JSONArray(this.contributors);
+			for(int i=0; i<array.length(); i++){
+				this.contributorsList.add(array.getLong(i));
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	public void addContributor(Long userId){
+		if(!getContributorsList().contains(userId)){
+			getContributorsList().add(userId);
+		}
+		upgradeContributors();
+	}
+	
+	public void removeContributor(Long userId){
+		if(getContributorsList().contains(userId)){
+			getContributorsList().remove(userId);
+			this.upgradeContributors();
+		}
+	}
+	
+	public void upgradeContributors(){
+		JSONArray array = new JSONArray(getContributorsList());
+		this.contributors = array.toString();
+	}
+	
+	
+	public Long getSectionId() {
+		return sectionId;
+	}
+
+	public void setSectionId(Long sectionId) {
+		this.sectionId = sectionId;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+
+	public String getContributors() {
+		return contributors;
+	}
+
+	public void setContributors(String contributors) {
+		this.contributors = contributors;
+	}
+	
+	public String getLabel() {
+		return label;
+	}
+
+	public void setLabel(String label) {
+		this.label = label;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}	
+
+	public Long getCurrentLastFileId() {
+		return currentLastFileId;
+	}
+
+	public void setCurrentLastFileId(Long currentLastFileId) {
+		this.currentLastFileId = currentLastFileId;
+	}
+
+	public DuplexKey<Long, Long> getKey(){
+		return new DuplexKey<Long, Long>(this.userId, this.id);
+	}
+	
+	
+	@Override
+	public String toString(){
+		return "LGBranch[label=" + label + ", id=" + id + ", sectionId=" + sectionId + "]";
+	}
+
+	public String getContributorsLabel() {
+		return contributorsLabel;
+	}
+
+	public void setContributorsLabel(String contributorsLabel) {
+		this.contributorsLabel = contributorsLabel;
+	}
+
+	public void setContributorsList(List<Long> contributorsList) {
+		this.contributorsList = contributorsList;
+	}	
+
+	public DBSection getSection() {
+		return section;
+	}
+
+	public void setSection(DBSection section) {
+		this.section = section;
+	}
+
+	public DBBook getBook() {
+		return book;
+	}
+
+	public void setBook(DBBook book) {
+		this.book = book;
+	}
+
+	public boolean isPublished() {
+		return published;
+	}
+
+	public void setPublished(boolean published) {
+		this.published = published;
+	}	
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/bo/LGFile.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,134 @@
+package de.mpiwg.gazetteer.bo;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import cl.maps.duplex.DuplexKey;
+import de.mpiwg.gazetteer.dataverse.DataverseUtils;
+
+
+@Entity
+@Table(name="File")
+@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
+public class LGFile extends DBEntry implements Cloneable, Serializable, Comparable<LGFile> {
+	
+	private static final long serialVersionUID = 1638482732212457961L;
+
+	//many files can have the same fileId
+	@Column(name="branchId")
+	private Long branchId;
+	
+	//if this file has been exported to DV, here is saved the id.
+	@Column(name="dvId")
+	private Long dvId;
+	
+	@Column(name="version")
+	private Integer version = 0;
+	
+	@Column(name="fileName")
+	private String fileName;
+
+	@Column(name="userId")
+	private Long userId;
+	
+	@Column(name="lastVersion")
+	private boolean lastVersion = true;
+	
+	
+	@Column(name="notes")
+	private String notes;
+	
+	@Transient
+	private String content;
+	
+	public Long getDvId() {
+		return dvId;
+	}
+
+	public void setDvId(Long dvId) {
+		this.dvId = dvId;
+	}
+
+	public Integer getVersion() {
+		return version;
+	}
+
+	public void setVersion(Integer version) {
+		this.version = version;
+	}
+
+	public String getFileName() {
+		return fileName;
+	}
+
+	public void setFileName(String fileName) {
+		this.fileName = fileName;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+	
+	public String getUsername(){
+		if(this.userId != null){
+			return DataverseUtils.getUsername(this.userId);
+		}
+		return null;
+	}
+	
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+	public boolean isLastVersion() {
+		return lastVersion;
+	}
+
+	public void setLastVersion(boolean lastVersion) {
+		this.lastVersion = lastVersion;
+	}
+	
+	public Long getBranchId() {
+		return branchId;
+	}
+
+	public void setBranchId(Long branchId) {
+		this.branchId = branchId;
+	}
+
+	public String getNotes() {
+		return notes;
+	}
+
+	public void setNotes(String notes) {
+		this.notes = notes;
+	}
+	
+	 @Override
+	 public int compareTo(LGFile o) {
+	    return getCreationDate().compareTo(o.getCreationDate());
+	 }
+
+	public DuplexKey<Long, Long> getKey(){
+		return new DuplexKey<Long, Long>(this.branchId, this.id);
+	}
+	
+	@Override
+	public String toString(){
+		return "LGFile [id=" + id + ", branchId=" + branchId + ", fileName=" + fileName + "]";
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/bo/SearchRulesFile.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,67 @@
+package de.mpiwg.gazetteer.bo;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import cl.maps.duplex.DuplexKey;
+
+@Entity
+@Table(name="SearchRulesFile.java")
+@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
+public class SearchRulesFile extends DBEntry implements Cloneable, Serializable {
+
+	private static final long serialVersionUID = -3717062037374537162L;
+
+	@Column(name="fileName")
+	private String fileName;
+	
+	@Column(name="description")
+	private String description;
+	
+	@Column(name="content")
+	private String content;
+
+	@Column(name="userId")
+	private Long userId;
+	
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}	
+
+	public String getFileName() {
+		return fileName;
+	}
+
+	public void setFileName(String fileName) {
+		this.fileName = fileName;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}	
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+	
+	public DuplexKey<Long, Long> getKey(){
+		return new DuplexKey<Long, Long>(this.userId, this.id);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/bo/Sequence.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,94 @@
+package de.mpiwg.gazetteer.bo;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author jurzua
+ */
+@Entity
+@Table(name="row_sequence")
+public class Sequence implements Serializable {
+	
+	private static final long serialVersionUID = 120128920808559599L;
+
+	public Sequence(){}
+    
+    public Sequence(String name, Long value){
+        this.lastValue = value;
+        this.name = name;
+    }
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    @Column(name="name")
+    private String name;
+
+    @Column(name="last_value")
+    private Long lastValue;
+
+    public Long generateId(){
+        return this.lastValue++;
+    }
+
+    public Long getLastValue() {
+        return lastValue;
+    }
+
+    public void setLastValue(Long lastValue) {
+        this.lastValue = lastValue;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+
+    @Override
+    public int hashCode() {
+        int hash = 0;
+        hash += (id != null ? id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        // TODO: Warning - this method won't work in the case the id fields are not set
+        if (!(object instanceof Sequence)) {
+            return false;
+        }
+        Sequence other = (Sequence) object;
+        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "org.mpi.openmind.ontology.joins.Sequence[id=" + id + "]";
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/DVDataDepositAPI.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,43 @@
+package de.mpiwg.gazetteer.dataverse;
+
+import de.mpiwg.gazetteer.utils.HTTPUtils;
+import de.mpiwg.gazetteer.utils.HTTPUtils.HttpStringResponse;
+
+/**
+ * Doc: http://thedata.harvard.edu/guides/dataverse-api-main.html#data-deposit-api
+ * @author jurzua
+ *
+ */
+public class DVDataDepositAPI {
+
+	private static String user = "jurzua";
+	private static String pwd = "221082";
+	//curl https://jurzua:221082@thedata.harvard.edu/dvn/api/data-deposit/v1/swordv2/service-document
+	
+	
+	public static String retrieveSWORDServiceDocument(String user, String pwd) throws Exception{
+		HttpStringResponse resp = 
+				HTTPUtils.getStringResponse("https://" + user + ":" + pwd + "@thedata.harvard.edu/dvn/api/data-deposit/v1/swordv2/service-document");
+		return resp.content;
+	}
+	
+	public static void createStudy(String xmlFile){
+		//TODO
+	}
+	
+	public static void addFiles2Study(){
+		
+	}
+	
+	public static void listStudies(){
+		
+	}
+	
+	public static void deleteStudy(){}
+	
+	public static void deaccessStudy() {}
+	
+	public static void releaseStudy() {}
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/DVFileAccessAPI.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.gazetteer.dataverse;
+
+public class DVFileAccessAPI {
+
+	///dvn/api/downloadInfo/9956
+	public String downloadInfo(){
+		return "";
+	}
+	
+	///dvn/api/download/9956
+	public Byte[] download(){
+		return null;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/DVMetadataAPI.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,33 @@
+package de.mpiwg.gazetteer.dataverse;
+
+import java.io.IOException;
+
+import de.mpiwg.gazetteer.utils.HTTPUtils;
+import de.mpiwg.gazetteer.utils.HTTPUtils.HttpStringResponse;
+
+public class DVMetadataAPI {
+
+	//public static String dataverseInstance = "https://thedata.harvard.edu/dvn/api/";
+	public static String dataverseInstance = "https://localhost/dvn/api/";
+	
+	public static String metadataSearchFields() throws Exception{
+		HttpStringResponse res = HTTPUtils.getStringResponse(dataverseInstance + "metadataSearchFields");
+		return res.content;
+	}
+	
+	public static void metadataSearch(){}
+	
+	public static void metadataFormatsAvailable(){}
+	
+	public static void metadata(){}
+	
+	
+	public static void main(String[] args){
+		try {
+			System.out.println(DVMetadataAPI.metadataSearchFields());
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/DataverseUtils.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,214 @@
+package de.mpiwg.gazetteer.dataverse;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.dataverse.bo.Study;
+import de.mpiwg.gazetteer.dataverse.bo.VDCUser;
+import de.mpiwg.gazetteer.utils.DataProvider;
+import de.mpiwg.gazetteer.utils.FileManager;
+import de.mpiwg.gazetteer.utils.HTTPUtils;
+import de.mpiwg.gazetteer.utils.HTTPUtils.HttpStringResponse;
+import de.mpiwg.gazetteer.utils.PropertiesUtils;
+
+public class DataverseUtils {
+	
+	private static List<VDCUser> userList;
+	
+	static{
+		userList = new ArrayList<VDCUser>();
+		userList.add(new VDCUser(new Long(10), "jurzua", "1234"));
+		userList.add(new VDCUser(new Long(11), "john", "1234"));
+		userList.add(new VDCUser(new Long(12), "zoe", "1234"));
+		userList.add(new VDCUser(new Long(13), "paul", "1234"));
+	}
+	
+
+	/**
+	 * 
+	 *  curl --form upload=@pom.xml --form user=networkAdmin --form password=networkAdmin --form studyId=hdl:TEST/10002 http://localhost/dvn/saveResource
+	 * see: http://www.codejava.net/java-se/networking/upload-files-by-sending-multipart-request-programmatically
+	 * @param branchId
+	 * @param studyGlobalId
+	 * @throws Exception
+	 */
+		public static JSONObject publishFile(Long fileId, String studyGlobalId, String userName, String password) throws Exception{
+			
+			LGFile lgFile = DataProvider.getInstance().getFile(fileId);
+			LGBranch branch = DataProvider.getInstance().getBranch(lgFile.getBranchId());
+			String link = PropertiesUtils.getPropValue("dvn_server") + "/saveResource";
+			
+			
+			MultipartUtility multipart = new MultipartUtility(link, "UTF-8");
+            
+            multipart.addFormField("studyId", studyGlobalId);
+            multipart.addFormField("password", password);
+            multipart.addFormField("user", userName);
+            //multipart.addFormField("fileLabel", branch.getLabel() + ".html");
+             
+ 
+            String table = HTTPUtils.getTableOfFile(lgFile.getId());
+            System.out.println("Table string lenght" + table.length());
+            
+            multipart.addFilePart0(branch.getLabel() + ".html", table);
+            
+            String response = multipart.finish();
+			
+            System.out.println(response);
+			
+            return new JSONObject(response);
+	}
+	
+	public static List<Study> getStudies(String userName, String password) throws IOException{
+		List<Study> list = new ArrayList<Study>();
+		
+		String query = PropertiesUtils.getPropValue("dvn_server") + "/getStudies?user=" + userName + "&password=" + password;
+		
+		HttpStringResponse response = null;
+		try {
+			response = HTTPUtils.getStringResponse(query);
+			JSONObject json = new JSONObject(response.content);
+			if(json.has("studies")){
+				
+				JSONArray userArray = json.getJSONArray("studies");
+				
+				for(int i=0; i<userArray.length(); i++){
+					JSONObject studyJson = userArray.getJSONObject(i);
+					Study study = new Study(studyJson);
+					list.add(study);
+				}	
+			}
+		} catch (Exception e) {
+			if(response != null){
+				System.err.println(response.content);
+			}
+			e.printStackTrace();
+		}
+		
+		return list;
+	}
+	
+	public static VDCUser login0(String userName, String password){
+		for(VDCUser user : userList){
+			if(StringUtils.equals(userName, user.getUserName()) && StringUtils.equals(password, user.getPassword())){
+				return user;
+			}
+		}
+		return null;
+	}
+	
+	public static List<VDCUser> getAllUsers0(){
+		return userList;
+	}
+	
+	public static VDCUser getUser(Long id){
+		try {
+			for(VDCUser user : getAllUsers()){
+				if(user.getId().equals(id)){
+					return user;
+				}
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+	public static String getUsername(Long id){
+		try {
+			for(VDCUser user : getAllUsers()){
+				if(user.getId().equals(id)){
+					return user.getUserName();
+				}
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return "user-no-found ("+ id +")";
+	}
+	
+	public static List<VDCUser> getAllUsers() throws Exception{
+		List<VDCUser> list = new ArrayList<VDCUser>();
+		
+		String query = PropertiesUtils.getPropValue("dvn_server") + "/getAllUsers";
+		/*
+		System.out.println("************************************************");
+		System.out.println("URL: " + query);
+		System.out.println("************************************************");
+		*/
+		HttpStringResponse response = null;
+		try {
+			response = HTTPUtils.getStringResponse(query);
+			JSONObject json = new JSONObject(response.content);
+			if(StringUtils.equals(json.getString("state"), "ok")){
+				
+				JSONArray userArray = json.getJSONArray("users");
+				
+				for(int i=0; i<userArray.length(); i++){
+					JSONObject userJson = userArray.getJSONObject(i);
+					VDCUser user = new VDCUser(userJson);
+					list.add(user);
+				}
+					
+			}
+			
+			
+		} catch (Exception e) {
+			if(response != null){
+				System.err.println(response.content);
+			}
+			e.printStackTrace();
+		}
+		
+		return list;	
+	}
+	
+	public static VDCUser login(String userName, String password) throws Exception{
+		
+		System.out.println("userName=" + userName + ", password=" + password);
+		
+		String query = PropertiesUtils.getPropValue("dvn_server") + "/getUser?user=" + userName + "&password=" + password;
+		
+		System.out.println("************************************************");
+		System.out.println("URL: " + query);
+		System.out.println("************************************************");
+		
+		HttpStringResponse response = null;
+		try {
+			response = HTTPUtils.getStringResponse(query);
+			JSONObject json = new JSONObject(response.content);
+			if(StringUtils.equals(json.getString("state"), "ok")){
+				VDCUser user = new VDCUser(json.getJSONObject("user"));
+				return user;	
+			}
+			
+			
+		} catch (Exception e) {
+			if(response != null){
+				System.err.println(response.content);
+			}
+			e.printStackTrace();
+		}
+		
+		return null;
+	}
+
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/MultipartUtility.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,171 @@
+package de.mpiwg.gazetteer.dataverse;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+ 
+public class MultipartUtility {
+    private final String boundary;
+    private static final String LINE_FEED = "\r\n";
+    private HttpURLConnection httpConn;
+    private String charset;
+    private OutputStream outputStream;
+    private PrintWriter writer;
+ 
+    /**
+     * This constructor initializes a new HTTP POST request with content type
+     * is set to multipart/form-data
+     * @param requestURL
+     * @param charset
+     * @throws IOException
+     */
+    public MultipartUtility(String requestURL, String charset)
+            throws IOException {
+        this.charset = charset;
+         
+        // creates a unique boundary based on time stamp
+        boundary = "===" + System.currentTimeMillis() + "===";
+         
+        URL url = new URL(requestURL);
+        httpConn = (HttpURLConnection) url.openConnection();
+        httpConn.setUseCaches(false);
+        httpConn.setDoOutput(true); // indicates POST method
+        httpConn.setDoInput(true);
+        httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
+        //httpConn.setRequestProperty("User-Agent", "CodeJava Agent");
+        outputStream = httpConn.getOutputStream();
+        writer = new PrintWriter(new OutputStreamWriter(outputStream, charset), true);
+    }
+ 
+    /**
+     * Adds a form field to the request
+     * @param name field name
+     * @param value field value
+     */
+    public void addFormField(String name, String value) {
+        writer.append("--" + boundary).append(LINE_FEED);
+        writer.append("Content-Disposition: form-data; name=\"" + name + "\"")
+                .append(LINE_FEED);
+        writer.append("Content-Type: text/plain; charset=" + charset).append(
+                LINE_FEED);
+        writer.append(LINE_FEED);
+        writer.append(value).append(LINE_FEED);
+        writer.flush();
+    }
+ 
+    /**
+     * Adds a upload file section to the request
+     * @param fieldName name attribute in <input type="file" name="..." />
+     * @param uploadFile a File to be uploaded
+     * @throws IOException
+     */
+    public void addFilePart(String fieldName, File uploadFile)
+            throws IOException {
+        String fileName = uploadFile.getName();
+        writer.append("--" + boundary).append(LINE_FEED);
+        writer.append(
+                "Content-Disposition: form-data; name=\"" + fieldName
+                        + "\"; filename=\"" + fileName + "\"")
+                .append(LINE_FEED);
+        writer.append(
+                "Content-Type: "
+                        + URLConnection.guessContentTypeFromName(fileName))
+                .append(LINE_FEED);
+        writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
+        writer.append(LINE_FEED);
+        writer.flush();
+ 
+        FileInputStream inputStream = new FileInputStream(uploadFile);
+        byte[] buffer = new byte[4096];
+        int bytesRead = -1;
+        while ((bytesRead = inputStream.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, bytesRead);
+        }
+        outputStream.flush();
+        inputStream.close();
+         
+        writer.append(LINE_FEED);
+        writer.flush();    
+    }
+ 
+    public void addFilePart0(String fieldName, String fileContent)
+            throws IOException {
+        writer.append("--" + boundary).append(LINE_FEED);
+        writer.append(
+                "Content-Disposition: form-data; name=\"" + fieldName
+                        + "\"; filename=\"" + fieldName + "\"")
+                .append(LINE_FEED);
+        writer.append(
+                "Content-Type: "
+                        + URLConnection.guessContentTypeFromName(fieldName))
+                .append(LINE_FEED);
+        writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
+        writer.append(LINE_FEED);
+        writer.flush();
+ 
+        InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8));
+        byte[] buffer = new byte[4096];
+        int bytesRead = -1;
+        while ((bytesRead = inputStream.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, bytesRead);
+        }
+        outputStream.flush();
+        inputStream.close();
+         
+        writer.append(LINE_FEED);
+        writer.flush();    
+    }
+    
+    /**
+     * Adds a header field to the request.
+     * @param name - name of the header field
+     * @param value - value of the header field
+     */
+    public void addHeaderField(String name, String value) {
+        writer.append(name + ": " + value).append(LINE_FEED);
+        writer.flush();
+    }
+     
+    /**
+     * Completes the request and receives response from the server.
+     * @return a list of Strings as response in case the server returned
+     * status OK, otherwise an exception is thrown.
+     * @throws IOException
+     */
+    public String finish() throws IOException {
+        StringBuilder sb = new StringBuilder();
+ 
+        writer.append(LINE_FEED).flush();
+        writer.append("--" + boundary + "--").append(LINE_FEED);
+        writer.close();
+ 
+        // checks server's status code first
+        int status = httpConn.getResponseCode();
+        if (status == HttpURLConnection.HTTP_OK) {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(
+                    httpConn.getInputStream()));
+            String line = null;
+            while ((line = reader.readLine()) != null) {
+                sb.append(line);
+            }
+            reader.close();
+            httpConn.disconnect();
+        } else {
+            throw new IOException("Server returned non-OK status: " + status);
+        }
+ 
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/bo/Dataverse.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,47 @@
+package de.mpiwg.gazetteer.dataverse.bo;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class Dataverse {
+
+	private String name;
+	private String aboutThis;
+	private Integer version;
+	private String alias;
+	
+	public Dataverse(JSONObject json) throws JSONException{
+		this.name = json.getString("name");
+		this.aboutThis = json.getString("aboutThis");
+		this.alias = json.getString("alias");
+		this.version = json.getInt("version");
+	}
+	
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getAboutThis() {
+		return aboutThis;
+	}
+	public void setAboutThis(String aboutThis) {
+		this.aboutThis = aboutThis;
+	}
+	public Integer getVersion() {
+		return version;
+	}
+	public void setVersion(Integer version) {
+		this.version = version;
+	}
+	public String getAlias() {
+		return alias;
+	}
+	public void setAlias(String alias) {
+		this.alias = alias;
+	}
+	
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/bo/Study.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,142 @@
+package de.mpiwg.gazetteer.dataverse.bo;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class Study {
+
+	private Long id;
+	private String authority;
+	private String globalId;
+	private String persistentURL;
+	private String protocol;
+	private String studyId;
+	private String createTime;
+	private String title;
+	private String status;
+	private String creator;
+	
+	private Integer numberOfDownloads;
+	private Integer version;
+	
+	private Dataverse dataverse;
+	
+	public Study(JSONObject json) throws JSONException{
+		
+		this.authority = json.getString("authority");
+		this.globalId = json.getString("globalId");
+		this.persistentURL = json.getString("persistentURL");
+		this.protocol = json.getString("protocol");
+		this.studyId = json.getString("studyId");
+		this.createTime = json.getString("createTime");
+		this.title = json.getJSONObject("metadata").getString("title");
+		this.status = json.getString("status");
+		
+		this.id = json.getLong("id");
+		
+		this.numberOfDownloads = json.getInt("numberOfDownloads");
+		this.version = json.getInt("version");
+		
+		this.creator = json.getJSONObject("creator").getString("userName");
+	
+		this.dataverse = new Dataverse(json.getJSONObject("owner"));
+		
+	}
+	
+	
+	public String getAuthority() {
+		return authority;
+	}
+	public void setAuthority(String authority) {
+		this.authority = authority;
+	}
+	public String getGlobalId() {
+		return globalId;
+	}
+	public void setGlobalId(String globalId) {
+		this.globalId = globalId;
+	}
+	public String getPersistentURL() {
+		return persistentURL;
+	}
+	public void setPersistentURL(String persistentURL) {
+		this.persistentURL = persistentURL;
+	}
+	public String getProtocol() {
+		return protocol;
+	}
+	public void setProtocol(String protocol) {
+		this.protocol = protocol;
+	}
+	public Integer getVersion() {
+		return version;
+	}
+	public void setVersion(Integer version) {
+		this.version = version;
+	}
+	public String getStudyId() {
+		return studyId;
+	}
+	public void setStudyId(String studyId) {
+		this.studyId = studyId;
+	}
+	public String getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(String createTime) {
+		this.createTime = createTime;
+	}
+	public Integer getNumberOfDownloads() {
+		return numberOfDownloads;
+	}
+	public void setNumberOfDownloads(Integer numberOfDownloads) {
+		this.numberOfDownloads = numberOfDownloads;
+	}
+	public String getTitle() {
+		return title;
+	}
+	public void setTitle(String title) {
+		this.title = title;
+	}
+	public Long getId() {
+		return id;
+	}
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+
+	public String getStatus() {
+		return status;
+	}
+
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+
+	public String getCreator() {
+		return creator;
+	}
+
+
+	public void setCreator(String creator) {
+		this.creator = creator;
+	}
+
+
+	public Dataverse getDataverse() {
+		return dataverse;
+	}
+
+
+	public void setDataverse(Dataverse dataverse) {
+		this.dataverse = dataverse;
+	}
+	
+	
+	
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/dataverse/bo/VDCUser.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,117 @@
+package de.mpiwg.gazetteer.dataverse.bo;
+
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.utils.JSONUtils;
+
+/**
+ * See: edu.harvard.iq.dvn.core.admin.VDCUser
+ * @author jurzua
+ *
+ */
+public class VDCUser {
+
+	private String userName;
+    private String email;
+    private String firstName;
+    private String lastName;
+    private String institution;
+    private Long id;
+    private Long version;
+    private Long position;
+    
+    private String password;
+    public VDCUser(Long id, String userName, String password){
+    	this.id = id;
+    	this.userName = userName;
+    	this.password = password;
+    }
+    
+    public VDCUser(JSONObject json){
+    	
+    	this.email = JSONUtils.getString(json, "email");
+    	this.firstName = JSONUtils.getString(json, "firstName");
+    	this.userName = JSONUtils.getString(json, "userName");
+    	this.lastName = JSONUtils.getString(json, "lastName");
+    	this.institution = JSONUtils.getString(json, "institution");
+    	
+    	this.id = JSONUtils.getLong(json, "id");
+    	this.position = JSONUtils.getLong(json, "position");
+    	this.version = JSONUtils.getLong(json, "version");
+    }
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public String getEmail() {
+		return email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+
+	public String getInstitution() {
+		return institution;
+	}
+
+	public void setInstitution(String institution) {
+		this.institution = institution;
+	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getVersion() {
+		return version;
+	}
+
+	public void setVersion(Long version) {
+		this.version = version;
+	}
+
+	public Long getPosition() {
+		return position;
+	}
+
+	public void setPosition(Long position) {
+		this.position = position;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}    
+
+	
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/db/DBBook.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,188 @@
+package de.mpiwg.gazetteer.db;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public class DBBook {
+
+	private String id;
+	private String name;
+	private Integer line;
+	private String period;
+	//
+	private String author;
+	private String edition;
+	private String volume;
+	private String dynasty;
+	
+	private String level1;
+	private String level2;
+	private String admin_type;
+	private String in_jibengujiku;
+	
+	private Integer start_year;
+	private Integer end_year;
+	
+	
+	public DBBook(ResultSet rs) throws SQLException{
+		this.name = rs.getString("name");
+		this.id = rs.getString("id");
+		this.line = rs.getInt("line");
+		this.period = rs.getString("period");
+		this.author = rs.getString("author");
+		this.edition = rs.getString("edition");
+		this.volume = rs.getString("volume");
+		this.dynasty = rs.getString("dynasty");
+		
+		this.level1 = rs.getString("level1");
+		this.level2 = rs.getString("level2");
+		this.admin_type = rs.getString("admin_type");
+		this.in_jibengujiku = rs.getString("in_jibengujiku");
+		
+		this.start_year = rs.getInt("start_year");
+		this.end_year = rs.getInt("end_year");
+		
+	}
+
+
+	public String getId() {
+		return id;
+	}
+
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+
+	public String getName() {
+		return name;
+	}
+
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+
+	public Integer getLine() {
+		return line;
+	}
+
+
+	public void setLine(Integer line) {
+		this.line = line;
+	}
+
+
+	public String getPeriod() {
+		return period;
+	}
+
+
+	public void setPeriod(String period) {
+		this.period = period;
+	}
+
+
+	public String getAuthor() {
+		return author;
+	}
+
+
+	public void setAuthor(String author) {
+		this.author = author;
+	}
+
+
+	public String getEdition() {
+		return edition;
+	}
+
+
+	public void setEdition(String edition) {
+		this.edition = edition;
+	}
+
+
+	public String getVolume() {
+		return volume;
+	}
+
+
+	public void setVolume(String volume) {
+		this.volume = volume;
+	}
+
+
+	public String getDynasty() {
+		return dynasty;
+	}
+
+
+	public void setDynasty(String dynasty) {
+		this.dynasty = dynasty;
+	}
+
+
+	public String getLevel1() {
+		return level1;
+	}
+
+
+	public void setLevel1(String level1) {
+		this.level1 = level1;
+	}
+
+
+	public String getLevel2() {
+		return level2;
+	}
+
+
+	public void setLevel2(String level2) {
+		this.level2 = level2;
+	}
+
+
+	public String getAdmin_type() {
+		return admin_type;
+	}
+
+
+	public void setAdmin_type(String admin_type) {
+		this.admin_type = admin_type;
+	}
+
+
+	public String getIn_jibengujiku() {
+		return in_jibengujiku;
+	}
+
+
+	public void setIn_jibengujiku(String in_jibengujiku) {
+		this.in_jibengujiku = in_jibengujiku;
+	}
+
+
+	public Integer getStart_year() {
+		return start_year;
+	}
+
+
+	public void setStart_year(Integer start_year) {
+		this.start_year = start_year;
+	}
+
+
+	public Integer getEnd_year() {
+		return end_year;
+	}
+
+
+	public void setEnd_year(Integer end_year) {
+		this.end_year = end_year;
+	}
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/db/DBSection.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,113 @@
+package de.mpiwg.gazetteer.db;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+
+public class DBSection implements Comparable<DBSection>{
+
+	private Long id;
+	private String name;
+	private String text;
+	
+	private String bookId;
+	private DBBook book;
+	
+	private Integer start_page;
+	private Integer end_page;
+	
+	private List<LGBranch> branches;
+	
+	/*
+	public DBSection(Long id){
+		this.id = id;
+	}
+	
+	
+	public DBSection(Long id, String name, String bookId){
+		this.id = id;
+		this.name = name;
+		this.bookId = bookId;
+	}*/
+	
+	public DBSection(ResultSet rs) throws SQLException{
+		this.name = rs.getString("name");
+		this.id = rs.getLong("id");
+		this.bookId = rs.getString("books_id");
+		this.start_page = rs.getInt("start_page");
+		this.end_page = rs.getInt("end_page");
+	}
+	
+	
+	public Long getId() {
+		return id;
+	}
+	public void setId(Long id) {
+		this.id = id;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getBookId() {
+		return bookId;
+	}
+
+	public void setBookId(String bookId) {
+		this.bookId = bookId;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public DBBook getBook() {
+		return book;
+	}
+
+	public void setBook(DBBook book) {
+		this.book = book;
+	}
+
+	public List<LGBranch> getBranches() {
+		return branches;
+	}
+
+	public void setBranches(List<LGBranch> branches) {
+		this.branches = branches;
+	}
+	
+	public Integer getStart_page() {
+		return start_page;
+	}
+
+	public void setStart_page(Integer start_page) {
+		this.start_page = start_page;
+	}
+
+	public Integer getEnd_page() {
+		return end_page;
+	}
+
+	public void setEnd_page(Integer end_page) {
+		this.end_page = end_page;
+	}
+
+	public String getPages(){
+		return this.start_page + " - " + this.end_page;
+	}
+	
+	@Override
+	public int compareTo(DBSection o) {
+		return this.getName().compareTo(o.getName());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/AbstractServletMethod.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,104 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Part;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.json.JSONObject;
+
+
+public abstract class AbstractServletMethod {
+	
+	private static Logger LOGGER = Logger.getLogger(AbstractServletMethod.class);
+
+	
+	
+	protected static void writeError(HttpServletResponse response, String message){
+		try {
+			JSONObject json = new JSONObject();
+			json.put("status", "error");
+			json.put("message", message);
+			
+			PrintWriter out = response.getWriter();
+			out.print(json.toString());
+			out.flush();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	protected static Long getQueryLongParam(HttpServletRequest request, String paraName) {
+		String value = request.getParameter(paraName);
+		if (StringUtils.isNotEmpty(value)) {
+			try {
+				return Long.parseLong(value);
+			} catch (Exception e) {
+			}
+		}
+		return null;
+	}
+	
+	protected static Long getRequestLongPart(HttpServletRequest request, String partName) throws IOException,
+			IllegalStateException, ServletException {
+		
+		String value = getRequestPart(request, partName);
+		
+		try {
+			Long v = Long.parseLong(value);
+			return v;
+		} catch (Exception e) {
+		}
+		
+		return null;
+		
+	}
+
+	protected static String getRequestPart(HttpServletRequest request, String partName) throws IOException,
+			IllegalStateException, ServletException {
+
+		String partText = null;
+		final Part filePart = request.getPart(partName);
+
+		if (filePart != null) {
+			OutputStream out = null;
+			InputStream filecontent = null;
+
+			try {
+				out = new ByteArrayOutputStream();
+				filecontent = filePart.getInputStream();
+
+				int read = 0;
+				final byte[] bytes = new byte[1024];
+
+				while ((read = filecontent.read(bytes)) != -1) {
+					out.write(bytes, 0, read);
+				}
+
+				partText = out.toString();
+
+			} catch (FileNotFoundException fne) {
+				LOGGER.info("Problems during file upload. Error: " + fne.getMessage());
+			} finally {
+				if (out != null) {
+					out.close();
+				}
+				if (filecontent != null) {
+					filecontent.close();
+				}
+			}
+		}
+
+		return partText;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/GetFileText.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,56 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.utils.DataProvider;
+import de.mpiwg.gazetteer.utils.FileManager;
+import de.mpiwg.gazetteer.utils.exceptions.GazetteerException;
+
+public class GetFileText extends AbstractServletMethod {
+
+	public static String name = "getFileText";
+	
+	public static void execute(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		Long fileId = getQueryLongParam(request, "fileId");
+		
+		System.out.println("%%%%% GetFileText [fileId=" + fileId + "]");
+		
+		if(fileId != null){
+			LGFile file = DataProvider.getInstance().getFile(fileId);
+			if(file != null){
+				
+				String text = FileManager.getFileAsText(file);
+				PrintWriter out = response.getWriter();
+				out.print(text);
+				out.flush();
+				response.setContentType("text/plain; charset=UTF-8");
+				
+			}else{
+				response.setContentType("application/json");
+				JSONObject json = new JSONObject();
+				json.put("status", "error");
+				json.put("message", "File no found (" + fileId + ")");
+				json.put("code", GazetteerException.CODE);
+				PrintWriter out = response.getWriter();
+				out.print(json.toString());
+				out.flush();
+			}
+		}else{
+			response.setContentType("application/json");
+			JSONObject json = new JSONObject();
+			json.put("status", "error");
+			json.put("message", "Following parameters are mandatory: fileId.");
+			PrintWriter out = response.getWriter();
+			out.print(json.toString());
+			out.flush();
+		}
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/GetSectionMetadata.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,89 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.db.DBBook;
+import de.mpiwg.gazetteer.db.DBSection;
+import de.mpiwg.gazetteer.utils.DBService;
+
+public class GetSectionMetadata  extends AbstractServletMethod {
+
+	public static String name = "getSectionMetadata";
+	
+	public static void execute(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		Long sectionId = getQueryLongParam(request, "sectionId");
+		
+		if(sectionId != null){
+			DBSection section = DBService.getSectionWithContent(sectionId);
+			if(section != null){
+				//DBBook book = DBService.getBookFromDB(section.getBookId());
+				DBBook book = DBService.getInstance().getBook(section.getBookId());
+				
+				response.setContentType("application/json");
+				JSONObject json = new JSONObject();
+				json.put("status", "ok");
+				
+				
+				JSONObject sectionJson = new JSONObject();
+				sectionJson.put("id", section.getId());
+				sectionJson.put("name", section.getName());
+				sectionJson.put("start_page", section.getStart_page());
+				sectionJson.put("end_page", section.getEnd_page());
+				
+				
+				JSONObject bookJson = new JSONObject();
+				bookJson.put("id", book.getId());
+				bookJson.put("name", book.getName());
+				bookJson.put("author", book.getAuthor());
+				bookJson.put("edition", book.getEdition());
+				bookJson.put("line", book.getLine());
+				bookJson.put("period", book.getPeriod());
+				bookJson.put("volume", book.getVolume());
+				
+				bookJson.put("level1", book.getLevel1());
+				bookJson.put("level2", book.getLevel2());
+				bookJson.put("admin_type", book.getAdmin_type());
+				bookJson.put("in_jibengujiku", book.getIn_jibengujiku());
+				
+				
+				bookJson.put("dynasty", book.getDynasty());
+				bookJson.put("start_year", book.getStart_year());
+				bookJson.put("end_year", book.getEnd_year());
+				
+				
+				sectionJson.put("book", bookJson);
+				
+				
+				json.put("section", sectionJson);
+				
+				
+				PrintWriter out = response.getWriter();
+				out.print(json.toString());
+				out.flush();
+				
+			}else{
+				response.setContentType("application/json");
+				JSONObject json = new JSONObject();
+				json.put("status", "error");
+				json.put("message", "Section no found (" + sectionId + ")");
+				PrintWriter out = response.getWriter();
+				out.print(json.toString());
+				out.flush();
+			}
+		}else{
+			response.setContentType("application/json");
+			JSONObject json = new JSONObject();
+			json.put("status", "error");
+			json.put("message", "Following parameters are mandatory: sectionId.");
+			PrintWriter out = response.getWriter();
+			out.print(json.toString());
+			out.flush();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/GetSectionText.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,50 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.utils.DBService;
+
+public class GetSectionText extends AbstractServletMethod {
+
+	public static String name = "getSectionText";
+	
+	public static void execute(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		Long sectionId = getQueryLongParam(request, "sectionId");
+		
+		if(sectionId != null){
+			String text = DBService.getSectionWithContent(sectionId).getText();
+			if(StringUtils.isNotEmpty(text)){
+				
+				PrintWriter out = response.getWriter();
+				out.print(text);
+				out.flush();
+				response.setContentType("text/plain; charset=UTF-8");
+				
+			}else{
+				response.setContentType("application/json");
+				JSONObject json = new JSONObject();
+				json.put("status", "error");
+				json.put("message", "Section no found (" + sectionId + ")");
+				PrintWriter out = response.getWriter();
+				out.print(json.toString());
+				out.flush();
+			}
+		}else{
+			response.setContentType("application/json");
+			JSONObject json = new JSONObject();
+			json.put("status", "error");
+			json.put("message", "Following parameters are mandatory: sectionId.");
+			PrintWriter out = response.getWriter();
+			out.print(json.toString());
+			out.flush();
+		}
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/GetTable4File.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,54 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.utils.DataProvider;
+import de.mpiwg.gazetteer.utils.HTTPUtils;
+
+public class GetTable4File extends AbstractServletMethod {
+	public static String name = "getTable4File";
+	
+	public static void execute(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		Long fileId = getQueryLongParam(request, "fileId");
+		
+		if(fileId != null){
+			LGFile file = DataProvider.getInstance().getFile(fileId);
+			if(file != null){
+				String text = HTTPUtils.getTableOfFile(fileId);
+				if(StringUtils.isNotEmpty(text)){
+					
+					PrintWriter out = response.getWriter();
+					out.print(text);
+					out.flush();
+					response.setContentType("text/plain; charset=UTF-8");
+					
+				}	
+			} else{
+				response.setContentType("application/json");
+				JSONObject json = new JSONObject();
+				json.put("status", "error");
+				json.put("message", "File no found (" + fileId + ")");
+				PrintWriter out = response.getWriter();
+				out.print(json.toString());
+				out.flush();
+			}
+		}else{
+			response.setContentType("application/json");
+			JSONObject json = new JSONObject();
+			json.put("status", "error");
+			json.put("message", "Following parameters are mandatory: fileId.");
+			PrintWriter out = response.getWriter();
+			out.print(json.toString());
+			out.flush();
+		}
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/GetUser.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,45 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+
+public class GetUser extends AbstractServletMethod{
+	
+	public static String name = "getUser";
+	
+	public static void execute(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		response.setContentType("application/json");
+		Long userId = getQueryLongParam(request, "userId");
+		
+		JSONObject json = new JSONObject();
+		
+		if(userId != null){
+			//TODO
+			/*
+			VDCUser user = DataProvider.getInstance().get
+			if(file != null){
+				
+				String text = FileManager.getFile(file.getFileName());
+				PrintWriter out = response.getWriter();
+				out.print(text);
+				out.flush();
+				response.setContentType("text/plain");
+				
+			}else{
+				json.put("status", "error");
+				json.put("message", "User not found (" + userId + ")");
+			}*/
+		}else{
+			json.put("status", "error");
+			json.put("message", "Following parameters are mandatory: userId.");
+		}
+		
+		PrintWriter out = response.getWriter();
+		out.print(json.toString());
+		out.flush();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/SaveNewText.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,65 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.lang.StringUtils;
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.utils.DataProvider;
+import de.mpiwg.gazetteer.utils.JSONUtils;
+import de.mpiwg.gazetteer.utils.exceptions.GazetteerException;
+
+public class SaveNewText extends AbstractServletMethod{
+
+	public static String name = "saveNew";
+	
+	public static void execute(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		response.setContentType("application/json");
+		JSONObject json = new JSONObject();
+		
+		System.out.println("%%%%% SaveNewText");
+		
+		if (ServletFileUpload.isMultipartContent(request)) {
+			String text = getRequestPart(request, "text");
+			Long userId = getRequestLongPart(request, "userId");
+			Long sectionId = getRequestLongPart(request, "sectionId");
+			String label = getRequestPart(request, "label");
+
+			if(StringUtils.isNotEmpty(text) && userId != null && sectionId != null){
+				Long branchId = DataProvider.getInstance().saveNewFile(text, label, sectionId, userId);
+				LGBranch branch = DataProvider.getInstance().getBranch(branchId);	
+				LGFile file = DataProvider.getInstance().getFile(branch.getCurrentLastFileId());
+				
+				JSONObject jsonBranch = JSONUtils.branch2JSON(branch);
+				JSONObject jsonFile = JSONUtils.file2JSON(file, true);
+				
+				json.put("branch", jsonBranch);
+				json.put("file", jsonFile);	
+				json.put("status", "ok");
+				
+			}else{
+				json.put("status", "error");
+				json.put("message", "Following parameters are mandatory: text, userId, sectionId.");
+				json.put("code", GazetteerException.CODE);
+			}
+			
+		} else {
+			json.put("status", "error");
+			json.put("message", "Content-type wrong. It should be: multipart/form-data");
+			json.put("code", GazetteerException.CODE);
+		}
+		
+		
+		
+		PrintWriter out = response.getWriter();
+		out.print(json.toString());
+		out.flush();
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/SaveText.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,83 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.lang.StringUtils;
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.utils.DataProvider;
+import de.mpiwg.gazetteer.utils.JSONUtils;
+import de.mpiwg.gazetteer.utils.exceptions.GazetteerException;
+import de.mpiwg.gazetteer.utils.exceptions.VersioningException;
+
+public class SaveText extends AbstractServletMethod{
+
+	public static String name = "save";
+	
+	public static void execute(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		response.setContentType("application/json");
+		JSONObject json = new JSONObject();
+		
+		if (ServletFileUpload.isMultipartContent(request)) {
+			String text = getRequestPart(request, "text");
+			;//getRequestPart(request, "text");
+			Long userId = getRequestLongPart(request, "userId");
+			Long branchId = getRequestLongPart(request, "branchId");
+			Long userPreviousFileId = getRequestLongPart(request, "userPreviousFileId");
+
+			System.out.println("%%%%% SaveText [branchId=" + branchId + ", userId=" + userId + "]");
+			
+			if(StringUtils.isNotEmpty(text) && userId != null && branchId != null && userPreviousFileId != null){
+				//text = new String(text.getBytes("iso-8859-1"), "UTF-8");
+				try {
+					LGFile file = DataProvider.getInstance().saveFile(branchId, text, userId, userPreviousFileId);
+					LGBranch branch = DataProvider.getInstance().getBranch(file.getBranchId());
+					
+					JSONObject jsonBranch = JSONUtils.branch2JSON(branch);
+					JSONObject jsonFile = JSONUtils.file2JSON(file, true);
+					
+					json.put("branch", jsonBranch);
+					json.put("file", jsonFile);
+					json.put("status", "ok");
+				} catch (GazetteerException e){
+					json.put("status", "error");
+					json.put("message", e.getMessage());
+					json.put("code", e.getCode());
+					if(e instanceof VersioningException){
+						
+						JSONObject curentFile = JSONUtils.file2JSON(((VersioningException) e).getCurrentFile(), false);
+						JSONObject userFile = JSONUtils.file2JSON(((VersioningException) e).getUserFile(), false);
+						
+						json.put("currentFile", curentFile);	
+						json.put("userFile", userFile);	
+					}
+				} catch (Exception e) {
+					e.printStackTrace();
+					json.put("status", "error");
+					json.put("message", e.getMessage());
+					json.put("code", GazetteerException.CODE);
+				}
+				
+				
+			}else{
+				json.put("status", "error");
+				json.put("message", "Following parameters are mandatory: text, userId, branchId, userPreviousFileId.");
+			}
+			
+		} else {
+			json.put("status", "error");
+			json.put("message", "Content-type wrong. It should be: multipart/form-data");
+		}
+		
+		PrintWriter out = response.getWriter();
+		out.print(json.toString());
+		out.flush();
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/TextServlet.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,90 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.MultipartConfig;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.json.JSONObject;
+
+@WebServlet("/rest/text/*")
+@MultipartConfig
+public class TextServlet extends HttpServlet {
+
+	private static final long serialVersionUID = -8809504256505388787L;
+
+	private final static Logger LOGGER = Logger.getLogger(TextServlet.class.getCanonicalName());
+
+	@Override
+	public void init() throws ServletException {
+		
+	}
+
+	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+		try {
+			processRequest(request, response);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+		try {
+			processRequest(request, response);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		
+		String method = getLastPathComponent(request);
+		request.setCharacterEncoding("UTF-8");
+		response.setCharacterEncoding("UTF-8");
+		
+		if(StringUtils.equals(SaveNewText.name, method)){
+			SaveNewText.execute(request, response);
+		}else if(StringUtils.equals(SaveText.name, method)){
+			SaveText.execute(request, response);
+		}else if(StringUtils.equals(GetFileText.name, method)){
+			GetFileText.execute(request, response);
+		}else if(StringUtils.equals(GetUser.name, method)){
+			GetUser.execute(request, response);
+		}else if(StringUtils.equals(GetSectionText.name, method)){
+			GetSectionText.execute(request, response);
+		}else if(StringUtils.equals(GetSectionMetadata.name, method)){
+			GetSectionMetadata.execute(request, response);
+		}else if(StringUtils.equals(GetTable4File.name, method)){
+			GetTable4File.execute(request, response);
+		}else{
+			writeError(response, "Content-type wrong. It should be: multipart/form-data");
+		}
+	}
+	
+	private static void writeError(HttpServletResponse response, String message){
+		try {
+			JSONObject json = new JSONObject();
+			json.put("status", "error");
+			json.put("message", message);
+			
+			PrintWriter out = response.getWriter();
+			out.print(json.toString());
+			out.flush();
+		} catch (Exception e) {
+			LOGGER.error(e);
+		}
+	}
+	
+	public static String getLastPathComponent(HttpServletRequest request){
+		String uri = request.getRequestURI();
+		String[] array = uri.split("/");
+		return array[array.length-1];
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/rest/UtilsServlet.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,111 @@
+package de.mpiwg.gazetteer.rest;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.MultipartConfig;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.json.JSONObject;
+
+import de.mpiwg.web.jsp.SessionBean;
+import de.mpiwg.web.jsp.utils.SessionCollectorListener;
+import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
+
+@WebServlet("/rest/utils/*")
+public class UtilsServlet extends HttpServlet {
+
+	private static final long serialVersionUID = -8809504256505388787L;
+
+	private final static Logger LOGGER = Logger.getLogger(UtilsServlet.class.getCanonicalName());
+
+	private final static int MINS_30 = 60 * 30;
+	
+	@Override
+	public void init() throws ServletException {
+
+	}
+
+	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+		try {
+			processRequest(request, response);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+		try {
+			processRequest(request, response);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		
+		String method = TextServlet.getLastPathComponent(request);
+		request.setCharacterEncoding("UTF-8");
+		response.setCharacterEncoding("UTF-8");
+		
+		response.setContentType("application/json");
+		JSONObject json = new JSONObject();
+		//System.out.println("Own Session: " + request.getSession().getId());
+		
+		if(StringUtils.equals(method, "getUser")){
+			String sessionId = getString(request, "sessionId");
+			ServletContext context = request.getSession().getServletContext();
+			
+			Map<String, HttpSession> sessionCollector = (Map<String, HttpSession>) context.getAttribute(SessionCollectorListener.SESSION_COLLECTOR);	
+			
+			if(sessionCollector.get(sessionId) != null){
+				HttpSession session = sessionCollector.get(sessionId);
+				session.setMaxInactiveInterval(MINS_30);
+				SessionBean sessionBean = (SessionBean)session.getAttribute("sessionBean");
+				
+				json.put("status", "ok");
+				json.put("sessionId", sessionId);
+				json.put("userName", sessionBean.getUserName());
+				
+			}else{
+				json.put("status", "error");
+				json.put("message", "The session has not been found.");
+				json.put("sessionId", sessionId);
+			}
+		}
+		
+		PrintWriter out = response.getWriter();
+		out.print(json.toString());
+		out.flush();
+		
+	}
+	
+	public static Long getLong(HttpServletRequest request, String name){
+		Long value = null;
+		try{
+			String s = request.getParameter(name);
+			value = new Long(s);
+		}catch (Exception e) {
+		}
+		return value;
+	}
+	
+	public static String getString(HttpServletRequest request, String name){
+		String value = null;
+		try{
+			value = request.getParameter(name);
+		}catch (Exception e) {
+		}
+		return value;
+	}	
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/scripts/SectionsIndex.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,360 @@
+package de.mpiwg.gazetteer.scripts;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+/**
+ * 
+ * mvn exec:java -Dexec.mainClass="de.mpiwg.gazetteer.scripts.SectionsIndex" -Dexec.args="Gazetteer root admin"
+ * 
+ * @author jurzua
+ *
+ */
+public class SectionsIndex {
+
+	private static String TABLE_NAME = "sections_index";
+	
+	private static String DROP_TABLE = 
+			"DROP TABLE IF EXISTS `"+ TABLE_NAME +"`;";
+	
+	private static String CREATE_TABLE = 
+			"CREATE TABLE `" + TABLE_NAME + "` (`id` int(10) NOT NULL AUTO_INCREMENT, "
+			+ "`name` varchar(255) NOT NULL, "
+			+ "`books_id` varchar(5) NOT NULL, "
+			+ "`section_after` varchar(255) NOT NULL, "
+			+ "`start_page` int(5) NOT NULL, `end_page` int(5) NOT NULL, "
+			+ "`level` int(5) NOT NULL, "
+			+ "`split_from` int(10) DEFAULT NULL, PRIMARY KEY (`id`) ) "
+			+ "ENGINE=MyISAM DEFAULT CHARSET=utf8;";
+	
+	private static String SELECT_SECTIONS = 
+			"SELECT * FROM sections";
+	
+	private static String SECTIONS_COUNT = 
+			"SELECT count(*) FROM sections";
+	
+	private static String SELECT_SECTIONS_VERSIONS = 
+			"SELECT * from sections_versions";
+	
+	
+	private static void execute(String dbName, String dbUser, String dbPwd){
+		
+		Connection conn = null;
+		
+		
+		try {
+			//Class.forName("com.mysql.jdbc.Driver").newInstance();
+			String dbURL = "jdbc:mysql://localhost/"+ dbName +"?characterEncoding=UTF-8";
+			conn = DriverManager.getConnection(dbURL, dbUser, dbPwd);
+			
+			createTable(conn);
+			copyFromSectionsTable(conn);
+			replaceFromSectionsRevisions(conn);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			try {
+				conn.close();
+			} catch (SQLException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+	
+	private static void replaceFromSectionsRevisions(Connection conn){
+		Statement stmt = null;
+		ResultSet rs = null;
+		try {
+		
+			stmt = conn.createStatement();
+			rs = stmt.executeQuery(SELECT_SECTIONS_VERSIONS);
+			
+			Map<String, SectionVersion> mapVersions = new HashMap<String, SectionsIndex.SectionVersion>();
+			
+			while(rs.next()){
+				SectionVersion version = new SectionVersion(rs);
+				if(!mapVersions.containsKey(version.books_id)){
+					mapVersions.put(version.books_id, version);
+				}else if(version.version > mapVersions.get(version.books_id).version){
+					mapVersions.put(version.books_id, version);
+				}
+			}
+			
+			for(SectionVersion sectionVersion : mapVersions.values()){
+				
+				String query = "SELECT * FROM sections_revisions WHERE "
+						+ "books_id = '"+ sectionVersion.books_id +"' AND "
+						+ "versions_id = " + sectionVersion.id + " AND "
+						+ "deleted = 0";
+				stmt = conn.createStatement();
+				rs = stmt.executeQuery(query);
+				
+				while(rs.next()){
+					Section section = new Section(rs, false);
+					
+					if(section.deleted == 0){
+						if(section.id == -1){
+							
+							PreparedStatement stmt0 = section.getInsertStatementWithoutId(conn);
+							stmt0.executeUpdate();
+							ResultSet rs0 = stmt0.getGeneratedKeys();
+						    rs0.next();
+						    int newSectionId = rs0.getInt(1); 
+							
+							//Updating sections_revisions (from -1 to new id)
+						    String sqlUpdateRevision = "UPDATE sections_revisions SET sections_id = ? WHERE id = ?";
+						    PreparedStatement stmt1 = conn.prepareStatement(sqlUpdateRevision);
+						    stmt1.setInt(1, newSectionId);
+						    stmt1.setInt(2, section.sectionsRevisionsId);
+						    int rowsUpdated = stmt1.executeUpdate();
+						    
+						    System.out.println("Changing revision section with id: " + section.sectionsRevisionsId + " from -1 to " + newSectionId + ". Rows updated: " + rowsUpdated);
+						    //System.out.print("#");
+						}else{
+							PreparedStatement stm = section.getUpdateStatement(conn);
+							stm.execute();
+						}						
+					}
+				}
+			}
+			
+			System.out.println();
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	private static void copyFromSectionsTable(Connection conn){
+		Statement stmt = null;
+		ResultSet rs = null;
+		try {
+			/*
+			stmt = conn.createStatement();
+			rs = stmt.executeQuery(SECTIONS_COUNT);
+			rs.next();
+			int count = rs.getInt(1);
+			*/
+			stmt = conn.createStatement();
+			rs = stmt.executeQuery(SELECT_SECTIONS);
+			
+			int index = 0;
+			while(rs.next()){
+				Section section = new Section(rs, true);
+				
+				//stmt = conn.createStatement();
+				//stmt.executeUpdate(section.getInsertStatement());
+				PreparedStatement stm = section.getInsertStatementWithId(conn);
+				stm.execute();
+				
+				if(index % 100 == 0){
+					System.out.print("*");
+				}
+				index++;
+			}
+			System.out.println();
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	
+	private static void createTable(Connection conn){
+		Statement stmt = null;
+		
+		try {
+			stmt = conn.createStatement();
+			int rows = stmt.executeUpdate(DROP_TABLE);
+			System.out.println("DROP table: " + rows);
+			
+		} catch (Exception e) {
+			System.err.println("\n" + DROP_TABLE);
+			e.printStackTrace();
+		}
+		
+		try {
+			stmt = conn.createStatement();
+			int rows = stmt.executeUpdate(CREATE_TABLE);
+			System.out.println("CREATE table: " + rows);
+		} catch (Exception e) {
+			System.err.println("\n" + CREATE_TABLE);
+			e.printStackTrace();
+		}
+	}
+	
+	
+	private static void printSetting(){
+        
+       int mb = 1024*1024;
+        
+       //Getting the runtime reference from system
+       Runtime runtime = Runtime.getRuntime();
+        
+       System.out.println("##### Heap utilization statistics [MB] #####");
+        
+       //Print used memory
+       System.out.println("Used Memory:"
+           + (runtime.totalMemory() - runtime.freeMemory()) / mb);
+
+       //Print free memory
+       System.out.println("Free Memory:"
+           + runtime.freeMemory() / mb);
+        
+       //Print total available memory
+       System.out.println("Total Memory:" + runtime.totalMemory() / mb);
+
+       //Print Maximum available memory
+       System.out.println("Max Memory:" + runtime.maxMemory() / mb);
+   }
+	
+	public static void main(String[] args){
+		
+		printSetting();
+		
+		String dbName = args[0];
+		String dbUser = args[1];
+		String dbPwd = args[2];
+		
+		SectionsIndex.execute(dbName, dbUser, dbPwd);
+		
+		System.exit(0);
+	} 
+	//table: sections_revisions
+	private static class SectionVersion{
+		
+		private int id;
+		private int version;
+		private String editor;
+		private String books_id;
+		
+		public SectionVersion(ResultSet rs) throws SQLException{
+			this.id = rs.getInt("id");
+			this.version = rs.getInt("version");
+			this.editor = rs.getString("editor");
+			this.books_id = rs.getString("books_id");
+		}
+		
+		public int getVersion(){
+			return this.version;
+		}
+	}
+	
+	private static class Section{
+		private int id;
+		private String name;
+		private String books_id;
+		private String section_after;
+		private int start_page;
+		private int end_page;
+		private int level;
+		private int split_from;
+		//private int sections_id;
+		
+		//tables for the revisions_sections
+		private int sectionsRevisionsId;
+		private int deleted;
+		
+		public Section(ResultSet rs, boolean isSectionTable) throws SQLException{
+			
+			this.name = rs.getString("name");
+			this.books_id = rs.getString("books_id");
+			this.section_after = rs.getString("section_after");
+			this.start_page = rs.getInt("start_page");
+			this.end_page = rs.getInt("end_page");
+			this.level = rs.getInt("level");
+			this.split_from = rs.getInt("split_from");
+			if(isSectionTable){
+				this.id = rs.getInt("id");
+			}else{
+				this.id = rs.getInt("sections_id");
+				this.sectionsRevisionsId = rs.getInt("id");
+				this.deleted = rs.getInt("deleted");
+			}
+		}
+		
+		public PreparedStatement getInsertStatementWithId(Connection conn) throws SQLException{
+			
+			String sql = "INSERT INTO " + TABLE_NAME + " " + 
+					"(id, name, books_id, section_after, start_page, end_page, level, split_from) VALUES" +
+					"(?,?,?,?,?,?,?,?)";
+			PreparedStatement stm = conn.prepareStatement(sql);
+			
+			stm.setInt(1, id);
+			stm.setString(2, name);
+			stm.setString(3, books_id);
+			stm.setString(4, section_after);
+			stm.setInt(5, start_page);
+			stm.setInt(6, end_page);
+			stm.setInt(7, level);
+			stm.setInt(8, split_from);
+			
+			return stm;
+		}
+		
+		public PreparedStatement getInsertStatementWithoutId(Connection conn) throws SQLException{
+		
+			String sql = "INSERT INTO " + TABLE_NAME + " " + 
+					"(name, books_id, section_after, start_page, end_page, level, split_from) VALUES" +
+					"(?,?,?,?,?,?,?)";
+			PreparedStatement stm = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
+			
+			stm.setString(1, name);
+			stm.setString(2, books_id);
+			stm.setString(3, section_after);
+			stm.setInt(4, start_page);
+			stm.setInt(5, end_page);
+			stm.setInt(6, level);
+			stm.setInt(7, split_from);
+			
+			return stm;
+		}
+		
+		public PreparedStatement getUpdateStatement(Connection conn) throws SQLException{
+			String s = "UPDATE " + TABLE_NAME + " " +
+					"SET id = ?, name = ?, books_id = ?, section_after = ?, start_page = ?, end_page = ?, level = ?, split_from = ? " +
+					"WHERE id = ?"; 
+			PreparedStatement stm = conn.prepareStatement(s);
+			
+			stm.setInt(1, id);
+			stm.setString(2, name);
+			stm.setString(3, books_id);
+			stm.setString(4, section_after);
+			stm.setInt(5, start_page);
+			stm.setInt(6, end_page);
+			stm.setInt(7, level);
+			stm.setInt(8, split_from);
+			stm.setInt(9, id);
+			
+			return stm;
+		}
+		/*
+		public String getUpdateStatement(){
+			
+			String statement = "UPDATE " + TABLE_NAME + " ";
+			statement += "WHERE id = " + sections_id + " ";
+			//statement += " (id, name, books_id, section_after, start_page, end_page, level, split_from) ";
+			statement += " VALUES (" +
+					sections_id + ", '" + 
+					name + "', '"+ 
+					books_id +"', '"+
+					section_after+"', "+ 
+					start_page +", " + 
+					end_page + ", "+ 
+					level +", " + 
+					split_from + ")";
+			
+			return statement;
+		}*/
+		
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,50 @@
+package de.mpiwg.gazetteer.utils;
+
+import java.util.List;
+
+import cl.maps.duplex.DuplexMap;
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.bo.SearchRulesFile;
+
+public class AbstractDataProvider {
+
+	
+	//###############################
+	
+	private DuplexMap<LGBranch, Long, Long> branchMap = null;
+	
+	protected DuplexMap<LGBranch, Long, Long> getBranchMap(){
+		if(branchMap == null){
+			loadBranches();
+		}
+		return branchMap;
+	}
+	
+	public void loadBranches(){
+		List<LGBranch> list = DBService.getAllLGBranchFromDB();
+		this.branchMap = new DuplexMap<LGBranch, Long, Long>();
+		for(LGBranch item : list){
+			this.branchMap.put(item.getKey(), item);
+		}
+	}
+	
+	
+	private DuplexMap<LGFile, Long, Long> fileMap = null;
+	
+	protected DuplexMap<LGFile, Long, Long> getFileMap(){
+		if(fileMap == null){
+			loadFiles();
+		}
+		return fileMap;
+	}
+	
+	
+	private void loadFiles(){
+		List<LGFile> list = DBService.getAllLGFileFromDB();
+		this.fileMap = new DuplexMap<LGFile, Long, Long>();
+		for(LGFile file : list){
+			this.fileMap.put(file.getKey(), file);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/DBService.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,538 @@
+	package de.mpiwg.gazetteer.utils;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.hibernate.Query;
+import org.hibernate.Session;
+
+import de.mpiwg.gazetteer.bo.DBEntry;
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.bo.SearchRulesFile;
+import de.mpiwg.gazetteer.bo.Sequence;
+import de.mpiwg.gazetteer.db.DBBook;
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class DBService {
+
+	private static Logger logger = Logger.getLogger(DBService.class);
+	
+	// JDBC driver name and database URL
+	static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
+	static final String DB_URL = "jdbc:mysql://localhost/";
+	
+	private static String SECTIONS_TABLE = "sections_index";
+
+	private static DBService instance = null;
+	
+	public static DBService getInstance(){
+		if(instance == null){
+			instance = new DBService();
+		}
+		return instance;
+	}
+	
+	private Map<String, DBBook> bookMap;
+	private List<String> dynastyList;
+	
+	public List<String> getDynastyList() throws SQLException{
+		if(this.dynastyList == null){
+			this.loadDynastyList();
+		}
+		return dynastyList;
+	}
+	
+	private void loadDynastyList() throws SQLException{
+		Long start = System.currentTimeMillis();
+		Connection conn = null;
+		Statement stmt = null;
+		this.dynastyList = new ArrayList<String>();
+		
+		try {
+			String query = "SELECT DISTINCT dynasty FROM books";
+			logger.debug(query);
+			conn = getNewConnection();
+			stmt   = conn.createStatement();
+			ResultSet rs = stmt.executeQuery(query);
+			
+			while(rs.next()){
+				this.dynastyList.add(rs.getString("dynasty"));
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			conn.close();
+		}
+		
+		long end = System.currentTimeMillis();
+		logger.debug("Time execution loading Book Map [ms]: " + (end - start));
+	}
+	
+	public DBBook getBook(String id){
+		return getBookMap().get(id);
+	}
+	
+	private Map<String, DBBook> getBookMap(){
+		if(bookMap == null){
+			try {
+				this.loadBookMap();	
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		return this.bookMap;
+	}
+	
+	private void loadBookMap() throws SQLException{
+		Long start = System.currentTimeMillis();
+		Connection conn = null;
+		Statement stmt = null;
+		this.bookMap = new HashMap<String, DBBook>();
+		
+		try {
+			String query = "SELECT * FROM books";
+			logger.debug(query);
+			conn = getNewConnection();
+			stmt   = conn.createStatement();
+			ResultSet rs = stmt.executeQuery(query);
+			
+			while(rs.next()){
+				DBBook book = new DBBook(rs);
+				this.bookMap.put(book.getId(), book);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			conn.close();
+		}
+		
+		long end = System.currentTimeMillis();
+		logger.debug("Time execution loading Book Map [ms]: " + (end - start));
+	}
+	
+	public static List<DBSection> searchBook(List<String> termList, String field) throws SQLException{
+		Long start = System.currentTimeMillis();
+		
+		List<DBSection> list = new ArrayList<DBSection>();
+		
+		Connection conn = null;
+		Statement stmt = null;
+		
+		//TODO this query should join the section table
+		String query = "SELECT * FROM books WHERE ";
+		for(int i=0; i<termList.size() ; i++){
+			String term = termList.get(i);
+			if(i>0){
+				query += " OR ";
+			}
+			query += field + " like '%" + term + "%' ";
+		}
+
+		try {
+			conn = getNewConnection();
+			stmt = conn.createStatement();
+			
+			ResultSet rs = stmt.executeQuery(query);
+			while (rs.next()) {
+				DBBook book = new DBBook(rs);
+				
+				String sql = "SELECT * FROM "+ SECTIONS_TABLE +" WHERE " + "books_id = '" + book.getId() + "'";
+				logger.debug(sql);
+				stmt = conn.createStatement();
+				ResultSet rs0 = stmt.executeQuery(sql);
+				while(rs0.next()){
+					DBSection section = new DBSection(rs0);
+					section.setBook(book);
+					list.add(section);
+				}
+			}
+			rs.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			conn.close();
+		}
+		
+		long end = System.currentTimeMillis();
+		logger.debug("Time execution serching Books [ms]: " + (end - start));
+		
+		return list;
+	}
+	
+	/**
+	 * This methods search from a list of terms. 
+	 * Every term is considered a subsequence of whole section name.
+	 * 
+	 * @param termList
+	 * @return
+	 * @throws SQLException
+	 */
+	public static List<DBSection> searchSection(List<String> termList) throws SQLException{
+		
+		Long start = System.currentTimeMillis();
+		
+		List<DBSection> list = new ArrayList<DBSection>();
+		
+		Connection conn = null;
+		Statement stmt = null;
+		
+		String query = "SELECT * FROM "+ SECTIONS_TABLE +" WHERE ";
+		for(int i=0; i<termList.size() ; i++){
+			String term = termList.get(i);
+			if(i>0){
+				query += " OR ";
+			}
+			query += "name like '%" + term + "%' ";
+		}
+
+		try {
+			Class.forName(JDBC_DRIVER);
+			conn = getNewConnection();
+			stmt = conn.createStatement();
+			
+			ResultSet rs = stmt.executeQuery(query);
+			while (rs.next()) {
+				DBSection section = new DBSection(rs);
+				DBBook book = getInstance().getBook(section.getBookId());
+				section.setBook(book);
+				list.add(section);
+			}
+			rs.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			conn.close();
+		}
+		
+		long end = System.currentTimeMillis();
+		logger.debug("Time execution serching Sections [ms]: " + (end - start));
+		
+		return list;
+	}
+	
+	public static List<String> suggestBookName(String term, int limit) throws SQLException{
+		List<String> list = new ArrayList<String>();
+		
+		Connection conn = null;
+		Statement stmt = null;
+		
+		String query = "SELECT name FROM books WHERE name like '" + term + "%' limit " + limit;
+
+		try {
+			Class.forName(JDBC_DRIVER);
+			conn = getNewConnection();
+			stmt = conn.createStatement();
+			
+			ResultSet rs = stmt.executeQuery(query);
+			while (rs.next()) {
+				String name = rs.getString("name");
+				if(!list.contains(name)){
+					list.add(name);
+				}
+			}
+			rs.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			conn.close();
+		}
+		return list;		
+	}
+	
+	public static List<String> suggestSectionName(String term, int limit) throws SQLException {
+		List<String> list = new ArrayList<String>();
+		
+		Connection conn = null;
+		Statement stmt = null;
+		
+		String query = "SELECT name FROM "+SECTIONS_TABLE+" WHERE name like '" + term + "%' limit " + limit;
+
+		try {
+			Class.forName(JDBC_DRIVER);
+			conn = getNewConnection();
+			stmt = conn.createStatement();
+			
+			ResultSet rs = stmt.executeQuery(query);
+			while (rs.next()) {
+				String name = rs.getString("name");
+				if(!list.contains(name)){
+					list.add(name);
+				}
+			}
+			rs.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			conn.close();
+		}
+		return list;
+	}
+	
+	
+	public static List<String> suggestSectionId(String input, int limit) throws SQLException {
+		List<String> list = new ArrayList<String>();
+		
+		Connection conn = null;
+		Statement stmt = null;
+		
+		String query = "SELECT id FROM "+SECTIONS_TABLE+" WHERE id like '" + input + "%' limit " + limit;
+
+		try {
+			Class.forName(JDBC_DRIVER);
+			conn = getNewConnection();
+			stmt = conn.createStatement();
+			
+			ResultSet rs = stmt.executeQuery(query);
+			while (rs.next()) {
+				
+				String id = rs.getString("id");
+				list.add(id);
+				
+			}
+			rs.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			conn.close();
+		}
+		
+	
+		
+		return list;
+	}
+	
+	public static DBSection getSectionWithContent(Long sectionId) throws SQLException {
+
+		Connection conn = null;
+		Statement stmt = null;
+		DBSection section = null;
+		
+		String query = "SELECT * FROM "+SECTIONS_TABLE+" WHERE id = '" + sectionId + "'";
+		
+		try {
+			Class.forName(JDBC_DRIVER);
+			conn = getNewConnection();
+			stmt = conn.createStatement();
+			
+			ResultSet rs = stmt.executeQuery(query);
+			while (rs.next()) {
+				
+				section = new DBSection(rs);
+				/*
+				String bookId = rs.getString("books_id");
+				int startPage = rs.getInt("start_page");
+				int endPage = rs.getInt("end_page");
+				String sectionName = rs.getString("name");
+				
+				response.setBookId(bookId);
+				response.setName(sectionName);
+				*/
+				//System.out.println("bookId=" + bookId + ", startPage=" + startPage + ", endPage=" + endPage);
+				//String content = getContent(conn, bookId, startPage, endPage);
+				String content = getContent(conn, section);
+				section.setText(content);
+				
+				//DBBook book = getBook0FromDB(conn, bookId);
+				DBBook book = DBService.getInstance().getBook(section.getBookId());
+				section.setBook(book);
+				
+			}
+			rs.close();
+		} catch (Exception e) {
+		} finally {
+			conn.close();
+		}
+		return section;
+	}
+	
+	public static String fixToNewline(String orig){
+	    char[] chars = orig.toCharArray();
+	    StringBuilder sb = new StringBuilder(100);
+	    for(char c : chars){
+	        switch(c){
+	            case '\r':
+	            case '\f':
+	                break;
+	            case '\n':
+	                sb.append("<br>");
+	                break;
+	            default:
+	                sb.append(c);
+	        }
+	    }
+	    return sb.toString();
+	}
+	
+	//"SELECT `content`, `line`, `books_id` FROM `contents` WHERE `books_id`=\"%s\" AND `line`>=%d AND `line`<=%d
+	//private static String getContent(Connection conn, String bookId, Integer startLine, Integer endLine) throws Exception{
+	private static String getContent(Connection conn, DBSection section) throws Exception{
+		String query = "SELECT content, line FROM contents WHERE books_id = '" + section.getBookId() + "' AND line >= '" + section.getStart_page() + "' AND line <= '" + section.getEnd_page() + "'";
+		
+		logger.debug(query);
+		
+		Statement stmt   = conn.createStatement();
+		ResultSet rs = stmt.executeQuery(query);
+		
+		StringBuilder sb = new StringBuilder();
+		while(rs.next()){
+			String line = rs.getString("line");
+			String content = rs.getString("content");
+			sb.append("【" + line + "】" + content + "\n");
+		}
+		
+		return sb.toString();
+	}
+	
+	/*
+	public static DBBook getBookFromDB(String id) throws SQLException{
+		Connection conn = null;
+		DBBook book = null;
+	
+		try {
+			//Class.forName(JDBC_DRIVER);
+			conn = getNewConnection();
+			book = getBook0FromDB(conn, id);
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			conn.close();
+		}
+		return book;
+	}*/
+	/*
+	private static DBBook getBook0FromDB(Connection conn, String id) throws SQLException{
+		DBBook book = null;
+		
+		String query = "SELECT * FROM books WHERE id = '" + id + "'";
+		logger.debug(query);
+		
+		Statement stmt   = conn.createStatement();
+		ResultSet rs = stmt.executeQuery(query);
+		
+		if(rs.next()){
+			book = new DBBook(rs);
+		}
+		
+		return book;
+	}*/
+
+	/**
+	 * This method removed all files for a particular fileId.
+	 * The elimination includes the current version as well as the old versions.
+	 * @param fileId
+	 * @return
+	 */
+	protected static int deleteBranchFromDB(Long branchId){
+		logger.info("Deleting Branch by branchId=" + branchId);
+		
+		int modifiedFiles;
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+		
+		Query query = session.createQuery("delete LGBranch where id = :id");
+		query.setLong("id", branchId);
+		modifiedFiles = query.executeUpdate();
+		
+		Query query0 = session.createQuery("delete LGFile where branchId = :branchId");
+		query0.setLong("branchId", branchId);
+		modifiedFiles += query0.executeUpdate();
+		
+		session.getTransaction().commit();
+		
+		return modifiedFiles;
+	}
+	
+	protected static int deleteFileFromDB(Long fileId){
+		
+		int modifiedFiles;
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+		
+		
+		Query query0 = session.createQuery("delete LGFile where id = :fileId");
+		query0.setLong("fileId", fileId);
+		modifiedFiles = query0.executeUpdate();
+		
+		session.getTransaction().commit();
+		
+		return modifiedFiles;
+		
+	}
+	
+	protected static  List<LGFile> getAllLGFileFromDB(){
+		List<LGFile> list = null;
+
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+		Query query = session.createQuery("from LGFile");
+		list = query.list();
+		session.getTransaction().commit();
+
+		return list;
+	}	
+	
+	protected static  List<LGFile> getCurrentLGFilesFromDB(){
+		List<LGFile> list = null;
+
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+		Query query = session.createQuery("from LGFile where lastVersion = :lastVersion");
+		query.setBoolean("lastVersion", true);
+		list = query.list();
+		session.getTransaction().commit();
+
+		return list;
+	}
+	
+	protected static  List<LGBranch> getAllLGBranchFromDB(){
+		List<LGBranch> list = null;
+
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+		Query query = session.createQuery("from LGBranch");
+		list = query.list();
+		session.getTransaction().commit();
+
+		return list;
+	}
+	
+	protected static void saveDBEntry(DBEntry entry, Date date){
+
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+
+		saveDBEntry0(session, entry, date);
+
+		session.getTransaction().commit();
+	}
+
+	public static void saveDBEntry0(Session session, DBEntry entry, Date date){
+		entry.setLastChangeDate(date);
+		if (entry.isPersistent()) {
+			session.update(entry);
+		} else {
+			entry.setCreationDate(date);
+			session.save(entry);
+		}
+		logger.info("saveDBEntry: " + entry.toString());
+	}
+
+	public static Connection getNewConnection() throws SQLException, IOException{
+		return DriverManager.getConnection(
+				DB_URL + PropertiesUtils.getPropValue("db_gazetter_name") + "?useUnicode=yes&characterEncoding=UTF-8", 
+				PropertiesUtils.getPropValue("db_gazetter_username"), 
+				PropertiesUtils.getPropValue("db_gazetter_password"));
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,246 @@
+package de.mpiwg.gazetteer.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.Session;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.utils.exceptions.NoAuthorizedException;
+import de.mpiwg.gazetteer.utils.exceptions.VersioningException;
+
+public class DataProvider extends AbstractDataProvider{
+	
+	private static Logger logger = Logger.getLogger(DBService.class);
+	private static DataProvider instance;
+	
+	public static DataProvider getInstance(){
+		if(instance == null)
+			instance = new DataProvider();
+		return instance;
+	}
+	
+	public DataProvider(){
+		logger.info("##### Starting DataProvider #####");
+	}
+	
+	public LGFile getFile(Long fileId){
+		return getFileMap().getValuesByOwnKey(fileId);
+	}
+	
+	public List<LGFile> getAllFiles(Long branchId){
+		List<LGFile> list = getFileMap().getValuesByAKey(branchId);
+		Collections.sort(list);
+		Collections.reverse(list);
+		return list;
+	}
+	
+	public List<LGBranch> getBranches(Long userId){
+		List<LGBranch> list = new ArrayList<LGBranch>();
+		for(LGBranch branch : getBranchMap().values()){
+			if(branch.hasContributor(userId)){
+				list.add(branch);
+			}
+		}
+		return list;
+	}
+	
+	public LGBranch getBranch(Long branchId){
+		return getBranchMap().getValuesByOwnKey(branchId);
+	}
+	
+	public void deleteFile(LGFile file) throws Exception{
+	
+		LGBranch branch = getBranch(file.getBranchId());
+		
+		if(branch == null){
+			throw new Exception("There is any Branch for " + file);
+		}
+		
+		List<LGFile> files = getAllFiles(file.getBranchId());
+		
+		if(files.size() == 1){
+			throw new Exception("This file could not be deleted, because it is part of a branch that has only one file. A Branch without files is a inconsistency.");
+		}
+		
+		// if the file is the last version of a branch, we must replace the current file with the penultimate file.
+		if(branch.getCurrentLastFileId().equals(file.getId())){
+			LGFile penultimateFile = getPenultimateFile(files);
+			
+			penultimateFile.setLastVersion(true);
+			branch.setCurrentLastFileId(penultimateFile.getId());
+			
+			this.updateBranch(branch);
+			this.updateFile(penultimateFile);
+			
+		}
+		
+		//deleting file from DB and cache
+		int modifiedFiles = DBService.deleteFileFromDB(file.getId());
+		getFileMap().remove(file.getKey());
+		
+		logger.info(modifiedFiles + " items deleted by removing file " + file);
+	}
+	
+	private LGFile getPenultimateFile(List<LGFile> files){
+		LGFile penultimateFile = null;
+		LGFile lastFile = null;
+		
+		for(LGFile file : files){
+			if(lastFile == null){
+				lastFile = file;
+			}else if(penultimateFile == null){
+				lastFile = (lastFile.getVersion() > file.getVersion()) ? lastFile : file;
+				penultimateFile = (lastFile.getVersion() < file.getVersion()) ? lastFile : file;
+			}else{
+				if(file.getVersion() > lastFile.getVersion()){
+					penultimateFile = lastFile;
+					lastFile = file;
+				}else if(file.getVersion() > penultimateFile.getVersion()){
+					penultimateFile = file;
+				}
+			}
+		}
+		
+		return penultimateFile;
+	}
+	
+	public void deleteBranch(LGBranch branch){
+		
+		int modifiedFiles = DBService.deleteBranchFromDB(branch.getId());
+		List<LGFile> fileToDelete = getFileMap().getValuesByAKey(branch.getId());
+		
+		for(LGFile file : new ArrayList<LGFile>(fileToDelete)){
+			getFileMap().remove(file.getKey());
+		}
+		getBranchMap().remove(branch.getKey());
+
+		logger.info(modifiedFiles + " items deleted by removing branch " + branch.toString());
+	}
+	
+	public void updateFile(LGFile file) throws Exception{
+		if(!file.isPersistent()){
+			throw new Exception("Trying to update a file that it is not persistent!");
+		}
+		
+		Date date = new Date();
+		DBService.saveDBEntry(file, date);
+		this.getFileMap().put(file.getKey(), file);
+	}
+	
+	public void updateBranch(LGBranch branch) throws Exception{
+		if(!branch.isPersistent()){
+			throw new Exception("Trying to update a branch that it is not persistent!");
+		}
+		
+		Date date = new Date();
+		DBService.saveDBEntry(branch, date);
+		this.getBranchMap().put(branch.getKey(), branch);
+	}
+	
+	public LGFile saveFile(Long branchId, String text, Long userId, Long userPreviousFileId) throws Exception{
+		
+		
+		
+		Date date = new Date();
+		
+		LGBranch branch = getBranchMap().getValuesByOwnKey(branchId);
+		
+		if(!branch.hasContributor(userId)){
+			throw new NoAuthorizedException(userId, branchId);
+		}
+		
+		if(!branch.getCurrentLastFileId().equals(userPreviousFileId)){
+			LGFile userPreviousFile = getFileMap().getValuesByOwnKey(userPreviousFileId);
+			LGFile currentLastFile = getFileMap().getValuesByOwnKey(branch.getCurrentLastFileId());
+			
+			throw new VersioningException(userPreviousFile, currentLastFile);
+		}
+		
+		LGFile previousFile = getFileMap().getValuesByOwnKey(branch.getCurrentLastFileId());
+		
+		LGFile file = new LGFile();
+		file.setBranchId(branchId);
+		file.setVersion(previousFile.getVersion() + 1);
+		file.setUserId(userId);
+		file.setContent(text);
+		
+		//Saving into DB
+		//##################################
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+		
+		
+		file.setBranchId(branch.getId());
+		DBService.saveDBEntry0(session, file, date);
+		
+		previousFile.setLastVersion(false);
+		DBService.saveDBEntry0(session, previousFile, date);
+		
+		branch.setCurrentLastFileId(file.getId());
+		DBService.saveDBEntry0(session, branch, date);
+		
+		//Saving physical file in the operating system
+		String fileName = FileManager.saveFile(branch, file, date, userId);
+		file.setFileName(fileName);
+		DBService.saveDBEntry0(session, file, date);
+		
+		session.getTransaction().commit();
+		//##################################
+		
+		
+		//Saving into Cache
+		getBranchMap().put(branch.getKey(), branch);
+		getFileMap().put(file.getKey(), file);
+		getFileMap().put(previousFile.getKey(), previousFile);
+		
+		return file;
+	}
+	
+	public Long saveNewFile(String text, String label, Long sectionId, Long userId) throws Exception{
+		
+		Date date = new Date();
+		
+		LGBranch branch = new LGBranch();				
+		branch.setSectionId(sectionId);
+		branch.setUserId(userId);
+		branch.setLabel(label);
+		branch.addContributor(userId);
+		branch.loadTransientData();
+		
+		LGFile file = new LGFile();
+		file.setUserId(userId);
+		file.setContent(text);
+		
+		//Saving into DB
+		//##################################
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+		session.getTransaction().begin();
+		
+		DBService.saveDBEntry0(session, branch, date);
+		file.setBranchId(branch.getId());
+		
+		DBService.saveDBEntry0(session, file, date);
+		branch.setCurrentLastFileId(file.getId());
+
+		//Saving physical file in the operating system
+		String fileName = FileManager.saveFile(branch, file, date, userId);
+		file.setFileName(fileName);
+		DBService.saveDBEntry0(session, file, date);
+		
+		session.getTransaction().commit();
+		//##################################
+		
+		
+		//Saving into Cache
+		getBranchMap().put(branch.getKey(), branch);
+		getFileMap().put(file.getKey(), file);
+		
+		return branch.getId();
+		
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/FileManager.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,87 @@
+package de.mpiwg.gazetteer.utils;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.UUID;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+
+public class FileManager {
+
+	private static Logger logger = Logger.getLogger(FileManager.class);
+	
+	private static DateFormat dfmt = new SimpleDateFormat( "yyyy.MM.dd_hh.mm.ss.SSS" );
+
+	
+	
+	private static String getRootPath() throws Exception{
+		String base = PropertiesUtils.getPropValue("files_root");
+		
+		if(StringUtils.isEmpty(base)){
+			throw new Exception("Property files_root no found. The files can be stored without this property.");
+		}
+		
+		if(!base.endsWith("/")){
+			base += "/";
+		}
+		
+		logger.info("files_root=" + base);
+		
+		return base;
+	}
+	
+	public static String saveFile(LGBranch branch, LGFile file, Date date, Long userId) throws Exception{
+				
+		String absolutePath = getRootPath() + branch.getSectionId() + "/";
+		String fileName = 
+				branch.getSectionId() + "_" + 
+				branch.getId() + "_"  + 
+				file.getId() +  "_" + 
+				dfmt.format(date) + "_" +
+				userId +
+				".txt";
+		
+		File folder = new File(absolutePath);
+		folder.mkdirs();
+		
+		logger.info("Trying to save file " + absolutePath + fileName + ".");
+		
+		PrintWriter out = new PrintWriter(absolutePath + fileName);
+		out.println(file.getContent());
+		out.close();
+		
+		logger.info("The file " + fileName + " has been saved correctly.");
+		return fileName;
+	}
+	
+	public static String getFileAsText(LGFile file) throws Exception{
+		
+		LGBranch branch = DataProvider.getInstance().getBranch(file.getBranchId());
+		
+		String absolutePath = getRootPath() + branch.getSectionId() + "/" + file.getFileName();
+		System.out.println("Loading: " + absolutePath);
+		byte[] encoded = Files.readAllBytes(Paths.get(absolutePath));
+		return new String(encoded, "UTF8");
+	}
+	
+	public static File getFileAsFile(LGFile file) throws Exception{
+		
+		LGBranch branch = DataProvider.getInstance().getBranch(file.getBranchId());
+		
+		String absolutePath = getRootPath() + branch.getSectionId() + "/" + file.getFileName();
+		System.out.println("Loading: " + absolutePath);
+		return new File(absolutePath);
+	}
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/HTTPUtils.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,178 @@
+package de.mpiwg.gazetteer.utils;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+
+public class HTTPUtils {
+
+    final static TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
+        @Override
+        public void checkClientTrusted( final X509Certificate[] chain, final String authType ) {
+        }
+        @Override
+        public void checkServerTrusted( final X509Certificate[] chain, final String authType ) {
+        }
+        @Override
+        public X509Certificate[] getAcceptedIssuers() {
+            return null;
+        }
+    } };	
+	
+
+    
+    /**
+     * This method returns a table that is generated by the extraction interface from a file id.
+     * 
+     * @TODO: Currently, the extraction interface runs over HTTP, when it changes to HTTPS, this methods should be adapted to this. 
+     * 
+     * @param fileId
+     * @return
+     * @throws Exception some HTTP code different higher than 400
+     */
+    public static String getTableOfFile(Long fileId) throws Exception{
+		
+		
+		String link = PropertiesUtils.getPropValue("extraction_interface") + "/Extractapp/ExportTable";
+		
+		System.out.println(link);
+		
+		URL url = new URL(link);
+		HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();
+		
+		httpConn.setReadTimeout(10000);
+		httpConn.setConnectTimeout(15000);
+		httpConn.setRequestMethod("POST");
+		httpConn.setDoInput(true);
+		httpConn.setDoOutput(true);
+
+		//Send request
+		DataOutputStream wr = new DataOutputStream (httpConn.getOutputStream ());
+	    wr.writeBytes ("fileId=" + fileId);
+	    wr.flush ();
+	    wr.close ();
+		
+        BufferedReader in = null;
+        if (httpConn.getResponseCode() >= 400) {
+        	in = new BufferedReader(
+                    new InputStreamReader(
+                    		httpConn.getErrorStream()));
+        	
+        	String inputLine;
+            StringBuilder sb = new StringBuilder();
+            while ((inputLine = in.readLine()) != null) 
+            	sb.append(inputLine + "\n");
+        	
+        	throw new Exception("HTTP Error, code " + httpConn.getResponseCode());
+        	
+        } else {
+        	in = new BufferedReader(
+                    new InputStreamReader(
+                    		httpConn.getInputStream()));
+        }
+        
+        String inputLine;
+        StringBuilder sb = new StringBuilder();
+        while ((inputLine = in.readLine()) != null) 
+        	sb.append(inputLine + "\n");
+        in.close();
+        
+		return sb.toString();
+	}
+    
+    public static HttpStringResponse getStringResponse(String link) throws IOException, KeyManagementException, NoSuchAlgorithmException{
+    	if(link.startsWith("https") || link.startsWith("HTTPS"))
+    		return getHttpSSLStringResponse(link);
+    	return getHttpStringResponse(link);
+    }
+    
+	private static HttpStringResponse getHttpSSLStringResponse(String link) throws IOException, KeyManagementException, NoSuchAlgorithmException{
+	    
+	    // Install the all-trusting trust manager
+	    final SSLContext sslContext = SSLContext.getInstance( "SSL" );
+	    sslContext.init( null, trustAllCerts, new java.security.SecureRandom() );
+	    // Create an ssl socket factory with our all-trusting manager
+	    final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
+		
+		URL url = new URL(link);
+		HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();
+		
+		( (HttpsURLConnection) httpConn ).setSSLSocketFactory( sslSocketFactory );
+
+        
+        BufferedReader in = null;
+        if (httpConn.getResponseCode() >= 400) {
+        	in = new BufferedReader(
+                    new InputStreamReader(
+                    		httpConn.getErrorStream()));
+        } else {
+        	in = new BufferedReader(
+                    new InputStreamReader(
+                    		httpConn.getInputStream()));
+        }	        
+        
+        String inputLine;
+        StringBuilder sb = new StringBuilder();
+        while ((inputLine = in.readLine()) != null) 
+        	sb.append(inputLine + "\n");
+        in.close();
+        
+        return new HttpStringResponse(httpConn.getResponseCode(), sb.toString());
+	}
+	
+	private static HttpStringResponse getHttpStringResponse(String link) throws IOException{
+        
+		//System.out.println(link);
+		
+		URL url = new URL(link);
+		HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();
+        
+        BufferedReader in = null;
+        if (httpConn.getResponseCode() >= 400) {
+        	in = new BufferedReader(
+                    new InputStreamReader(
+                    		httpConn.getErrorStream()));
+        } else {
+        	in = new BufferedReader(
+                    new InputStreamReader(
+                    		httpConn.getInputStream()));
+        }
+        
+        
+        String inputLine;
+        StringBuilder sb = new StringBuilder();
+        while ((inputLine = in.readLine()) != null) 
+        	sb.append(inputLine + "\n");
+        in.close();
+        
+        return new HttpStringResponse(httpConn.getResponseCode(), sb.toString());
+	}
+	
+	public static class HttpStringResponse{
+		public int code;
+		public String content;
+		public HttpStringResponse(int code, String content){
+			this.code = code;
+			this.content = content;
+		}
+	}	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/HibernateUtil.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,31 @@
+package de.mpiwg.gazetteer.utils;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.AnnotationConfiguration;
+
+
+public class HibernateUtil {
+
+    private static final SessionFactory sessionFactory;
+
+    static {
+        try {
+            // Create the SessionFactory from hibernate.cfg.xml
+        	AnnotationConfiguration cfg = new AnnotationConfiguration().configure("hibernate.cfg.xml");
+            if(System.getProperty("hibernate.hbm2ddl.auto") != null && System.getProperty("hibernate.hbm2ddl.auto").equals("create")){
+            	cfg.setProperty("hibernate.hbm2ddl.auto", "create");
+            }
+            sessionFactory = cfg.buildSessionFactory();
+        } catch (Throwable ex) {
+            // Make sure you log the exception, as it might be swallowed
+            System.err.println("Initial SessionFactory creation failed." + ex);
+            ex.printStackTrace();
+            throw new ExceptionInInitializerError(ex);
+        }
+    }
+
+    public static SessionFactory getSessionFactory() {
+        return sessionFactory;
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/JSONUtils.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,66 @@
+package de.mpiwg.gazetteer.utils;
+
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+
+public class JSONUtils {
+
+	public static String getString(JSONObject json, String label){
+		try {
+			return (json.has(label)) ? json.getString(label) : null;
+		} catch (Exception e) {}
+		return null;
+	}
+	
+	public static Long getLong(JSONObject json, String label){
+		try {
+			return (json.has(label)) ? json.getLong(label) : null;
+		} catch (Exception e) {}
+		return null;
+	}
+	
+	public static JSONObject branch2JSON(LGBranch branch){
+		JSONObject json = new JSONObject();
+		
+		try {
+			
+			json.put("id", branch.getId());
+			json.put("label", branch.getLabel());
+			json.put("sectionId", branch.getSectionId());
+			json.put("currentLastFileId", branch.getCurrentLastFileId());
+			json.put("creatorId", branch.getUserId());
+			json.put("creationDate", branch.getFomattedCreation());
+			json.put("info", branch.getInfo());
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return json;
+	}
+	
+	public static JSONObject file2JSON(LGFile file, boolean includeText){
+		JSONObject json = new JSONObject();
+		
+		try {
+			
+			json.put("id", file.getId());
+			json.put("version", file.getVersion());
+			json.put("fileName", file.getFileName());
+			json.put("info", file.getInfo());
+			json.put("creatorId", file.getUserId());
+			json.put("creationDate", file.getFomattedCreation());
+			
+			if(includeText){
+				json.put("text", file.getContent());
+			}
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return json;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/PropertiesUtils.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,50 @@
+package de.mpiwg.gazetteer.utils;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+public class PropertiesUtils {
+	
+	private static Logger logger = Logger.getLogger(PropertiesUtils.class);
+	private static PropertiesUtils instance;
+	
+	
+	private static String PROP_FILENAME = "config.properties";
+	private Properties prop;
+	
+	private PropertiesUtils() throws IOException{
+		loadProperties();
+	}
+	
+	
+	public void loadProperties() throws IOException {
+		
+		logger.info("##### Loading Propertis from " + PROP_FILENAME + " #####");
+		
+		prop = new Properties();
+		InputStream inputStream = getClass().getClassLoader().getResourceAsStream(PROP_FILENAME);
+ 
+		if (inputStream != null) {
+			prop.load(inputStream);
+		} else {
+			prop = null;
+			throw new FileNotFoundException("property file '" + PROP_FILENAME + "' not found in the classpath");
+			
+		}
+	}
+
+	public static String getPropValue(String key) throws IOException{
+		if(instance == null){
+			instance = new PropertiesUtils();
+		}
+		if(instance.prop == null){
+			instance.loadProperties();
+		}
+		return instance.prop.getProperty(key);
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/SelectableObject.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,43 @@
+package de.mpiwg.gazetteer.utils;
+
+import java.io.Serializable;
+
+public class SelectableObject<N> implements Serializable{
+	
+	private static final long serialVersionUID = 1L;
+	
+	private boolean selected;
+	private N obj;
+	private String label;
+	
+	public SelectableObject(N obj){
+		this.obj = obj;
+		this.selected = false;
+	}
+	
+	public SelectableObject(N obj, String label){
+		this.obj = obj;
+		this.selected = false;
+		this.label = label;
+	}
+	
+	public boolean isSelected() {
+		return selected;
+	}
+	public void setSelected(boolean selected) {
+		this.selected = selected;
+	}
+	public N getObj() {
+		return obj;
+	}
+	public void setObj(N obj) {
+		this.obj = obj;
+	}
+	public String getLabel() {
+		return label;
+	}
+	public void setLabel(String label) {
+		this.label = label;
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/exceptions/GazetteerException.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,13 @@
+package de.mpiwg.gazetteer.utils.exceptions;
+
+public abstract class GazetteerException extends Exception{
+
+	private static final long serialVersionUID = -7540131287577085722L;
+	
+	public	 static int CODE = 0;
+	
+	public int getCode(){
+		return CODE;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/exceptions/NoAuthorizedException.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,22 @@
+package de.mpiwg.gazetteer.utils.exceptions;
+
+public class NoAuthorizedException extends GazetteerException{
+	private static final long serialVersionUID = 3483644794781830882L;
+	
+	private static int CODE = 2;
+	private Long userId;
+	private Long branchId;
+	
+	public NoAuthorizedException(Long userId, Long branchId){
+		this.userId = userId;
+		this.branchId = branchId;
+	}
+	public String getMessage(){
+		return "NoAuthorizedException: This user " + userId + " is not authorized to modify this branch (" + branchId + ")!";
+	}
+	
+	public int getCode(){
+		return CODE;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/gazetteer/utils/exceptions/VersioningException.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,45 @@
+package de.mpiwg.gazetteer.utils.exceptions;
+
+import de.mpiwg.gazetteer.bo.LGFile;
+
+public class VersioningException extends GazetteerException{
+
+	private static final long serialVersionUID = 3686916552150745726L;
+
+	private static int CODE = 1;
+	
+	public LGFile userFile;
+	public LGFile currentFile;
+	
+	public VersioningException(LGFile userFile, LGFile currentFile){
+		this.userFile = userFile;
+		this.currentFile = currentFile;
+	}
+	
+	public String getMessage(){
+		String msg = "VersioningException: In the between time, somebody else saved a new version of this file. ";
+		msg += " You modified the version " + this.userFile.getVersion() + ", however the current version is " + this.currentFile.getVersion() + ".";
+		return msg;
+	}
+	
+	
+	public LGFile getUserFile() {
+		return userFile;
+	}
+
+	public void setUserFile(LGFile userFile) {
+		this.userFile = userFile;
+	}
+
+	public LGFile getCurrentFile() {
+		return currentFile;
+	}
+
+	public void setCurrentFile(LGFile currentFile) {
+		this.currentFile = currentFile;
+	}
+
+	public int getCode(){
+		return CODE;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/AbstractJSPPage.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,92 @@
+package de.mpiwg.web.jsp;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public abstract class AbstractJSPPage {
+	
+	protected HttpServletRequest request;
+	protected HttpServletResponse response;
+	
+	public HttpServletRequest getRequest() {
+		return request;
+	}
+	public void setRequest(HttpServletRequest request) {
+		this.request = request;
+	}
+	public HttpServletResponse getResponse() {
+		return response;
+	}
+	public void setResponse(HttpServletResponse response) {
+		this.response = response;
+	}
+
+	public void addMsg(String msg){
+		if(getSessionBean().getMsgList() == null){
+			getSessionBean().setMsgList(new ArrayList<String>());
+		}
+		getSessionBean().getMsgList().add(msg);
+	}
+	
+	public void init(){
+		Map<String, String[]> parameters = request.getParameterMap();
+		for(String parameter : parameters.keySet()) {
+			System.out.println(parameter + "= " + printVars(parameters.get(parameter)));
+		}
+	}
+	
+	public String getParameter(String name){
+		String[] array = request.getParameterValues(name);
+		if(array != null && array.length > 0){
+			return array[0];
+		}
+		return new String();
+	}
+	
+	public Long getLongParameter(String name){
+		String param = getParameter(name);
+		try {
+			return Long.parseLong(param);
+		} catch (Exception e) {
+		}
+		return null;
+	}
+	
+	public Integer getIntParameter(String name){
+		String param = getParameter(name);
+		try {
+			return Integer.parseInt(param);
+		} catch (Exception e) {
+		}
+		return null;
+	}
+	
+	public String printVars(String[] array){
+		String response = new String();
+		for(String s : array){
+			response += s + ", ";
+		}
+		return response;
+	}
+	
+	
+	public void internalError(Exception e){
+		addMsg("Internal Error: " + e.getMessage());
+		e.printStackTrace();
+	}
+	
+	public SessionBean getSessionBean(){
+		SessionBean bean = (SessionBean)((HttpServletRequest) request).getSession().getAttribute("sessionBean");
+		if(bean == null){
+			((HttpServletRequest) request).getSession().setAttribute("sessionBean", new SessionBean());
+		}
+		return (SessionBean)((HttpServletRequest) request).getSession().getAttribute("sessionBean");
+	}
+	
+	public ApplicationBean getApplicationBean(){
+		return ApplicationBean.getInstance();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/ApplicationBean.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,153 @@
+package de.mpiwg.web.jsp;
+
+import java.io.Serializable;
+
+import org.apache.log4j.Logger;
+
+import de.mpiwg.gazetteer.utils.PropertiesUtils;
+
+public class ApplicationBean  implements Serializable{
+	
+	private static final long serialVersionUID = 804932192506497432L;
+
+	private static Logger logger = Logger.getLogger(ApplicationBean.class);
+
+	private static ApplicationBean instance;
+	
+	public static ApplicationBean getInstance(){
+		if(instance == null){
+			instance = new ApplicationBean();
+		}
+		return instance;
+	}
+	
+	public ApplicationBean(){
+		System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
+		System.out.println("Starting Application Bean");
+		System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
+	}
+	
+	
+	public String getExtractionInterfaceUrl(){
+		String value = null;
+		try {
+			value = PropertiesUtils.getPropValue("extraction_interface");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return value;
+	}
+	
+	public String getTocInterfaceUrl(){
+		String value = null;
+		try {
+			value = PropertiesUtils.getPropValue("toc_interface");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return value;
+	}
+	
+	public String getRootServer(){
+		String value = null;
+		try {
+			value = PropertiesUtils.getPropValue("root_server");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return value;	
+	}
+	
+	public String getDvnRootServer(){
+		String value = null;
+		try {
+			value = PropertiesUtils.getPropValue("dvn_server");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return value;	
+	}
+	
+	public String getShowImage(){
+		return getRootServer() + "/resources/images/show_16.png";
+	}
+	
+	public String getEditImage(){
+		return getRootServer() + "/resources/images/edit_16.png";
+	}
+	
+	public String getPublishImage(){
+		return getRootServer() + "/resources/images/publish_16.png";
+	}
+	
+	public String getBranchDetailsImage(){
+		return getRootServer() + "/resources/images/branch_details_16.png";
+	}
+	
+	public String getNewBranchImage(){
+		return getRootServer() + "/resources/images/new_branch_16.png";
+	}
+	
+	public String getEditBranchImage(){
+		return getRootServer() + "/resources/images/edit_branch_16.png";
+	}
+	
+	public String getSearchImage(){
+		return getRootServer() + "/resources/images/search_32.png";
+	}
+	
+	public String getPaginatorFirst(){
+		return getRootServer() + "/resources/images/arrow-first.gif";
+	}
+	
+	public String getPaginatorFr(){
+		return getRootServer() + "/resources/images/arrow-fr.gif";
+	}
+	
+	public String getPaginatorPrevious(){
+		return getRootServer() + "/resources/images/arrow-previous.gif";
+	}
+	
+	public String getPaginatorNext(){
+		return getRootServer() + "/resources/images/arrow-next.gif";
+	}
+	public String getPaginatorFf(){
+		return getRootServer() + "/resources/images/arrow-ff.gif";
+	}
+	
+	public String getPaginatorLast(){
+		return getRootServer() + "/resources/images/arrow-last.gif";
+	}
+	
+	public String getUpImage(){
+		return getRootServer() + "/resources/images/up_16.png";
+	}
+	
+	public String getFilterImage(){
+		return getRootServer() + "/resources/images/filter_16.png";
+	}
+	
+	public String getDownImage(){
+		return getRootServer() + "/resources/images/down_16.png";
+	}
+	
+	public String getDeleteImage(){
+		return getRootServer() + "/resources/images/delete_16.png";
+	}
+	
+	public String getMoreInfoImage(){
+		return getRootServer() + "/resources/images/more_info_16.png";
+	}
+	
+	public String getJSConfirmationDelete(){
+		return "if(!confirm('Do you really want to delete this?')){ return false; };";
+	}
+	
+	public String getJSConfirmationPublish(){
+		return "if(!confirm('Do you really want to publish this?')){ return false; };";
+	}
+	
+	public String getJSConfirmationSave(){
+		return "if(!confirm('Do you really want to save this?')){ return false; };";
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/BranchPage.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,262 @@
+package de.mpiwg.web.jsp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.json.JSONObject;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.bo.LGFile;
+import de.mpiwg.gazetteer.dataverse.DataverseUtils;
+import de.mpiwg.gazetteer.dataverse.bo.VDCUser;
+import de.mpiwg.gazetteer.utils.DataProvider;
+import de.mpiwg.gazetteer.utils.FileManager;
+
+public class BranchPage extends AbstractJSPPage{
+
+	private static Logger logger = Logger.getLogger(CreateFilePage.class);
+	
+	public static String bean = "branchBean";
+	public static String page = "pages/branchPage.jsp";
+	
+	private LGBranch branch;
+	private LGFile lastFile;
+	private Long branchId;
+	private List<LGFile> allFiles;
+	private String text;
+	private List<VDCUser> suggestionUserList;
+	private List<VDCUser> contributors;
+	
+	private Long fileId;
+	
+	private Long userId;
+
+	private String studyGlobalId;
+	
+	
+	public void loadParameters(HttpServletRequest request, HttpServletResponse response){
+		this.request = request;
+		this.response = response;
+		this.userId = getLongParameter("userId");
+		this.fileId = getLongParameter("fileId");
+		this.studyGlobalId = getParameter("studyGlobalId");
+	}
+	
+	public void publishFile(){
+		System.out.println("publishFile: " + this.fileId + " in " + studyGlobalId);
+		if(fileId != null && StringUtils.isNotEmpty(studyGlobalId)){
+			
+			try {
+				JSONObject resp = DataverseUtils.publishFile(fileId, studyGlobalId, getSessionBean().getUser().getUserName(), getSessionBean().getUser().getPassword());
+				if(resp.has("fileMetadata")){
+					
+					Long dvId = resp.getJSONObject("fileMetadata").getLong("id");
+					String fileNameInDv = resp.getJSONObject("fileMetadata").getString("label");
+					
+					LGFile  file = DataProvider.getInstance().getFile(getFileId());
+					//LGBranch branch = DataProvider.getInstance().getBranch(file.getBranchId());
+					file.setDvId(dvId);
+					DataProvider.getInstance().updateFile(file);
+					
+					addMsg("The File has been published.");
+					addMsg("The id of the file in Dataverse is: " + dvId + ".");
+					addMsg("The name of the file in Dataverse is: " + fileNameInDv + ".");
+					
+				}else{
+					if(resp.has("status") && StringUtils.equals(resp.getString("status"), "error")){
+						addMsg("Dataverse reported an error: " + resp.getString("message"));
+					}else{
+						addMsg("Internal Error: problems generating the table for the file " + fileId);
+					}
+				}
+				
+			} catch (Exception e) {
+				internalError(e);
+			}
+		}
+	}
+	
+	public void loadBranch(String branchId0){
+		try {
+			
+			this.branchId = Long.parseLong(branchId0);
+			
+			LGBranch branch = DataProvider.getInstance().getBranch(branchId);
+			if(branch != null){
+				this.loadBranch(branch);	
+			}else{
+				addMsg("Branch [id=" + branchId0 + "] no found.");
+			}
+			
+			
+		} catch (Exception e) {
+			internalError(e);
+		}
+	}
+	
+	public void addContributor(){
+		if(userId != null){
+			
+			VDCUser user = DataverseUtils.getUser(userId);
+			System.out.println("Adding user: " + user.getUserName());
+			
+			this.branch.addContributor(userId);
+			this.saveBranch0();
+		}
+	}
+	
+	public void deleteFile(){
+		if(this.fileId != null){
+			
+			try {
+				LGFile file = DataProvider.getInstance().getFile(fileId); 
+				DataProvider.getInstance().deleteFile(file);
+				LGBranch branch = DataProvider.getInstance().getBranch(file.getBranchId());
+				this.loadBranch(branch);
+				
+			} catch (Exception e) {
+				internalError(e);
+			}
+		}
+	}
+	
+	public void removeContributor(){
+		if(userId != null){
+			
+			VDCUser user = DataverseUtils.getUser(userId);
+			System.out.println("Removing user: " + user.getUserName());
+			
+			this.branch.removeContributor(userId);
+			this.saveBranch0();
+		}
+	}
+	
+	private void saveBranch0(){
+		try {
+			DataProvider.getInstance().updateBranch(branch);
+			this.loadBranch(branch);
+			addMsg("The branch has been updated!");
+		} catch (Exception e) {
+			internalError(e);
+		}
+	}
+	
+	public void loadBranch(LGBranch branch){
+		logger.info("Loading Branch: " + branch.toString());
+		this.reset();
+		if(branch != null && branch.isPersistent()){
+			
+			try {
+				this.branch = (LGBranch)branch.clone();
+				this.lastFile = DataProvider.getInstance().getFile(branch.getCurrentLastFileId());
+				this.allFiles = DataProvider.getInstance().getAllFiles(branch.getId());
+				this.text = FileManager.getFileAsText(this.lastFile);
+				this.contributors = new ArrayList<VDCUser>();
+				for(Long userId : this.branch.getContributorsList()){
+					VDCUser user = DataverseUtils.getUser(userId);
+					if(user != null){
+						this.contributors.add(user);
+					}
+					
+				}
+				
+				this.loadSuggestionUserList();
+			} catch (Exception e) {
+				internalError(e);
+			}
+			
+			logger.info("allFiles.size=" + allFiles.size());
+		}
+	}
+	
+	private void loadSuggestionUserList() throws Exception{
+		this.suggestionUserList = new ArrayList<VDCUser>();
+		for(VDCUser user : DataverseUtils.getAllUsers()){
+			if(!branch.hasContributor(user.getId())){
+				this.suggestionUserList.add(user);
+			}
+		}
+	}
+	
+	public void reset(){
+		this.branch = null;
+		this.lastFile = null;
+		this.allFiles = null;
+	}
+	
+	public LGBranch getBranch() {
+		return branch;
+	}
+	public void setBranch(LGBranch branch) {
+		this.branch = branch;
+	}
+	public LGFile getLastFile() {
+		return lastFile;
+	}
+	public void setLastFile(LGFile lastFile) {
+		this.lastFile = lastFile;
+	}
+	public Long getBranchId() {
+		return branchId;
+	}
+	public void setBranchId(Long branchId) {
+		this.branchId = branchId;
+	}
+	public List<LGFile> getAllFiles() {
+		return allFiles;
+	}
+	public void setAllFiles(List<LGFile> allFiles) {
+		this.allFiles = allFiles;
+	}
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	
+	
+	
+	public List<VDCUser> getContributors() {
+		return contributors;
+	}
+
+	public void setContributors(List<VDCUser> contributors) {
+		this.contributors = contributors;
+	}
+
+	public List<VDCUser> getSuggestionUserList() {
+		return suggestionUserList;
+	}
+	public void setSuggestionUserList(List<VDCUser> suggestionUserList) {
+		this.suggestionUserList = suggestionUserList;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+
+	public Long getFileId() {
+		return fileId;
+	}
+
+	public void setFileId(Long fileId) {
+		this.fileId = fileId;
+	}
+	public String getStudyGlobalId() {
+		return studyGlobalId;
+	}
+
+	public void setStudyGlobalId(String studyGlobalId) {
+		this.studyGlobalId = studyGlobalId;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/CreateFilePage.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,63 @@
+package de.mpiwg.web.jsp;
+
+import java.sql.SQLException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import de.mpiwg.gazetteer.db.DBSection;
+import de.mpiwg.gazetteer.utils.DBService;
+
+public class CreateFilePage extends AbstractJSPPage{
+	
+	private static Logger logger = Logger.getLogger(CreateFilePage.class);
+	
+	public static String bean = "createFileBean";
+	public static String page = "pages/createFile.jsp";
+	
+	private Long sectionId;
+	private DBSection section;
+
+	public void loadParameters(HttpServletRequest request, HttpServletResponse response){
+		this.request = request;
+		this.response = response;
+		
+		this.sectionId = getLongParameter("sectionId");
+	}
+	
+	public void loadSection(){
+		System.out.println("$$$$$ loadSection= " + sectionId);
+		try {
+			
+			this.section = DBService.getSectionWithContent(sectionId);
+		} catch (SQLException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	public void reset(){
+		this.section = null;
+		this.sectionId = null;
+	}
+	
+	public Long getSectionId() {
+		return sectionId;
+	}
+
+	public void setSectionId(Long sectionId) {
+		this.sectionId = sectionId;
+	}
+
+	public DBSection getSection() {
+		return section;
+	}
+
+	public void setSection(DBSection section) {
+		this.section = section;
+	}
+	
+	
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/DataPaginator.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,127 @@
+package de.mpiwg.web.jsp;
+import java.text.MessageFormat;
+
+public class DataPaginator {
+	
+	private int itemsPerPage = 100;
+	private int rewindFastForwardBy = 10;
+	
+	private int currentPage;
+	private int numberOfPages;
+	
+	private String recordStatus;
+	
+	public void first(){
+		this.currentPage = 0;
+	}
+	
+	public void last(){
+		this.currentPage = this.numberOfPages -1;
+	}
+	
+	public void fastRewind () {
+		this.rewind(this.rewindFastForwardBy);
+	}
+	
+	private void rewind (int aRewindFastForwardBy) {
+		int newPageNumber = currentPage - aRewindFastForwardBy;
+		if (newPageNumber < 0) {
+			currentPage = 0;
+		} else {
+			currentPage = newPageNumber;
+		}
+	}	
+	
+	public void goToPage(int newPageNumber){
+		if (newPageNumber > this.numberOfPages -1) {
+			currentPage = this.numberOfPages -1;
+		} else if(newPageNumber < 0 ){
+			currentPage = 0;
+		}else{
+			currentPage = newPageNumber;
+		}
+		
+	}
+	
+	private void forward (int aRewindFastForwardBy) {
+		int newPageNumber = currentPage + aRewindFastForwardBy;
+		if (newPageNumber > this.numberOfPages - 1) {
+			currentPage = this.numberOfPages -1;
+		} else {
+			currentPage = newPageNumber;
+		}
+	}	
+	
+	public void previous () {
+		this.rewind(1);		
+	}
+
+	public void next () {
+		this.forward(1);
+	}
+	
+	public void fastForward () {
+		this.forward(this.rewindFastForwardBy);
+	}
+	
+	public void initCount() {
+		if (currentPage > numberOfPages) {
+			currentPage=numberOfPages;
+		}
+	}
+	
+	public int getNumberOfPages() {
+		return numberOfPages;
+	}
+
+	public void setNumberOfPages(int numberOfPages) {
+		this.numberOfPages = numberOfPages;
+	}
+	
+	public void resetNumberOfPages(int itemsTotal){
+		int numberOfPages = (itemsTotal
+				% this.getItemsPerPage() == 0) ?
+						itemsTotal
+						/ this.getItemsPerPage() :
+							(itemsTotal
+							/ this.getItemsPerPage()) + 1;
+		this.setNumberOfPages(numberOfPages);
+	}
+
+	public int getCurrentPage() {
+		return currentPage;
+	}
+
+	public void setCurrentPage(int currentPage) {
+		this.currentPage = currentPage;
+	}
+	
+	public String getRecordStatus () {
+		this.recordStatus = MessageFormat.format("{0} of {1}", 
+				new Object []{
+				Integer.valueOf(currentPage + 1),
+				Integer.valueOf(numberOfPages)
+				});
+		return recordStatus;
+	}
+
+	public void setRecordStatus(String recordStatus) {
+		this.recordStatus = recordStatus;
+	}
+	
+	public int getItemsPerPage() {
+		return itemsPerPage;
+	}
+
+	public void setItemsPerPage(int itemsPerPage) {
+		this.itemsPerPage = itemsPerPage;
+	}
+
+	public int getRewindFastForwardBy() {
+		return rewindFastForwardBy;
+	}
+
+	public void setRewindFastForwardBy(int rewindFastForwardBy) {
+		this.rewindFastForwardBy = rewindFastForwardBy;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/HomePage.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,80 @@
+package de.mpiwg.web.jsp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.utils.DataProvider;
+
+public class HomePage  extends AbstractJSPPage{
+	
+	private static Logger logger = Logger.getLogger(HomePage.class);
+	
+	public static String bean = "homeBean";
+	public static String page = "pages/home.jsp";
+	
+	
+	private List<LGBranch> branches;
+	private Long branchId;
+	
+	
+	public void loadParameters(HttpServletRequest request, HttpServletResponse response){
+		this.request = request;
+		this.response = response;
+		
+		this.branchId = getLongParameter("branchId");
+	}
+	
+	public void reloadBranches(){
+		
+		logger.debug("reloadBranches");
+		
+		this.branches = new ArrayList<LGBranch>();
+		if(getSessionBean().getUser() != null){
+			for(LGBranch branch : DataProvider.getInstance().getBranches(getSessionBean().getUser().getId())){
+				if(!branch.isTransientDataLoaded()){
+					branch.loadTransientData();
+				}	
+				this.branches.add(branch);
+			}	
+		}
+	}
+	
+	public void deleteBranch(){
+		
+		logger.debug("deleteBranch " + branchId);
+		
+		if(branchId != null){
+			LGBranch branch = DataProvider.getInstance().getBranch(branchId);
+			if(branch != null){
+				DataProvider.getInstance().deleteBranch(branch);
+				this.reloadBranches();
+			}	
+		}
+	}
+	
+	public List<LGBranch> getBranches() {
+		return branches;
+	}
+
+
+	public void setBranches(List<LGBranch> branches) {
+		this.branches = branches;
+	}
+
+	public Long getBranchId() {
+		return branchId;
+	}
+
+	public void setBranchId(Long branchId) {
+		this.branchId = branchId;
+	}	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,178 @@
+package de.mpiwg.web.jsp;
+
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import de.mpiwg.gazetteer.utils.DBService;
+
+public class JSPProxy extends AbstractJSPPage {
+	
+	private static Logger logger = Logger.getLogger(JSPProxy.class);
+	
+	private String action;
+	private String bean;
+
+	public void init(){
+		/*
+		Map<String, String[]> parameters = request.getParameterMap();
+		for(String parameter : parameters.keySet()) {
+		    if(parameter.toLowerCase().startsWith("token")) {
+		        String[] values = parameters.get(parameter);
+		        System.out.println(parameter + "= " + values);
+		    }
+		}*/
+	}
+	
+	
+	public String processRequest(){
+		
+		logger.info("processRequest [bean= " + bean + ", action=" + action +"]");
+		
+		if(StringUtils.equals(bean, BranchPage.bean)){
+			
+			getSessionBean().getBranchPage().loadParameters(request, response);
+			
+			if(StringUtils.equals(action, "addContributor")){
+				getSessionBean().getBranchPage().addContributor();
+			} else if(StringUtils.equals(action, "removeContributor")){
+				getSessionBean().getBranchPage().removeContributor();
+			}else if(StringUtils.equals(action, "deleteFile")){
+				getSessionBean().getBranchPage().deleteFile();
+			}else if(StringUtils.equals(action, "publishFile")){
+				getSessionBean().getBranchPage().publishFile();
+			}
+			
+			return BranchPage.page;
+			
+			
+		}else if(StringUtils.equals(bean, CreateFilePage.bean)){
+			
+			getSessionBean().getCreateFilePage().loadParameters(request, response);
+			
+			if(StringUtils.equals(action, "loadSection")){
+				getSessionBean().getCreateFilePage().loadSection();
+			}else if(StringUtils.equals(action, "reset")){
+				getSessionBean().getCreateFilePage().reset();
+			}
+			
+			return CreateFilePage.page;
+			
+		}else if(StringUtils.equals(bean, HomePage.bean)){
+			
+			getSessionBean().getHomePage().loadParameters(request, response);
+			
+			if(StringUtils.equals(action, "deleteBranch")){
+				getSessionBean().getHomePage().deleteBranch();
+			}else if(StringUtils.equals(action, "reloadBranches")){
+				getSessionBean().getHomePage().reloadBranches();
+			}
+			
+			return HomePage.page;
+			
+		}else if(StringUtils.equals(bean, "loginBean")){
+			getSessionBean().loadParameters(request, response);
+			
+			if(StringUtils.equals(action, "login")){
+				getSessionBean().login();
+			}else if(StringUtils.equals(action, "logout")){
+				getSessionBean().logout();
+			}
+			
+			return "pages/home.jsp";
+			
+		}else if(StringUtils.equals(bean, SearchPage.bean)){
+			getSessionBean().getSearchPage().loadParameters(request, response);
+			
+			if(StringUtils.equals(action, "search")){
+				getSessionBean().getSearchPage().search();
+			} else if(StringUtils.equals(action, "filter")){
+				getSessionBean().getSearchPage().filter();
+			//PAGINATOR
+			} else if(StringUtils.equals(action, "firstPage")){
+				getSessionBean().getSearchPage().firstPage();
+			} else if(StringUtils.equals(action, "fastRewind")){
+				getSessionBean().getSearchPage().fastRewind();
+			} else if(StringUtils.equals(action, "previousPage")){
+				getSessionBean().getSearchPage().previousPage();
+			} else if(StringUtils.equals(action, "nextPage")){
+				getSessionBean().getSearchPage().nextPage();
+			} else if(StringUtils.equals(action, "fastForward")){
+				getSessionBean().getSearchPage().fastForward();
+			} else if(StringUtils.equals(action, "lastPage")){
+				getSessionBean().getSearchPage().lastPage();
+			
+			//SORTING
+			} else if(StringUtils.equals(action, "sortByBookIdUp")){
+				getSessionBean().getSearchPage().sortByBookIdUp();
+			} else if(StringUtils.equals(action, "sortByBookIdDown")){
+				getSessionBean().getSearchPage().sortByBookIdDown();
+			} else if(StringUtils.equals(action, "sortByBookNameUp")){
+				getSessionBean().getSearchPage().sortByBookNameUp();
+			} else if(StringUtils.equals(action, "sortByBookNameDown")){
+				getSessionBean().getSearchPage().sortByBookNameDown();
+			} else if(StringUtils.equals(action, "sortByDynastyUp")){
+				getSessionBean().getSearchPage().sortByDynastyUp();
+			} else if(StringUtils.equals(action, "sortByDynastyDown")){
+				getSessionBean().getSearchPage().sortByDynastyDown();
+			} else if(StringUtils.equals(action, "sortByPeriodUp")){
+				getSessionBean().getSearchPage().sortByPeriodUp();
+			} else if(StringUtils.equals(action, "sortByPeriodDown")){
+				getSessionBean().getSearchPage().sortByPeriodDown();
+			} else if(StringUtils.equals(action, "sortByVolumeUp")){
+				getSessionBean().getSearchPage().sortByVolumeUp();
+			} else if(StringUtils.equals(action, "sortByVolumeDown")){
+				getSessionBean().getSearchPage().sortByVolumeDown();
+			} else if(StringUtils.equals(action, "sortBySectionNameUp")){
+				getSessionBean().getSearchPage().sortBySectionNameUp();
+			} else if(StringUtils.equals(action, "sortBySectionNameDown")){
+				getSessionBean().getSearchPage().sortBySectionNameDown();
+			
+			} else if(StringUtils.equals(action, "sortByLevel1Up")){
+				getSessionBean().getSearchPage().sortByLevel1Up();
+			} else if(StringUtils.equals(action, "sortByLevel1Down")){
+				getSessionBean().getSearchPage().sortByLevel1Down();
+				
+			} else if(StringUtils.equals(action, "sortByAdminTypeUp")){
+				getSessionBean().getSearchPage().sortByAdminTypeUp();
+			} else if(StringUtils.equals(action, "sortByAdminTypeDown")){
+				getSessionBean().getSearchPage().sortByAdminTypeDown();
+			
+			} else if(StringUtils.equals(action, "sortByStartPageUp")){
+				getSessionBean().getSearchPage().sortByStartPageUp();
+			} else if(StringUtils.equals(action, "sortByStartPageDown")){
+				getSessionBean().getSearchPage().sortByStartPageDown();
+			} 
+			
+			
+			
+			
+			return SearchPage.page;
+			
+		}
+		
+		//Default Page
+		return "pages/search.jsp";
+	}
+
+
+	public String getAction() {
+		return action;
+	}
+
+
+	public void setAction(String action) {
+		this.action = action;
+	}
+
+
+	public String getBean() {
+		return bean;
+	}
+
+
+	public void setBean(String bean) {
+		this.bean = bean;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/SearchPage.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,502 @@
+package de.mpiwg.web.jsp;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.db.DBSection;
+import de.mpiwg.gazetteer.utils.DBService;
+import de.mpiwg.gazetteer.utils.DataProvider;
+import de.mpiwg.web.search.SortSectionByAdminType;
+import de.mpiwg.web.search.SortSectionByAuthor;
+import de.mpiwg.web.search.SortSectionByBookId;
+import de.mpiwg.web.search.SortSectionByBookName;
+import de.mpiwg.web.search.SortSectionByDynasty;
+import de.mpiwg.web.search.SortSectionByEdition;
+import de.mpiwg.web.search.SortSectionById;
+import de.mpiwg.web.search.SortSectionByLevel1;
+import de.mpiwg.web.search.SortSectionByPeriod;
+import de.mpiwg.web.search.SortSectionByStartPage;
+import de.mpiwg.web.search.SortSectionByVolume;
+
+public class SearchPage extends AbstractJSPPage{
+	
+	private static Logger logger = Logger.getLogger(SearchPage.class);
+	
+	public static String bean = "searchBean";
+	public static String page = "pages/search.jsp";
+	
+	private static Integer SEARCH_IN_SECTION_NAME = 0;
+	private static Integer SEARCH_IN_BOOK_NAME = 1;
+	
+	
+	
+	private Map<Long, List<LGBranch>> branchesMap;
+	private List<DBSection> completeSectionList;
+	private List<DBSection> filteredSectionList;
+	private List<DBSection> displaySectionList;
+	
+	private String searchTerm = new String();
+	private Integer searchIn = SEARCH_IN_SECTION_NAME;
+	
+	private String dynastyFilter = new String();
+	private String adminTypeFilter = new String();
+	private String level1Filter = new String();
+	
+	private DataPaginator paginator = new DataPaginator();
+	private String searchMessage;
+	private String filteringMessage;
+	
+	@Override
+	public void init(){
+		super.init();
+	}
+	
+	public void loadParameters(HttpServletRequest request, HttpServletResponse response){
+		this.request = request;
+		this.response = response;
+		
+		this.searchTerm = getParameter("searchTerm");
+		this.dynastyFilter = getParameter("dynastyFilter");
+		this.adminTypeFilter = getParameter("adminTypeFilter");
+		this.level1Filter = getParameter("level1Filter");
+		this.searchIn = getIntParameter("searchIn");
+	}
+	
+	public void search(){
+		logger.debug("Searching: " + this.searchTerm);
+		
+		this.dynastyFilter = new String();
+		this.level1Filter = new String();
+		this.adminTypeFilter = new String();
+		
+		if(StringUtils.isNotEmpty(this.searchTerm)){
+			this.loadBranches();
+			try {
+				List<String> terms = splitTerms();
+				
+				if(SEARCH_IN_SECTION_NAME.equals(this.searchIn)){
+					System.out.println("Search in Section Name");
+					this.completeSectionList = DBService.searchSection(terms);
+				}else if(SEARCH_IN_BOOK_NAME.equals(this.searchIn)){
+					System.out.println("Search in Book Name");
+					this.completeSectionList = DBService.searchBook(terms, "name");
+				}
+				
+				Collections.sort(this.completeSectionList);
+				
+				filter();
+
+								
+			} catch (Exception e) {
+				internalError(e);
+			}			
+		}
+	}
+	
+	public void filter(){
+		this.filteredSectionList = new ArrayList<DBSection>();
+		for(DBSection section : this.completeSectionList){
+			if(!this.filteredSectionList.contains(section)){
+				
+				if( (StringUtils.isEmpty(dynastyFilter) || StringUtils.startsWith(section.getBook().getDynasty(), dynastyFilter)) &&
+						(StringUtils.isEmpty(level1Filter) || StringUtils.startsWith(section.getBook().getLevel1(), level1Filter)) &&
+						(StringUtils.isEmpty(adminTypeFilter) || StringUtils.startsWith(section.getBook().getAdmin_type(), adminTypeFilter))
+								){
+					this.filteredSectionList.add(section);
+				}	
+			}
+		}
+		
+		if(completeSectionList.size() > 0){
+			this.searchMessage = completeSectionList.size() + " section(s) found for the term(s): " + this.searchTerm;
+			this.filteringMessage = this.filteredSectionList.size() + " section(s) listed after the filtering";
+			this.paginator.setCurrentPage(0);
+			this.paginator.resetNumberOfPages(filteredSectionList.size());
+			this.updateCurrentSections();
+		}else{
+			this.searchMessage = "No sections found for the term(s): " + this.searchTerm;
+			this.filteredSectionList = null;
+		}
+	}
+	
+	private void updateCurrentSections() {
+		this.paginator.initCount();
+		int startRecord = this.paginator.getCurrentPage()
+				* this.paginator.getItemsPerPage();
+		if(this.paginator.getNumberOfPages() == 0){
+			this.displaySectionList = new ArrayList<DBSection>();
+		}else if((this.paginator.getCurrentPage() + 1) == this.paginator.getNumberOfPages()){
+			int mod = this.filteredSectionList.size() % paginator.getItemsPerPage();
+			if(mod == 0){
+				this.displaySectionList = filteredSectionList.subList(startRecord, startRecord + this.paginator.getItemsPerPage());
+			}else{
+				this.displaySectionList = filteredSectionList.subList(startRecord, startRecord + mod);	
+			}
+			
+		}else{
+			this.displaySectionList = filteredSectionList.subList(startRecord, startRecord + this.paginator.getItemsPerPage());	
+		}
+		
+		for(DBSection section : this.displaySectionList){
+			section.setBranches(this.branchesMap.get(section.getId()));
+		}
+	}
+	
+	private void loadBranches(){
+		this.branchesMap = new HashMap<Long, List<LGBranch>>();
+		List<LGBranch> list = DataProvider.getInstance().getBranches(getSessionBean().getUser().getId());
+		for(LGBranch branch : list){
+			branch.loadTransientData();
+			if(this.branchesMap.get(branch.getSectionId()) == null){
+				this.branchesMap.put(branch.getSectionId(), new ArrayList<LGBranch>());
+			}
+			this.branchesMap.get(branch.getSectionId()).add(branch);
+		}
+	}
+	
+	private List<String> splitTerms(){
+		List<String> rs = new ArrayList<String>();
+		String[] array = this.searchTerm.split(",");
+		
+		for(String tmp : array){
+			tmp = tmp.replace(" ", "");
+			if(StringUtils.isNotEmpty(tmp)){
+				rs.add(tmp);	
+			}
+		}
+		return rs;
+	}
+
+	public List<String> suggestDynasty(String term, int limit){
+		List<String> list = new ArrayList<String>();
+		for(DBSection section : this.completeSectionList){
+			String dynasty = section.getBook().getDynasty();
+			if(!list.contains(dynasty) && dynasty.startsWith(term)){
+				list.add(dynasty);
+			}
+			if(limit == list.size()){
+				break;
+			}	
+		}
+		return list;
+	}
+	
+	public List<String> suggestLevel1(String term, int limit){
+		List<String> list = new ArrayList<String>();
+		for(DBSection section : this.completeSectionList){
+			String level1 = section.getBook().getLevel1();
+			if(!list.contains(level1) && level1.startsWith(term)){
+				list.add(level1);
+			}
+			if(limit == list.size()){
+				break;
+			}	
+		}
+		return list;
+	}
+	
+	public List<String> suggestAdminType(String term, int limit){
+		List<String> list = new ArrayList<String>();
+		for(DBSection section : this.completeSectionList){
+			String adminType = section.getBook().getAdmin_type();
+			if(!list.contains(adminType) && adminType.startsWith(term)){
+				list.add(adminType);
+			}
+			if(limit == list.size()){
+				break;
+			}	
+		}
+		return list;
+	}
+	
+
+	public static Integer getSEARCH_IN_SECTION_NAME() {
+		return SEARCH_IN_SECTION_NAME;
+	}
+
+
+	public static void setSEARCH_IN_SECTION_NAME(Integer sEARCH_IN_SECTION_NAME) {
+		SEARCH_IN_SECTION_NAME = sEARCH_IN_SECTION_NAME;
+	}
+
+
+	public Map<Long, List<LGBranch>> getBranchesMap() {
+		return branchesMap;
+	}
+
+
+	public void setBranchesMap(Map<Long, List<LGBranch>> branchesMap) {
+		this.branchesMap = branchesMap;
+	}
+
+
+	public List<DBSection> getCompleteSectionList() {
+		return completeSectionList;
+	}
+
+
+	public void setCompleteSectionList(List<DBSection> completeSectionList) {
+		this.completeSectionList = completeSectionList;
+	}
+
+
+	public String getSearchTerm() {
+		return searchTerm;
+	}
+
+
+	public void setSearchTerm(String searchTerm) {
+		this.searchTerm = searchTerm;
+	}
+
+
+	public Integer getSearchIn() {
+		return searchIn;
+	}
+
+
+	public void setSearchIn(Integer searchIn) {
+		this.searchIn = searchIn;
+	}
+
+	public List<DBSection> getFilteredSectionList() {
+		return filteredSectionList;
+	}
+
+	public void setFilteredSectionList(List<DBSection> filteredSectionList) {
+		this.filteredSectionList = filteredSectionList;
+	}
+
+	public List<DBSection> getDisplaySectionList() {
+		return displaySectionList;
+	}
+
+	public void setDisplaySectionList(List<DBSection> displaySectionList) {
+		this.displaySectionList = displaySectionList;
+	}
+
+	public DataPaginator getPaginator() {
+		return paginator;
+	}
+
+	public void setPaginator(DataPaginator paginator) {
+		this.paginator = paginator;
+	}
+	
+	public void firstPage() {
+		this.paginator.first();
+		this.updateCurrentSections();
+	}
+
+	public void lastPage() {
+		this.paginator.last();
+		this.updateCurrentSections();
+	}
+
+	public void fastForward() {
+		this.paginator.fastForward();
+		this.updateCurrentSections();
+	}
+
+	public void fastRewind() {
+		this.paginator.fastRewind();
+		this.updateCurrentSections();
+	}
+
+	public void previousPage() {
+		this.paginator.previous();
+		this.updateCurrentSections();
+	}
+
+	public void nextPage() {
+		this.paginator.next();
+		this.updateCurrentSections();
+	}
+
+	public String getSearchMessage() {
+		return searchMessage;
+	}
+
+	public void setSearchMessage(String searchMessage) {
+		this.searchMessage = searchMessage;
+	}
+
+	public String getFilteringMessage() {
+		return filteringMessage;
+	}
+
+	public void setFilteringMessage(String filteringMessage) {
+		this.filteringMessage = filteringMessage;
+	}
+	
+	/////// Sorting
+	
+	public String getDynastyFilter() {
+		return dynastyFilter;
+	}
+
+	public void setDynastyFilter(String dynastyFilter) {
+		this.dynastyFilter = dynastyFilter;
+	}
+
+	public void sortByBookNameUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByBookName());
+		filter();
+	}
+	
+	public void sortByBookNameDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByBookName());
+		Collections.reverse(this.completeSectionList);
+		filter();
+	}
+	
+	public void sortBySectionNameUp(){
+		Collections.sort(this.completeSectionList);
+		filter();
+	}
+	
+	public void sortBySectionNameDown(){
+		Collections.sort(this.completeSectionList);
+		Collections.reverse(this.completeSectionList);
+		filter();
+	}
+	
+	public void sortByAuthorUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByAuthor());
+		filter();
+	}
+	
+	public void sortByAuthorDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByAuthor());
+		Collections.reverse(this.completeSectionList);
+		filter();
+	}
+	
+	public void sortByPeriodUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByPeriod());
+		filter();
+	}
+	
+	public void sortByPeriodDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByPeriod());
+		Collections.reverse(this.completeSectionList);
+		filter();
+	}
+	
+	public void sortByVolumeUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByVolume());
+		filter();
+	}
+	
+	public void sortByVolumeDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByVolume());
+		Collections.reverse(this.completeSectionList);
+		filter();
+	}
+	
+	
+	public void sortBySectionIdUp(){
+		Collections.sort(this.completeSectionList, new SortSectionById());
+		this.filter();
+	}
+	
+	public void sortBySectionIdDown(){
+		Collections.sort(this.completeSectionList, new SortSectionById());
+		Collections.reverse(completeSectionList);
+		this.filter();
+	}
+	
+	public void sortByEditionUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByEdition());
+		filter();
+	}
+	
+	public void sortByEditionDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByEdition());
+		Collections.reverse(completeSectionList);
+		filter();
+	}
+	
+	public void sortByDynastyUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByDynasty());
+		filter();
+	}
+	
+	public void sortByDynastyDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByDynasty());
+		Collections.reverse(completeSectionList);
+		filter();
+	}
+	
+	public void sortByBookIdUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByBookId());
+		filter();
+	}
+	
+	public void sortByBookIdDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByBookId());
+		Collections.reverse(completeSectionList);
+		filter();
+	}
+	
+	public void sortByLevel1Up(){
+		Collections.sort(this.completeSectionList, new SortSectionByLevel1());
+		filter();
+	}
+	
+	public void sortByLevel1Down(){
+		Collections.sort(this.completeSectionList, new SortSectionByLevel1());
+		Collections.reverse(completeSectionList);
+		filter();
+	}
+	
+	public void sortByAdminTypeUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByAdminType());
+		filter();
+	}
+	
+	public void sortByAdminTypeDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByAdminType());
+		Collections.reverse(completeSectionList);
+		filter();
+	}
+	
+	public void sortByStartPageUp(){
+		Collections.sort(this.completeSectionList, new SortSectionByStartPage());
+		filter();
+	}
+	
+	public void sortByStartPageDown(){
+		Collections.sort(this.completeSectionList, new SortSectionByStartPage());
+		Collections.reverse(completeSectionList);
+		filter();
+	}
+
+	public String getAdminTypeFilter() {
+		return adminTypeFilter;
+	}
+
+	public void setAdminTypeFilter(String adminTypeFilter) {
+		this.adminTypeFilter = adminTypeFilter;
+	}
+
+	public String getLevel1Filter() {
+		return level1Filter;
+	}
+
+	public void setLevel1Filter(String level1Filter) {
+		this.level1Filter = level1Filter;
+	}
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/SessionBean.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,162 @@
+package de.mpiwg.web.jsp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+import de.mpiwg.gazetteer.dataverse.DataverseUtils;
+import de.mpiwg.gazetteer.dataverse.bo.VDCUser;
+import de.mpiwg.gazetteer.utils.DataProvider;
+
+public class SessionBean extends AbstractJSPPage {
+
+	private static Logger logger = Logger.getLogger(SessionBean.class);
+	public static final String BEAN_NAME = "sessionBean";
+	
+	private List<String> msgList = new ArrayList<String>();
+	
+	
+	
+	private VDCUser user;
+	private String userName;
+	private String password;
+	
+	private String currentSectionId = "5190882";
+	private SearchPage searchPage = new SearchPage();
+	private HomePage homePage = new HomePage();
+	private CreateFilePage createFilePage = new CreateFilePage();
+	private BranchPage branchPage = new BranchPage();
+	
+	public SessionBean(){
+		logger.info("\n\n### SessionBean #####\n\n");
+	}
+	
+	
+	public void loadParameters(HttpServletRequest request, HttpServletResponse response){
+		this.request = request;
+		this.response = response;
+		
+		this.userName = getParameter("userName");
+		this.password = getParameter("password");
+	}
+	
+	public void reset(){
+		this.user = null;
+		this.searchPage = new SearchPage();
+		this.homePage = new HomePage();
+		this.createFilePage = new CreateFilePage();
+		this.branchPage = new BranchPage();
+		this.userName = new String();
+		this.password = new String();
+	}
+	
+	public List<String> getMsgList() {
+		return msgList;
+	}
+
+	public void setMsgList(List<String> msgList) {
+		this.msgList = msgList;
+	}
+
+	public void resetMsgList(){
+		this.msgList = null;
+	}
+	
+	public void logout(){
+		this.reset();
+	}
+	
+	public void login(){
+		try {
+			this.user = DataverseUtils.login(userName, password);
+			if(user != null){
+				this.user.setPassword(this.password);
+				this.homePage.loadParameters(request, response);
+				this.homePage.reloadBranches();	
+				
+			}else{
+				addMsg("User account no found or userName and password do not match!");
+			}
+						
+		} catch (Exception e) {
+			internalError(e);
+		}
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public VDCUser getUser() {
+		return user;
+	}
+
+	public void setUser(VDCUser user) {
+		this.user = user;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}	
+
+	public String getCurrentSectionId() {
+		return currentSectionId;
+	}
+
+	public void setCurrentSectionId(String currentSectionId) {
+		this.currentSectionId = currentSectionId;
+	}
+
+	public SearchPage getSearchPage() {
+		return searchPage;
+	}
+
+	public void setSearchPage(SearchPage searchPage) {
+		this.searchPage = searchPage;
+	}
+
+
+	public HomePage getHomePage() {
+		return homePage;
+	}
+
+
+	public void setHomePage(HomePage homePage) {
+		this.homePage = homePage;
+	}
+
+
+	public CreateFilePage getCreateFilePage() {
+		return createFilePage;
+	}
+
+
+	public void setCreateFilePage(CreateFilePage createFilePage) {
+		this.createFilePage = createFilePage;
+	}
+
+
+	public BranchPage getBranchPage() {
+		return branchPage;
+	}
+
+
+	public void setBranchPage(BranchPage branchPage) {
+		this.branchPage = branchPage;
+	}
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/utils/CharsetFilter.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,39 @@
+package de.mpiwg.web.jsp.utils;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+public class CharsetFilter implements Filter {
+	private String encoding;
+
+	public void init(FilterConfig config) throws ServletException {
+		encoding = config.getInitParameter("requestEncoding");
+
+		if (encoding == null)
+			encoding = "UTF-8";
+	}
+
+	public void doFilter(ServletRequest request, ServletResponse response, FilterChain next) throws IOException,
+			ServletException {
+		// Respect the client-specified character encoding
+		// (see HTTP specification section 3.4.1)
+		if (null == request.getCharacterEncoding())
+			request.setCharacterEncoding(encoding);
+
+		/**
+		 * Set the default response content type and encoding
+		 */
+		response.setContentType("text/html; charset=UTF-8");
+		response.setCharacterEncoding("UTF-8");
+
+		next.doFilter(request, response);
+	}
+
+	public void destroy() {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/jsp/utils/SessionCollectorListener.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,61 @@
+package de.mpiwg.web.jsp.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.log4j.Logger;
+
+import de.mpiwg.web.jsp.SessionBean;
+
+public class SessionCollectorListener implements HttpSessionListener {
+	
+	
+	private static Logger logger = Logger.getLogger(SessionCollectorListener.class);
+	
+	public static String SESSION_COLLECTOR = "sessionCollector";
+	public static String SESSION_TIMER = "sessionTimer";
+	
+	@Override
+    public void sessionCreated(final HttpSessionEvent se) {
+    	final HttpSession session = se.getSession();
+    	final ServletContext context = session.getServletContext();
+    	
+    	Map<String, HttpSession> sessionCollector = (Map<String, HttpSession>)context.getAttribute(SESSION_COLLECTOR);
+    	if(sessionCollector == null){
+    		sessionCollector = new HashMap<String, HttpSession>();
+    		context.setAttribute(SESSION_COLLECTOR, sessionCollector);
+    	}
+    	
+    	Map<String, Long> sessionTimer = (Map<String, Long>)context.getAttribute(SESSION_TIMER);
+    	if(sessionTimer == null){
+    		sessionTimer = new HashMap<String, Long>();
+    		context.setAttribute(SESSION_TIMER, sessionTimer);
+    	}
+    	
+    	
+    	
+    	sessionCollector.put(session.getId(), session);
+    	sessionTimer.put(session.getId(), System.currentTimeMillis());
+    	logger.info("sessionCreated: " + session.getId());
+    }
+
+    @Override
+    public void sessionDestroyed(final HttpSessionEvent se) {
+    	final HttpSession session = se.getSession();
+    	final ServletContext context = session.getServletContext();
+    	
+    	Map<String, HttpSession> sessionCollector = (Map<String, HttpSession>)context.getAttribute(SESSION_COLLECTOR);
+    	sessionCollector.remove(session.getId());
+    	
+    	Map<String, Long> sessionTimer = (Map<String, Long>)context.getAttribute(SESSION_TIMER);
+    	
+    	logger.info("sessionDestroyed: " + session.getId() + " timeOut [ms]: " + (System.currentTimeMillis() - sessionTimer.get(session.getId())));
+    	
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByAdminType.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByAdminType  implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getAdmin_type().compareTo(o2.getBook().getAdmin_type());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByAuthor.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByAuthor implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getAuthor().compareTo(o2.getBook().getAuthor());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByBookId.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByBookId implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getId().compareTo(o2.getBook().getId());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByBookName.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByBookName implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getName().compareTo(o2.getBook().getName());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByDynasty.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByDynasty implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getDynasty().compareTo(o2.getBook().getDynasty());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByEdition.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByEdition implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getEdition().compareTo(o2.getBook().getEdition());
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionById.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,12 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionById implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		return o1.getId().compareTo(o2.getId());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByLevel1.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByLevel1 implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getLevel1().compareTo(o2.getBook().getLevel1());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByPeriod.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByPeriod implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getPeriod().compareTo(o2.getBook().getPeriod());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByStartPage.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByStartPage implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getStart_page().compareTo(o2.getStart_page());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/search/SortSectionByVolume.java	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,15 @@
+package de.mpiwg.web.search;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.db.DBSection;
+
+public class SortSectionByVolume implements Comparator<DBSection>{
+	
+	public int compare(DBSection o1, DBSection o2) {
+		if(o1.getBook() == null || o2.getBook() == null){
+			return o1.getName().compareTo(o2.getName());	
+		}
+		return o1.getBook().getVolume().compareTo(o2.getBook().getVolume());
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/config.properties	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,12 @@
+db_gazetter_username=root
+db_gazetter_password=admin
+db_gazetter_name=Gazetteer
+files_root=/gazetteer-server/data
+#extraction_interface=http://141.14.239.50:1080/localmonographs
+extraction_interface=http://localgazetteers-dev/extraction-interface
+toc_interface=http://localgazetteers-dev/LGToc
+dvn_server=http://localgazetteers-dev/dvn
+#dvn_server=http://localhost/dvn
+#root_server=http://localgazetteers.mpiwg-berlin.mpg.de:8080/gazetteer-server
+#root_server=http://localhost:8080/LGServices
+root_server=http://localgazetteers-dev/LGServices
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/hibernate.cfg.xml	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,42 @@
+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+	<session-factory>
+
+		<!-- hibernate.cfg.xml -->
+		<property name="c3p0.min_size">5</property>
+		<property name="c3p0.max_size">20</property>
+		<property name="c3p0.timeout">1800</property>
+		<property name="c3p0.max_statements">50</property>
+		<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
+
+		<!-- Database connection settings -->
+		<!-- 
+		<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
+		 -->
+		<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
+        <property name="hibernate.connection.url">jdbc:mysql://localhost/LGServer?characterEncoding=UTF-8</property>
+        
+        <property name="hibernate.connection.username">root</property>
+		<property name="hibernate.connection.password">admin</property>
+		<property name="hibernate.connection.charSet">UTF-8</property>
+		
+		<!-- JDBC connection pool (use the built-in) -->
+		<property name="hibernate.connection.pool_size">1</property>
+
+		<!-- Enable Hibernate's automatic session context management -->
+		<property name="hibernate.current_session_context_class">thread</property>
+		<!-- Disable the second-level cache -->
+		<!-- 
+		<property name="hibernate.cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
+ 		-->
+		<!-- 
+		<property name="hibernate.show_sql">true</property> 
+		<property name="hibernate.hbm2ddl.auto">create</property> 
+	    
+		 -->
+	    <mapping class="de.mpiwg.gazetteer.bo.LGBranch"/>
+	    <mapping class="de.mpiwg.gazetteer.bo.LGFile"/>
+		<mapping class="de.mpiwg.gazetteer.bo.Sequence"/>	    
+	</session-factory>
+
+</hibernate-configuration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/log4j.properties	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,31 @@
+### direct log messages to stdout ###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %5p %c{1}:%L - %m%n
+
+### set log levels - for more verbose logging change 'info' to 'debug' ##
+
+log4j.rootLogger=info, stdout
+
+log4j.logger.de.mpiwg=debug, file
+
+#log4j.logger.cl.dialectic=info, stdout
+
+#log4j.logger.net.sf.hibernate=debug, stdout
+#Hibernate
+#log4j.logger.org.hibernate.cfg=debug, file
+#log4j.logger.org.hibernate.cfg.annotations.Version=info, stdout
+#log4j.logger.org.hibernate.cfg.Environment=info, stdout
+#log4j.logger.org.hibernate.cfg.AnnotationBinder=info, stdout
+
+
+### enable the following line if you want to track down connection ###
+### leakages when using DriverManagerConnectionProvider ###
+#log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace
+
+### log JDBC bind parameters ###
+#log4j.logger.net.sf.hibernate.type=debug
+
+### log prepared statement cache activity ###
+#log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=debug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/WEB-INF/web.xml	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+	id="WebApp_ID" version="3.0">
+
+	<display-name>LGServices</display-name>
+
+	<welcome-file-list>
+		<welcome-file>pages/home.jsp</welcome-file>
+	</welcome-file-list>
+
+	<jsp-config>
+		<jsp-property-group>
+			<url-pattern>*.jsp</url-pattern>
+			<page-encoding>UTF-8</page-encoding>
+		</jsp-property-group>
+	</jsp-config>
+
+	<listener>
+		<listener-class>de.mpiwg.web.jsp.utils.SessionCollectorListener</listener-class>
+	</listener>
+
+	<filter>
+		<filter-name>CharsetFilter</filter-name>
+		<filter-class>de.mpiwg.web.jsp.utils.CharsetFilter</filter-class>
+		<init-param>
+			<param-name>requestEncoding</param-name>
+			<param-value>UTF-8</param-value>
+		</init-param>
+	</filter>
+
+	<filter-mapping>
+		<filter-name>CharsetFilter</filter-name>
+		<url-pattern>/*</url-pattern>
+	</filter-mapping>
+
+	<servlet-mapping>
+		<servlet-name>jsp</servlet-name>
+		<url-pattern>*.jsp</url-pattern>
+		<url-pattern>*.dcss</url-pattern>
+	</servlet-mapping>
+	
+	<session-config>
+	    <session-timeout>30</session-timeout>
+	</session-config>	
+
+
+</web-app>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/componentes/headContent.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,16 @@
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<title>LGServices</title>
+
+<link rel="stylesheet" href="<%=sessionBean.getApplicationBean().getRootServer()%>/resources/css/style.css" />
+	
+<script type="text/javascript"
+	src="<%=sessionBean.getApplicationBean().getRootServer()%>/resources/js/proxyMethods.js"></script>
+<script type="text/javascript"
+	src="<%=sessionBean.getApplicationBean().getRootServer()%>/resources/js/general.js"></script>
+	
+	
+<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
+<script type="text/javascript" src="<%=sessionBean.getApplicationBean().getRootServer()%>/resources/js/jquery.min.js"></script>
+<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>	
+	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/componentes/paginator.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,47 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+		
+		
+		
+		<table style="width: 300px; margin-left: auto;margin-right: auto;">
+			<tr>
+				<td>
+					<input 
+						type="image"
+						src="<%=sessionBean.getApplicationBean().getPaginatorFirst()%>"
+						onclick="setAction('firstPage', 'searchForm');"/>
+				</td>
+				<td>
+					<input 				
+						type="image"
+						src="<%=sessionBean.getApplicationBean().getPaginatorFr()%>"
+						onclick="setAction('fastRewind', 'searchForm');"/>
+				</td>
+				<td>
+					<input 				
+						type="image"
+						src="<%=sessionBean.getApplicationBean().getPaginatorPrevious()%>"
+						onclick="setAction('previousPage', 'searchForm');"/>
+				</td>
+				<td><%=sessionBean.getSearchPage().getPaginator().getRecordStatus()%></td>
+				<td>
+					<input 				
+						type="image"
+						src="<%=sessionBean.getApplicationBean().getPaginatorNext()%>"
+						onclick="setAction('nextPage', 'searchForm');"/>
+				</td>
+				<td>
+					<input 				
+						type="image"
+						src="<%=sessionBean.getApplicationBean().getPaginatorFf()%>"
+						onclick="setAction('fastForward', 'searchForm');"/>
+				</td>
+				<td>
+					<input 	
+						src="<%=sessionBean.getApplicationBean().getPaginatorLast()%>"						
+						type="image"
+						onclick="setAction('lastPage', 'searchForm');"/>
+				</td>
+			</tr>
+		</table>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/componentes/template.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,68 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+	
+<% if(sessionBean.getMsgList() != null && !sessionBean.getMsgList().isEmpty()) { %>	
+  	<script>
+  		$(function() {
+    		$( "#msgDialog" ).dialog();
+  		});
+  	</script>	
+	
+	<div id="msgDialog" title="Message">
+		<table>
+			<% for(String msg : sessionBean.getMsgList()) { %>
+				<tr><td><label><%=msg %></label></td></tr>
+			<% } %>
+		</table>	
+	</div>
+	<% sessionBean.resetMsgList(); %>
+<% } %>
+	
+	<div id="header">
+		<div id="logo">
+			<h1><a href="#"><label class="titelPage">Local Gazetter Server</label></a></h1>
+		</div>
+	</div>
+	
+	<div id="login">
+		<div id="loginContent">
+		
+			<form name="loginForm"
+				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+				method="post"
+				class="contentForm">
+				<input name="bean" type="hidden" value="loginBean" /> 
+				
+			<% if(sessionBean.getUser() == null) { %>
+			<table>
+				<tr>
+					<td><a href="<%=sessionBean.getApplicationBean().getDvnRootServer() %>/faces/login/AddAccountPage.xhtml"target="_blank" style="font-size: 12px;">Create Account</a></td>
+					<td><label>Login</label></td>
+					<td><input type="text" name="userName"/></td>
+					<td><input type="password" name="password" /></td>
+					<td>
+						<button value="Submit" onclick="setAction('login', 'loginForm');">Submit</button>
+					</td>
+					
+				</tr>
+			</table>
+			<% } else { %>
+			<table>
+				<tr>
+					<td>Logged in as: <%=sessionBean.getUser().getUserName() %></td>
+					<td>|</td>
+					<td><input type="submit" value="logout" class="link" onclick="setAction('logout', 'loginForm');"/></td>
+					<td><a href="<%=sessionBean.getApplicationBean().getDvnRootServer() %>" target="_blank">Go To Dataverse</a></td>
+				</tr>
+			</table>
+			<% } %>
+		</form>
+		
+		</div>
+	</div>
+	
+	<div class="menu">
+	    <a href="<%=sessionBean.getApplicationBean().getRootServer()%>/pages/home.jsp">Home</a>
+	    <a href="<%=sessionBean.getApplicationBean().getRootServer()%>/pages/createFile.jsp" class="current">Create File</a>
+	    <a href="<%=sessionBean.getApplicationBean().getRootServer()%>/pages/search.jsp">Search</a>
+	</div>	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/methods/adminTypeAutocomplete.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,26 @@
+<%@page import="java.util.List"%>
+<%@page import="de.mpiwg.gazetteer.utils.DBService"%>
+<%@page import="org.json.JSONObject"%>
+<%@page import="org.json.JSONArray"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<%
+
+	
+	
+	String term = request.getParameter("term");
+	List<String> list = sessionBean.getSearchPage().suggestAdminType(term, 10);
+
+	
+	JSONArray jsonArr = new JSONArray();
+	
+	for(String item : list){
+		JSONObject json = new JSONObject();
+		json.put("name", item);
+		json.put("value", item);
+		jsonArr.put(json);
+		System.out.print("*");
+	}
+	out.println(jsonArr);
+%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/methods/dynastyAutocomplete.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,27 @@
+<%@page import="java.util.List"%>
+<%@page import="de.mpiwg.gazetteer.utils.DBService"%>
+<%@page import="org.json.JSONObject"%>
+<%@page import="org.json.JSONArray"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<%
+
+	
+	
+	String term = request.getParameter("term");
+	List<String> list = sessionBean.getSearchPage().suggestDynasty(term, 10);
+
+	System.out.println("dynastyFilter: " + term + " " + list.size());
+	
+	JSONArray jsonArr = new JSONArray();
+	
+	for(String item : list){
+		JSONObject json = new JSONObject();
+		json.put("name", item);
+		json.put("value", item);
+		jsonArr.put(json);
+		System.out.print("*");
+	}
+	out.println(jsonArr);
+%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/methods/getDataverseForm.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,73 @@
+<%@page import="de.mpiwg.gazetteer.dataverse.DataverseUtils"%>
+<%@page import="de.mpiwg.gazetteer.dataverse.bo.Study"%>
+<%@page import="java.util.List"%>
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+<%
+	
+
+	List<Study> studies = DataverseUtils.getStudies(sessionBean.getUser().getUserName(), sessionBean.getUser().getPassword());
+	System.out.println("%%%%% Studies: " + studies.size());
+	
+	if(studies.isEmpty()){
+%>
+
+	<label>The system does not find studies for the user <%= sessionBean.getUser().getUserName()%>.</label>
+
+<%		
+	} else {
+%>
+
+<form name="dataverseForm"
+	action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+	method="post">
+	<input name="bean" type="hidden" value="branchBean" />
+	<input name="fileId" type="hidden" value="<%=request.getParameter("fileId") %>" /> 	
+	
+	
+	<table class="pageTable">
+		<tbody>
+			<tr>
+				<th><label class="tableTitle">Study Global ID</label></th>
+				<th><label class="tableTitle">Title</label></th>
+				<th><label class="tableTitle">Creator</label></th>
+				<th><label class="tableTitle">Created</label></th>
+				<th><label class="tableTitle">Status</label></th>
+				<th><label class="tableTitle">Dataverse</label></th>
+				<th><label class="tableTitle">Publish</label></th>
+				<!-- 
+				<th><label class="tableTitle">Release Date</label></th>
+				<th><label class="tableTitle">Version</label></th>
+				<th><label class="tableTitle">Last Updated</label></th>
+				 -->
+				
+				<!-- 
+				<th><label class="tableTitle">Number of Files </label></th>
+				 -->
+			</tr>
+		</tbody>
+		<%
+			for(Study study : studies){
+		%>
+			
+			<tr>
+				<td><%= study.getGlobalId()%></td>
+				<td><%= study.getTitle() %></td>
+				<td><%= study.getCreator() %></td>
+				<td><%= study.getCreateTime() %></td>
+				<td><%= study.getStatus() %></td>
+				<td><%= study.getDataverse().getName() %></td>
+				<td>
+					<input type="image" 
+						onclick="<%=sessionBean.getApplicationBean().getJSConfirmationPublish() %> setAction0('publishFile', 'dataverseForm', 'studyGlobalId', '<%=study.getGlobalId() %>');" 
+						src="<%=sessionBean.getApplicationBean().getPublishImage()%>"/>
+				</td>
+			</tr>
+			
+		<% 
+			}
+		%>				
+	</table>
+</form>
+<%
+	}
+%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/methods/level1Autocomplete.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,26 @@
+<%@page import="java.util.List"%>
+<%@page import="de.mpiwg.gazetteer.utils.DBService"%>
+<%@page import="org.json.JSONObject"%>
+<%@page import="org.json.JSONArray"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<%
+
+	
+	
+	String term = request.getParameter("term");
+	List<String> list = sessionBean.getSearchPage().suggestLevel1(term, 10);
+
+	
+	JSONArray jsonArr = new JSONArray();
+	
+	for(String item : list){
+		JSONObject json = new JSONObject();
+		json.put("name", item);
+		json.put("value", item);
+		jsonArr.put(json);
+		System.out.print("*");
+	}
+	out.println(jsonArr);
+%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/methods/searchAutocomplete.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,38 @@
+<%@page import="java.util.List"%>
+<%@page import="de.mpiwg.gazetteer.utils.DBService"%>
+<%@page import="org.json.JSONObject"%>
+<%@page import="org.json.JSONArray"%>
+<%
+
+	String term = request.getParameter("term");
+	String searchIn0 = request.getParameter("searchIn");
+	Integer searchIn = 0;
+	try{
+		searchIn = Integer.parseInt(searchIn0);
+	}catch(Exception e){}
+	
+	
+	
+	List<String> list = null;
+	
+	if(searchIn == 0){
+		System.out.println("By Section");
+		list = DBService.suggestSectionName(term, 10);
+	}else{
+		System.out.println("By Book");
+		list = DBService.suggestBookName(term, 10);
+	}
+
+	System.out.println("AutoComplete: " + term + " " + list.size());
+	
+	JSONArray jsonArr = new JSONArray();
+	
+	for(String item : list){
+		JSONObject json = new JSONObject();
+		json.put("name", item);
+		json.put("value", item);
+		jsonArr.put(json);
+		System.out.print("*");
+	}
+	out.println(jsonArr);
+%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/methods/sectionIdAutocomplete.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,20 @@
+<%@page import="java.util.List"%>
+<%@page import="de.mpiwg.gazetteer.utils.DBService"%>
+<%@page import="org.json.JSONObject"%>
+<%@page import="org.json.JSONArray"%>
+<%
+
+	String term = request.getParameter("term");
+	List<String> list = DBService.suggestSectionId(term, 10);
+
+	
+	JSONArray jsonArr = new JSONArray();
+	
+	for(String item : list){
+		JSONObject json = new JSONObject();
+		json.put("name", item);
+		json.put("value", item);
+		jsonArr.put(json);
+	}
+	out.println(jsonArr);
+%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/methods/sectionTableDetails.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,102 @@
+
+
+<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
+<%@page import="de.mpiwg.gazetteer.utils.DBService"%>
+<%@page import="de.mpiwg.gazetteer.utils.DataProvider"%>
+<%
+	if(request.getParameter("sectionId") != null){
+		Long sectionId = Long.parseLong(request.getParameter("sectionId"));
+		DBSection section = DBService.getSectionWithContent(sectionId);
+		if(section != null){
+%>
+	
+	<table class="dialogTable0">
+		<tr>
+			<td><label style="font-weight: bold;">Book</label></td>
+			<td>
+				<table class="dialogTable">
+					<tr>
+						<td><label>Id</label></td>
+						<td><label><%=section.getBook().getId() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Name</label></td>
+						<td><label><%=section.getBook().getName() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Author</label></td>
+						<td><label><%=section.getBook().getAuthor() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Edition</label></td>
+						<td><label><%=section.getBook().getEdition() %></label></td>
+					</tr>
+					<tr>
+						<td><label>In Jibengujiku</label></td>
+						<td><label><%=section.getBook().getIn_jibengujiku() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Level 1</label></td>
+						<td><label><%=section.getBook().getLevel1() %></label></td>
+					</tr>					
+					<tr>
+						<td><label>Level 2</label></td>
+						<td><label><%=section.getBook().getLevel2() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Start Year</label></td>
+						<td><label><%=section.getBook().getStart_year() %></label></td>
+					</tr>
+					<tr>
+						<td><label>End Year</label></td>
+						<td><label><%=section.getBook().getEnd_year() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Volume</label></td>
+						<td><label><%=section.getBook().getVolume() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Period</label></td>
+						<td><label><%=section.getBook().getPeriod() %></label></td>
+					</tr>
+				</table>			
+			</td>
+		</tr>
+		<tr>
+			<td></td>
+			<td><hr></td>
+		</tr>
+		<tr>
+			<td><label style="font-weight: bold;">Section</label></td>
+			<td>
+				<table class="dialogTable">
+					<tr>
+						<td><label>Id</label></td>
+						<td><label><%=section.getId() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Name</label></td>
+						<td><label><%=section.getName() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Pages</label></td>
+						<td><label><%=section.getPages() %></label></td>
+					</tr>
+					<tr>
+						<td><label>Start Page</label></td>
+						<td><label><%=section.getStart_page() %></label></td>
+					</tr>
+					<tr>
+						<td><label>End Page</label></td>
+						<td><label><%=section.getEnd_page() %></label></td>
+					</tr>
+				</table>			
+			</td>
+		</tr>
+	</table>
+	
+
+<%
+		}
+	}
+%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/pages/branchPage.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,330 @@
+<%@page import="de.mpiwg.gazetteer.dataverse.bo.VDCUser"%>
+<%@page import="de.mpiwg.gazetteer.bo.LGFile"%>
+<%@page import="org.apache.commons.lang.StringUtils"%>
+<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<html>
+<head>
+
+	<jsp:include page="../componentes/headContent.jsp"/>	
+	<%
+		sessionBean.getBranchPage().loadParameters(request, response);
+		if(request.getParameter("branchId") != null){
+			sessionBean.getBranchPage().loadBranch(request.getParameter("branchId"));
+		}
+	%>
+	<script>
+		  $(function() {
+			  
+			    $( "#dialogDataverse" ).dialog({
+			        autoOpen: false,
+			        modal: true,
+			        width: 600,
+			        position: { my: "center", at: "top", of: window },
+			        hide: {
+			          effect: "explode",
+			          duration: 1000
+			        }
+				});			
+				
+				$( ".get-studies" ).click(function() {
+					var fileId = $( this ).data('file-id');
+					
+					var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/getDataverseForm.jsp?fileId=" + fileId;
+
+					$.ajax( url0 )
+					.done(function(data) {
+						$( "#dialogDataverseTable" ).replaceWith(data);
+						$( "#dialogDataverse" ).dialog( "open" );
+					})
+				  	.fail(function() {
+				    	console.error("Error calling: " + query);
+				  	})
+					
+			    });					  
+			  
+			  
+			 var dialog = $( "#dialogAddContributors" ).dialog(
+					{autoOpen: false}
+		  	);	  
+			 
+			$( "#addContributors" ).button().on( "click", function() {
+			        dialog.dialog( "open" );
+			});	 
+		  });
+	</script>
+	
+</head>
+
+<body>
+	<jsp:include page="../componentes/template.jsp"/>
+	
+	<div id="dialogDataverse" title="Select a study to publish your File" >
+	  <div id="dialogDataverseTable">XXXX</div>
+	</div>		
+
+	<div id="page">
+		
+		<% if(sessionBean.getUser() == null) { %>
+			<label>You must login!</label>
+		<% } else { %>
+		
+			<label class="subTitel">Branch Details</label>
+		
+		
+			<% if(sessionBean.getBranchPage().getBranch() != null) { %>
+			<div id="dialogAddContributors" title="Select a new Contributors:">
+				<form name="contributorsForm" id="contributorsForm"
+						action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+						method="post">
+						<input name="bean" type="hidden" value="branchBean" /> 
+					<table>
+						<% for(VDCUser user : sessionBean.getBranchPage().getSuggestionUserList()) { %>
+							<tr>
+								<td><a href="#" onclick="setAction0('addContributor', 'contributorsForm', 'userId', <%=user.getId() %>);document.getElementById('contributorsForm').submit();"><%=user.getUserName()%></a></td>
+							</tr>
+						<% } %>
+					</table>
+				</form>
+			</div>		
+			<% } %>
+			<!-- 
+			<form name="branchForm"
+				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+				method="post"
+				class="contentForm"
+				style="width: 70%; margin-left: auto;margin-right: auto;">
+				<input name="bean" type="hidden" value="branchBean" /> 
+				 -->
+				<% if(sessionBean.getBranchPage().getBranch() == null) { %>
+					<label>Branch no found!</label>
+				<% } else { %>
+				
+					<table>
+						<tr>
+							<td><label class="subTitel">General Information</label></td>
+							<td>
+								<table class="tableComponent">
+									<tr>
+										<td><label>Branch Id</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getId() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Label</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getLabel() %></label></td>
+									</tr>
+									
+									<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
+									<tr>
+										<td><label>Book Id</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getId() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Book Name</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getName() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Level 1</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getLevel1() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Level 2</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getLevel2() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Dynasty</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getDynasty() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Period</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getPeriod() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Admin Type</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getAdmin_type() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Volume</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getVolume() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Author</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getAuthor() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Edition</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getBook().getEdition() %></label></td>
+									</tr>
+									
+									<!-- %%%%%%%%%%%%%%%%%%%%%%%% -->
+									<tr>
+										<td><label>Section Id</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getSectionId() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Section Name</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getSection().getName() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Pages</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getSection().getPages()%></label></td>
+									</tr>
+									
+									
+									
+									
+									
+									
+									
+									
+									<tr>
+										<td><label>Created</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getFomattedCreation() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Creator</label></td>
+										<td><label><%=sessionBean.getBranchPage().getBranch().getUsername() %></label></td>
+									</tr><tr>
+										<td><label>Contributors</label></td>
+										<td>
+											<table>
+												<tr>
+													<td>
+														<form name="contributorForm"
+															action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+															method="post">
+															<input name="bean" type="hidden" value="branchBean" /> 
+															<table style="width: 300px;" class="pageTable">
+																<% for(VDCUser contr : sessionBean.getBranchPage().getContributors()) { %>
+																	<tr>
+																		<td><label><%=contr.getUserName() %></label></td>
+																		<td>
+																			<input type="image" 
+																				onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('removeContributor', 'contributorForm', 'userId',  <%=contr.getId() %>);" 
+																				src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>																	
+																		</td>
+																	</tr>
+																<% } %>
+															</table>
+														</form>
+													</td>
+													<td>
+														<button id="addContributors" type="button" class="lgButton">Add Contributors</button>
+													</td>
+												</tr>
+											</table>
+										</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+						<tr>
+							<td><label class="subTitel">Current Version</label></td>
+							<td>
+								<table class="tableComponent">
+									<tr>
+										<td><label>File Id</label></td>
+										<td><label><%=sessionBean.getBranchPage().getLastFile().getId() %></label></td>
+									</tr>
+									<tr>
+										<td><label>File Version</label></td>
+										<td><label><%=sessionBean.getBranchPage().getLastFile().getVersion() %></label></td>
+									</tr>
+									<tr>
+										<td><label>User</label></td>
+										<td><label><%=sessionBean.getBranchPage().getLastFile().getUsername() %></label></td>
+									</tr>
+									<tr>
+										<td><label>File Name</label></td>
+										<td><label><%=sessionBean.getBranchPage().getLastFile().getFileName() %></label></td>
+									</tr>
+									<tr>
+										<td><label>Created</label></td>
+										<td><label><%=sessionBean.getBranchPage().getLastFile().getFomattedCreation() %></label></td>
+									</tr>									
+									<tr>
+										<td><label>Text</label></td>
+										<td>
+											<textarea rows=20" cols="70">
+												<%=sessionBean.getBranchPage().getText() %>
+											</textarea>											
+										</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+						<tr>
+							<td><label class="subTitel">All Versions</label></td>
+							<td>
+								<form name="filesForm"
+									action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+									method="post">
+									<input name="bean" type="hidden" value="branchBean" /> 							
+							
+								
+									<table class="pageTable tableComponent">
+										<tr>
+											<th><label class="tableTitle">File Id</label></th>
+											<th><label class="tableTitle">Version</label></th>
+											<th><label class="tableTitle">User</label></th>
+											<th><label class="tableTitle">Created</label></th>
+											<th><label class="tableTitle">Text</label></th>
+											<th><label class="tableTitle">Table (to be published)</label></th>
+											<th><label class="tableTitle">Published in Dataverse?</label></th>
+											
+											<th><label class="tableTitle">Delete</label></th>
+										</tr>	
+										
+										<% for(LGFile file : sessionBean.getBranchPage().getAllFiles()) { %>
+											<tr>
+												<td><label><%= file.getId() %></label></td>
+												<td><label><%= file.getVersion() %></label></td>
+												<td><label><%= file.getUsername() %></label></td>
+												<td><label><%= file.getFomattedCreation() %></label></td>
+												<td>
+													<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFileText?fileId=<%=file.getId() %>"
+														target="_blank">
+														<img alt="Show text" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
+													</a>
+												</td>
+												<td>
+													<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getTable4File?fileId=<%=file.getId() %>"
+														target="_blank">
+														<img alt="Show text" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
+													</a>												
+												</td>												
+												<td>
+													<% if(file.getDvId() == null) {%>
+													<button type="button" class="get-studies" data-file-id="<%=file.getId()%>">load</button>
+													<% } else { %>
+													<label>Yes! Id in Dataverse: <%= file.getDvId() %></label>							
+													<% } %>		
+												</td>												
+												<td>
+													<input type="image" 
+														onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'filesForm', 'fileId', <%=file.getId() %>);" 
+														src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
+												</td>
+											</tr>
+										<% } %>				
+									</table>
+									
+								</form>
+							</td>
+						</tr>
+					
+					</table>
+				
+				<% } %>
+				
+					
+					
+				
+			<!-- </form> -->
+		<% } %>
+	
+	</div>
+	
+</body>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/pages/createFile.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,127 @@
+<%@page import="org.apache.commons.lang.StringUtils"%>
+<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<html>
+
+<head>
+
+	<jsp:include page="../componentes/headContent.jsp"/>
+	
+	<script>
+		$(function() {
+			$("#sectionId").autocomplete({
+				source : function(request, response) {
+					$.ajax({
+						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/sectionIdAutocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});
+		});			
+	</script>
+	
+	
+</head>
+
+<body>
+
+	<jsp:include page="../componentes/template.jsp"/>
+
+	<div id="page">
+	
+		<% if(sessionBean.getUser() == null) { %>
+			<label>You must login!</label>
+		<% } else { %>
+		
+			<label class="subTitel">Create New File (Branch)</label>
+			
+			<form name="createFileForm"
+				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+				method="post"
+				class="contentForm">
+				<input name="bean" type="hidden" value="createFileBean" /> 
+			
+				<table style="width: 300px; margin-left: auto;margin-right: auto;">
+					<tr>
+						<td><label>Section Id</label></td>
+						<td>
+							<input
+								id="sectionId"
+								name="sectionId"		 
+								type="text"
+								class="searchInput"
+								value="<%=(sessionBean.getCreateFilePage().getSectionId() == null) ? "" : sessionBean.getCreateFilePage().getSectionId()%>"
+								style="width: 150px;" />						
+						</td>
+						<td>
+							<input type="submit" value="Load" onclick="setAction('loadSection', 'createFileForm');"/>
+						</td>
+					</tr>
+				</table>
+				
+				<% if(sessionBean.getCreateFilePage().getSection() != null) { %>
+					
+					<table style="width: 300px; margin-left: auto;margin-right: auto;">
+						<tr>
+							<td><label>Section Name</label></td>
+							<td><label><%= sessionBean.getCreateFilePage().getSection().getName() %></label></td>
+						</tr>
+						<tr>
+							<td><label>Book Id</label></td>
+							<td><label><%= sessionBean.getCreateFilePage().getSection().getBook().getId() %></label></td>
+						</tr>
+						<tr>
+							<td><label>Book Name</label></td>
+							<td><label><%= sessionBean.getCreateFilePage().getSection().getBook().getName() %></label></td>
+						</tr>
+						<tr>
+							<td><label>Text</label></td>
+							<td>
+								<textarea rows=20" cols="70">
+									<%=sessionBean.getCreateFilePage().getSection().getText() %>
+								</textarea>
+								
+							</td>
+						</tr>
+						<tr>
+							<td></td>
+							<td>
+								<input type="submit"
+									value="Create"
+							 		title="Create Branch in Extraction Interface"
+									onclick="sectionInExtractionInterface(<%=sessionBean.getCreateFilePage().getSectionId() %>, '<%=sessionBean.getCreateFilePage().getSection().getName()%>', <%=sessionBean.getCreateFilePage().getSection().getBook().getId() %>, '<%=sessionBean.getCreateFilePage().getSection().getBook().getName() %>', <%=sessionBean.getUser().getId() %>, '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl() %>');"/>
+									
+								<input type="submit" value="Reset" onclick="setAction('reset', 'createFileForm');"/>
+							</td>
+						</tr>
+					</table>
+					
+					
+				<% } %>
+				
+			</form>
+		<% } %>
+	
+	</div>
+	
+</body>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/pages/home.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,106 @@
+<%@page import="de.mpiwg.gazetteer.bo.LGBranch"%>
+<%@page import="org.apache.commons.lang.StringUtils"%>
+<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+
+<html>
+
+<head>
+	<jsp:include page="../componentes/headContent.jsp"/>	
+</head>
+
+<body>
+
+	<jsp:include page="../componentes/template.jsp"/>
+
+	<div id="page">
+		
+		<% if(sessionBean.getUser() == null) { %>
+			<label>You must login!</label>
+		<% } else { 
+			sessionBean.getHomePage().loadParameters(request, response);
+			sessionBean.getHomePage().reloadBranches();
+		%>
+		<label class="subTitel">User's Branches</label>
+		
+		<% if(sessionBean.getHomePage().getBranches().isEmpty()) { %>
+			<label>You do not have branches!</label>
+		<% } else { %>
+				
+			<form
+				name="homeForm"
+				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+				method="post">
+				
+				<input name="bean" type="hidden" value="homeBean" /> 
+				
+				<table style="width: 90%; margin-left: auto;margin-right: auto;"  class="pageTable">
+					<tr>
+						<td><label class="tableTitle">Branch ID</label></td>
+						<td><label class="tableTitle">Book ID</label></td>
+						<td><label class="tableTitle">Book Name</label></td>
+						<td><label class="tableTitle">Section Name</label></td>
+						<td><label class="tableTitle">Label</label></td>
+						<td><label class="tableTitle">Contributors</label></td>
+						<td><label class="tableTitle">Last Modified</label></td>
+						<td><label class="tableTitle">Extraction Interface</label></td>
+						<td><label class="tableTitle">Published in Dataverse</label></td>
+						<td><label class="tableTitle">Manage</label></td>
+						<td><label class="tableTitle">Delete</label></td>
+					</tr>	
+					
+					<% for(LGBranch branch : sessionBean.getHomePage().getBranches()) { %>
+					
+					<tr>
+						<td><%=branch.getId() %></td>
+						<td><%=branch.getBook().getId() %></td>
+						<td><%=branch.getBook().getName() %></td>
+						<td><%=branch.getSection().getName() %></td>
+						<td><%=branch.getLabel() %></td>
+						<td>
+							<table style="width:120px;">
+							<% for(String contributor : branch.getContributorsNameList()) { %>
+								<tr><td><label><%= contributor %></label></td></tr>
+							<% } %>
+							</table>
+						</td>
+						<td><%=branch.getFomattedLastChange() %></td>
+						<td>
+							<a onclick="branchInExtractionInterface('<%=branch.getId() %>', '<%=branch.getCurrentLastFileId() %>', '<%=branch.getSectionId() %>', '<%=branch.getSection().getName() %>', '<%=branch.getBook().getId() %>', '<%=branch.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');">
+								<img alt="Show Branch in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
+							</a>
+						</td>
+						<!-- Dataverse -->
+						<td>
+							<%=branch.isPublished() %>
+						</td>
+						<td>
+							<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" >
+								<img alt="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/>
+							</a>
+						</td>
+						<td>
+							<input type="image" 
+								onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> deleteBranch('deleteBranch', 'homeForm', '<%=branch.getId() %>');" 
+								src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
+						</td>
+						
+					</tr>
+					
+					<% } %>
+				</table>
+				<!-- 
+				<table>
+					<tr>
+						<td><input type="submit" value="Reload" onclick="setAction('reloadBranches', 'homeForm');"/> </td>
+					</tr>
+				</table>
+				 -->
+			</form>
+		<% } %>
+		<% } %>
+	</div>
+	
+</body>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/pages/search.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,520 @@
+<%@page import="de.mpiwg.gazetteer.bo.LGBranch"%>
+<%@page import="org.apache.commons.lang.StringUtils"%>
+<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />
+	
+
+<html>
+
+<head>
+
+	<jsp:include page="../componentes/headContent.jsp"/>	
+
+	
+	<script>
+		$(function() {
+			
+		    $( "#dialogMoreInfo" ).dialog({
+		        autoOpen: false,
+		        modal: true,
+		        position: { my: "center", at: "top", of: window },
+		        hide: {
+		          effect: "explode",
+		          duration: 1000
+		        }
+		      });
+		   
+			$( ".moreInfo" ).click(function() {
+				var sectionId = $( this ).data('section-id');
+				
+				var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/sectionTableDetails.jsp?sectionId=" + sectionId;
+				
+				$.ajax( url0 )
+				.done(function(data) {
+					$( "#dialogMoreInfoTable" ).replaceWith(data);
+					$( "#dialogMoreInfo" ).dialog( "open" );
+				})
+			  	.fail(function() {
+			    	console.error("Error calling: " + query);
+			  	})
+				
+				
+				
+		    });			
+			
+			$("#searchTerm").autocomplete({
+				source : function(request, response) {
+					var radioButton0 = $("input[type='radio'][name='searchIn']:checked");
+					var searchInVal = (radioButton0) ? radioButton0.val() : 0;
+				$.ajax({
+					url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/searchAutocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term,
+							searchIn : searchInVal
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});
+			
+			$("#dynastyFilter").autocomplete({
+				source : function(request, response) {
+					$.ajax({
+						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/dynastyAutocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});	
+			
+			$("#level1Filter").autocomplete({
+				source : function(request, response) {
+					$.ajax({
+						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/level1Autocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});		
+			
+			$("#adminTypeFilter").autocomplete({
+				source : function(request, response) {
+					$.ajax({
+						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/adminTypeAutocomplete.jsp",
+						type : "POST",
+						dataType : "json",
+						data : {
+							term : request.term
+						},
+						success : function(data) {
+	
+							response($.map(data, function(item) {
+								return {
+									label : item.name,
+									value : item.value,
+								}
+							}));
+						},
+						error : function(error) {
+							alert('error: ' + error);
+						}
+					});
+				},
+				minLength : 0
+			});		
+				
+		});
+	</script>
+</head>
+
+<body>
+
+
+
+	<jsp:include page="../componentes/template.jsp"/>
+
+
+	<div id="dialogMoreInfo" title="Section Details">
+	  <div id="dialogMoreInfoTable">XXXX</div>
+	</div>
+ 
+
+	<div id="page">
+	
+		<% if(sessionBean.getUser() == null) { %>
+			<label>You must login!</label>
+		<% } else { %>
+			
+		<label class="subTitel">Search for Sections</label>
+		
+		<form name="searchForm"
+			action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
+			method="post"
+			class="contentForm">
+			<input name="bean" type="hidden" value="searchBean" /> 
+			
+			
+			<table style="width: 300px; margin-left: auto;margin-right: auto;">
+				<tr>
+					<td>
+						<input
+							id="searchTerm"
+							name="searchTerm"
+							type="text"
+							class="searchInput"
+							value="<%=sessionBean.getSearchPage().getSearchTerm()%>" />				
+					</td>
+					<td>
+						<input
+							type="image" 
+							onclick="setAction('search', 'searchForm');"
+							src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/>
+					</td>
+				</tr>
+				<tr>
+					<td>
+						<label>Search in:</label>
+						<input type="radio" name="searchIn" value="0" <%= (sessionBean.getSearchPage().getSearchIn() == 0) ? "checked" : "" %>><label>Section Name</label>
+						<input type="radio" name="searchIn" value="1" <%= (sessionBean.getSearchPage().getSearchIn() == 1) ? "checked" : "" %>/><label>Book Name</label>
+					</td>
+				</tr>
+				<tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getSearchMessage())) ? sessionBean.getSearchPage().getSearchMessage() : ""%></label></td></tr>
+				<tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getFilteringMessage())) ? sessionBean.getSearchPage().getFilteringMessage() : ""%></label></td></tr>
+			</table>
+	
+	
+			<%
+				if (sessionBean.getSearchPage().getCompleteSectionList() != null) {
+			%>
+	
+	
+			<jsp:include page="../componentes/paginator.jsp"/>
+	
+			<table class="pageTable">
+				<tbody>
+					<tr>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Book Id</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByBookIdUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookIdDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Book Name</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookNameUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookNameDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																	
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>					
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Level 1</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByLevel1Up', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByLevel1Down', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="level1Filter" id="level1Filter" value="<%= sessionBean.getSearchPage().getLevel1Filter()%>"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'searchForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>								
+							</table>	
+						</th>
+						<th><label class="tableTitle">Level 2</label></th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Dynasty</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByDynastyUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByDynastyDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getSearchPage().getDynastyFilter()%>"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'searchForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>
+							</table>					
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Period</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByPeriodUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByPeriodDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>						
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Admin Type</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByAdminTypeUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByAdminTypeDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getSearchPage().getAdminTypeFilter()%>"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'searchForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>								
+							</table>	
+						</th>
+						<!-- 
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Volume</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByVolumeUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByVolumeDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>						
+						</th>
+						-->
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Section Name</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortBySectionNameUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortBySectionNameDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>	
+						</th>
+						<th>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Pages</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByStartPageUp', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByStartPageDown', 'searchForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>							
+						
+						</th>
+						<th><label class="tableTitle">View Page Text</label></th>
+						<th><label class="tableTitle">Existing Branches</label></th>
+					</tr>
+				
+	
+					<%
+						for (DBSection section : sessionBean.getSearchPage().getDisplaySectionList()) {
+					%>
+					<tr>
+						<td>
+							<a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=section.getBook().getId() %>&amp;count=100&amp;sessionId=<%= session.getId()%>" target="blank">
+								<%=section.getBook().getId()%>
+							</a>	
+							<img alt="More Information" src="<%=sessionBean.getApplicationBean().getMoreInfoImage()%>" data-section-id="<%=section.getId()%>" class="moreInfo"/>
+						</td>
+						<td><%=section.getBook().getName()%></td>
+						<td><%=section.getBook().getLevel1()%></td>
+						<td><%=section.getBook().getLevel2()%></td>
+						<td><%=section.getBook().getDynasty()%></td>
+						<td><%=section.getBook().getPeriod()%></td>
+						<td><%=section.getBook().getAdmin_type() %></td>
+						<td><%=section.getName()%></td>
+						<td><%=section.getPages()%></td>
+						<td>
+							<a	href="#"
+								title="Show Section in Extraction Interface" 
+							 	onclick="sectionInExtractionInterface('<%=section.getId() %>', '<%=section.getName() %>', '<%=section.getBook().getId() %>', '<%=section.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');">
+							 	<img alt="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>">
+							</a>
+						</td>
+						<td>
+							<% if(section.getBranches() != null && !section.getBranches().isEmpty()) { %>
+								<table>
+									<% for(LGBranch branch : section.getBranches()) { %>
+										<tr>
+											<td>
+												<table>
+												<tr><td><%=branch.getFomattedLastChange() %></td></tr>
+												<tr><td><%=branch.getLabel() %></td></tr>
+												</table>
+											</td>
+											<td>
+												<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" >
+													<img alt="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/>
+												</a>												
+											</td>
+										</tr>
+									<% } %>
+								</table>
+							<% } %>
+						</td>
+		
+					</tr>
+					<%
+						}
+					%>
+				</tbody>
+			</table>
+	
+			<jsp:include page="../componentes/paginator.jsp"/>
+	
+			<%
+				}
+			%>
+	
+	
+		</form>
+	
+		<% } %>
+		
+	</div>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/proxy.jsp	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,23 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<html>
+
+	<head>
+
+		
+		<jsp:useBean id="proxy" class="de.mpiwg.web.jsp.JSPProxy" scope="request" >
+			<jsp:setProperty property="*" name="proxy"/>
+		</jsp:useBean>
+		
+		<jsp:setProperty name="proxy" property="request" value="${pageContext.request}" />
+		<jsp:setProperty name="proxy" property="response" value="${pageContext.response}" />
+		
+		<% 
+			response.sendRedirect(proxy.processRequest());
+		%>
+		
+	</head>
+	<body>
+	
+	</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/resources/css/style.css	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,260 @@
+body {
+    margin: 0;
+    padding: 0;
+    font-family: Verdana, Arial, sans-serif;
+    background-color: #FCF2DF ;
+    font-size: 12px;
+}
+
+label{
+	font-family: Verdana, Arial, sans-serif;
+    color: #485297;
+    font-size: 12px;
+}
+
+.ui-btn.my-tooltip-btn,
+.ui-btn.my-tooltip-btn:hover,
+.ui-btn.my-tooltip-btn:active {
+    background: none;
+    border: 0;
+}
+
+#header {
+    background-color: #fcf2df;
+    box-shadow: 0 0 5px 3px #d0d0d0;
+    height: 120px;
+    margin: 0 auto;
+    width: 80%;
+}
+
+
+.lgButton{
+	font-size: 12px !important;
+}
+
+.titelPage{
+	color: #485297;
+  	font-family: Verdana,Arial,sans-serif;
+  	padding: 2px 0;
+  	font-size: 20px;
+}
+
+.label {
+  color: #485297;
+  font-family: Verdana,Arial,sans-serif;
+  padding: 2px 0;
+  font-size: small;
+}
+
+/* Logo */
+
+#logo {
+	width: 920px;
+	height: 40px;
+	margin: 0;
+	padding: 20px 45px 0px 40px;
+	/*color: #000000;*/
+}
+
+#logo h1, #logo p {
+	margin: 0px;
+	padding: 0px;
+	//text-transform: uppercase;
+}
+
+#logo h1 {
+	font-family: Verdana, Verdana, Arial, sans-serif;
+	font-size: x-large;
+}
+
+#logo p {
+	font-size: 12px;
+	font-weight: bold;
+	color: #FFFFFF;
+} 
+
+#logo a {
+	border: none;
+	background: none;
+	text-decoration: none;
+	color: #FFFFFF;
+}
+
+.link {
+    margin: 0;
+    border: 0;
+    background: none;
+    overflow: visible;
+    color: blue;
+    cursor: pointer;
+    font-size: 16px;
+    font-family: Verdana,Arial,sans-serif;
+}
+
+#page {
+    background-color: #fcf2df;
+    box-shadow: 0 0 5px 3px #d0d0d0;
+    margin: 0 auto;
+    padding-bottom: 50px;
+    width: 80%;
+}
+
+.subTitel{
+	width: 100%;
+	display: inline-block;
+	font-size: x-large;
+	padding: 10px 0;
+    color: #485297;
+  	text-align: center;
+}
+
+.contentForm{
+	
+}
+
+.searchInput{
+	width: 300px;
+	box-shadow: inset 0 2px 2px #d3d3d3;
+	border: 1px solid #d3d3d3;
+  color: #555555;
+	margin: 0;
+	  outline: medium none;
+	  padding: 4px;
+}
+
+.tableComponent {
+  margin-top: 10px;
+  padding-top: 10px;
+  width: 300px;
+  border-top: 5px solid #ABABCC;
+  width: 100%;
+}
+
+.pageTable{
+	width: 90%; 
+	margin-left: auto;
+	margin-right: auto;
+	background-color: white;
+	border-collapse: collapse;
+}
+
+
+
+.pageTable tr:nth-child(odd) {
+  background:#EBEBEB;
+}
+
+
+.pageTable td {
+    border-color: inherit;
+    border-style: solid;
+    border-width: 1px;
+    text-align: center;
+    border-collapse: collapse;
+    font-size: 12px;
+}
+
+.pageTable th {
+	background-color: #F2F2F6;
+	border-left:1px solid #555;
+	border-right: 1px solid #777;
+	border-top: 1px solid #555;
+
+}
+
+.dialogTable0{
+	/*
+	border-style: solid;
+    border-width: 2px;
+	border-color: #485297;*/
+	margin: 5px 5px 5px 5px;
+	
+}
+
+.dialogTable0 hr{
+	border:solid #485297 2px;
+}
+
+.dialogTable0 label{
+	font-size: 15px;
+}
+
+.dialogTable tr:nth-child(odd) {
+  background:#ebebeb;
+}
+
+.dialogTable{
+	margin-top: 5px;
+	margin-bottom: 5px;
+}
+
+.tableTitle{
+	
+  	font-size: 14px;
+	color: black;
+  	font-weight: bold;
+	position: relative;	
+}
+
+.sortTable td{
+	border-style: none;
+}
+
+.sortTable tr{
+	background: none !important;
+	
+}
+
+#login {
+    background-color: #fcf2df;
+    color: black;
+    font-size: 11px;
+    height: 25px;
+    margin: 0 auto;
+    padding-bottom: 2px;
+    width: 80%;
+}
+
+#loginContent {
+    float: right;
+    width: 600px;
+    font-size: 12px;
+}
+
+/* MENU */
+
+div.menu
+{
+    /*width:500px;margin:0 auto;*//*Uncomment this line to make the menu center-aligned.*/
+    text-align:center;
+    background-color: white;
+    font-size:0;
+    width: 80%;
+    margin-left: auto;
+    margin-right: auto;
+    margin-bottom: 10px;
+    
+}
+
+div.menu a
+{
+	
+    display: inline-block;
+    padding: 0 20px;
+    background-color: white;
+    color:black;
+    text-decoration:none;
+    font: bold 12px Arial;
+    line-height: 32px;
+}
+
+div.menu a:hover, div.menu2 a.current
+{
+    background-color: #C2E0FF;
+}
+
+div.menu a.dummy
+{
+    width:2px;
+    padding:0 0;
+}
\ No newline at end of file
Binary file src/main/webapp/resources/images/arrow-ff.gif has changed
Binary file src/main/webapp/resources/images/arrow-first.gif has changed
Binary file src/main/webapp/resources/images/arrow-fr.gif has changed
Binary file src/main/webapp/resources/images/arrow-last.gif has changed
Binary file src/main/webapp/resources/images/arrow-next.gif has changed
Binary file src/main/webapp/resources/images/arrow-previous.gif has changed
Binary file src/main/webapp/resources/images/branch_details_16.png has changed
Binary file src/main/webapp/resources/images/branch_details_32.png has changed
Binary file src/main/webapp/resources/images/delete_16.png has changed
Binary file src/main/webapp/resources/images/down_16.png has changed
Binary file src/main/webapp/resources/images/down_20.png has changed
Binary file src/main/webapp/resources/images/edit_16.png has changed
Binary file src/main/webapp/resources/images/edit_32.png has changed
Binary file src/main/webapp/resources/images/edit_branch_16.png has changed
Binary file src/main/webapp/resources/images/edit_branch_32.png has changed
Binary file src/main/webapp/resources/images/filter_16.png has changed
Binary file src/main/webapp/resources/images/filter_24.png has changed
Binary file src/main/webapp/resources/images/more_info_16.png has changed
Binary file src/main/webapp/resources/images/new_branch_16.png has changed
Binary file src/main/webapp/resources/images/new_branch_32.png has changed
Binary file src/main/webapp/resources/images/publish_16.png has changed
Binary file src/main/webapp/resources/images/publish_32.png has changed
Binary file src/main/webapp/resources/images/search_16.png has changed
Binary file src/main/webapp/resources/images/search_32.png has changed
Binary file src/main/webapp/resources/images/search_64.png has changed
Binary file src/main/webapp/resources/images/show_16.png has changed
Binary file src/main/webapp/resources/images/show_32.png has changed
Binary file src/main/webapp/resources/images/up_16.png has changed
Binary file src/main/webapp/resources/images/up_20.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/resources/js/bootstrap.min.js	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,6 @@
+/*!
+* Bootstrap.js by @fat & @mdo
+* Copyright 2012 Twitter, Inc.
+* http://www.apache.org/licenses/LICENSE-2.0.txt
+*/
+!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>this.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children()[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning||this.$element.hasClass("in"))return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning||!this.$element.hasClass("in"))return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},e.fn.collapse.defaults,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function r(){e(".dropdown-backdrop").remove(),e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||("ontouchstart"in document.documentElement&&e('<div class="dropdown-backdrop"/>').insertBefore(e(this)).on("click",r),s.toggleClass("open")),n.focus(),!1},keydown:function(n){var r,s,o,u,a,f;if(!/(38|40|27)/.test(n.keyCode))return;r=e(this),n.preventDefault(),n.stopPropagation();if(r.is(".disabled, :disabled"))return;u=i(r),a=u.hasClass("open");if(!a||a&&n.keyCode==27)return n.which==27&&u.find(t).focus(),r.click();s=e("[role=menu] li:not(.divider):visible a",u);if(!s.length)return;f=s.index(s.filter(":focus")),n.keyCode==38&&f>0&&f--,n.keyCode==40&&f<s.length-1&&f++,~f||(f=0),s.eq(f).focus()}};var s=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdown.Constructor=n,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=s,this},e(document).on("click.dropdown.data-api",r).on("click.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",t,n.prototype.toggle).on("keydown.dropdown.data-api",t+", [role=menu]",n.prototype.keydown)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")})},hide:function(t){t&&t.preventDefault();var n=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]!==e.target&&!t.$element.has(e.target).length&&t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){t.which==27&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){var e=this;this.$element.hide(),this.backdrop(function(){e.removeBackdrop(),e.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!t)return;i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t):t()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),i=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},i.data(),n.data());t.preventDefault(),i.modal(s).one("hide",function(){n.focus()})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s,o,u,a;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,o=this.options.trigger.split(" ");for(a=o.length;a--;)u=o[a],u=="click"?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):u!="manual"&&(i=u=="hover"?"mouseenter":"focus",s=u=="hover"?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e.fn[this.type].defaults,r={},i;this._options&&e.each(this._options,function(e,t){n[e]!=t&&(r[e]=t)},this),i=e(t.currentTarget)[this.type](r).data(this.type);if(!i.options.delay||!i.options.delay.show)return i.show();clearTimeout(this.timeout),i.hoverState="in",this.timeout=setTimeout(function(){i.hoverState=="in"&&i.show()},i.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var t,n,r,i,s,o,u=e.Event("show");if(this.hasContent()&&this.enabled){this.$element.trigger(u);if(u.isDefaultPrevented())return;t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),r=t[0].offsetWidth,i=t[0].offsetHeight;switch(s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}this.applyPlacement(o,s),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n=this.tip(),r=n[0].offsetWidth,i=n[0].offsetHeight,s,o,u,a;n.offset(e).addClass(t).addClass("in"),s=n[0].offsetWidth,o=n[0].offsetHeight,t=="top"&&o!=i&&(e.top=e.top+i-o,a=!0),t=="bottom"||t=="top"?(u=0,e.left<0&&(u=e.left*-2,e.left=0,n.offset(e),s=n[0].offsetWidth,o=n[0].offsetHeight),this.replaceArrow(u-r+s,s,"left")):this.replaceArrow(o-i,o,"top"),a&&n.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function i(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var t=this,n=this.tip(),r=e.Event("hide");this.$element.trigger(r);if(r.isDefaultPrevented())return;return n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i():n.detach(),this.$element.trigger("hidden"),this},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=(typeof n.content=="function"?n.content.call(t[0]):n.content)||t.attr("data-content"),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(window.jQuery),!function(e){"use strict";function t(t,n){var r=e.proxy(this.process,this),i=e(t).is("body")?e(window):e(t),s;this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=i.on("scroll.scroll-spy.data-api",r),this.selector=(this.options.target||(s=e(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t=this,n;this.offsets=e([]),this.targets=e([]),n=this.$body.find(this.selector).map(function(){var n=e(this),r=n.data("target")||n.attr("href"),i=/^#\w/.test(r)&&e(r);return i&&i.length&&[[i.position().top+(!e.isWindow(t.$scrollElement.get(0))&&t.$scrollElement.scrollTop()),r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},process:function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;if(e>=n)return s!=(o=i.last()[0])&&this.activate(o);for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(!r[o+1]||e<=r[o+1])&&this.activate(i[o])},activate:function(t){var n,r;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(r).parent("li").addClass("active"),n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var r=e(this),i=r.data("scrollspy"),s=typeof n=="object"&&n;i||r.data("scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active:last a")[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=e(this.options.menu),this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var t=[],n=[],r=[],i;while(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);return t.concat(n,r)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this;return t=e(t).map(function(t,r){return t=e(n.options.item).attr("data-value",r),t.find("a").html(n.highlighter(r)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.next();r.length||(r=e(this.$menu.find("li")[0])),r.addClass("active")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prev();n.length||(n=this.$menu.find("li").last()),n.addClass("active")},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},focus:function(e){this.focused=!0},blur:function(e){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(e){e.stopPropagation(),e.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")},mouseleave:function(e){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=e.fn.typeahead;e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this},e(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeahead"))return;n.typeahead(n.data())})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var t=e(document).height(),n=this.$window.scrollTop(),r=this.$element.offset(),i=this.options.offset,s=i.bottom,o=i.top,u="affix affix-top affix-bottom",a;typeof i!="object"&&(s=o=i),typeof o=="function"&&(o=i.top()),typeof s=="function"&&(s=i.bottom()),a=this.unpin!=null&&n+this.unpin<=r.top?!1:s!=null&&r.top+this.$element.height()>=t-s?"bottom":o!=null&&n<=o?"top":!1;if(this.affixed===a)return;this.affixed=a,this.unpin=a=="bottom"?r.top-n:null,this.$element.removeClass(u).addClass("affix"+(a?"-"+a:""))};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var r=e(this),i=r.data("affix"),s=typeof n=="object"&&n;i||r.data("affix",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/resources/js/general.js	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,99 @@
+function branchInExtractionInterface(
+		branchId, fileId, 
+		sectionId, 
+		sectionName, 
+		bookId, 
+		bookName, 
+		userId, extractionInterfaceUrl){
+	
+	var form = document.createElement("form");
+	form.setAttribute("method", "post");
+	form.setAttribute("action", extractionInterfaceUrl + "/Extractapp/TaggingText");  // hand to controller
+	form.setAttribute("target", "_blank");
+	
+	
+	var hiddenField0 = document.createElement("input");      
+	hiddenField0.setAttribute("name", "branchId");
+	hiddenField0.setAttribute("value", branchId);
+	form.appendChild(hiddenField0);
+	
+	var hiddenField1 = document.createElement("input");      
+	hiddenField1.setAttribute("name", "fileId");
+	hiddenField1.setAttribute("value", fileId);
+	form.appendChild(hiddenField1);
+
+	var hiddenField2 = document.createElement("input");      
+	hiddenField2.setAttribute("name", "userId");
+	hiddenField2.setAttribute("value", userId);
+	form.appendChild(hiddenField2);
+	
+	var hiddenField3 = document.createElement("input");      
+	hiddenField3.setAttribute("name", "sectionId");
+	hiddenField3.setAttribute("value", sectionId);
+	form.appendChild(hiddenField3);	
+	
+	
+	var hiddenField4 = document.createElement("input");      
+	hiddenField4.setAttribute("name", "sectionName");
+	hiddenField4.setAttribute("value", sectionName);
+	form.appendChild(hiddenField4);	
+	
+	var hiddenField5 = document.createElement("input");      
+	hiddenField5.setAttribute("name", "bookId");
+	hiddenField5.setAttribute("value", bookId);
+	form.appendChild(hiddenField5);	
+	
+	var hiddenField6 = document.createElement("input");      
+	hiddenField6.setAttribute("name", "bookName");
+	hiddenField6.setAttribute("value", bookName);
+	form.appendChild(hiddenField6);		
+	
+	if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
+	       document.body.appendChild(form);
+	       form.submit();
+	       document.body.removeChild(form);
+	   } else {
+	       form.submit(); // works under IE and Chrome, but not FF  
+	   }
+}
+
+function sectionInExtractionInterface(sectionId, sectionName, bookId, bookName, userId, extractionInterfaceUrl){
+	
+	var form = document.createElement("form");
+	form.setAttribute("method", "post");
+	form.setAttribute("action", extractionInterfaceUrl + "/Extractapp/TaggingText");  // hand to controller
+	form.setAttribute("target", "_blank");
+
+	var hiddenField2 = document.createElement("input");      
+	hiddenField2.setAttribute("name", "userId");
+	hiddenField2.setAttribute("value", userId);
+	form.appendChild(hiddenField2);
+	
+	var hiddenField3 = document.createElement("input");      
+	hiddenField3.setAttribute("name", "sectionId");
+	hiddenField3.setAttribute("value", sectionId);
+	form.appendChild(hiddenField3);	
+	
+	var hiddenField4 = document.createElement("input");      
+	hiddenField4.setAttribute("name", "sectionName");
+	hiddenField4.setAttribute("value", sectionName);
+	form.appendChild(hiddenField4);	
+	
+	var hiddenField5 = document.createElement("input");      
+	hiddenField5.setAttribute("name", "bookId");
+	hiddenField5.setAttribute("value", bookId);
+	form.appendChild(hiddenField5);	
+	
+	var hiddenField6 = document.createElement("input");      
+	hiddenField6.setAttribute("name", "bookName");
+	hiddenField6.setAttribute("value", bookName);
+	form.appendChild(hiddenField6);	
+	
+	if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
+	       document.body.appendChild(form);
+	       form.submit();
+	       document.body.removeChild(form);
+	   } else {
+	       form.submit(); // works under IE and Chrome, but not FF  
+	   }	
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/resources/js/jquery.min.js	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,3128 @@
+/*! jQuery v2.0.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
+//@ sourceMappingURL=jquery-2.0.2.min.map
+*/
+(
+    function (e, undefined) {
+        var t, n, r = typeof undefined,
+            i = e.location,
+            o = e.document,
+            s = o.documentElement,
+            a = e.jQuery,
+            u = e.$,
+            l = {}, c = [],
+            p = "2.0.2",
+            f = c.concat,
+            h = c.push,
+            d = c.slice,
+            g = c.indexOf,
+            m = l.toString,
+            y = l.hasOwnProperty,
+            v = p.trim,
+            x = function (e, n) {
+                return new x.fn.init(e, n, t)
+            }, b = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+            w = /\S+/g,
+            T = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+            C = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+            k = /^-ms-/,
+            N = /-([\da-z])/gi,
+            E = function (e, t) {
+                return t.toUpperCase()
+            }, S = function () {
+                o.removeEventListener("DOMContentLoaded", S, !1), e.removeEventListener("load", S, !1), x.ready()
+            };
+        x.fn = x.prototype = {
+            jquery: p,
+            constructor: x,
+            init: function (e, t, n) {
+                var r, i;
+                if (!e) return this;
+                if ("string" == typeof e) {
+                    if (r = "<" === e.charAt(0) && ">" === e.charAt(e.length - 1) && e.length >= 3 ? [null, e, null] : T.exec(e), !r || !r[1] && t) return !t || t.jquery ? (t || n).find(e) : this.constructor(t).find(e);
+                    if (r[1]) {
+                        if (t = t instanceof x ? t[0] : t, x.merge(this, x.parseHTML(r[1], t && t.nodeType ? t.ownerDocument || t : o, !0)), C.test(r[1]) && x.isPlainObject(t))
+                            for (r in t) x.isFunction(this[r]) ? this[r](t[r]) : this.attr(r, t[r]);
+                        return this
+                    }
+                    return i = o.getElementById(r[2]), i && i.parentNode && (this.length = 1, this[0] = i), this.context = o, this.selector = e, this
+                }
+                return e.nodeType ? (this.context = this[0] = e, this.length = 1, this) : x.isFunction(e) ? n.ready(e) : (e.selector !== undefined && (this.selector = e.selector, this.context = e.context), x.makeArray(e, this))
+            },
+            selector: "",
+            length: 0,
+            toArray: function () {
+                return d.call(this)
+            },
+            get: function (e) {
+                return null == e ? this.toArray() : 0 > e ? this[this.length + e] : this[e]
+            },
+            pushStack: function (e) {
+                var t = x.merge(this.constructor(), e);
+                return t.prevObject = this, t.context = this.context, t
+            },
+            each: function (e, t) {
+                return x.each(this, e, t)
+            },
+            ready: function (e) {
+                return x.ready.promise().done(e), this
+            },
+            slice: function () {
+                return this.pushStack(d.apply(this, arguments))
+            },
+            first: function () {
+                return this.eq(0)
+            },
+            last: function () {
+                return this.eq(-1)
+            },
+            eq: function (e) {
+                var t = this.length,
+                    n = +e + (0 > e ? t : 0);
+                return this.pushStack(n >= 0 && t > n ? [this[n]] : [])
+            },
+            map: function (e) {
+                return this.pushStack(x.map(this, function (t, n) {
+                    return e.call(t, n, t)
+                }))
+            },
+            end: function () {
+                return this.prevObject || this.constructor(null)
+            },
+            push: h,
+            sort: [].sort,
+            splice: [].splice
+        }, x.fn.init.prototype = x.fn, x.extend = x.fn.extend = function () {
+            var e, t, n, r, i, o, s = arguments[0] || {}, a = 1,
+                u = arguments.length,
+                l = !1;
+            for ("boolean" == typeof s && (l = s, s = arguments[1] || {}, a = 2), "object" == typeof s || x.isFunction(s) || (s = {}), u === a && (s = this, --a); u > a; a++)
+                if (null != (e = arguments[a]))
+                    for (t in e) n = s[t], r = e[t], s !== r && (l && r && (x.isPlainObject(r) || (i = x.isArray(r))) ? (i ? (i = !1, o = n && x.isArray(n) ? n : []) : o = n && x.isPlainObject(n) ? n : {}, s[t] = x.extend(l, o, r)) : r !== undefined && (s[t] = r));
+            return s
+        }, x.extend({
+            expando: "jQuery" + (p + Math.random()).replace(/\D/g, ""),
+            noConflict: function (t) {
+                return e.$ === x && (e.$ = u), t && e.jQuery === x && (e.jQuery = a), x
+            },
+            isReady: !1,
+            readyWait: 1,
+            holdReady: function (e) {
+                e ? x.readyWait++ : x.ready(!0)
+            },
+            ready: function (e) {
+                (e === !0 ? --x.readyWait : x.isReady) || (x.isReady = !0, e !== !0 && --x.readyWait > 0 || (n.resolveWith(o, [x]), x.fn.trigger && x(o).trigger("ready").off("ready")))
+            },
+            isFunction: function (e) {
+                return "function" === x.type(e)
+            },
+            isArray: Array.isArray,
+            isWindow: function (e) {
+                return null != e && e === e.window
+            },
+            isNumeric: function (e) {
+                return !isNaN(parseFloat(e)) && isFinite(e)
+            },
+            type: function (e) {
+                return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? l[m.call(e)] || "object" : typeof e
+            },
+            isPlainObject: function (e) {
+                if ("object" !== x.type(e) || e.nodeType || x.isWindow(e)) return !1;
+                try {
+                    if (e.constructor && !y.call(e.constructor.prototype, "isPrototypeOf")) return !1
+                } catch (t) {
+                    return !1
+                }
+                return !0
+            },
+            isEmptyObject: function (e) {
+                var t;
+                for (t in e) return !1;
+                return !0
+            },
+            error: function (e) {
+                throw Error(e)
+            },
+            parseHTML: function (e, t, n) {
+                if (!e || "string" != typeof e) return null;
+                "boolean" == typeof t && (n = t, t = !1), t = t || o;
+                var r = C.exec(e),
+                    i = !n && [];
+                return r ? [t.createElement(r[1])] : (r = x.buildFragment([e], t, i), i && x(i).remove(), x.merge([], r.childNodes))
+            },
+            parseJSON: JSON.parse,
+            parseXML: function (e) {
+                var t, n;
+                if (!e || "string" != typeof e) return null;
+                try {
+                    n = new DOMParser, t = n.parseFromString(e, "text/xml")
+                } catch (r) {
+                    t = undefined
+                }
+                return (!t || t.getElementsByTagName("parsererror").length) && x.error("Invalid XML: " + e), t
+            },
+            noop: function () {},
+            globalEval: function (e) {
+                var t, n = eval;
+                e = x.trim(e), e && (1 === e.indexOf("use strict") ? (t = o.createElement("script"), t.text = e, o.head.appendChild(t).parentNode.removeChild(t)) : n(e))
+            },
+            camelCase: function (e) {
+                return e.replace(k, "ms-").replace(N, E)
+            },
+            nodeName: function (e, t) {
+                return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase()
+            },
+            each: function (e, t, n) {
+                var r, i = 0,
+                    o = e.length,
+                    s = j(e);
+                if (n) {
+                    if (s) {
+                        for (; o > i; i++)
+                            if (r = t.apply(e[i], n), r === !1) break
+                    } else
+                        for (i in e)
+                            if (r = t.apply(e[i], n), r === !1) break
+                } else if (s) {
+                    for (; o > i; i++)
+                        if (r = t.call(e[i], i, e[i]), r === !1) break
+                } else
+                    for (i in e)
+                        if (r = t.call(e[i], i, e[i]), r === !1) break; return e
+            },
+            trim: function (e) {
+                return null == e ? "" : v.call(e)
+            },
+            makeArray: function (e, t) {
+                var n = t || [];
+                return null != e && (j(Object(e)) ? x.merge(n, "string" == typeof e ? [e] : e) : h.call(n, e)), n
+            },
+            inArray: function (e, t, n) {
+                return null == t ? -1 : g.call(t, e, n)
+            },
+            merge: function (e, t) {
+                var n = t.length,
+                    r = e.length,
+                    i = 0;
+                if ("number" == typeof n)
+                    for (; n > i; i++) e[r++] = t[i];
+                else
+                    while (t[i] !== undefined) e[r++] = t[i++];
+                return e.length = r, e
+            },
+            grep: function (e, t, n) {
+                var r, i = [],
+                    o = 0,
+                    s = e.length;
+                for (n = !! n; s > o; o++) r = !! t(e[o], o), n !== r && i.push(e[o]);
+                return i
+            },
+            map: function (e, t, n) {
+                var r, i = 0,
+                    o = e.length,
+                    s = j(e),
+                    a = [];
+                if (s)
+                    for (; o > i; i++) r = t(e[i], i, n), null != r && (a[a.length] = r);
+                else
+                    for (i in e) r = t(e[i], i, n), null != r && (a[a.length] = r);
+                return f.apply([], a)
+            },
+            guid: 1,
+            proxy: function (e, t) {
+                var n, r, i;
+                return "string" == typeof t && (n = e[t], t = e, e = n), x.isFunction(e) ? (r = d.call(arguments, 2), i = function () {
+                    return e.apply(t || this, r.concat(d.call(arguments)))
+                }, i.guid = e.guid = e.guid || x.guid++, i) : undefined
+            },
+            access: function (e, t, n, r, i, o, s) {
+                var a = 0,
+                    u = e.length,
+                    l = null == n;
+                if ("object" === x.type(n)) {
+                    i = !0;
+                    for (a in n) x.access(e, t, a, n[a], !0, o, s)
+                } else if (r !== undefined && (i = !0, x.isFunction(r) || (s = !0), l && (s ? (t.call(e, r), t = null) : (l = t, t = function (e, t, n) {
+                    return l.call(x(e), n)
+                })), t))
+                    for (; u > a; a++) t(e[a], n, s ? r : r.call(e[a], a, t(e[a], n)));
+                return i ? e : l ? t.call(e) : u ? t(e[0], n) : o
+            },
+            now: Date.now,
+            swap: function (e, t, n, r) {
+                var i, o, s = {};
+                for (o in t) s[o] = e.style[o], e.style[o] = t[o];
+                i = n.apply(e, r || []);
+                for (o in t) e.style[o] = s[o];
+                return i
+            }
+        }), x.ready.promise = function (t) {
+            return n || (n = x.Deferred(), "complete" === o.readyState ? setTimeout(x.ready) : (o.addEventListener("DOMContentLoaded", S, !1), e.addEventListener("load", S, !1))), n.promise(t)
+        }, x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (e, t) {
+            l["[object " + t + "]"] = t.toLowerCase()
+        });
+
+        function j(e) {
+            var t = e.length,
+                n = x.type(e);
+            return x.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === n || "function" !== n && (0 === t || "number" == typeof t && t > 0 && t - 1 in e)
+        }
+        t = x(o),
+        function (e, undefined) {
+            var t, n, r, i, o, s, a, u, l, c, p, f, h, d, g, m, y, v = "sizzle" + -new Date,
+                b = e.document,
+                w = 0,
+                T = 0,
+                C = at(),
+                k = at(),
+                N = at(),
+                E = !1,
+                S = function () {
+                    return 0
+                }, j = typeof undefined,
+                D = 1 << 31,
+                A = {}.hasOwnProperty,
+                L = [],
+                H = L.pop,
+                q = L.push,
+                O = L.push,
+                F = L.slice,
+                P = L.indexOf || function (e) {
+                    var t = 0,
+                        n = this.length;
+                    for (; n > t; t++)
+                        if (this[t] === e) return t;
+                    return -1
+                }, R = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
+                M = "[\\x20\\t\\r\\n\\f]",
+                W = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+                $ = W.replace("w", "w#"),
+                B = "\\[" + M + "*(" + W + ")" + M + "*(?:([*^$|!~]?=)" + M + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + $ + ")|)|)" + M + "*\\]",
+                I = ":(" + W + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + B.replace(3, 8) + ")*)|.*)\\)|)",
+                z = RegExp("^" + M + "+|((?:^|[^\\\\])(?:\\\\.)*)" + M + "+$", "g"),
+                _ = RegExp("^" + M + "*," + M + "*"),
+                X = RegExp("^" + M + "*([>+~]|" + M + ")" + M + "*"),
+                U = RegExp(M + "*[+~]"),
+                Y = RegExp("=" + M + "*([^\\]'\"]*)" + M + "*\\]", "g"),
+                V = RegExp(I),
+                G = RegExp("^" + $ + "$"),
+                J = {
+                    ID: RegExp("^#(" + W + ")"),
+                    CLASS: RegExp("^\\.(" + W + ")"),
+                    TAG: RegExp("^(" + W.replace("w", "w*") + ")"),
+                    ATTR: RegExp("^" + B),
+                    PSEUDO: RegExp("^" + I),
+                    CHILD: RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + M + "*(even|odd|(([+-]|)(\\d*)n|)" + M + "*(?:([+-]|)" + M + "*(\\d+)|))" + M + "*\\)|)", "i"),
+                    bool: RegExp("^(?:" + R + ")$", "i"),
+                    needsContext: RegExp("^" + M + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + M + "*((?:-\\d)?\\d*)" + M + "*\\)|)(?=[^-]|$)", "i")
+                }, Q = /^[^{]+\{\s*\[native \w/,
+                K = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+                Z = /^(?:input|select|textarea|button)$/i,
+                et = /^h\d$/i,
+                tt = /'|\\/g,
+                nt = RegExp("\\\\([\\da-f]{1,6}" + M + "?|(" + M + ")|.)", "ig"),
+                rt = function (e, t, n) {
+                    var r = "0x" + t - 65536;
+                    return r !== r || n ? t : 0 > r ? String.fromCharCode(r + 65536) : String.fromCharCode(55296 | r >> 10, 56320 | 1023 & r)
+                };
+            try {
+                O.apply(L = F.call(b.childNodes), b.childNodes), L[b.childNodes.length].nodeType
+            } catch (it) {
+                O = {
+                    apply: L.length ? function (e, t) {
+                        q.apply(e, F.call(t))
+                    } : function (e, t) {
+                        var n = e.length,
+                            r = 0;
+                        while (e[n++] = t[r++]);
+                        e.length = n - 1
+                    }
+                }
+            }
+
+            function ot(e, t, r, i) {
+                var o, s, a, u, l, f, g, m, x, w;
+                if ((t ? t.ownerDocument || t : b) !== p && c(t), t = t || p, r = r || [], !e || "string" != typeof e) return r;
+                if (1 !== (u = t.nodeType) && 9 !== u) return [];
+                if (h && !i) {
+                    if (o = K.exec(e))
+                        if (a = o[1]) {
+                            if (9 === u) {
+                                if (s = t.getElementById(a), !s || !s.parentNode) return r;
+                                if (s.id === a) return r.push(s), r
+                            } else if (t.ownerDocument && (s = t.ownerDocument.getElementById(a)) && y(t, s) && s.id === a) return r.push(s), r
+                        } else {
+                            if (o[2]) return O.apply(r, t.getElementsByTagName(e)), r;
+                            if ((a = o[3]) && n.getElementsByClassName && t.getElementsByClassName) return O.apply(r, t.getElementsByClassName(a)), r
+                        }
+                    if (n.qsa && (!d || !d.test(e))) {
+                        if (m = g = v, x = t, w = 9 === u && e, 1 === u && "object" !== t.nodeName.toLowerCase()) {
+                            f = vt(e), (g = t.getAttribute("id")) ? m = g.replace(tt, "\\$&") : t.setAttribute("id", m), m = "[id='" + m + "'] ", l = f.length;
+                            while (l--) f[l] = m + xt(f[l]);
+                            x = U.test(e) && t.parentNode || t, w = f.join(",")
+                        }
+                        if (w) try {
+                            return O.apply(r, x.querySelectorAll(w)), r
+                        } catch (T) {} finally {
+                            g || t.removeAttribute("id")
+                        }
+                    }
+                }
+                return St(e.replace(z, "$1"), t, r, i)
+            }
+
+            function st(e) {
+                return Q.test(e + "")
+            }
+
+            function at() {
+                var e = [];
+
+                function t(n, r) {
+                    return e.push(n += " ") > i.cacheLength && delete t[e.shift()], t[n] = r
+                }
+                return t
+            }
+
+            function ut(e) {
+                return e[v] = !0, e
+            }
+
+            function lt(e) {
+                var t = p.createElement("div");
+                try {
+                    return !!e(t)
+                } catch (n) {
+                    return !1
+                } finally {
+                    t.parentNode && t.parentNode.removeChild(t), t = null
+                }
+            }
+
+            function ct(e, t, n) {
+                e = e.split("|");
+                var r, o = e.length,
+                    s = n ? null : t;
+                while (o--)(r = i.attrHandle[e[o]]) && r !== t || (i.attrHandle[e[o]] = s)
+            }
+
+            function pt(e, t) {
+                var n = e.getAttributeNode(t);
+                return n && n.specified ? n.value : e[t] === !0 ? t.toLowerCase() : null
+            }
+
+            function ft(e, t) {
+                return e.getAttribute(t, "type" === t.toLowerCase() ? 1 : 2)
+            }
+
+            function ht(e) {
+                return "input" === e.nodeName.toLowerCase() ? e.defaultValue : undefined
+            }
+
+            function dt(e, t) {
+                var n = t && e,
+                    r = n && 1 === e.nodeType && 1 === t.nodeType && (~t.sourceIndex || D) - (~e.sourceIndex || D);
+                if (r) return r;
+                if (n)
+                    while (n = n.nextSibling)
+                        if (n === t) return -1;
+                return e ? 1 : -1
+            }
+
+            function gt(e) {
+                return function (t) {
+                    var n = t.nodeName.toLowerCase();
+                    return "input" === n && t.type === e
+                }
+            }
+
+            function mt(e) {
+                return function (t) {
+                    var n = t.nodeName.toLowerCase();
+                    return ("input" === n || "button" === n) && t.type === e
+                }
+            }
+
+            function yt(e) {
+                return ut(function (t) {
+                    return t = +t, ut(function (n, r) {
+                        var i, o = e([], n.length, t),
+                            s = o.length;
+                        while (s--) n[i = o[s]] && (n[i] = !(r[i] = n[i]))
+                    })
+                })
+            }
+            s = ot.isXML = function (e) {
+                var t = e && (e.ownerDocument || e).documentElement;
+                return t ? "HTML" !== t.nodeName : !1
+            }, n = ot.support = {}, c = ot.setDocument = function (e) {
+                var t = e ? e.ownerDocument || e : b,
+                    r = t.parentWindow;
+                return t !== p && 9 === t.nodeType && t.documentElement ? (p = t, f = t.documentElement, h = !s(t), r && r.frameElement && r.attachEvent("onbeforeunload", function () {
+                    c()
+                }), n.attributes = lt(function (e) {
+                    return e.innerHTML = "<a href='#'></a>", ct("type|href|height|width", ft, "#" === e.firstChild.getAttribute("href")), ct(R, pt, null == e.getAttribute("disabled")), e.className = "i", !e.getAttribute("className")
+                }), n.input = lt(function (e) {
+                    return e.innerHTML = "<input>", e.firstChild.setAttribute("value", ""), "" === e.firstChild.getAttribute("value")
+                }), ct("value", ht, n.attributes && n.input), n.getElementsByTagName = lt(function (e) {
+                    return e.appendChild(t.createComment("")), !e.getElementsByTagName("*").length
+                }), n.getElementsByClassName = lt(function (e) {
+                    return e.innerHTML = "<div class='a'></div><div class='a i'></div>", e.firstChild.className = "i", 2 === e.getElementsByClassName("i").length
+                }), n.getById = lt(function (e) {
+                    return f.appendChild(e).id = v, !t.getElementsByName || !t.getElementsByName(v).length
+                }), n.getById ? (i.find.ID = function (e, t) {
+                    if (typeof t.getElementById !== j && h) {
+                        var n = t.getElementById(e);
+                        return n && n.parentNode ? [n] : []
+                    }
+                }, i.filter.ID = function (e) {
+                    var t = e.replace(nt, rt);
+                    return function (e) {
+                        return e.getAttribute("id") === t
+                    }
+                }) : (delete i.find.ID, i.filter.ID = function (e) {
+                    var t = e.replace(nt, rt);
+                    return function (e) {
+                        var n = typeof e.getAttributeNode !== j && e.getAttributeNode("id");
+                        return n && n.value === t
+                    }
+                }), i.find.TAG = n.getElementsByTagName ? function (e, t) {
+                    return typeof t.getElementsByTagName !== j ? t.getElementsByTagName(e) : undefined
+                } : function (e, t) {
+                    var n, r = [],
+                        i = 0,
+                        o = t.getElementsByTagName(e);
+                    if ("*" === e) {
+                        while (n = o[i++]) 1 === n.nodeType && r.push(n);
+                        return r
+                    }
+                    return o
+                }, i.find.CLASS = n.getElementsByClassName && function (e, t) {
+                    return typeof t.getElementsByClassName !== j && h ? t.getElementsByClassName(e) : undefined
+                }, g = [], d = [], (n.qsa = st(t.querySelectorAll)) && (lt(function (e) {
+                    e.innerHTML = "<select><option selected=''></option></select>", e.querySelectorAll("[selected]").length || d.push("\\[" + M + "*(?:value|" + R + ")"), e.querySelectorAll(":checked").length || d.push(":checked")
+                }), lt(function (e) {
+                    var n = t.createElement("input");
+                    n.setAttribute("type", "hidden"), e.appendChild(n).setAttribute("t", ""), e.querySelectorAll("[t^='']").length && d.push("[*^$]=" + M + "*(?:''|\"\")"), e.querySelectorAll(":enabled").length || d.push(":enabled", ":disabled"), e.querySelectorAll("*,:x"), d.push(",.*:")
+                })), (n.matchesSelector = st(m = f.webkitMatchesSelector || f.mozMatchesSelector || f.oMatchesSelector || f.msMatchesSelector)) && lt(function (e) {
+                    n.disconnectedMatch = m.call(e, "div"), m.call(e, "[s!='']:x"), g.push("!=", I)
+                }), d = d.length && RegExp(d.join("|")), g = g.length && RegExp(g.join("|")), y = st(f.contains) || f.compareDocumentPosition ? function (e, t) {
+                    var n = 9 === e.nodeType ? e.documentElement : e,
+                        r = t && t.parentNode;
+                    return e === r || !(!r || 1 !== r.nodeType || !(n.contains ? n.contains(r) : e.compareDocumentPosition && 16 & e.compareDocumentPosition(r)))
+                } : function (e, t) {
+                    if (t)
+                        while (t = t.parentNode)
+                            if (t === e) return !0;
+                    return !1
+                }, n.sortDetached = lt(function (e) {
+                    return 1 & e.compareDocumentPosition(t.createElement("div"))
+                }), S = f.compareDocumentPosition ? function (e, r) {
+                    if (e === r) return E = !0, 0;
+                    var i = r.compareDocumentPosition && e.compareDocumentPosition && e.compareDocumentPosition(r);
+                    return i ? 1 & i || !n.sortDetached && r.compareDocumentPosition(e) === i ? e === t || y(b, e) ? -1 : r === t || y(b, r) ? 1 : l ? P.call(l, e) - P.call(l, r) : 0 : 4 & i ? -1 : 1 : e.compareDocumentPosition ? -1 : 1
+                } : function (e, n) {
+                    var r, i = 0,
+                        o = e.parentNode,
+                        s = n.parentNode,
+                        a = [e],
+                        u = [n];
+                    if (e === n) return E = !0, 0;
+                    if (!o || !s) return e === t ? -1 : n === t ? 1 : o ? -1 : s ? 1 : l ? P.call(l, e) - P.call(l, n) : 0;
+                    if (o === s) return dt(e, n);
+                    r = e;
+                    while (r = r.parentNode) a.unshift(r);
+                    r = n;
+                    while (r = r.parentNode) u.unshift(r);
+                    while (a[i] === u[i]) i++;
+                    return i ? dt(a[i], u[i]) : a[i] === b ? -1 : u[i] === b ? 1 : 0
+                }, t) : p
+            }, ot.matches = function (e, t) {
+                return ot(e, null, null, t)
+            }, ot.matchesSelector = function (e, t) {
+                if ((e.ownerDocument || e) !== p && c(e), t = t.replace(Y, "='$1']"), !(!n.matchesSelector || !h || g && g.test(t) || d && d.test(t))) try {
+                    var r = m.call(e, t);
+                    if (r || n.disconnectedMatch || e.document && 11 !== e.document.nodeType) return r
+                } catch (i) {}
+                return ot(t, p, null, [e]).length > 0
+            }, ot.contains = function (e, t) {
+                return (e.ownerDocument || e) !== p && c(e), y(e, t)
+            }, ot.attr = function (e, t) {
+                (e.ownerDocument || e) !== p && c(e);
+                var r = i.attrHandle[t.toLowerCase()],
+                    o = r && A.call(i.attrHandle, t.toLowerCase()) ? r(e, t, !h) : undefined;
+                return o === undefined ? n.attributes || !h ? e.getAttribute(t) : (o = e.getAttributeNode(t)) && o.specified ? o.value : null : o
+            }, ot.error = function (e) {
+                throw Error("Syntax error, unrecognized expression: " + e)
+            }, ot.uniqueSort = function (e) {
+                var t, r = [],
+                    i = 0,
+                    o = 0;
+                if (E = !n.detectDuplicates, l = !n.sortStable && e.slice(0), e.sort(S), E) {
+                    while (t = e[o++]) t === e[o] && (i = r.push(o));
+                    while (i--) e.splice(r[i], 1)
+                }
+                return e
+            }, o = ot.getText = function (e) {
+                var t, n = "",
+                    r = 0,
+                    i = e.nodeType;
+                if (i) {
+                    if (1 === i || 9 === i || 11 === i) {
+                        if ("string" == typeof e.textContent) return e.textContent;
+                        for (e = e.firstChild; e; e = e.nextSibling) n += o(e)
+                    } else if (3 === i || 4 === i) return e.nodeValue
+                } else
+                    for (; t = e[r]; r++) n += o(t);
+                return n
+            }, i = ot.selectors = {
+                cacheLength: 50,
+                createPseudo: ut,
+                match: J,
+                attrHandle: {},
+                find: {},
+                relative: {
+                    ">": {
+                        dir: "parentNode",
+                        first: !0
+                    },
+                    " ": {
+                        dir: "parentNode"
+                    },
+                    "+": {
+                        dir: "previousSibling",
+                        first: !0
+                    },
+                    "~": {
+                        dir: "previousSibling"
+                    }
+                },
+                preFilter: {
+                    ATTR: function (e) {
+                        return e[1] = e[1].replace(nt, rt), e[3] = (e[4] || e[5] || "").replace(nt, rt), "~=" === e[2] && (e[3] = " " + e[3] + " "), e.slice(0, 4)
+                    },
+                    CHILD: function (e) {
+                        return e[1] = e[1].toLowerCase(), "nth" === e[1].slice(0, 3) ? (e[3] || ot.error(e[0]), e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * ("even" === e[3] || "odd" === e[3])), e[5] = +(e[7] + e[8] || "odd" === e[3])) : e[3] && ot.error(e[0]), e
+                    },
+                    PSEUDO: function (e) {
+                        var t, n = !e[5] && e[2];
+                        return J.CHILD.test(e[0]) ? null : (e[3] && e[4] !== undefined ? e[2] = e[4] : n && V.test(n) && (t = vt(n, !0)) && (t = n.indexOf(")", n.length - t) - n.length) && (e[0] = e[0].slice(0, t), e[2] = n.slice(0, t)), e.slice(0, 3))
+                    }
+                },
+                filter: {
+                    TAG: function (e) {
+                        var t = e.replace(nt, rt).toLowerCase();
+                        return "*" === e ? function () {
+                            return !0
+                        } : function (e) {
+                            return e.nodeName && e.nodeName.toLowerCase() === t
+                        }
+                    },
+                    CLASS: function (e) {
+                        var t = C[e + " "];
+                        return t || (t = RegExp("(^|" + M + ")" + e + "(" + M + "|$)")) && C(e, function (e) {
+                            return t.test("string" == typeof e.className && e.className || typeof e.getAttribute !== j && e.getAttribute("class") || "")
+                        })
+                    },
+                    ATTR: function (e, t, n) {
+                        return function (r) {
+                            var i = ot.attr(r, e);
+                            return null == i ? "!=" === t : t ? (i += "", "=" === t ? i === n : "!=" === t ? i !== n : "^=" === t ? n && 0 === i.indexOf(n) : "*=" === t ? n && i.indexOf(n) > -1 : "$=" === t ? n && i.slice(-n.length) === n : "~=" === t ? (" " + i + " ").indexOf(n) > -1 : "|=" === t ? i === n || i.slice(0, n.length + 1) === n + "-" : !1) : !0
+                        }
+                    },
+                    CHILD: function (e, t, n, r, i) {
+                        var o = "nth" !== e.slice(0, 3),
+                            s = "last" !== e.slice(-4),
+                            a = "of-type" === t;
+                        return 1 === r && 0 === i ? function (e) {
+                            return !!e.parentNode
+                        } : function (t, n, u) {
+                            var l, c, p, f, h, d, g = o !== s ? "nextSibling" : "previousSibling",
+                                m = t.parentNode,
+                                y = a && t.nodeName.toLowerCase(),
+                                x = !u && !a;
+                            if (m) {
+                                if (o) {
+                                    while (g) {
+                                        p = t;
+                                        while (p = p[g])
+                                            if (a ? p.nodeName.toLowerCase() === y : 1 === p.nodeType) return !1;
+                                        d = g = "only" === e && !d && "nextSibling"
+                                    }
+                                    return !0
+                                }
+                                if (d = [s ? m.firstChild : m.lastChild], s && x) {
+                                    c = m[v] || (m[v] = {}), l = c[e] || [], h = l[0] === w && l[1], f = l[0] === w && l[2], p = h && m.childNodes[h];
+                                    while (p = ++h && p && p[g] || (f = h = 0) || d.pop())
+                                        if (1 === p.nodeType && ++f && p === t) {
+                                            c[e] = [w, h, f];
+                                            break
+                                        }
+                                } else if (x && (l = (t[v] || (t[v] = {}))[e]) && l[0] === w) f = l[1];
+                                else
+                                    while (p = ++h && p && p[g] || (f = h = 0) || d.pop())
+                                        if ((a ? p.nodeName.toLowerCase() === y : 1 === p.nodeType) && ++f && (x && ((p[v] || (p[v] = {}))[e] = [w, f]), p === t)) break; return f -= i, f === r || 0 === f % r && f / r >= 0
+                            }
+                        }
+                    },
+                    PSEUDO: function (e, t) {
+                        var n, r = i.pseudos[e] || i.setFilters[e.toLowerCase()] || ot.error("unsupported pseudo: " + e);
+                        return r[v] ? r(t) : r.length > 1 ? (n = [e, e, "", t], i.setFilters.hasOwnProperty(e.toLowerCase()) ? ut(function (e, n) {
+                            var i, o = r(e, t),
+                                s = o.length;
+                            while (s--) i = P.call(e, o[s]), e[i] = !(n[i] = o[s])
+                        }) : function (e) {
+                            return r(e, 0, n)
+                        }) : r
+                    }
+                },
+                pseudos: {
+                    not: ut(function (e) {
+                        var t = [],
+                            n = [],
+                            r = a(e.replace(z, "$1"));
+                        return r[v] ? ut(function (e, t, n, i) {
+                            var o, s = r(e, null, i, []),
+                                a = e.length;
+                            while (a--)(o = s[a]) && (e[a] = !(t[a] = o))
+                        }) : function (e, i, o) {
+                            return t[0] = e, r(t, null, o, n), !n.pop()
+                        }
+                    }),
+                    has: ut(function (e) {
+                        return function (t) {
+                            return ot(e, t).length > 0
+                        }
+                    }),
+                    contains: ut(function (e) {
+                        return function (t) {
+                            return (t.textContent || t.innerText || o(t)).indexOf(e) > -1
+                        }
+                    }),
+                    lang: ut(function (e) {
+                        return G.test(e || "") || ot.error("unsupported lang: " + e), e = e.replace(nt, rt).toLowerCase(),
+                        function (t) {
+                            var n;
+                            do
+                                if (n = h ? t.lang : t.getAttribute("xml:lang") || t.getAttribute("lang")) return n = n.toLowerCase(), n === e || 0 === n.indexOf(e + "-"); while ((t = t.parentNode) && 1 === t.nodeType);
+                            return !1
+                        }
+                    }),
+                    target: function (t) {
+                        var n = e.location && e.location.hash;
+                        return n && n.slice(1) === t.id
+                    },
+                    root: function (e) {
+                        return e === f
+                    },
+                    focus: function (e) {
+                        return e === p.activeElement && (!p.hasFocus || p.hasFocus()) && !! (e.type || e.href || ~e.tabIndex)
+                    },
+                    enabled: function (e) {
+                        return e.disabled === !1
+                    },
+                    disabled: function (e) {
+                        return e.disabled === !0
+                    },
+                    checked: function (e) {
+                        var t = e.nodeName.toLowerCase();
+                        return "input" === t && !! e.checked || "option" === t && !! e.selected
+                    },
+                    selected: function (e) {
+                        return e.parentNode && e.parentNode.selectedIndex, e.selected === !0
+                    },
+                    empty: function (e) {
+                        for (e = e.firstChild; e; e = e.nextSibling)
+                            if (e.nodeName > "@" || 3 === e.nodeType || 4 === e.nodeType) return !1;
+                        return !0
+                    },
+                    parent: function (e) {
+                        return !i.pseudos.empty(e)
+                    },
+                    header: function (e) {
+                        return et.test(e.nodeName)
+                    },
+                    input: function (e) {
+                        return Z.test(e.nodeName)
+                    },
+                    button: function (e) {
+                        var t = e.nodeName.toLowerCase();
+                        return "input" === t && "button" === e.type || "button" === t
+                    },
+                    text: function (e) {
+                        var t;
+                        return "input" === e.nodeName.toLowerCase() && "text" === e.type && (null == (t = e.getAttribute("type")) || t.toLowerCase() === e.type)
+                    },
+                    first: yt(function () {
+                        return [0]
+                    }),
+                    last: yt(function (e, t) {
+                        return [t - 1]
+                    }),
+                    eq: yt(function (e, t, n) {
+                        return [0 > n ? n + t : n]
+                    }),
+                    even: yt(function (e, t) {
+                        var n = 0;
+                        for (; t > n; n += 2) e.push(n);
+                        return e
+                    }),
+                    odd: yt(function (e, t) {
+                        var n = 1;
+                        for (; t > n; n += 2) e.push(n);
+                        return e
+                    }),
+                    lt: yt(function (e, t, n) {
+                        var r = 0 > n ? n + t : n;
+                        for (; --r >= 0;) e.push(r);
+                        return e
+                    }),
+                    gt: yt(function (e, t, n) {
+                        var r = 0 > n ? n + t : n;
+                        for (; t > ++r;) e.push(r);
+                        return e
+                    })
+                }
+            };
+            for (t in {
+                radio: !0,
+                checkbox: !0,
+                file: !0,
+                password: !0,
+                image: !0
+            }) i.pseudos[t] = gt(t);
+            for (t in {
+                submit: !0,
+                reset: !0
+            }) i.pseudos[t] = mt(t);
+
+            function vt(e, t) {
+                var n, r, o, s, a, u, l, c = k[e + " "];
+                if (c) return t ? 0 : c.slice(0);
+                a = e, u = [], l = i.preFilter;
+                while (a) {
+                    (!n || (r = _.exec(a))) && (r && (a = a.slice(r[0].length) || a), u.push(o = [])), n = !1, (r = X.exec(a)) && (n = r.shift(), o.push({
+                        value: n,
+                        type: r[0].replace(z, " ")
+                    }), a = a.slice(n.length));
+                    for (s in i.filter)!(r = J[s].exec(a)) || l[s] && !(r = l[s](r)) || (n = r.shift(), o.push({
+                        value: n,
+                        type: s,
+                        matches: r
+                    }), a = a.slice(n.length));
+                    if (!n) break
+                }
+                return t ? a.length : a ? ot.error(e) : k(e, u).slice(0)
+            }
+
+            function xt(e) {
+                var t = 0,
+                    n = e.length,
+                    r = "";
+                for (; n > t; t++) r += e[t].value;
+                return r
+            }
+
+            function bt(e, t, n) {
+                var i = t.dir,
+                    o = n && "parentNode" === i,
+                    s = T++;
+                return t.first ? function (t, n, r) {
+                    while (t = t[i])
+                        if (1 === t.nodeType || o) return e(t, n, r)
+                } : function (t, n, a) {
+                    var u, l, c, p = w + " " + s;
+                    if (a) {
+                        while (t = t[i])
+                            if ((1 === t.nodeType || o) && e(t, n, a)) return !0
+                    } else
+                        while (t = t[i])
+                            if (1 === t.nodeType || o)
+                                if (c = t[v] || (t[v] = {}), (l = c[i]) && l[0] === p) {
+                                    if ((u = l[1]) === !0 || u === r) return u === !0
+                                } else if (l = c[i] = [p], l[1] = e(t, n, a) || r, l[1] === !0) return !0
+                }
+            }
+
+            function wt(e) {
+                return e.length > 1 ? function (t, n, r) {
+                    var i = e.length;
+                    while (i--)
+                        if (!e[i](t, n, r)) return !1;
+                    return !0
+                } : e[0]
+            }
+
+            function Tt(e, t, n, r, i) {
+                var o, s = [],
+                    a = 0,
+                    u = e.length,
+                    l = null != t;
+                for (; u > a; a++)(o = e[a]) && (!n || n(o, r, i)) && (s.push(o), l && t.push(a));
+                return s
+            }
+
+            function Ct(e, t, n, r, i, o) {
+                return r && !r[v] && (r = Ct(r)), i && !i[v] && (i = Ct(i, o)), ut(function (o, s, a, u) {
+                    var l, c, p, f = [],
+                        h = [],
+                        d = s.length,
+                        g = o || Et(t || "*", a.nodeType ? [a] : a, []),
+                        m = !e || !o && t ? g : Tt(g, f, e, a, u),
+                        y = n ? i || (o ? e : d || r) ? [] : s : m;
+                    if (n && n(m, y, a, u), r) {
+                        l = Tt(y, h), r(l, [], a, u), c = l.length;
+                        while (c--)(p = l[c]) && (y[h[c]] = !(m[h[c]] = p))
+                    }
+                    if (o) {
+                        if (i || e) {
+                            if (i) {
+                                l = [], c = y.length;
+                                while (c--)(p = y[c]) && l.push(m[c] = p);
+                                i(null, y = [], l, u)
+                            }
+                            c = y.length;
+                            while (c--)(p = y[c]) && (l = i ? P.call(o, p) : f[c]) > -1 && (o[l] = !(s[l] = p))
+                        }
+                    } else y = Tt(y === s ? y.splice(d, y.length) : y), i ? i(null, s, y, u) : O.apply(s, y)
+                })
+            }
+
+            function kt(e) {
+                var t, n, r, o = e.length,
+                    s = i.relative[e[0].type],
+                    a = s || i.relative[" "],
+                    l = s ? 1 : 0,
+                    c = bt(function (e) {
+                        return e === t
+                    }, a, !0),
+                    p = bt(function (e) {
+                        return P.call(t, e) > -1
+                    }, a, !0),
+                    f = [
+                        function (e, n, r) {
+                            return !s && (r || n !== u) || ((t = n).nodeType ? c(e, n, r) : p(e, n, r))
+                        }
+                    ];
+                for (; o > l; l++)
+                    if (n = i.relative[e[l].type]) f = [bt(wt(f), n)];
+                    else {
+                        if (n = i.filter[e[l].type].apply(null, e[l].matches), n[v]) {
+                            for (r = ++l; o > r; r++)
+                                if (i.relative[e[r].type]) break;
+                            return Ct(l > 1 && wt(f), l > 1 && xt(e.slice(0, l - 1).concat({
+                                value: " " === e[l - 2].type ? "*" : ""
+                            })).replace(z, "$1"), n, r > l && kt(e.slice(l, r)), o > r && kt(e = e.slice(r)), o > r && xt(e))
+                        }
+                        f.push(n)
+                    }
+                return wt(f)
+            }
+
+            function Nt(e, t) {
+                var n = 0,
+                    o = t.length > 0,
+                    s = e.length > 0,
+                    a = function (a, l, c, f, h) {
+                        var d, g, m, y = [],
+                            v = 0,
+                            x = "0",
+                            b = a && [],
+                            T = null != h,
+                            C = u,
+                            k = a || s && i.find.TAG("*", h && l.parentNode || l),
+                            N = w += null == C ? 1 : Math.random() || .1;
+                        for (T && (u = l !== p && l, r = n); null != (d = k[x]); x++) {
+                            if (s && d) {
+                                g = 0;
+                                while (m = e[g++])
+                                    if (m(d, l, c)) {
+                                        f.push(d);
+                                        break
+                                    }
+                                T && (w = N, r = ++n)
+                            }
+                            o && ((d = !m && d) && v--, a && b.push(d))
+                        }
+                        if (v += x, o && x !== v) {
+                            g = 0;
+                            while (m = t[g++]) m(b, y, l, c);
+                            if (a) {
+                                if (v > 0)
+                                    while (x--) b[x] || y[x] || (y[x] = H.call(f));
+                                y = Tt(y)
+                            }
+                            O.apply(f, y), T && !a && y.length > 0 && v + t.length > 1 && ot.uniqueSort(f)
+                        }
+                        return T && (w = N, u = C), b
+                    };
+                return o ? ut(a) : a
+            }
+            a = ot.compile = function (e, t) {
+                var n, r = [],
+                    i = [],
+                    o = N[e + " "];
+                if (!o) {
+                    t || (t = vt(e)), n = t.length;
+                    while (n--) o = kt(t[n]), o[v] ? r.push(o) : i.push(o);
+                    o = N(e, Nt(i, r))
+                }
+                return o
+            };
+
+            function Et(e, t, n) {
+                var r = 0,
+                    i = t.length;
+                for (; i > r; r++) ot(e, t[r], n);
+                return n
+            }
+
+            function St(e, t, r, o) {
+                var s, u, l, c, p, f = vt(e);
+                if (!o && 1 === f.length) {
+                    if (u = f[0] = f[0].slice(0), u.length > 2 && "ID" === (l = u[0]).type && n.getById && 9 === t.nodeType && h && i.relative[u[1].type]) {
+                        if (t = (i.find.ID(l.matches[0].replace(nt, rt), t) || [])[0], !t) return r;
+                        e = e.slice(u.shift().value.length)
+                    }
+                    s = J.needsContext.test(e) ? 0 : u.length;
+                    while (s--) {
+                        if (l = u[s], i.relative[c = l.type]) break;
+                        if ((p = i.find[c]) && (o = p(l.matches[0].replace(nt, rt), U.test(u[0].type) && t.parentNode || t))) {
+                            if (u.splice(s, 1), e = o.length && xt(u), !e) return O.apply(r, o), r;
+                            break
+                        }
+                    }
+                }
+                return a(e, f)(o, t, !h, r, U.test(e)), r
+            }
+            i.pseudos.nth = i.pseudos.eq;
+
+            function jt() {}
+            jt.prototype = i.filters = i.pseudos, i.setFilters = new jt, n.sortStable = v.split("").sort(S).join("") === v, c(), [0, 0].sort(S), n.detectDuplicates = E, x.find = ot, x.expr = ot.selectors, x.expr[":"] = x.expr.pseudos, x.unique = ot.uniqueSort, x.text = ot.getText, x.isXMLDoc = ot.isXML, x.contains = ot.contains
+        }(e);
+        var D = {};
+
+        function A(e) {
+            var t = D[e] = {};
+            return x.each(e.match(w) || [], function (e, n) {
+                t[n] = !0
+            }), t
+        }
+        x.Callbacks = function (e) {
+            e = "string" == typeof e ? D[e] || A(e) : x.extend({}, e);
+            var t, n, r, i, o, s, a = [],
+                u = !e.once && [],
+                l = function (p) {
+                    for (t = e.memory && p, n = !0, s = i || 0, i = 0, o = a.length, r = !0; a && o > s; s++)
+                        if (a[s].apply(p[0], p[1]) === !1 && e.stopOnFalse) {
+                            t = !1;
+                            break
+                        }
+                    r = !1, a && (u ? u.length && l(u.shift()) : t ? a = [] : c.disable())
+                }, c = {
+                    add: function () {
+                        if (a) {
+                            var n = a.length;
+                            (function s(t) {
+                                x.each(t, function (t, n) {
+                                    var r = x.type(n);
+                                    "function" === r ? e.unique && c.has(n) || a.push(n) : n && n.length && "string" !== r && s(n)
+                                })
+                            })(arguments), r ? o = a.length : t && (i = n, l(t))
+                        }
+                        return this
+                    },
+                    remove: function () {
+                        return a && x.each(arguments, function (e, t) {
+                            var n;
+                            while ((n = x.inArray(t, a, n)) > -1) a.splice(n, 1), r && (o >= n && o--, s >= n && s--)
+                        }), this
+                    },
+                    has: function (e) {
+                        return e ? x.inArray(e, a) > -1 : !(!a || !a.length)
+                    },
+                    empty: function () {
+                        return a = [], o = 0, this
+                    },
+                    disable: function () {
+                        return a = u = t = undefined, this
+                    },
+                    disabled: function () {
+                        return !a
+                    },
+                    lock: function () {
+                        return u = undefined, t || c.disable(), this
+                    },
+                    locked: function () {
+                        return !u
+                    },
+                    fireWith: function (e, t) {
+                        return t = t || [], t = [e, t.slice ? t.slice() : t], !a || n && !u || (r ? u.push(t) : l(t)), this
+                    },
+                    fire: function () {
+                        return c.fireWith(this, arguments), this
+                    },
+                    fired: function () {
+                        return !!n
+                    }
+                };
+            return c
+        }, x.extend({
+            Deferred: function (e) {
+                var t = [
+                    ["resolve", "done", x.Callbacks("once memory"), "resolved"],
+                    ["reject", "fail", x.Callbacks("once memory"), "rejected"],
+                    ["notify", "progress", x.Callbacks("memory")]
+                ],
+                    n = "pending",
+                    r = {
+                        state: function () {
+                            return n
+                        },
+                        always: function () {
+                            return i.done(arguments).fail(arguments), this
+                        },
+                        then: function () {
+                            var e = arguments;
+                            return x.Deferred(function (n) {
+                                x.each(t, function (t, o) {
+                                    var s = o[0],
+                                        a = x.isFunction(e[t]) && e[t];
+                                    i[o[1]](function () {
+                                        var e = a && a.apply(this, arguments);
+                                        e && x.isFunction(e.promise) ? e.promise().done(n.resolve).fail(n.reject).progress(n.notify) : n[s + "With"](this === r ? n.promise() : this, a ? [e] : arguments)
+                                    })
+                                }), e = null
+                            }).promise()
+                        },
+                        promise: function (e) {
+                            return null != e ? x.extend(e, r) : r
+                        }
+                    }, i = {};
+                return r.pipe = r.then, x.each(t, function (e, o) {
+                    var s = o[2],
+                        a = o[3];
+                    r[o[1]] = s.add, a && s.add(function () {
+                        n = a
+                    }, t[1 ^ e][2].disable, t[2][2].lock), i[o[0]] = function () {
+                        return i[o[0] + "With"](this === i ? r : this, arguments), this
+                    }, i[o[0] + "With"] = s.fireWith
+                }), r.promise(i), e && e.call(i, i), i
+            },
+            when: function (e) {
+                var t = 0,
+                    n = d.call(arguments),
+                    r = n.length,
+                    i = 1 !== r || e && x.isFunction(e.promise) ? r : 0,
+                    o = 1 === i ? e : x.Deferred(),
+                    s = function (e, t, n) {
+                        return function (r) {
+                            t[e] = this, n[e] = arguments.length > 1 ? d.call(arguments) : r, n === a ? o.notifyWith(t, n) : --i || o.resolveWith(t, n)
+                        }
+                    }, a, u, l;
+                if (r > 1)
+                    for (a = Array(r), u = Array(r), l = Array(r); r > t; t++) n[t] && x.isFunction(n[t].promise) ? n[t].promise().done(s(t, l, n)).fail(o.reject).progress(s(t, u, a)) : --i;
+                return i || o.resolveWith(l, n), o.promise()
+            }
+        }), x.support = function (t) {
+            var n = o.createElement("input"),
+                r = o.createDocumentFragment(),
+                i = o.createElement("div"),
+                s = o.createElement("select"),
+                a = s.appendChild(o.createElement("option"));
+            return n.type ? (n.type = "checkbox", t.checkOn = "" !== n.value, t.optSelected = a.selected, t.reliableMarginRight = !0, t.boxSizingReliable = !0, t.pixelPosition = !1, n.checked = !0, t.noCloneChecked = n.cloneNode(!0).checked, s.disabled = !0, t.optDisabled = !a.disabled, n = o.createElement("input"), n.value = "t", n.type = "radio", t.radioValue = "t" === n.value, n.setAttribute("checked", "t"), n.setAttribute("name", "t"), r.appendChild(n), t.checkClone = r.cloneNode(!0).cloneNode(!0).lastChild.checked, t.focusinBubbles = "onfocusin" in e, i.style.backgroundClip = "content-box", i.cloneNode(!0).style.backgroundClip = "", t.clearCloneStyle = "content-box" === i.style.backgroundClip, x(function () {
+                var n, r, s = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",
+                    a = o.getElementsByTagName("body")[0];
+                a && (n = o.createElement("div"), n.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", a.appendChild(n).appendChild(i), i.innerHTML = "", i.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%", x.swap(a, null != a.style.zoom ? {
+                    zoom: 1
+                } : {}, function () {
+                    t.boxSizing = 4 === i.offsetWidth
+                }), e.getComputedStyle && (t.pixelPosition = "1%" !== (e.getComputedStyle(i, null) || {}).top, t.boxSizingReliable = "4px" === (e.getComputedStyle(i, null) || {
+                    width: "4px"
+                }).width, r = i.appendChild(o.createElement("div")), r.style.cssText = i.style.cssText = s, r.style.marginRight = r.style.width = "0", i.style.width = "1px", t.reliableMarginRight = !parseFloat((e.getComputedStyle(r, null) || {}).marginRight)), a.removeChild(n))
+            }), t) : t
+        }({});
+        var L, H, q = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+            O = /([A-Z])/g;
+
+        function F() {
+            Object.defineProperty(this.cache = {}, 0, {
+                get: function () {
+                    return {}
+                }
+            }), this.expando = x.expando + Math.random()
+        }
+        F.uid = 1, F.accepts = function (e) {
+            return e.nodeType ? 1 === e.nodeType || 9 === e.nodeType : !0
+        }, F.prototype = {
+            key: function (e) {
+                if (!F.accepts(e)) return 0;
+                var t = {}, n = e[this.expando];
+                if (!n) {
+                    n = F.uid++;
+                    try {
+                        t[this.expando] = {
+                            value: n
+                        }, Object.defineProperties(e, t)
+                    } catch (r) {
+                        t[this.expando] = n, x.extend(e, t)
+                    }
+                }
+                return this.cache[n] || (this.cache[n] = {}), n
+            },
+            set: function (e, t, n) {
+                var r, i = this.key(e),
+                    o = this.cache[i];
+                if ("string" == typeof t) o[t] = n;
+                else if (x.isEmptyObject(o)) x.extend(this.cache[i], t);
+                else
+                    for (r in t) o[r] = t[r];
+                return o
+            },
+            get: function (e, t) {
+                var n = this.cache[this.key(e)];
+                return t === undefined ? n : n[t]
+            },
+            access: function (e, t, n) {
+                return t === undefined || t && "string" == typeof t && n === undefined ? this.get(e, t) : (this.set(e, t, n), n !== undefined ? n : t)
+            },
+            remove: function (e, t) {
+                var n, r, i, o = this.key(e),
+                    s = this.cache[o];
+                if (t === undefined) this.cache[o] = {};
+                else {
+                    x.isArray(t) ? r = t.concat(t.map(x.camelCase)) : (i = x.camelCase(t), t in s ? r = [t, i] : (r = i, r = r in s ? [r] : r.match(w) || [])), n = r.length;
+                    while (n--) delete s[r[n]]
+                }
+            },
+            hasData: function (e) {
+                return !x.isEmptyObject(this.cache[e[this.expando]] || {})
+            },
+            discard: function (e) {
+                e[this.expando] && delete this.cache[e[this.expando]]
+            }
+        }, L = new F, H = new F, x.extend({
+            acceptData: F.accepts,
+            hasData: function (e) {
+                return L.hasData(e) || H.hasData(e)
+            },
+            data: function (e, t, n) {
+                return L.access(e, t, n)
+            },
+            removeData: function (e, t) {
+                L.remove(e, t)
+            },
+            _data: function (e, t, n) {
+                return H.access(e, t, n)
+            },
+            _removeData: function (e, t) {
+                H.remove(e, t)
+            }
+        }), x.fn.extend({
+            data: function (e, t) {
+                var n, r, i = this[0],
+                    o = 0,
+                    s = null;
+                if (e === undefined) {
+                    if (this.length && (s = L.get(i), 1 === i.nodeType && !H.get(i, "hasDataAttrs"))) {
+                        for (n = i.attributes; n.length > o; o++) r = n[o].name, 0 === r.indexOf("data-") && (r = x.camelCase(r.slice(5)), P(i, r, s[r]));
+                        H.set(i, "hasDataAttrs", !0)
+                    }
+                    return s
+                }
+                return "object" == typeof e ? this.each(function () {
+                    L.set(this, e)
+                }) : x.access(this, function (t) {
+                    var n, r = x.camelCase(e);
+                    if (i && t === undefined) {
+                        if (n = L.get(i, e), n !== undefined) return n;
+                        if (n = L.get(i, r), n !== undefined) return n;
+                        if (n = P(i, r, undefined), n !== undefined) return n
+                    } else this.each(function () {
+                        var n = L.get(this, r);
+                        L.set(this, r, t), -1 !== e.indexOf("-") && n !== undefined && L.set(this, e, t)
+                    })
+                }, null, t, arguments.length > 1, null, !0)
+            },
+            removeData: function (e) {
+                return this.each(function () {
+                    L.remove(this, e)
+                })
+            }
+        });
+
+        function P(e, t, n) {
+            var r;
+            if (n === undefined && 1 === e.nodeType)
+                if (r = "data-" + t.replace(O, "-$1").toLowerCase(), n = e.getAttribute(r), "string" == typeof n) {
+                    try {
+                        n = "true" === n ? !0 : "false" === n ? !1 : "null" === n ? null : +n + "" === n ? +n : q.test(n) ? JSON.parse(n) : n
+                    } catch (i) {}
+                    L.set(e, t, n)
+                } else n = undefined;
+            return n
+        }
+        x.extend({
+            queue: function (e, t, n) {
+                var r;
+                return e ? (t = (t || "fx") + "queue", r = H.get(e, t), n && (!r || x.isArray(n) ? r = H.access(e, t, x.makeArray(n)) : r.push(n)), r || []) : undefined
+            },
+            dequeue: function (e, t) {
+                t = t || "fx";
+                var n = x.queue(e, t),
+                    r = n.length,
+                    i = n.shift(),
+                    o = x._queueHooks(e, t),
+                    s = function () {
+                        x.dequeue(e, t)
+                    };
+                "inprogress" === i && (i = n.shift(), r--), i && ("fx" === t && n.unshift("inprogress"), delete o.stop, i.call(e, s, o)), !r && o && o.empty.fire()
+            },
+            _queueHooks: function (e, t) {
+                var n = t + "queueHooks";
+                return H.get(e, n) || H.access(e, n, {
+                    empty: x.Callbacks("once memory").add(function () {
+                        H.remove(e, [t + "queue", n])
+                    })
+                })
+            }
+        }), x.fn.extend({
+            queue: function (e, t) {
+                var n = 2;
+                return "string" != typeof e && (t = e, e = "fx", n--), n > arguments.length ? x.queue(this[0], e) : t === undefined ? this : this.each(function () {
+                    var n = x.queue(this, e, t);
+                    x._queueHooks(this, e), "fx" === e && "inprogress" !== n[0] && x.dequeue(this, e)
+                })
+            },
+            dequeue: function (e) {
+                return this.each(function () {
+                    x.dequeue(this, e)
+                })
+            },
+            delay: function (e, t) {
+                return e = x.fx ? x.fx.speeds[e] || e : e, t = t || "fx", this.queue(t, function (t, n) {
+                    var r = setTimeout(t, e);
+                    n.stop = function () {
+                        clearTimeout(r)
+                    }
+                })
+            },
+            clearQueue: function (e) {
+                return this.queue(e || "fx", [])
+            },
+            promise: function (e, t) {
+                var n, r = 1,
+                    i = x.Deferred(),
+                    o = this,
+                    s = this.length,
+                    a = function () {
+                        --r || i.resolveWith(o, [o])
+                    };
+                "string" != typeof e && (t = e, e = undefined), e = e || "fx";
+                while (s--) n = H.get(o[s], e + "queueHooks"), n && n.empty && (r++, n.empty.add(a));
+                return a(), i.promise(t)
+            }
+        });
+        var R, M, W = /[\t\r\n\f]/g,
+            $ = /\r/g,
+            B = /^(?:input|select|textarea|button)$/i;
+        x.fn.extend({
+            attr: function (e, t) {
+                return x.access(this, x.attr, e, t, arguments.length > 1)
+            },
+            removeAttr: function (e) {
+                return this.each(function () {
+                    x.removeAttr(this, e)
+                })
+            },
+            prop: function (e, t) {
+                return x.access(this, x.prop, e, t, arguments.length > 1)
+            },
+            removeProp: function (e) {
+                return this.each(function () {
+                    delete this[x.propFix[e] || e]
+                })
+            },
+            addClass: function (e) {
+                var t, n, r, i, o, s = 0,
+                    a = this.length,
+                    u = "string" == typeof e && e;
+                if (x.isFunction(e)) return this.each(function (t) {
+                    x(this).addClass(e.call(this, t, this.className))
+                });
+                if (u)
+                    for (t = (e || "").match(w) || []; a > s; s++)
+                        if (n = this[s], r = 1 === n.nodeType && (n.className ? (" " + n.className + " ").replace(W, " ") : " ")) {
+                            o = 0;
+                            while (i = t[o++]) 0 > r.indexOf(" " + i + " ") && (r += i + " ");
+                            n.className = x.trim(r)
+                        }
+                return this
+            },
+            removeClass: function (e) {
+                var t, n, r, i, o, s = 0,
+                    a = this.length,
+                    u = 0 === arguments.length || "string" == typeof e && e;
+                if (x.isFunction(e)) return this.each(function (t) {
+                    x(this).removeClass(e.call(this, t, this.className))
+                });
+                if (u)
+                    for (t = (e || "").match(w) || []; a > s; s++)
+                        if (n = this[s], r = 1 === n.nodeType && (n.className ? (" " + n.className + " ").replace(W, " ") : "")) {
+                            o = 0;
+                            while (i = t[o++])
+                                while (r.indexOf(" " + i + " ") >= 0) r = r.replace(" " + i + " ", " ");
+                            n.className = e ? x.trim(r) : ""
+                        }
+                return this
+            },
+            toggleClass: function (e, t) {
+                var n = typeof e,
+                    i = "boolean" == typeof t;
+                return x.isFunction(e) ? this.each(function (n) {
+                    x(this).toggleClass(e.call(this, n, this.className, t), t)
+                }) : this.each(function () {
+                    if ("string" === n) {
+                        var o, s = 0,
+                            a = x(this),
+                            u = t,
+                            l = e.match(w) || [];
+                        while (o = l[s++]) u = i ? u : !a.hasClass(o), a[u ? "addClass" : "removeClass"](o)
+                    } else(n === r || "boolean" === n) && (this.className && H.set(this, "__className__", this.className), this.className = this.className || e === !1 ? "" : H.get(this, "__className__") || "")
+                })
+            },
+            hasClass: function (e) {
+                var t = " " + e + " ",
+                    n = 0,
+                    r = this.length;
+                for (; r > n; n++)
+                    if (1 === this[n].nodeType && (" " + this[n].className + " ").replace(W, " ").indexOf(t) >= 0) return !0;
+                return !1
+            },
+            val: function (e) {
+                var t, n, r, i = this[0]; {
+                    if (arguments.length) return r = x.isFunction(e), this.each(function (n) {
+                        var i;
+                        1 === this.nodeType && (i = r ? e.call(this, n, x(this).val()) : e, null == i ? i = "" : "number" == typeof i ? i += "" : x.isArray(i) && (i = x.map(i, function (e) {
+                            return null == e ? "" : e + ""
+                        })), t = x.valHooks[this.type] || x.valHooks[this.nodeName.toLowerCase()], t && "set" in t && t.set(this, i, "value") !== undefined || (this.value = i))
+                    });
+                    if (i) return t = x.valHooks[i.type] || x.valHooks[i.nodeName.toLowerCase()], t && "get" in t && (n = t.get(i, "value")) !== undefined ? n : (n = i.value, "string" == typeof n ? n.replace($, "") : null == n ? "" : n)
+                }
+            }
+        }), x.extend({
+            valHooks: {
+                option: {
+                    get: function (e) {
+                        var t = e.attributes.value;
+                        return !t || t.specified ? e.value : e.text
+                    }
+                },
+                select: {
+                    get: function (e) {
+                        var t, n, r = e.options,
+                            i = e.selectedIndex,
+                            o = "select-one" === e.type || 0 > i,
+                            s = o ? null : [],
+                            a = o ? i + 1 : r.length,
+                            u = 0 > i ? a : o ? i : 0;
+                        for (; a > u; u++)
+                            if (n = r[u], !(!n.selected && u !== i || (x.support.optDisabled ? n.disabled : null !== n.getAttribute("disabled")) || n.parentNode.disabled && x.nodeName(n.parentNode, "optgroup"))) {
+                                if (t = x(n).val(), o) return t;
+                                s.push(t)
+                            }
+                        return s
+                    },
+                    set: function (e, t) {
+                        var n, r, i = e.options,
+                            o = x.makeArray(t),
+                            s = i.length;
+                        while (s--) r = i[s], (r.selected = x.inArray(x(r).val(), o) >= 0) && (n = !0);
+                        return n || (e.selectedIndex = -1), o
+                    }
+                }
+            },
+            attr: function (e, t, n) {
+                var i, o, s = e.nodeType;
+                if (e && 3 !== s && 8 !== s && 2 !== s) return typeof e.getAttribute === r ? x.prop(e, t, n) : (1 === s && x.isXMLDoc(e) || (t = t.toLowerCase(), i = x.attrHooks[t] || (x.expr.match.bool.test(t) ? M : R)), n === undefined ? i && "get" in i && null !== (o = i.get(e, t)) ? o : (o = x.find.attr(e, t), null == o ? undefined : o) : null !== n ? i && "set" in i && (o = i.set(e, n, t)) !== undefined ? o : (e.setAttribute(t, n + ""), n) : (x.removeAttr(e, t), undefined))
+            },
+            removeAttr: function (e, t) {
+                var n, r, i = 0,
+                    o = t && t.match(w);
+                if (o && 1 === e.nodeType)
+                    while (n = o[i++]) r = x.propFix[n] || n, x.expr.match.bool.test(n) && (e[r] = !1), e.removeAttribute(n)
+            },
+            attrHooks: {
+                type: {
+                    set: function (e, t) {
+                        if (!x.support.radioValue && "radio" === t && x.nodeName(e, "input")) {
+                            var n = e.value;
+                            return e.setAttribute("type", t), n && (e.value = n), t
+                        }
+                    }
+                }
+            },
+            propFix: {
+                "for": "htmlFor",
+                "class": "className"
+            },
+            prop: function (e, t, n) {
+                var r, i, o, s = e.nodeType;
+                if (e && 3 !== s && 8 !== s && 2 !== s) return o = 1 !== s || !x.isXMLDoc(e), o && (t = x.propFix[t] || t, i = x.propHooks[t]), n !== undefined ? i && "set" in i && (r = i.set(e, n, t)) !== undefined ? r : e[t] = n : i && "get" in i && null !== (r = i.get(e, t)) ? r : e[t]
+            },
+            propHooks: {
+                tabIndex: {
+                    get: function (e) {
+                        return e.hasAttribute("tabindex") || B.test(e.nodeName) || e.href ? e.tabIndex : -1
+                    }
+                }
+            }
+        }), M = {
+            set: function (e, t, n) {
+                return t === !1 ? x.removeAttr(e, n) : e.setAttribute(n, n), n
+            }
+        }, x.each(x.expr.match.bool.source.match(/\w+/g), function (e, t) {
+            var n = x.expr.attrHandle[t] || x.find.attr;
+            x.expr.attrHandle[t] = function (e, t, r) {
+                var i = x.expr.attrHandle[t],
+                    o = r ? undefined : (x.expr.attrHandle[t] = undefined) != n(e, t, r) ? t.toLowerCase() : null;
+                return x.expr.attrHandle[t] = i, o
+            }
+        }), x.support.optSelected || (x.propHooks.selected = {
+            get: function (e) {
+                var t = e.parentNode;
+                return t && t.parentNode && t.parentNode.selectedIndex, null
+            }
+        }), x.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
+            x.propFix[this.toLowerCase()] = this
+        }), x.each(["radio", "checkbox"], function () {
+            x.valHooks[this] = {
+                set: function (e, t) {
+                    return x.isArray(t) ? e.checked = x.inArray(x(e).val(), t) >= 0 : undefined
+                }
+            }, x.support.checkOn || (x.valHooks[this].get = function (e) {
+                return null === e.getAttribute("value") ? "on" : e.value
+            })
+        });
+        var I = /^key/,
+            z = /^(?:mouse|contextmenu)|click/,
+            _ = /^(?:focusinfocus|focusoutblur)$/,
+            X = /^([^.]*)(?:\.(.+)|)$/;
+
+        function U() {
+            return !0
+        }
+
+        function Y() {
+            return !1
+        }
+
+        function V() {
+            try {
+                return o.activeElement
+            } catch (e) {}
+        }
+        x.event = {
+            global: {},
+            add: function (e, t, n, i, o) {
+                var s, a, u, l, c, p, f, h, d, g, m, y = H.get(e);
+                if (y) {
+                    n.handler && (s = n, n = s.handler, o = s.selector), n.guid || (n.guid = x.guid++), (l = y.events) || (l = y.events = {}), (a = y.handle) || (a = y.handle = function (e) {
+                        return typeof x === r || e && x.event.triggered === e.type ? undefined : x.event.dispatch.apply(a.elem, arguments)
+                    }, a.elem = e), t = (t || "").match(w) || [""], c = t.length;
+                    while (c--) u = X.exec(t[c]) || [], d = m = u[1], g = (u[2] || "").split(".").sort(), d && (f = x.event.special[d] || {}, d = (o ? f.delegateType : f.bindType) || d, f = x.event.special[d] || {}, p = x.extend({
+                        type: d,
+                        origType: m,
+                        data: i,
+                        handler: n,
+                        guid: n.guid,
+                        selector: o,
+                        needsContext: o && x.expr.match.needsContext.test(o),
+                        namespace: g.join(".")
+                    }, s), (h = l[d]) || (h = l[d] = [], h.delegateCount = 0, f.setup && f.setup.call(e, i, g, a) !== !1 || e.addEventListener && e.addEventListener(d, a, !1)), f.add && (f.add.call(e, p), p.handler.guid || (p.handler.guid = n.guid)), o ? h.splice(h.delegateCount++, 0, p) : h.push(p), x.event.global[d] = !0);
+                    e = null
+                }
+            },
+            remove: function (e, t, n, r, i) {
+                var o, s, a, u, l, c, p, f, h, d, g, m = H.hasData(e) && H.get(e);
+                if (m && (u = m.events)) {
+                    t = (t || "").match(w) || [""], l = t.length;
+                    while (l--)
+                        if (a = X.exec(t[l]) || [], h = g = a[1], d = (a[2] || "").split(".").sort(), h) {
+                            p = x.event.special[h] || {}, h = (r ? p.delegateType : p.bindType) || h, f = u[h] || [], a = a[2] && RegExp("(^|\\.)" + d.join("\\.(?:.*\\.|)") + "(\\.|$)"), s = o = f.length;
+                            while (o--) c = f[o], !i && g !== c.origType || n && n.guid !== c.guid || a && !a.test(c.namespace) || r && r !== c.selector && ("**" !== r || !c.selector) || (f.splice(o, 1), c.selector && f.delegateCount--, p.remove && p.remove.call(e, c));
+                            s && !f.length && (p.teardown && p.teardown.call(e, d, m.handle) !== !1 || x.removeEvent(e, h, m.handle), delete u[h])
+                        } else
+                            for (h in u) x.event.remove(e, h + t[l], n, r, !0);
+                    x.isEmptyObject(u) && (delete m.handle, H.remove(e, "events"))
+                }
+            },
+            trigger: function (t, n, r, i) {
+                var s, a, u, l, c, p, f, h = [r || o],
+                    d = y.call(t, "type") ? t.type : t,
+                    g = y.call(t, "namespace") ? t.namespace.split(".") : [];
+                if (a = u = r = r || o, 3 !== r.nodeType && 8 !== r.nodeType && !_.test(d + x.event.triggered) && (d.indexOf(".") >= 0 && (g = d.split("."), d = g.shift(), g.sort()), c = 0 > d.indexOf(":") && "on" + d, t = t[x.expando] ? t : new x.Event(d, "object" == typeof t && t), t.isTrigger = i ? 2 : 3, t.namespace = g.join("."), t.namespace_re = t.namespace ? RegExp("(^|\\.)" + g.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, t.result = undefined, t.target || (t.target = r), n = null == n ? [t] : x.makeArray(n, [t]), f = x.event.special[d] || {}, i || !f.trigger || f.trigger.apply(r, n) !== !1)) {
+                    if (!i && !f.noBubble && !x.isWindow(r)) {
+                        for (l = f.delegateType || d, _.test(l + d) || (a = a.parentNode); a; a = a.parentNode) h.push(a), u = a;
+                        u === (r.ownerDocument || o) && h.push(u.defaultView || u.parentWindow || e)
+                    }
+                    s = 0;
+                    while ((a = h[s++]) && !t.isPropagationStopped()) t.type = s > 1 ? l : f.bindType || d, p = (H.get(a, "events") || {})[t.type] && H.get(a, "handle"), p && p.apply(a, n), p = c && a[c], p && x.acceptData(a) && p.apply && p.apply(a, n) === !1 && t.preventDefault();
+                    return t.type = d, i || t.isDefaultPrevented() || f._default && f._default.apply(h.pop(), n) !== !1 || !x.acceptData(r) || c && x.isFunction(r[d]) && !x.isWindow(r) && (u = r[c], u && (r[c] = null), x.event.triggered = d, r[d](), x.event.triggered = undefined, u && (r[c] = u)), t.result
+                }
+            },
+            dispatch: function (e) {
+                e = x.event.fix(e);
+                var t, n, r, i, o, s = [],
+                    a = d.call(arguments),
+                    u = (H.get(this, "events") || {})[e.type] || [],
+                    l = x.event.special[e.type] || {};
+                if (a[0] = e, e.delegateTarget = this, !l.preDispatch || l.preDispatch.call(this, e) !== !1) {
+                    s = x.event.handlers.call(this, e, u), t = 0;
+                    while ((i = s[t++]) && !e.isPropagationStopped()) {
+                        e.currentTarget = i.elem, n = 0;
+                        while ((o = i.handlers[n++]) && !e.isImmediatePropagationStopped())(!e.namespace_re || e.namespace_re.test(o.namespace)) && (e.handleObj = o, e.data = o.data, r = ((x.event.special[o.origType] || {}).handle || o.handler).apply(i.elem, a), r !== undefined && (e.result = r) === !1 && (e.preventDefault(), e.stopPropagation()))
+                    }
+                    return l.postDispatch && l.postDispatch.call(this, e), e.result
+                }
+            },
+            handlers: function (e, t) {
+                var n, r, i, o, s = [],
+                    a = t.delegateCount,
+                    u = e.target;
+                if (a && u.nodeType && (!e.button || "click" !== e.type))
+                    for (; u !== this; u = u.parentNode || this)
+                        if (u.disabled !== !0 || "click" !== e.type) {
+                            for (r = [], n = 0; a > n; n++) o = t[n], i = o.selector + " ", r[i] === undefined && (r[i] = o.needsContext ? x(i, this).index(u) >= 0 : x.find(i, this, null, [u]).length), r[i] && r.push(o);
+                            r.length && s.push({
+                                elem: u,
+                                handlers: r
+                            })
+                        }
+                return t.length > a && s.push({
+                    elem: this,
+                    handlers: t.slice(a)
+                }), s
+            },
+            props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+            fixHooks: {},
+            keyHooks: {
+                props: "char charCode key keyCode".split(" "),
+                filter: function (e, t) {
+                    return null == e.which && (e.which = null != t.charCode ? t.charCode : t.keyCode), e
+                }
+            },
+            mouseHooks: {
+                props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+                filter: function (e, t) {
+                    var n, r, i, s = t.button;
+                    return null == e.pageX && null != t.clientX && (n = e.target.ownerDocument || o, r = n.documentElement, i = n.body, e.pageX = t.clientX + (r && r.scrollLeft || i && i.scrollLeft || 0) - (r && r.clientLeft || i && i.clientLeft || 0), e.pageY = t.clientY + (r && r.scrollTop || i && i.scrollTop || 0) - (r && r.clientTop || i && i.clientTop || 0)), e.which || s === undefined || (e.which = 1 & s ? 1 : 2 & s ? 3 : 4 & s ? 2 : 0), e
+                }
+            },
+            fix: function (e) {
+                if (e[x.expando]) return e;
+                var t, n, r, i = e.type,
+                    s = e,
+                    a = this.fixHooks[i];
+                a || (this.fixHooks[i] = a = z.test(i) ? this.mouseHooks : I.test(i) ? this.keyHooks : {}), r = a.props ? this.props.concat(a.props) : this.props, e = new x.Event(s), t = r.length;
+                while (t--) n = r[t], e[n] = s[n];
+                return e.target || (e.target = o), 3 === e.target.nodeType && (e.target = e.target.parentNode), a.filter ? a.filter(e, s) : e
+            },
+            special: {
+                load: {
+                    noBubble: !0
+                },
+                focus: {
+                    trigger: function () {
+                        return this !== V() && this.focus ? (this.focus(), !1) : undefined
+                    },
+                    delegateType: "focusin"
+                },
+                blur: {
+                    trigger: function () {
+                        return this === V() && this.blur ? (this.blur(), !1) : undefined
+                    },
+                    delegateType: "focusout"
+                },
+                click: {
+                    trigger: function () {
+                        return "checkbox" === this.type && this.click && x.nodeName(this, "input") ? (this.click(), !1) : undefined
+                    },
+                    _default: function (e) {
+                        return x.nodeName(e.target, "a")
+                    }
+                },
+                beforeunload: {
+                    postDispatch: function (e) {
+                        e.result !== undefined && (e.originalEvent.returnValue = e.result)
+                    }
+                }
+            },
+            simulate: function (e, t, n, r) {
+                var i = x.extend(new x.Event, n, {
+                    type: e,
+                    isSimulated: !0,
+                    originalEvent: {}
+                });
+                r ? x.event.trigger(i, null, t) : x.event.dispatch.call(t, i), i.isDefaultPrevented() && n.preventDefault()
+            }
+        }, x.removeEvent = function (e, t, n) {
+            e.removeEventListener && e.removeEventListener(t, n, !1)
+        }, x.Event = function (e, t) {
+            return this instanceof x.Event ? (e && e.type ? (this.originalEvent = e, this.type = e.type, this.isDefaultPrevented = e.defaultPrevented || e.getPreventDefault && e.getPreventDefault() ? U : Y) : this.type = e, t && x.extend(this, t), this.timeStamp = e && e.timeStamp || x.now(), this[x.expando] = !0, undefined) : new x.Event(e, t)
+        }, x.Event.prototype = {
+            isDefaultPrevented: Y,
+            isPropagationStopped: Y,
+            isImmediatePropagationStopped: Y,
+            preventDefault: function () {
+                var e = this.originalEvent;
+                this.isDefaultPrevented = U, e && e.preventDefault && e.preventDefault()
+            },
+            stopPropagation: function () {
+                var e = this.originalEvent;
+                this.isPropagationStopped = U, e && e.stopPropagation && e.stopPropagation()
+            },
+            stopImmediatePropagation: function () {
+                this.isImmediatePropagationStopped = U, this.stopPropagation()
+            }
+        }, x.each({
+            mouseenter: "mouseover",
+            mouseleave: "mouseout"
+        }, function (e, t) {
+            x.event.special[e] = {
+                delegateType: t,
+                bindType: t,
+                handle: function (e) {
+                    var n, r = this,
+                        i = e.relatedTarget,
+                        o = e.handleObj;
+                    return (!i || i !== r && !x.contains(r, i)) && (e.type = o.origType, n = o.handler.apply(this, arguments), e.type = t), n
+                }
+            }
+        }), x.support.focusinBubbles || x.each({
+            focus: "focusin",
+            blur: "focusout"
+        }, function (e, t) {
+            var n = 0,
+                r = function (e) {
+                    x.event.simulate(t, e.target, x.event.fix(e), !0)
+                };
+            x.event.special[t] = {
+                setup: function () {
+                    0 === n++ && o.addEventListener(e, r, !0)
+                },
+                teardown: function () {
+                    0 === --n && o.removeEventListener(e, r, !0)
+                }
+            }
+        }), x.fn.extend({
+            on: function (e, t, n, r, i) {
+                var o, s;
+                if ("object" == typeof e) {
+                    "string" != typeof t && (n = n || t, t = undefined);
+                    for (s in e) this.on(s, t, n, e[s], i);
+                    return this
+                }
+                if (null == n && null == r ? (r = t, n = t = undefined) : null == r && ("string" == typeof t ? (r = n, n = undefined) : (r = n, n = t, t = undefined)), r === !1) r = Y;
+                else if (!r) return this;
+                return 1 === i && (o = r, r = function (e) {
+                    return x().off(e), o.apply(this, arguments)
+                }, r.guid = o.guid || (o.guid = x.guid++)), this.each(function () {
+                    x.event.add(this, e, r, n, t)
+                })
+            },
+            one: function (e, t, n, r) {
+                return this.on(e, t, n, r, 1)
+            },
+            off: function (e, t, n) {
+                var r, i;
+                if (e && e.preventDefault && e.handleObj) return r = e.handleObj, x(e.delegateTarget).off(r.namespace ? r.origType + "." + r.namespace : r.origType, r.selector, r.handler), this;
+                if ("object" == typeof e) {
+                    for (i in e) this.off(i, t, e[i]);
+                    return this
+                }
+                return (t === !1 || "function" == typeof t) && (n = t, t = undefined), n === !1 && (n = Y), this.each(function () {
+                    x.event.remove(this, e, n, t)
+                })
+            },
+            trigger: function (e, t) {
+                return this.each(function () {
+                    x.event.trigger(e, t, this)
+                })
+            },
+            triggerHandler: function (e, t) {
+                var n = this[0];
+                return n ? x.event.trigger(e, t, n, !0) : undefined
+            }
+        });
+        var G = /^.[^:#\[\.,]*$/,
+            J = /^(?:parents|prev(?:Until|All))/,
+            Q = x.expr.match.needsContext,
+            K = {
+                children: !0,
+                contents: !0,
+                next: !0,
+                prev: !0
+            };
+        x.fn.extend({
+            find: function (e) {
+                var t, n = [],
+                    r = this,
+                    i = r.length;
+                if ("string" != typeof e) return this.pushStack(x(e).filter(function () {
+                    for (t = 0; i > t; t++)
+                        if (x.contains(r[t], this)) return !0
+                }));
+                for (t = 0; i > t; t++) x.find(e, r[t], n);
+                return n = this.pushStack(i > 1 ? x.unique(n) : n), n.selector = this.selector ? this.selector + " " + e : e, n
+            },
+            has: function (e) {
+                var t = x(e, this),
+                    n = t.length;
+                return this.filter(function () {
+                    var e = 0;
+                    for (; n > e; e++)
+                        if (x.contains(this, t[e])) return !0
+                })
+            },
+            not: function (e) {
+                return this.pushStack(et(this, e || [], !0))
+            },
+            filter: function (e) {
+                return this.pushStack(et(this, e || [], !1))
+            },
+            is: function (e) {
+                return !!et(this, "string" == typeof e && Q.test(e) ? x(e) : e || [], !1).length
+            },
+            closest: function (e, t) {
+                var n, r = 0,
+                    i = this.length,
+                    o = [],
+                    s = Q.test(e) || "string" != typeof e ? x(e, t || this.context) : 0;
+                for (; i > r; r++)
+                    for (n = this[r]; n && n !== t; n = n.parentNode)
+                        if (11 > n.nodeType && (s ? s.index(n) > -1 : 1 === n.nodeType && x.find.matchesSelector(n, e))) {
+                            n = o.push(n);
+                            break
+                        }
+                return this.pushStack(o.length > 1 ? x.unique(o) : o)
+            },
+            index: function (e) {
+                return e ? "string" == typeof e ? g.call(x(e), this[0]) : g.call(this, e.jquery ? e[0] : e) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1
+            },
+            add: function (e, t) {
+                var n = "string" == typeof e ? x(e, t) : x.makeArray(e && e.nodeType ? [e] : e),
+                    r = x.merge(this.get(), n);
+                return this.pushStack(x.unique(r))
+            },
+            addBack: function (e) {
+                return this.add(null == e ? this.prevObject : this.prevObject.filter(e))
+            }
+        });
+
+        function Z(e, t) {
+            while ((e = e[t]) && 1 !== e.nodeType);
+            return e
+        }
+        x.each({
+            parent: function (e) {
+                var t = e.parentNode;
+                return t && 11 !== t.nodeType ? t : null
+            },
+            parents: function (e) {
+                return x.dir(e, "parentNode")
+            },
+            parentsUntil: function (e, t, n) {
+                return x.dir(e, "parentNode", n)
+            },
+            next: function (e) {
+                return Z(e, "nextSibling")
+            },
+            prev: function (e) {
+                return Z(e, "previousSibling")
+            },
+            nextAll: function (e) {
+                return x.dir(e, "nextSibling")
+            },
+            prevAll: function (e) {
+                return x.dir(e, "previousSibling")
+            },
+            nextUntil: function (e, t, n) {
+                return x.dir(e, "nextSibling", n)
+            },
+            prevUntil: function (e, t, n) {
+                return x.dir(e, "previousSibling", n)
+            },
+            siblings: function (e) {
+                return x.sibling((e.parentNode || {}).firstChild, e)
+            },
+            children: function (e) {
+                return x.sibling(e.firstChild)
+            },
+            contents: function (e) {
+                return e.contentDocument || x.merge([], e.childNodes)
+            }
+        }, function (e, t) {
+            x.fn[e] = function (n, r) {
+                var i = x.map(this, t, n);
+                return "Until" !== e.slice(-5) && (r = n), r && "string" == typeof r && (i = x.filter(r, i)), this.length > 1 && (K[e] || x.unique(i), J.test(e) && i.reverse()), this.pushStack(i)
+            }
+        }), x.extend({
+            filter: function (e, t, n) {
+                var r = t[0];
+                return n && (e = ":not(" + e + ")"), 1 === t.length && 1 === r.nodeType ? x.find.matchesSelector(r, e) ? [r] : [] : x.find.matches(e, x.grep(t, function (e) {
+                    return 1 === e.nodeType
+                }))
+            },
+            dir: function (e, t, n) {
+                var r = [],
+                    i = n !== undefined;
+                while ((e = e[t]) && 9 !== e.nodeType)
+                    if (1 === e.nodeType) {
+                        if (i && x(e).is(n)) break;
+                        r.push(e)
+                    }
+                return r
+            },
+            sibling: function (e, t) {
+                var n = [];
+                for (; e; e = e.nextSibling) 1 === e.nodeType && e !== t && n.push(e);
+                return n
+            }
+        });
+
+        function et(e, t, n) {
+            if (x.isFunction(t)) return x.grep(e, function (e, r) {
+                return !!t.call(e, r, e) !== n
+            });
+            if (t.nodeType) return x.grep(e, function (e) {
+                return e === t !== n
+            });
+            if ("string" == typeof t) {
+                if (G.test(t)) return x.filter(t, e, n);
+                t = x.filter(t, e)
+            }
+            return x.grep(e, function (e) {
+                return g.call(t, e) >= 0 !== n
+            })
+        }
+        var tt = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+            nt = /<([\w:]+)/,
+            rt = /<|&#?\w+;/,
+            it = /<(?:script|style|link)/i,
+            ot = /^(?:checkbox|radio)$/i,
+            st = /checked\s*(?:[^=]|=\s*.checked.)/i,
+            at = /^$|\/(?:java|ecma)script/i,
+            ut = /^true\/(.*)/,
+            lt = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+            ct = {
+                option: [1, "<select multiple='multiple'>", "</select>"],
+                thead: [1, "<table>", "</table>"],
+                col: [2, "<table><colgroup>", "</colgroup></table>"],
+                tr: [2, "<table><tbody>", "</tbody></table>"],
+                td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
+                _default: [0, "", ""]
+            };
+        ct.optgroup = ct.option, ct.tbody = ct.tfoot = ct.colgroup = ct.caption = ct.thead, ct.th = ct.td, x.fn.extend({
+            text: function (e) {
+                return x.access(this, function (e) {
+                    return e === undefined ? x.text(this) : this.empty().append((this[0] && this[0].ownerDocument || o).createTextNode(e))
+                }, null, e, arguments.length)
+            },
+            append: function () {
+                return this.domManip(arguments, function (e) {
+                    if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
+                        var t = pt(this, e);
+                        t.appendChild(e)
+                    }
+                })
+            },
+            prepend: function () {
+                return this.domManip(arguments, function (e) {
+                    if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
+                        var t = pt(this, e);
+                        t.insertBefore(e, t.firstChild)
+                    }
+                })
+            },
+            before: function () {
+                return this.domManip(arguments, function (e) {
+                    this.parentNode && this.parentNode.insertBefore(e, this)
+                })
+            },
+            after: function () {
+                return this.domManip(arguments, function (e) {
+                    this.parentNode && this.parentNode.insertBefore(e, this.nextSibling)
+                })
+            },
+            remove: function (e, t) {
+                var n, r = e ? x.filter(e, this) : this,
+                    i = 0;
+                for (; null != (n = r[i]); i++) t || 1 !== n.nodeType || x.cleanData(mt(n)), n.parentNode && (t && x.contains(n.ownerDocument, n) && dt(mt(n, "script")), n.parentNode.removeChild(n));
+                return this
+            },
+            empty: function () {
+                var e, t = 0;
+                for (; null != (e = this[t]); t++) 1 === e.nodeType && (x.cleanData(mt(e, !1)), e.textContent = "");
+                return this
+            },
+            clone: function (e, t) {
+                return e = null == e ? !1 : e, t = null == t ? e : t, this.map(function () {
+                    return x.clone(this, e, t)
+                })
+            },
+            html: function (e) {
+                return x.access(this, function (e) {
+                    var t = this[0] || {}, n = 0,
+                        r = this.length;
+                    if (e === undefined && 1 === t.nodeType) return t.innerHTML;
+                    if ("string" == typeof e && !it.test(e) && !ct[(nt.exec(e) || ["", ""])[1].toLowerCase()]) {
+                        e = e.replace(tt, "<$1></$2>");
+                        try {
+                            for (; r > n; n++) t = this[n] || {}, 1 === t.nodeType && (x.cleanData(mt(t, !1)), t.innerHTML = e);
+                            t = 0
+                        } catch (i) {}
+                    }
+                    t && this.empty().append(e)
+                }, null, e, arguments.length)
+            },
+            replaceWith: function () {
+                var e = x.map(this, function (e) {
+                    return [e.nextSibling, e.parentNode]
+                }),
+                    t = 0;
+                return this.domManip(arguments, function (n) {
+                    var r = e[t++],
+                        i = e[t++];
+                    i && (r && r.parentNode !== i && (r = this.nextSibling), x(this).remove(), i.insertBefore(n, r))
+                }, !0), t ? this : this.remove()
+            },
+            detach: function (e) {
+                return this.remove(e, !0)
+            },
+            domManip: function (e, t, n) {
+                e = f.apply([], e);
+                var r, i, o, s, a, u, l = 0,
+                    c = this.length,
+                    p = this,
+                    h = c - 1,
+                    d = e[0],
+                    g = x.isFunction(d);
+                if (g || !(1 >= c || "string" != typeof d || x.support.checkClone) && st.test(d)) return this.each(function (r) {
+                    var i = p.eq(r);
+                    g && (e[0] = d.call(this, r, i.html())), i.domManip(e, t, n)
+                });
+                if (c && (r = x.buildFragment(e, this[0].ownerDocument, !1, !n && this), i = r.firstChild, 1 === r.childNodes.length && (r = i), i)) {
+                    for (o = x.map(mt(r, "script"), ft), s = o.length; c > l; l++) a = r, l !== h && (a = x.clone(a, !0, !0), s && x.merge(o, mt(a, "script"))), t.call(this[l], a, l);
+                    if (s)
+                        for (u = o[o.length - 1].ownerDocument, x.map(o, ht), l = 0; s > l; l++) a = o[l], at.test(a.type || "") && !H.access(a, "globalEval") && x.contains(u, a) && (a.src ? x._evalUrl(a.src) : x.globalEval(a.textContent.replace(lt, "")))
+                }
+                return this
+            }
+        }), x.each({
+            appendTo: "append",
+            prependTo: "prepend",
+            insertBefore: "before",
+            insertAfter: "after",
+            replaceAll: "replaceWith"
+        }, function (e, t) {
+            x.fn[e] = function (e) {
+                var n, r = [],
+                    i = x(e),
+                    o = i.length - 1,
+                    s = 0;
+                for (; o >= s; s++) n = s === o ? this : this.clone(!0), x(i[s])[t](n), h.apply(r, n.get());
+                return this.pushStack(r)
+            }
+        }), x.extend({
+            clone: function (e, t, n) {
+                var r, i, o, s, a = e.cloneNode(!0),
+                    u = x.contains(e.ownerDocument, e);
+                if (!(x.support.noCloneChecked || 1 !== e.nodeType && 11 !== e.nodeType || x.isXMLDoc(e)))
+                    for (s = mt(a), o = mt(e), r = 0, i = o.length; i > r; r++) yt(o[r], s[r]);
+                if (t)
+                    if (n)
+                        for (o = o || mt(e), s = s || mt(a), r = 0, i = o.length; i > r; r++) gt(o[r], s[r]);
+                    else gt(e, a);
+                return s = mt(a, "script"), s.length > 0 && dt(s, !u && mt(e, "script")), a
+            },
+            buildFragment: function (e, t, n, r) {
+                var i, o, s, a, u, l, c = 0,
+                    p = e.length,
+                    f = t.createDocumentFragment(),
+                    h = [];
+                for (; p > c; c++)
+                    if (i = e[c], i || 0 === i)
+                        if ("object" === x.type(i)) x.merge(h, i.nodeType ? [i] : i);
+                        else if (rt.test(i)) {
+                    o = o || f.appendChild(t.createElement("div")), s = (nt.exec(i) || ["", ""])[1].toLowerCase(), a = ct[s] || ct._default, o.innerHTML = a[1] + i.replace(tt, "<$1></$2>") + a[2], l = a[0];
+                    while (l--) o = o.firstChild;
+                    x.merge(h, o.childNodes), o = f.firstChild, o.textContent = ""
+                } else h.push(t.createTextNode(i));
+                f.textContent = "", c = 0;
+                while (i = h[c++])
+                    if ((!r || -1 === x.inArray(i, r)) && (u = x.contains(i.ownerDocument, i), o = mt(f.appendChild(i), "script"), u && dt(o), n)) {
+                        l = 0;
+                        while (i = o[l++]) at.test(i.type || "") && n.push(i)
+                    }
+                return f
+            },
+            cleanData: function (e) {
+                var t, n, r, i, o, s, a = x.event.special,
+                    u = 0;
+                for (;
+                    (n = e[u]) !== undefined; u++) {
+                    if (F.accepts(n) && (o = n[H.expando], o && (t = H.cache[o]))) {
+                        if (r = Object.keys(t.events || {}), r.length)
+                            for (s = 0;
+                                (i = r[s]) !== undefined; s++) a[i] ? x.event.remove(n, i) : x.removeEvent(n, i, t.handle);
+                        H.cache[o] && delete H.cache[o]
+                    }
+                    delete L.cache[n[L.expando]]
+                }
+            },
+            _evalUrl: function (e) {
+                return x.ajax({
+                    url: e,
+                    type: "GET",
+                    dataType: "script",
+                    async: !1,
+                    global: !1,
+                    "throws": !0
+                })
+            }
+        });
+
+        function pt(e, t) {
+            return x.nodeName(e, "table") && x.nodeName(1 === t.nodeType ? t : t.firstChild, "tr") ? e.getElementsByTagName("tbody")[0] || e.appendChild(e.ownerDocument.createElement("tbody")) : e
+        }
+
+        function ft(e) {
+            return e.type = (null !== e.getAttribute("type")) + "/" + e.type, e
+        }
+
+        function ht(e) {
+            var t = ut.exec(e.type);
+            return t ? e.type = t[1] : e.removeAttribute("type"), e
+        }
+
+        function dt(e, t) {
+            var n = e.length,
+                r = 0;
+            for (; n > r; r++) H.set(e[r], "globalEval", !t || H.get(t[r], "globalEval"))
+        }
+
+        function gt(e, t) {
+            var n, r, i, o, s, a, u, l;
+            if (1 === t.nodeType) {
+                if (H.hasData(e) && (o = H.access(e), s = H.set(t, o), l = o.events)) {
+                    delete s.handle, s.events = {};
+                    for (i in l)
+                        for (n = 0, r = l[i].length; r > n; n++) x.event.add(t, i, l[i][n])
+                }
+                L.hasData(e) && (a = L.access(e), u = x.extend({}, a), L.set(t, u))
+            }
+        }
+
+        function mt(e, t) {
+            var n = e.getElementsByTagName ? e.getElementsByTagName(t || "*") : e.querySelectorAll ? e.querySelectorAll(t || "*") : [];
+            return t === undefined || t && x.nodeName(e, t) ? x.merge([e], n) : n
+        }
+
+        function yt(e, t) {
+            var n = t.nodeName.toLowerCase();
+            "input" === n && ot.test(e.type) ? t.checked = e.checked : ("input" === n || "textarea" === n) && (t.defaultValue = e.defaultValue)
+        }
+        x.fn.extend({
+            wrapAll: function (e) {
+                var t;
+                return x.isFunction(e) ? this.each(function (t) {
+                    x(this).wrapAll(e.call(this, t))
+                }) : (this[0] && (t = x(e, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && t.insertBefore(this[0]), t.map(function () {
+                    var e = this;
+                    while (e.firstElementChild) e = e.firstElementChild;
+                    return e
+                }).append(this)), this)
+            },
+            wrapInner: function (e) {
+                return x.isFunction(e) ? this.each(function (t) {
+                    x(this).wrapInner(e.call(this, t))
+                }) : this.each(function () {
+                    var t = x(this),
+                        n = t.contents();
+                    n.length ? n.wrapAll(e) : t.append(e)
+                })
+            },
+            wrap: function (e) {
+                var t = x.isFunction(e);
+                return this.each(function (n) {
+                    x(this).wrapAll(t ? e.call(this, n) : e)
+                })
+            },
+            unwrap: function () {
+                return this.parent().each(function () {
+                    x.nodeName(this, "body") || x(this).replaceWith(this.childNodes)
+                }).end()
+            }
+        });
+        var vt, xt, bt = /^(none|table(?!-c[ea]).+)/,
+            wt = /^margin/,
+            Tt = RegExp("^(" + b + ")(.*)$", "i"),
+            Ct = RegExp("^(" + b + ")(?!px)[a-z%]+$", "i"),
+            kt = RegExp("^([+-])=(" + b + ")", "i"),
+            Nt = {
+                BODY: "block"
+            }, Et = {
+                position: "absolute",
+                visibility: "hidden",
+                display: "block"
+            }, St = {
+                letterSpacing: 0,
+                fontWeight: 400
+            }, jt = ["Top", "Right", "Bottom", "Left"],
+            Dt = ["Webkit", "O", "Moz", "ms"];
+
+        function At(e, t) {
+            if (t in e) return t;
+            var n = t.charAt(0).toUpperCase() + t.slice(1),
+                r = t,
+                i = Dt.length;
+            while (i--)
+                if (t = Dt[i] + n, t in e) return t;
+            return r
+        }
+
+        function Lt(e, t) {
+            return e = t || e, "none" === x.css(e, "display") || !x.contains(e.ownerDocument, e)
+        }
+
+        function Ht(t) {
+            return e.getComputedStyle(t, null)
+        }
+
+        function qt(e, t) {
+            var n, r, i, o = [],
+                s = 0,
+                a = e.length;
+            for (; a > s; s++) r = e[s], r.style && (o[s] = H.get(r, "olddisplay"), n = r.style.display, t ? (o[s] || "none" !== n || (r.style.display = ""), "" === r.style.display && Lt(r) && (o[s] = H.access(r, "olddisplay", Rt(r.nodeName)))) : o[s] || (i = Lt(r), (n && "none" !== n || !i) && H.set(r, "olddisplay", i ? n : x.css(r, "display"))));
+            for (s = 0; a > s; s++) r = e[s], r.style && (t && "none" !== r.style.display && "" !== r.style.display || (r.style.display = t ? o[s] || "" : "none"));
+            return e
+        }
+        x.fn.extend({
+            css: function (e, t) {
+                return x.access(this, function (e, t, n) {
+                    var r, i, o = {}, s = 0;
+                    if (x.isArray(t)) {
+                        for (r = Ht(e), i = t.length; i > s; s++) o[t[s]] = x.css(e, t[s], !1, r);
+                        return o
+                    }
+                    return n !== undefined ? x.style(e, t, n) : x.css(e, t)
+                }, e, t, arguments.length > 1)
+            },
+            show: function () {
+                return qt(this, !0)
+            },
+            hide: function () {
+                return qt(this)
+            },
+            toggle: function (e) {
+                var t = "boolean" == typeof e;
+                return this.each(function () {
+                    (t ? e : Lt(this)) ? x(this).show() : x(this).hide()
+                })
+            }
+        }), x.extend({
+            cssHooks: {
+                opacity: {
+                    get: function (e, t) {
+                        if (t) {
+                            var n = vt(e, "opacity");
+                            return "" === n ? "1" : n
+                        }
+                    }
+                }
+            },
+            cssNumber: {
+                columnCount: !0,
+                fillOpacity: !0,
+                fontWeight: !0,
+                lineHeight: !0,
+                opacity: !0,
+                orphans: !0,
+                widows: !0,
+                zIndex: !0,
+                zoom: !0
+            },
+            cssProps: {
+                "float": "cssFloat"
+            },
+            style: function (e, t, n, r) {
+                if (e && 3 !== e.nodeType && 8 !== e.nodeType && e.style) {
+                    var i, o, s, a = x.camelCase(t),
+                        u = e.style;
+                    return t = x.cssProps[a] || (x.cssProps[a] = At(u, a)), s = x.cssHooks[t] || x.cssHooks[a], n === undefined ? s && "get" in s && (i = s.get(e, !1, r)) !== undefined ? i : u[t] : (o = typeof n, "string" === o && (i = kt.exec(n)) && (n = (i[1] + 1) * i[2] + parseFloat(x.css(e, t)), o = "number"), null == n || "number" === o && isNaN(n) || ("number" !== o || x.cssNumber[a] || (n += "px"), x.support.clearCloneStyle || "" !== n || 0 !== t.indexOf("background") || (u[t] = "inherit"), s && "set" in s && (n = s.set(e, n, r)) === undefined || (u[t] = n)), undefined)
+                }
+            },
+            css: function (e, t, n, r) {
+                var i, o, s, a = x.camelCase(t);
+                return t = x.cssProps[a] || (x.cssProps[a] = At(e.style, a)), s = x.cssHooks[t] || x.cssHooks[a], s && "get" in s && (i = s.get(e, !0, n)), i === undefined && (i = vt(e, t, r)), "normal" === i && t in St && (i = St[t]), "" === n || n ? (o = parseFloat(i), n === !0 || x.isNumeric(o) ? o || 0 : i) : i
+            }
+        }), vt = function (e, t, n) {
+            var r, i, o, s = n || Ht(e),
+                a = s ? s.getPropertyValue(t) || s[t] : undefined,
+                u = e.style;
+            return s && ("" !== a || x.contains(e.ownerDocument, e) || (a = x.style(e, t)), Ct.test(a) && wt.test(t) && (r = u.width, i = u.minWidth, o = u.maxWidth, u.minWidth = u.maxWidth = u.width = a, a = s.width, u.width = r, u.minWidth = i, u.maxWidth = o)), a
+        };
+
+        function Ot(e, t, n) {
+            var r = Tt.exec(t);
+            return r ? Math.max(0, r[1] - (n || 0)) + (r[2] || "px") : t
+        }
+
+        function Ft(e, t, n, r, i) {
+            var o = n === (r ? "border" : "content") ? 4 : "width" === t ? 1 : 0,
+                s = 0;
+            for (; 4 > o; o += 2) "margin" === n && (s += x.css(e, n + jt[o], !0, i)), r ? ("content" === n && (s -= x.css(e, "padding" + jt[o], !0, i)), "margin" !== n && (s -= x.css(e, "border" + jt[o] + "Width", !0, i))) : (s += x.css(e, "padding" + jt[o], !0, i), "padding" !== n && (s += x.css(e, "border" + jt[o] + "Width", !0, i)));
+            return s
+        }
+
+        function Pt(e, t, n) {
+            var r = !0,
+                i = "width" === t ? e.offsetWidth : e.offsetHeight,
+                o = Ht(e),
+                s = x.support.boxSizing && "border-box" === x.css(e, "boxSizing", !1, o);
+            if (0 >= i || null == i) {
+                if (i = vt(e, t, o), (0 > i || null == i) && (i = e.style[t]), Ct.test(i)) return i;
+                r = s && (x.support.boxSizingReliable || i === e.style[t]), i = parseFloat(i) || 0
+            }
+            return i + Ft(e, t, n || (s ? "border" : "content"), r, o) + "px"
+        }
+
+        function Rt(e) {
+            var t = o,
+                n = Nt[e];
+            return n || (n = Mt(e, t), "none" !== n && n || (xt = (xt || x("<iframe frameborder='0' width='0' height='0'/>").css("cssText", "display:block !important")).appendTo(t.documentElement), t = (xt[0].contentWindow || xt[0].contentDocument).document, t.write("<!doctype html><html><body>"), t.close(), n = Mt(e, t), xt.detach()), Nt[e] = n), n
+        }
+
+        function Mt(e, t) {
+            var n = x(t.createElement(e)).appendTo(t.body),
+                r = x.css(n[0], "display");
+            return n.remove(), r
+        }
+        x.each(["height", "width"], function (e, t) {
+            x.cssHooks[t] = {
+                get: function (e, n, r) {
+                    return n ? 0 === e.offsetWidth && bt.test(x.css(e, "display")) ? x.swap(e, Et, function () {
+                        return Pt(e, t, r)
+                    }) : Pt(e, t, r) : undefined
+                },
+                set: function (e, n, r) {
+                    var i = r && Ht(e);
+                    return Ot(e, n, r ? Ft(e, t, r, x.support.boxSizing && "border-box" === x.css(e, "boxSizing", !1, i), i) : 0)
+                }
+            }
+        }), x(function () {
+            x.support.reliableMarginRight || (x.cssHooks.marginRight = {
+                get: function (e, t) {
+                    return t ? x.swap(e, {
+                        display: "inline-block"
+                    }, vt, [e, "marginRight"]) : undefined
+                }
+            }), !x.support.pixelPosition && x.fn.position && x.each(["top", "left"], function (e, t) {
+                x.cssHooks[t] = {
+                    get: function (e, n) {
+                        return n ? (n = vt(e, t), Ct.test(n) ? x(e).position()[t] + "px" : n) : undefined
+                    }
+                }
+            })
+        }), x.expr && x.expr.filters && (x.expr.filters.hidden = function (e) {
+            return 0 >= e.offsetWidth && 0 >= e.offsetHeight
+        }, x.expr.filters.visible = function (e) {
+            return !x.expr.filters.hidden(e)
+        }), x.each({
+            margin: "",
+            padding: "",
+            border: "Width"
+        }, function (e, t) {
+            x.cssHooks[e + t] = {
+                expand: function (n) {
+                    var r = 0,
+                        i = {}, o = "string" == typeof n ? n.split(" ") : [n];
+                    for (; 4 > r; r++) i[e + jt[r] + t] = o[r] || o[r - 2] || o[0];
+                    return i
+                }
+            }, wt.test(e) || (x.cssHooks[e + t].set = Ot)
+        });
+        var Wt = /%20/g,
+            $t = /\[\]$/,
+            Bt = /\r?\n/g,
+            It = /^(?:submit|button|image|reset|file)$/i,
+            zt = /^(?:input|select|textarea|keygen)/i;
+        x.fn.extend({
+            serialize: function () {
+                return x.param(this.serializeArray())
+            },
+            serializeArray: function () {
+                return this.map(function () {
+                    var e = x.prop(this, "elements");
+                    return e ? x.makeArray(e) : this
+                }).filter(function () {
+                    var e = this.type;
+                    return this.name && !x(this).is(":disabled") && zt.test(this.nodeName) && !It.test(e) && (this.checked || !ot.test(e))
+                }).map(function (e, t) {
+                    var n = x(this).val();
+                    return null == n ? null : x.isArray(n) ? x.map(n, function (e) {
+                        return {
+                            name: t.name,
+                            value: e.replace(Bt, "\r\n")
+                        }
+                    }) : {
+                        name: t.name,
+                        value: n.replace(Bt, "\r\n")
+                    }
+                }).get()
+            }
+        }), x.param = function (e, t) {
+            var n, r = [],
+                i = function (e, t) {
+                    t = x.isFunction(t) ? t() : null == t ? "" : t, r[r.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t)
+                };
+            if (t === undefined && (t = x.ajaxSettings && x.ajaxSettings.traditional), x.isArray(e) || e.jquery && !x.isPlainObject(e)) x.each(e, function () {
+                i(this.name, this.value)
+            });
+            else
+                for (n in e) _t(n, e[n], t, i);
+            return r.join("&").replace(Wt, "+")
+        };
+
+        function _t(e, t, n, r) {
+            var i;
+            if (x.isArray(t)) x.each(t, function (t, i) {
+                n || $t.test(e) ? r(e, i) : _t(e + "[" + ("object" == typeof i ? t : "") + "]", i, n, r)
+            });
+            else if (n || "object" !== x.type(t)) r(e, t);
+            else
+                for (i in t) _t(e + "[" + i + "]", t[i], n, r)
+        }
+        x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function (e, t) {
+            x.fn[t] = function (e, n) {
+                return arguments.length > 0 ? this.on(t, null, e, n) : this.trigger(t)
+            }
+        }), x.fn.extend({
+            hover: function (e, t) {
+                return this.mouseenter(e).mouseleave(t || e)
+            },
+            bind: function (e, t, n) {
+                return this.on(e, null, t, n)
+            },
+            unbind: function (e, t) {
+                return this.off(e, null, t)
+            },
+            delegate: function (e, t, n, r) {
+                return this.on(t, e, n, r)
+            },
+            undelegate: function (e, t, n) {
+                return 1 === arguments.length ? this.off(e, "**") : this.off(t, e || "**", n)
+            }
+        });
+        var Xt, Ut, Yt = x.now(),
+            Vt = /\?/,
+            Gt = /#.*$/,
+            Jt = /([?&])_=[^&]*/,
+            Qt = /^(.*?):[ \t]*([^\r\n]*)$/gm,
+            Kt = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+            Zt = /^(?:GET|HEAD)$/,
+            en = /^\/\//,
+            tn = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+            nn = x.fn.load,
+            rn = {}, on = {}, sn = "*/".concat("*");
+        try {
+            Ut = i.href
+        } catch (an) {
+            Ut = o.createElement("a"), Ut.href = "", Ut = Ut.href
+        }
+        Xt = tn.exec(Ut.toLowerCase()) || [];
+
+        function un(e) {
+            return function (t, n) {
+                "string" != typeof t && (n = t, t = "*");
+                var r, i = 0,
+                    o = t.toLowerCase().match(w) || [];
+                if (x.isFunction(n))
+                    while (r = o[i++]) "+" === r[0] ? (r = r.slice(1) || "*", (e[r] = e[r] || []).unshift(n)) : (e[r] = e[r] || []).push(n)
+            }
+        }
+
+        function ln(e, t, n, r) {
+            var i = {}, o = e === on;
+
+            function s(a) {
+                var u;
+                return i[a] = !0, x.each(e[a] || [], function (e, a) {
+                    var l = a(t, n, r);
+                    return "string" != typeof l || o || i[l] ? o ? !(u = l) : undefined : (t.dataTypes.unshift(l), s(l), !1)
+                }), u
+            }
+            return s(t.dataTypes[0]) || !i["*"] && s("*")
+        }
+
+        function cn(e, t) {
+            var n, r, i = x.ajaxSettings.flatOptions || {};
+            for (n in t) t[n] !== undefined && ((i[n] ? e : r || (r = {}))[n] = t[n]);
+            return r && x.extend(!0, e, r), e
+        }
+        x.fn.load = function (e, t, n) {
+            if ("string" != typeof e && nn) return nn.apply(this, arguments);
+            var r, i, o, s = this,
+                a = e.indexOf(" ");
+            return a >= 0 && (r = e.slice(a), e = e.slice(0, a)), x.isFunction(t) ? (n = t, t = undefined) : t && "object" == typeof t && (i = "POST"), s.length > 0 && x.ajax({
+                url: e,
+                type: i,
+                dataType: "html",
+                data: t
+            }).done(function (e) {
+                o = arguments, s.html(r ? x("<div>").append(x.parseHTML(e)).find(r) : e)
+            }).complete(n && function (e, t) {
+                s.each(n, o || [e.responseText, t, e])
+            }), this
+        }, x.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (e, t) {
+            x.fn[t] = function (e) {
+                return this.on(t, e)
+            }
+        }), x.extend({
+            active: 0,
+            lastModified: {},
+            etag: {},
+            ajaxSettings: {
+                url: Ut,
+                type: "GET",
+                isLocal: Kt.test(Xt[1]),
+                global: !0,
+                processData: !0,
+                async: !0,
+                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+                accepts: {
+                    "*": sn,
+                    text: "text/plain",
+                    html: "text/html",
+                    xml: "application/xml, text/xml",
+                    json: "application/json, text/javascript"
+                },
+                contents: {
+                    xml: /xml/,
+                    html: /html/,
+                    json: /json/
+                },
+                responseFields: {
+                    xml: "responseXML",
+                    text: "responseText",
+                    json: "responseJSON"
+                },
+                converters: {
+                    "* text": String,
+                    "text html": !0,
+                    "text json": x.parseJSON,
+                    "text xml": x.parseXML
+                },
+                flatOptions: {
+                    url: !0,
+                    context: !0
+                }
+            },
+            ajaxSetup: function (e, t) {
+                return t ? cn(cn(e, x.ajaxSettings), t) : cn(x.ajaxSettings, e)
+            },
+            ajaxPrefilter: un(rn),
+            ajaxTransport: un(on),
+            ajax: function (e, t) {
+                "object" == typeof e && (t = e, e = undefined), t = t || {};
+                var n, r, i, o, s, a, u, l, c = x.ajaxSetup({}, t),
+                    p = c.context || c,
+                    f = c.context && (p.nodeType || p.jquery) ? x(p) : x.event,
+                    h = x.Deferred(),
+                    d = x.Callbacks("once memory"),
+                    g = c.statusCode || {}, m = {}, y = {}, v = 0,
+                    b = "canceled",
+                    T = {
+                        readyState: 0,
+                        getResponseHeader: function (e) {
+                            var t;
+                            if (2 === v) {
+                                if (!o) {
+                                    o = {};
+                                    while (t = Qt.exec(i)) o[t[1].toLowerCase()] = t[2]
+                                }
+                                t = o[e.toLowerCase()]
+                            }
+                            return null == t ? null : t
+                        },
+                        getAllResponseHeaders: function () {
+                            return 2 === v ? i : null
+                        },
+                        setRequestHeader: function (e, t) {
+                            var n = e.toLowerCase();
+                            return v || (e = y[n] = y[n] || e, m[e] = t), this
+                        },
+                        overrideMimeType: function (e) {
+                            return v || (c.mimeType = e), this
+                        },
+                        statusCode: function (e) {
+                            var t;
+                            if (e)
+                                if (2 > v)
+                                    for (t in e) g[t] = [g[t], e[t]];
+                                else T.always(e[T.status]);
+                            return this
+                        },
+                        abort: function (e) {
+                            var t = e || b;
+                            return n && n.abort(t), k(0, t), this
+                        }
+                    };
+                if (h.promise(T).complete = d.add, T.success = T.done, T.error = T.fail, c.url = ((e || c.url || Ut) + "").replace(Gt, "").replace(en, Xt[1] + "//"), c.type = t.method || t.type || c.method || c.type, c.dataTypes = x.trim(c.dataType || "*").toLowerCase().match(w) || [""], null == c.crossDomain && (a = tn.exec(c.url.toLowerCase()), c.crossDomain = !(!a || a[1] === Xt[1] && a[2] === Xt[2] && (a[3] || ("http:" === a[1] ? "80" : "443")) === (Xt[3] || ("http:" === Xt[1] ? "80" : "443")))), c.data && c.processData && "string" != typeof c.data && (c.data = x.param(c.data, c.traditional)), ln(rn, c, t, T), 2 === v) return T;
+                u = c.global, u && 0 === x.active++ && x.event.trigger("ajaxStart"), c.type = c.type.toUpperCase(), c.hasContent = !Zt.test(c.type), r = c.url, c.hasContent || (c.data && (r = c.url += (Vt.test(r) ? "&" : "?") + c.data, delete c.data), c.cache === !1 && (c.url = Jt.test(r) ? r.replace(Jt, "$1_=" + Yt++) : r + (Vt.test(r) ? "&" : "?") + "_=" + Yt++)), c.ifModified && (x.lastModified[r] && T.setRequestHeader("If-Modified-Since", x.lastModified[r]), x.etag[r] && T.setRequestHeader("If-None-Match", x.etag[r])), (c.data && c.hasContent && c.contentType !== !1 || t.contentType) && T.setRequestHeader("Content-Type", c.contentType), T.setRequestHeader("Accept", c.dataTypes[0] && c.accepts[c.dataTypes[0]] ? c.accepts[c.dataTypes[0]] + ("*" !== c.dataTypes[0] ? ", " + sn + "; q=0.01" : "") : c.accepts["*"]);
+                for (l in c.headers) T.setRequestHeader(l, c.headers[l]);
+                if (c.beforeSend && (c.beforeSend.call(p, T, c) === !1 || 2 === v)) return T.abort();
+                b = "abort";
+                for (l in {
+                    success: 1,
+                    error: 1,
+                    complete: 1
+                }) T[l](c[l]);
+                if (n = ln(on, c, t, T)) {
+                    T.readyState = 1, u && f.trigger("ajaxSend", [T, c]), c.async && c.timeout > 0 && (s = setTimeout(function () {
+                        T.abort("timeout")
+                    }, c.timeout));
+                    try {
+                        v = 1, n.send(m, k)
+                    } catch (C) {
+                        if (!(2 > v)) throw C;
+                        k(-1, C)
+                    }
+                } else k(-1, "No Transport");
+
+                function k(e, t, o, a) {
+                    var l, m, y, b, w, C = t;
+                    2 !== v && (v = 2, s && clearTimeout(s), n = undefined, i = a || "", T.readyState = e > 0 ? 4 : 0, l = e >= 200 && 300 > e || 304 === e, o && (b = pn(c, T, o)), b = fn(c, b, T, l), l ? (c.ifModified && (w = T.getResponseHeader("Last-Modified"), w && (x.lastModified[r] = w), w = T.getResponseHeader("etag"), w && (x.etag[r] = w)), 204 === e || "HEAD" === c.type ? C = "nocontent" : 304 === e ? C = "notmodified" : (C = b.state, m = b.data, y = b.error, l = !y)) : (y = C, (e || !C) && (C = "error", 0 > e && (e = 0))), T.status = e, T.statusText = (t || C) + "", l ? h.resolveWith(p, [m, C, T]) : h.rejectWith(p, [T, C, y]), T.statusCode(g), g = undefined, u && f.trigger(l ? "ajaxSuccess" : "ajaxError", [T, c, l ? m : y]), d.fireWith(p, [T, C]), u && (f.trigger("ajaxComplete", [T, c]), --x.active || x.event.trigger("ajaxStop")))
+                }
+                return T
+            },
+            getJSON: function (e, t, n) {
+                return x.get(e, t, n, "json")
+            },
+            getScript: function (e, t) {
+                return x.get(e, undefined, t, "script")
+            }
+        }), x.each(["get", "post"], function (e, t) {
+            x[t] = function (e, n, r, i) {
+                return x.isFunction(n) && (i = i || r, r = n, n = undefined), x.ajax({
+                    url: e,
+                    type: t,
+                    dataType: i,
+                    data: n,
+                    success: r
+                })
+            }
+        });
+
+        function pn(e, t, n) {
+            var r, i, o, s, a = e.contents,
+                u = e.dataTypes;
+            while ("*" === u[0]) u.shift(), r === undefined && (r = e.mimeType || t.getResponseHeader("Content-Type"));
+            if (r)
+                for (i in a)
+                    if (a[i] && a[i].test(r)) {
+                        u.unshift(i);
+                        break
+                    }
+            if (u[0] in n) o = u[0];
+            else {
+                for (i in n) {
+                    if (!u[0] || e.converters[i + " " + u[0]]) {
+                        o = i;
+                        break
+                    }
+                    s || (s = i)
+                }
+                o = o || s
+            }
+            return o ? (o !== u[0] && u.unshift(o), n[o]) : undefined
+        }
+
+        function fn(e, t, n, r) {
+            var i, o, s, a, u, l = {}, c = e.dataTypes.slice();
+            if (c[1])
+                for (s in e.converters) l[s.toLowerCase()] = e.converters[s];
+            o = c.shift();
+            while (o)
+                if (e.responseFields[o] && (n[e.responseFields[o]] = t), !u && r && e.dataFilter && (t = e.dataFilter(t, e.dataType)), u = o, o = c.shift())
+                    if ("*" === o) o = u;
+                    else if ("*" !== u && u !== o) {
+                if (s = l[u + " " + o] || l["* " + o], !s)
+                    for (i in l)
+                        if (a = i.split(" "), a[1] === o && (s = l[u + " " + a[0]] || l["* " + a[0]])) {
+                            s === !0 ? s = l[i] : l[i] !== !0 && (o = a[0], c.unshift(a[1]));
+                            break
+                        }
+                if (s !== !0)
+                    if (s && e["throws"]) t = s(t);
+                    else try {
+                        t = s(t)
+                    } catch (p) {
+                        return {
+                            state: "parsererror",
+                            error: s ? p : "No conversion from " + u + " to " + o
+                        }
+                    }
+            }
+            return {
+                state: "success",
+                data: t
+            }
+        }
+        x.ajaxSetup({
+            accepts: {
+                script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+            },
+            contents: {
+                script: /(?:java|ecma)script/
+            },
+            converters: {
+                "text script": function (e) {
+                    return x.globalEval(e), e
+                }
+            }
+        }), x.ajaxPrefilter("script", function (e) {
+            e.cache === undefined && (e.cache = !1), e.crossDomain && (e.type = "GET")
+        }), x.ajaxTransport("script", function (e) {
+            if (e.crossDomain) {
+                var t, n;
+                return {
+                    send: function (r, i) {
+                        t = x("<script>").prop({
+                            async: !0,
+                            charset: e.scriptCharset,
+                            src: e.url
+                        }).on("load error", n = function (e) {
+                            t.remove(), n = null, e && i("error" === e.type ? 404 : 200, e.type)
+                        }), o.head.appendChild(t[0])
+                    },
+                    abort: function () {
+                        n && n()
+                    }
+                }
+            }
+        });
+        var hn = [],
+            dn = /(=)\?(?=&|$)|\?\?/;
+        x.ajaxSetup({
+            jsonp: "callback",
+            jsonpCallback: function () {
+                var e = hn.pop() || x.expando + "_" + Yt++;
+                return this[e] = !0, e
+            }
+        }), x.ajaxPrefilter("json jsonp", function (t, n, r) {
+            var i, o, s, a = t.jsonp !== !1 && (dn.test(t.url) ? "url" : "string" == typeof t.data && !(t.contentType || "").indexOf("application/x-www-form-urlencoded") && dn.test(t.data) && "data");
+            return a || "jsonp" === t.dataTypes[0] ? (i = t.jsonpCallback = x.isFunction(t.jsonpCallback) ? t.jsonpCallback() : t.jsonpCallback, a ? t[a] = t[a].replace(dn, "$1" + i) : t.jsonp !== !1 && (t.url += (Vt.test(t.url) ? "&" : "?") + t.jsonp + "=" + i), t.converters["script json"] = function () {
+                return s || x.error(i + " was not called"), s[0]
+            }, t.dataTypes[0] = "json", o = e[i], e[i] = function () {
+                s = arguments
+            }, r.always(function () {
+                e[i] = o, t[i] && (t.jsonpCallback = n.jsonpCallback, hn.push(i)), s && x.isFunction(o) && o(s[0]), s = o = undefined
+            }), "script") : undefined
+        }), x.ajaxSettings.xhr = function () {
+            try {
+                return new XMLHttpRequest
+            } catch (e) {}
+        };
+        var gn = x.ajaxSettings.xhr(),
+            mn = {
+                0: 200,
+                1223: 204
+            }, yn = 0,
+            vn = {};
+        e.ActiveXObject && x(e).on("unload", function () {
+            for (var e in vn) vn[e]();
+            vn = undefined
+        }), x.support.cors = !! gn && "withCredentials" in gn, x.support.ajax = gn = !! gn, x.ajaxTransport(function (e) {
+            var t;
+            return x.support.cors || gn && !e.crossDomain ? {
+                send: function (n, r) {
+                    var i, o, s = e.xhr();
+                    if (s.open(e.type, e.url, e.async, e.username, e.password), e.xhrFields)
+                        for (i in e.xhrFields) s[i] = e.xhrFields[i];
+                    e.mimeType && s.overrideMimeType && s.overrideMimeType(e.mimeType), e.crossDomain || n["X-Requested-With"] || (n["X-Requested-With"] = "XMLHttpRequest");
+                    for (i in n) s.setRequestHeader(i, n[i]);
+                    t = function (e) {
+                        return function () {
+                            t && (delete vn[o], t = s.onload = s.onerror = null, "abort" === e ? s.abort() : "error" === e ? r(s.status || 404, s.statusText) : r(mn[s.status] || s.status, s.statusText, "string" == typeof s.responseText ? {
+                                text: s.responseText
+                            } : undefined, s.getAllResponseHeaders()))
+                        }
+                    }, s.onload = t(), s.onerror = t("error"), t = vn[o = yn++] = t("abort"), s.send(e.hasContent && e.data || null)
+                },
+                abort: function () {
+                    t && t()
+                }
+            } : undefined
+        });
+        var xn, bn, wn = /^(?:toggle|show|hide)$/,
+            Tn = RegExp("^(?:([+-])=|)(" + b + ")([a-z%]*)$", "i"),
+            Cn = /queueHooks$/,
+            kn = [An],
+            Nn = {
+                "*": [
+                    function (e, t) {
+                        var n = this.createTween(e, t),
+                            r = n.cur(),
+                            i = Tn.exec(t),
+                            o = i && i[3] || (x.cssNumber[e] ? "" : "px"),
+                            s = (x.cssNumber[e] || "px" !== o && +r) && Tn.exec(x.css(n.elem, e)),
+                            a = 1,
+                            u = 20;
+                        if (s && s[3] !== o) {
+                            o = o || s[3], i = i || [], s = +r || 1;
+                            do a = a || ".5", s /= a, x.style(n.elem, e, s + o); while (a !== (a = n.cur() / r) && 1 !== a && --u)
+                        }
+                        return i && (s = n.start = +s || +r || 0, n.unit = o, n.end = i[1] ? s + (i[1] + 1) * i[2] : +i[2]), n
+                    }
+                ]
+            };
+
+        function En() {
+            return setTimeout(function () {
+                xn = undefined
+            }), xn = x.now()
+        }
+
+        function Sn(e, t, n) {
+            var r, i = (Nn[t] || []).concat(Nn["*"]),
+                o = 0,
+                s = i.length;
+            for (; s > o; o++)
+                if (r = i[o].call(n, t, e)) return r
+        }
+
+        function jn(e, t, n) {
+            var r, i, o = 0,
+                s = kn.length,
+                a = x.Deferred().always(function () {
+                    delete u.elem
+                }),
+                u = function () {
+                    if (i) return !1;
+                    var t = xn || En(),
+                        n = Math.max(0, l.startTime + l.duration - t),
+                        r = n / l.duration || 0,
+                        o = 1 - r,
+                        s = 0,
+                        u = l.tweens.length;
+                    for (; u > s; s++) l.tweens[s].run(o);
+                    return a.notifyWith(e, [l, o, n]), 1 > o && u ? n : (a.resolveWith(e, [l]), !1)
+                }, l = a.promise({
+                    elem: e,
+                    props: x.extend({}, t),
+                    opts: x.extend(!0, {
+                        specialEasing: {}
+                    }, n),
+                    originalProperties: t,
+                    originalOptions: n,
+                    startTime: xn || En(),
+                    duration: n.duration,
+                    tweens: [],
+                    createTween: function (t, n) {
+                        var r = x.Tween(e, l.opts, t, n, l.opts.specialEasing[t] || l.opts.easing);
+                        return l.tweens.push(r), r
+                    },
+                    stop: function (t) {
+                        var n = 0,
+                            r = t ? l.tweens.length : 0;
+                        if (i) return this;
+                        for (i = !0; r > n; n++) l.tweens[n].run(1);
+                        return t ? a.resolveWith(e, [l, t]) : a.rejectWith(e, [l, t]), this
+                    }
+                }),
+                c = l.props;
+            for (Dn(c, l.opts.specialEasing); s > o; o++)
+                if (r = kn[o].call(l, e, c, l.opts)) return r;
+            return x.map(c, Sn, l), x.isFunction(l.opts.start) && l.opts.start.call(e, l), x.fx.timer(x.extend(u, {
+                elem: e,
+                anim: l,
+                queue: l.opts.queue
+            })), l.progress(l.opts.progress).done(l.opts.done, l.opts.complete).fail(l.opts.fail).always(l.opts.always)
+        }
+
+        function Dn(e, t) {
+            var n, r, i, o, s;
+            for (n in e)
+                if (r = x.camelCase(n), i = t[r], o = e[n], x.isArray(o) && (i = o[1], o = e[n] = o[0]), n !== r && (e[r] = o, delete e[n]), s = x.cssHooks[r], s && "expand" in s) {
+                    o = s.expand(o), delete e[r];
+                    for (n in o) n in e || (e[n] = o[n], t[n] = i)
+                } else t[r] = i
+        }
+        x.Animation = x.extend(jn, {
+            tweener: function (e, t) {
+                x.isFunction(e) ? (t = e, e = ["*"]) : e = e.split(" ");
+                var n, r = 0,
+                    i = e.length;
+                for (; i > r; r++) n = e[r], Nn[n] = Nn[n] || [], Nn[n].unshift(t)
+            },
+            prefilter: function (e, t) {
+                t ? kn.unshift(e) : kn.push(e)
+            }
+        });
+
+        function An(e, t, n) {
+            var r, i, o, s, a, u, l = this,
+                c = {}, p = e.style,
+                f = e.nodeType && Lt(e),
+                h = H.get(e, "fxshow");
+            n.queue || (a = x._queueHooks(e, "fx"), null == a.unqueued && (a.unqueued = 0, u = a.empty.fire, a.empty.fire = function () {
+                a.unqueued || u()
+            }), a.unqueued++, l.always(function () {
+                l.always(function () {
+                    a.unqueued--, x.queue(e, "fx").length || a.empty.fire()
+                })
+            })), 1 === e.nodeType && ("height" in t || "width" in t) && (n.overflow = [p.overflow, p.overflowX, p.overflowY], "inline" === x.css(e, "display") && "none" === x.css(e, "float") && (p.display = "inline-block")), n.overflow && (p.overflow = "hidden", l.always(function () {
+                p.overflow = n.overflow[0], p.overflowX = n.overflow[1], p.overflowY = n.overflow[2]
+            }));
+            for (r in t)
+                if (i = t[r], wn.exec(i)) {
+                    if (delete t[r], o = o || "toggle" === i, i === (f ? "hide" : "show")) {
+                        if ("show" !== i || !h || h[r] === undefined) continue;
+                        f = !0
+                    }
+                    c[r] = h && h[r] || x.style(e, r)
+                }
+            if (!x.isEmptyObject(c)) {
+                h ? "hidden" in h && (f = h.hidden) : h = H.access(e, "fxshow", {}), o && (h.hidden = !f), f ? x(e).show() : l.done(function () {
+                    x(e).hide()
+                }), l.done(function () {
+                    var t;
+                    H.remove(e, "fxshow");
+                    for (t in c) x.style(e, t, c[t])
+                });
+                for (r in c) s = Sn(f ? h[r] : 0, r, l), r in h || (h[r] = s.start, f && (s.end = s.start, s.start = "width" === r || "height" === r ? 1 : 0))
+            }
+        }
+
+        function Ln(e, t, n, r, i) {
+            return new Ln.prototype.init(e, t, n, r, i)
+        }
+        x.Tween = Ln, Ln.prototype = {
+            constructor: Ln,
+            init: function (e, t, n, r, i, o) {
+                this.elem = e, this.prop = n, this.easing = i || "swing", this.options = t, this.start = this.now = this.cur(), this.end = r, this.unit = o || (x.cssNumber[n] ? "" : "px")
+            },
+            cur: function () {
+                var e = Ln.propHooks[this.prop];
+                return e && e.get ? e.get(this) : Ln.propHooks._default.get(this)
+            },
+            run: function (e) {
+                var t, n = Ln.propHooks[this.prop];
+                return this.pos = t = this.options.duration ? x.easing[this.easing](e, this.options.duration * e, 0, 1, this.options.duration) : e, this.now = (this.end - this.start) * t + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), n && n.set ? n.set(this) : Ln.propHooks._default.set(this), this
+            }
+        }, Ln.prototype.init.prototype = Ln.prototype, Ln.propHooks = {
+            _default: {
+                get: function (e) {
+                    var t;
+                    return null == e.elem[e.prop] || e.elem.style && null != e.elem.style[e.prop] ? (t = x.css(e.elem, e.prop, ""), t && "auto" !== t ? t : 0) : e.elem[e.prop]
+                },
+                set: function (e) {
+                    x.fx.step[e.prop] ? x.fx.step[e.prop](e) : e.elem.style && (null != e.elem.style[x.cssProps[e.prop]] || x.cssHooks[e.prop]) ? x.style(e.elem, e.prop, e.now + e.unit) : e.elem[e.prop] = e.now
+                }
+            }
+        }, Ln.propHooks.scrollTop = Ln.propHooks.scrollLeft = {
+            set: function (e) {
+                e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now)
+            }
+        }, x.each(["toggle", "show", "hide"], function (e, t) {
+            var n = x.fn[t];
+            x.fn[t] = function (e, r, i) {
+                return null == e || "boolean" == typeof e ? n.apply(this, arguments) : this.animate(Hn(t, !0), e, r, i)
+            }
+        }), x.fn.extend({
+            fadeTo: function (e, t, n, r) {
+                return this.filter(Lt).css("opacity", 0).show().end().animate({
+                    opacity: t
+                }, e, n, r)
+            },
+            animate: function (e, t, n, r) {
+                var i = x.isEmptyObject(e),
+                    o = x.speed(t, n, r),
+                    s = function () {
+                        var t = jn(this, x.extend({}, e), o);
+                        (i || H.get(this, "finish")) && t.stop(!0)
+                    };
+                return s.finish = s, i || o.queue === !1 ? this.each(s) : this.queue(o.queue, s)
+            },
+            stop: function (e, t, n) {
+                var r = function (e) {
+                    var t = e.stop;
+                    delete e.stop, t(n)
+                };
+                return "string" != typeof e && (n = t, t = e, e = undefined), t && e !== !1 && this.queue(e || "fx", []), this.each(function () {
+                    var t = !0,
+                        i = null != e && e + "queueHooks",
+                        o = x.timers,
+                        s = H.get(this);
+                    if (i) s[i] && s[i].stop && r(s[i]);
+                    else
+                        for (i in s) s[i] && s[i].stop && Cn.test(i) && r(s[i]);
+                    for (i = o.length; i--;) o[i].elem !== this || null != e && o[i].queue !== e || (o[i].anim.stop(n), t = !1, o.splice(i, 1));
+                    (t || !n) && x.dequeue(this, e)
+                })
+            },
+            finish: function (e) {
+                return e !== !1 && (e = e || "fx"), this.each(function () {
+                    var t, n = H.get(this),
+                        r = n[e + "queue"],
+                        i = n[e + "queueHooks"],
+                        o = x.timers,
+                        s = r ? r.length : 0;
+                    for (n.finish = !0, x.queue(this, e, []), i && i.stop && i.stop.call(this, !0), t = o.length; t--;) o[t].elem === this && o[t].queue === e && (o[t].anim.stop(!0), o.splice(t, 1));
+                    for (t = 0; s > t; t++) r[t] && r[t].finish && r[t].finish.call(this);
+                    delete n.finish
+                })
+            }
+        });
+
+        function Hn(e, t) {
+            var n, r = {
+                    height: e
+                }, i = 0;
+            for (t = t ? 1 : 0; 4 > i; i += 2 - t) n = jt[i], r["margin" + n] = r["padding" + n] = e;
+            return t && (r.opacity = r.width = e), r
+        }
+        x.each({
+            slideDown: Hn("show"),
+            slideUp: Hn("hide"),
+            slideToggle: Hn("toggle"),
+            fadeIn: {
+                opacity: "show"
+            },
+            fadeOut: {
+                opacity: "hide"
+            },
+            fadeToggle: {
+                opacity: "toggle"
+            }
+        }, function (e, t) {
+            x.fn[e] = function (e, n, r) {
+                return this.animate(t, e, n, r)
+            }
+        }), x.speed = function (e, t, n) {
+            var r = e && "object" == typeof e ? x.extend({}, e) : {
+                complete: n || !n && t || x.isFunction(e) && e,
+                duration: e,
+                easing: n && t || t && !x.isFunction(t) && t
+            };
+            return r.duration = x.fx.off ? 0 : "number" == typeof r.duration ? r.duration : r.duration in x.fx.speeds ? x.fx.speeds[r.duration] : x.fx.speeds._default, (null == r.queue || r.queue === !0) && (r.queue = "fx"), r.old = r.complete, r.complete = function () {
+                x.isFunction(r.old) && r.old.call(this), r.queue && x.dequeue(this, r.queue)
+            }, r
+        }, x.easing = {
+            linear: function (e) {
+                return e
+            },
+            swing: function (e) {
+                return .5 - Math.cos(e * Math.PI) / 2
+            }
+        }, x.timers = [], x.fx = Ln.prototype.init, x.fx.tick = function () {
+            var e, t = x.timers,
+                n = 0;
+            for (xn = x.now(); t.length > n; n++) e = t[n], e() || t[n] !== e || t.splice(n--, 1);
+            t.length || x.fx.stop(), xn = undefined
+        }, x.fx.timer = function (e) {
+            e() && x.timers.push(e) && x.fx.start()
+        }, x.fx.interval = 13, x.fx.start = function () {
+            bn || (bn = setInterval(x.fx.tick, x.fx.interval))
+        }, x.fx.stop = function () {
+            clearInterval(bn), bn = null
+        }, x.fx.speeds = {
+            slow: 600,
+            fast: 200,
+            _default: 400
+        }, x.fx.step = {}, x.expr && x.expr.filters && (x.expr.filters.animated = function (e) {
+            return x.grep(x.timers, function (t) {
+                return e === t.elem
+            }).length
+        }), x.fn.offset = function (e) {
+            if (arguments.length) return e === undefined ? this : this.each(function (t) {
+                x.offset.setOffset(this, e, t)
+            });
+            var t, n, i = this[0],
+                o = {
+                    top: 0,
+                    left: 0
+                }, s = i && i.ownerDocument;
+            if (s) return t = s.documentElement, x.contains(t, i) ? (typeof i.getBoundingClientRect !== r && (o = i.getBoundingClientRect()), n = qn(s), {
+                top: o.top + n.pageYOffset - t.clientTop,
+                left: o.left + n.pageXOffset - t.clientLeft
+            }) : o
+        }, x.offset = {
+            setOffset: function (e, t, n) {
+                var r, i, o, s, a, u, l, c = x.css(e, "position"),
+                    p = x(e),
+                    f = {};
+                "static" === c && (e.style.position = "relative"), a = p.offset(), o = x.css(e, "top"), u = x.css(e, "left"), l = ("absolute" === c || "fixed" === c) && (o + u).indexOf("auto") > -1, l ? (r = p.position(), s = r.top, i = r.left) : (s = parseFloat(o) || 0, i = parseFloat(u) || 0), x.isFunction(t) && (t = t.call(e, n, a)), null != t.top && (f.top = t.top - a.top + s), null != t.left && (f.left = t.left - a.left + i), "using" in t ? t.using.call(e, f) : p.css(f)
+            }
+        }, x.fn.extend({
+            position: function () {
+                if (this[0]) {
+                    var e, t, n = this[0],
+                        r = {
+                            top: 0,
+                            left: 0
+                        };
+                    return "fixed" === x.css(n, "position") ? t = n.getBoundingClientRect() : (e = this.offsetParent(), t = this.offset(), x.nodeName(e[0], "html") || (r = e.offset()), r.top += x.css(e[0], "borderTopWidth", !0), r.left += x.css(e[0], "borderLeftWidth", !0)), {
+                        top: t.top - r.top - x.css(n, "marginTop", !0),
+                        left: t.left - r.left - x.css(n, "marginLeft", !0)
+                    }
+                }
+            },
+            offsetParent: function () {
+                return this.map(function () {
+                    var e = this.offsetParent || s;
+                    while (e && !x.nodeName(e, "html") && "static" === x.css(e, "position")) e = e.offsetParent;
+                    return e || s
+                })
+            }
+        }), x.each({
+            scrollLeft: "pageXOffset",
+            scrollTop: "pageYOffset"
+        }, function (t, n) {
+            var r = "pageYOffset" === n;
+            x.fn[t] = function (i) {
+                return x.access(this, function (t, i, o) {
+                    var s = qn(t);
+                    return o === undefined ? s ? s[n] : t[i] : (s ? s.scrollTo(r ? e.pageXOffset : o, r ? o : e.pageYOffset) : t[i] = o, undefined)
+                }, t, i, arguments.length, null)
+            }
+        });
+
+        function qn(e) {
+            return x.isWindow(e) ? e : 9 === e.nodeType && e.defaultView
+        }
+        x.each({
+            Height: "height",
+            Width: "width"
+        }, function (e, t) {
+            x.each({
+                padding: "inner" + e,
+                content: t,
+                "": "outer" + e
+            }, function (n, r) {
+                x.fn[r] = function (r, i) {
+                    var o = arguments.length && (n || "boolean" != typeof r),
+                        s = n || (r === !0 || i === !0 ? "margin" : "border");
+                    return x.access(this, function (t, n, r) {
+                        var i;
+                        return x.isWindow(t) ? t.document.documentElement["client" + e] : 9 === t.nodeType ? (i = t.documentElement, Math.max(t.body["scroll" + e], i["scroll" + e], t.body["offset" + e], i["offset" + e], i["client" + e])) : r === undefined ? x.css(t, n, s) : x.style(t, n, r, s)
+                    }, t, o ? r : undefined, o, null)
+                }
+            })
+        }), x.fn.size = function () {
+            return this.length
+        }, x.fn.andSelf = x.fn.addBack, "object" == typeof module && module && "object" == typeof module.exports ? module.exports = x : "function" == typeof define && define.amd && define("jquery", [], function () {
+            return x
+        }), "object" == typeof e && "object" == typeof e.document && (e.jQuery = e.$ = x)
+    })(window);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/resources/js/proxyMethods.js	Thu Apr 23 15:46:01 2015 +0200
@@ -0,0 +1,45 @@
+
+
+function setAction(action, formName){
+	var theForm = document.forms[formName];
+    var input = document.createElement('input');
+    input.type = 'hidden';
+    input.name = 'action';
+    input.value = action;
+    theForm.appendChild(input);    
+}
+
+
+function setAction0(action, formName, varName, varValue){
+	
+	var theForm = document.forms[formName];
+    var input = document.createElement('input');
+    input.type = 'hidden';
+    input.name = varName;
+    input.value = varValue;
+    theForm.appendChild(input);  
+	
+	setAction(action, formName);
+}
+
+function deleteBranch(action, formName, branchId){
+	
+	var theForm = document.forms[formName];
+    var input = document.createElement('input');
+    input.type = 'hidden';
+    input.name = 'branchId';
+    input.value = branchId;
+    theForm.appendChild(input);  
+	
+	setAction(action, formName);
+}
+
+function addContributor(action, formName, userId){
+	var theForm = document.forms[formName];
+    var input = document.createElement('input');
+    input.type = 'hidden';
+    input.name = 'userId';
+    input.value = userId;
+    theForm.appendChild(input);  
+	setAction(action, formName);
+}
\ No newline at end of file