<%!
	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(albumTitle, separator) {
		StringBuffer title = new StringBuffer();
	  	for (int i = 0; i < breadcrumbs.size(); i++) {
           if (i < breadcrumbs.size() - 1) {
	    		if (i > 0) {
		    		title.append(breadcrumbs.get(i));
	    		} else {
	    			title.append(albumTitle);
	    		}
		      	title.append(" " + separator + " ");
		    } else {
                if (prevLevel > 0) {
                    title.append(breadcrumbs.get(i));
                } else {
                    title.append(albumTitle);
                }
		    }
	  	}
		return title.toString();
	}
	
	writePath(albumTitle, separator) {
		StringBuffer path = new StringBuffer();
		if (homepageAddress != void && homepageAddress != null && homepageAddress.length() > 0) {
			path.append("<a href=\"" + homepageAddress + "\">" + homepageLinkText + "</a>");
			path.append(separator);
		}
	  	for (int i = 0; i < breadcrumbs.size(); i++) {
    		if (i < breadcrumbs.size() - 1) {
    			if (i > 0) {
    				path.append(formatPath(prefix + indexPageNameFull, breadcrumbs.get(i), breadcrumbs.size()-i));
    			} else {
    				path.append(formatPath(prefix + indexPageNameFull, albumTitle, breadcrumbs.size()-i));
    			}
      			path.append(" " + separator + " ");
    		} else if (imageNum != void && imageNum != null) {
    			if (prevLevel > 0) {
		    		path.append(formatPath(prefix + indexPageNameFull, breadcrumbs.get(i), breadcrumbs.size()-i));
    			} else {
    				path.append(formatPath(prefix + indexPageNameFull, albumTitle, 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>"; 
	}
%>
