<%!
	breadcrumbs = new ArrayList();
	currentBreadCrumbFolderName = "";
	prefix = "";
	prevLevel = 0;
	indexPageNameFull = engine.getIndexPageName() + engine.getPageExtension();
	 
	calculatePath(File dir, int level) {
		if (imageNum!=void && imageNum!=null) {
			prefix="../";
		} else {
	  		prefix="";
	  	}
	  	if (indexNum == void || indexNum == 1) {
	    	if (level == prevLevel) {
	      		if (breadcrumbs.size() > 0) {
	      			breadcrumbs.remove(breadcrumbs.size() - 1);
	      		}
	    	} else if(level < prevLevel) {
	      		while (breadcrumbs.size() > level) {
	      			breadcrumbs.remove(breadcrumbs.size() - 1);
	      		}
	    	}
	    	breadcrumbs.add(currentBreadCrumbFolderName);
	    	prevLevel = level;
	  	}	  	
	}
	
	writeTitle(separator) {
		StringBuffer title = new StringBuffer();
	  	for (int i = 0; i < breadcrumbs.size(); i++) {
		    if (i < breadcrumbs.size() - 1) {
		    	title.append(breadcrumbs.get(i));
		      	title.append(" " + separator + " ");
		    } else {
		    	title.append(breadcrumbs.get(i));
		    }
	  	}
		return title.toString();
	}
	
	writePath(separator) {
		StringBuffer path = new StringBuffer();
	  	for (int i = 0; i < breadcrumbs.size(); i++) {
		    if (i < breadcrumbs.size() - 1) {
		    	path.append(formatPath(prefix + indexPageNameFull, breadcrumbs.get(i), breadcrumbs.size()-i));
		      	path.append(" " + separator + " ");
		    } else if (imageNum!=void && imageNum!=null) {
		    	path.append(formatPath(prefix + indexPageNameFull, breadcrumbs.get(i), breadcrumbs.size()-i));
		    } else {
		    	path.append(breadcrumbs.get(i));
		    }
	  	}
		return path.toString();
	}
	 
	formatPath(String toGo, String toShow, int level) {
	  	StringBuffer up = new StringBuffer();
	  	while(--level > 0) {
	  		up.append("../");
	  	}
	  	return "<a href=\"" + up.toString() + toGo + "\">" + toShow + "</a>"; 
	}
%>
