$(function(){
		
//Dropdown menu
		$("ul.DropDown li:has(ul)").find("a:first").append("<span class='HasDropDown'></span>");
			$("ul.DropDown li").hover(function(){
							$(this).addClass("Hover");
							$('ul:first',this).css('visibility', 'visible');
			}, function(){
							$(this).removeClass("Hover");
							$('ul:first',this).css('visibility', 'hidden');
							$('ul.ClassViewMenu li a:last').css('border-bottom', 'none');//Cos IE can't do ul li:last-child a in css :(
							$('ul.ClassSearchMenu li a:last').css('border-bottom', 'none');
								
			});
});
			
//Add class to last nav link
$('#MainNav li').last().addClass('Last');
			
//Add class to external links, and open them in new window
	$("a").filter(function() {
	return this.hostname && this.hostname !== location.hostname;
	}).addClass('ExternalLink').attr({ target: "_blank" });
	$("#Footer a").removeClass('ExternalLink');
	$("a.Donate").removeClass('ExternalLink');
	$("a.addthis_button").removeClass('ExternalLink');	
	
//Add spaces and commas to printable features list, last-child very handy (last would not work)
$(".printable #Feature1 ul li, .printable #Feature2 ul li").each(function(){
      $(this).not(':last-child').append(",&nbsp;");
});

//	Clearing form values on focus and adding a style
//	$('.ClearMe').each(function() {
//					var default_value = this.value;
//					$(this).focus(function() {
//									$(this).addClass('InputFocused');
//									if(this.value == default_value) {
//													this.value = '';
//									}
//					});
//					$(this).blur(function() {
//									if(this.value === '') {
//										$(this).removeClass('InputFocused');
//													this.value = default_value;
//									}
//					});
//	});
		
//Admin tools show/hide
	$(".AdminSearchResultLinks").hide();
	
//Init colorbox
if ($("a[rel='colorbox']").length) {
	$("a[rel='colorbox']").colorbox({rel:'nofollow'});
}
	
	$("a.AdminToolsToggle").toggle(function() {
			$(this).html('Hide admin tools');
			$(".AdminSearchResultLinks").slideToggle(180);
	}, function() {
			$(this).html('Show admin tools');
			$(".AdminSearchResultLinks").slideToggle(180);
					
});
