jQ(function(){
		
//Dropdown menu
		jQ("ul.DropDown li:has(ul)").find("a:first").append("<span class='HasDropDown'></span>");
			jQ("ul.DropDown li").hover(function(){
							jQ(this).addClass("Hover");
							jQ('ul:first',this).css('visibility', 'visible');
			}, function(){
							jQ(this).removeClass("Hover");
							jQ('ul:first',this).css('visibility', 'hidden');
							jQ('ul.ClassViewMenu li a:last').css('border-bottom', 'none');//Cos IE can't do ul li:last-child a in css :(
							jQ('ul.ClassSearchMenu li a:last').css('border-bottom', 'none');
								
			});
});
			
//Add class to last nav link
jQ('#MainNav li').last().addClass('Last');
			
//Add class to external links, and open them in new window
	jQ("a").filter(function() {
	return this.hostname && this.hostname !== location.hostname;
	}).addClass('ExternalLink').attr({ target: "_blank" });
	jQ("#Footer a").removeClass('ExternalLink');
	jQ("a.Donate").removeClass('ExternalLink');
	jQ("a.addthis_button").removeClass('ExternalLink');	
	
//Add spaces and commas to printable features list, last-child very handy (last would not work)
jQ(".printable #Feature1 ul li, .printable #Feature2 ul li").each(function(){
      jQ(this).not(':last-child').append(",&nbsp;");
});

//	Clearing form values on focus and adding a style
//	jQ('.ClearMe').each(function() {
//					var default_value = this.value;
//					jQ(this).focus(function() {
//									jQ(this).addClass('InputFocused');
//									if(this.value == default_value) {
//													this.value = '';
//									}
//					});
//					jQ(this).blur(function() {
//									if(this.value === '') {
//										jQ(this).removeClass('InputFocused');
//													this.value = default_value;
//									}
//					});
//	});
		
//Admin tools show/hide
	jQ(".AdminSearchResultLinks").hide();
	
//Init colorbox
if (jQ("a[rel='colorbox']").length) {
	jQ("a[rel='colorbox']").colorbox({rel:'nofollow'});
}
	
	jQ("a.AdminToolsToggle").toggle(function() {
			jQ(this).html('Hide admin tools');
			jQ(".AdminSearchResultLinks").slideToggle(180);
	}, function() {
			jQ(this).html('Show admin tools');
			jQ(".AdminSearchResultLinks").slideToggle(180);
					
});
