(function() {
	var	searchForm = document.getElementById("search_form"),
		search = document.getElementById("search");
	if (search !== null) {		
		/* Auto-clear the search field when focused */
		search.onfocus = function() {
			search.value = "";
			/* Prevent field from being auto-cleared twice */
			search.onfocus = function() {
				return true;
			};
			return true;
		};
	}
	
	/* Video overlay */
	if (!window.attachEvent) { // disable for IE, for now ..
		$("img[rel]").overlay();
	}
	
	
	/* Menu/submenu */
	
	$(document).ready(function () {
		$("#navigation_links > li").each(function () {
			if (window.attachEvent) { // IE has issues with animating, so show/hide is better
				(function (elmt) {
					var animating = false;
					elmt.hover(function () {
						$(elmt.children()[1]).show();
					}, function () {
						$(elmt.children()[1]).hide();
					});
				}($(this)));
			}
			else {
				(function (elmt) {
					var animating = false;
					elmt.hover(function () {
						if (!animating) {
							animating = true;
							$(elmt.children()[1]).slideDown(200);
						}
					}, function () {
						$(elmt.children()[1]).slideUp(300,function () {
							animating = false;
						});
					});
				}($(this)));
			}
		});
	});
}());