.append("\" alt=")
.append("\" alt=\"")
    private String getThumbMarkup(HttpServletRequest hrq, Item item) throws JspException    {    	Bundle[] original = item.getBundles("ORIGINAL");    	boolean html = false;     	    	// if multiple bitstreams, check if the primary one is HTML		if (original[0].getBitstreams().length > 1)		{            Bitstream[] bitstreams = original[0].getBitstreams();            for (int i = 0; i < bitstreams.length && !html; i++)            {                if (bitstreams[i].getID() == original[0].getPrimaryBitstreamID())                {                    html = bitstreams[i].getFormat().getMIMEType().equals("text/html");                }            }				}		    	Bundle[] thumbs = item.getBundles("THUMBNAIL");    	    	// if there are thumbs and we're not dealing with an HTML item    	// then show the thumbnail    	if (thumbs.length > 0 && !html)        {    		try			{				Context c = UIUtil.obtainContext(hrq);				Bitstream thumbnailBitstream;				Bitstream originalBitstream;    			    		if (original[0].getBitstreams().length > 1 &&	    			original[0].getPrimaryBitstreamID() > -1)	    		{	    			originalBitstream = Bitstream.find(c, original[0].getPrimaryBitstreamID());	    			thumbnailBitstream = thumbs[0].getBitstreamByName(originalBitstream.getName() + ".jpg");	    		}	    		else	    		{	    			originalBitstream = original[0].getBitstreams()[0];	    	  		thumbnailBitstream = thumbs[0].getBitstreams()[0];    	  			    		}	              				    		if ((thumbnailBitstream != null) &&	    			(AuthorizeManager.authorizeActionBoolean(c, thumbnailBitstream, Constants.READ)))  	    		{	    			StringBuffer thumbLink;	    				    			if (linkToBitstream)	    			{		        		thumbLink = new StringBuffer("<br/><a target=_blank href=\"")							.append(hrq.getContextPath())							.append("/bitstream/")							.append(item.getHandle())							.append("/")							.append(originalBitstream.getSequenceID())							.append("/")							.append(URLEncoder.encode(originalBitstream.getName()));	    			}	    			else	    			{		        		thumbLink = new StringBuffer("<br/><a href=\"")							.append(hrq.getContextPath())							.append("/handle/")							.append(item.getHandle());	    			}						    			thumbLink.append("\"><img src=\"")						.append(hrq.getContextPath())						.append("/retrieve/")						.append(thumbnailBitstream.getID())						.append("/")   						.append(URLEncoder.encode(thumbnailBitstream.getName()))						.append("\" alt=")						.append(thumbnailBitstream.getName())						.append("\" ")						.append(getScalingAttr(hrq, thumbnailBitstream))						.append("/></a>");	    				    			return thumbLink.toString();	    		}			}    		catch (SQLException sqle)			{    			throw new JspException(sqle.getMessage());			}	    }    	return "";    }