<script type="text/javascript"> 
   //<![CDATA[
	$(document).ready(function() {
  		/* Init Sidebar_2 */
  		$("#side2").accordion({
			autoHeight: false,
			clearStyle: true,					
			header: "h3"
		});
		$("#side2").accordion("activate", 1);					
		/* Load TagCloud */
		loadTagCloud();
	});
	
	$("#topwords").treeview({
			unique: true
	});
		
	function loadTagCloud() {		
		$("#tagcloud *").remove();
		$("#sidebar-2-1").toggleClass("ui.loading");
		$.ajax({
			type: "POST",
			url: "/api/ymarks/get_tags.xml?top=25&sort=alpha",			
			dataType: "xml",
			cache: false,
			success: function(xml) {				
				var bhtml = "<li id='bmk_tags_folder' class='closed'><span class='folder'>Bookmark Tags</span><ul>";
				$(xml).find('tag').each(function(){					
					var count = $(this).attr('count');
					var tag = $(this).attr('tag');										
					var size = ((count/20)+0.3);
					if (size < 1) {size = 1;}					
					$('<a style="font-size:'+size+'em"></a>')
						.html(HTMLenc(tag)+' ')						
						.appendTo('#tagcloud')
						.bind('click', function() {
							qtag = $(this).text().replace(/\s+/g,"");
							$("select[name='resource']").setValue('ymarks');
							$("input[name='search']").setValue(qtag);
							if ($tabs.data('selected.tabs') == bmk_tab) {
								reloadBM();
							} else {
								$tabs.tabs('select',2);
							}							
						});
					bhtml = bhtml + "<li><span class='tag'>"+tag+"</span></li>";																										
				}); //close each(
				bhtml = bhtml + "</ul></li>";
				var bfold = $(bhtml).prependTo("#yfolder");
				$("#yfolder").treeview({
					add: bfold
				});		
				$("#sidebar-2-1").toggleClass("ui.loading");
			}
		}); //close $.ajax(	
	}	
  //]]>  
</script>

<h3 id="sidebar-2-0"><a href="#">Search Options</a></h3><!-- 0 -->
<div class="yform">	
		<form id="yoptions" class="small" method="get" action="" accept-charset="UTF-8">			
			<p>			
			<label for="constraint">Constraint:</label>
			<br />
			<select class="selector" id="constraint" name="constraint">
				<option value="" selected="selected">all pages</option>
				<option value="AQAAAA" >index pages</option>														
			</select>			
			<br />
			<label for="urlmaskfilter">URL mask:</label>
			<br />
			<input class="filter" name="urlmaskfilter" value=".*" type="text" size="12" maxlength="80" />
			<img src="img-2/question_blue.png" class="help" alt="help" title="help" />
			<br />
			<label for="prefermaskfilter">Prefer mask:</label>
			<br />
			<input class="filter" name="prefermaskfilter" value="" type="text" size="12" maxlength="80" />
			<img src="img-2/question_blue.png" class="help" alt="help" title="help" />		
			</p>
		</form>			
</div>

<h3 id="sidebar-2-1"><a href="#">Bookmark TagCloud</a></h3><!-- 1 -->
<div>
	<p id="tagcloud"></p>	
</div>

<h3 id="sidebar-2-2"><a href="#">Topwords</a></h3><!-- 2 -->
<div>
	<ul id="topwords" class="filetree">
		<li><span class='folder'>Topwords</span>
			<ul id="topul">
			</ul>
		</li>
	</ul>	
</div>