function searchLink() {
	$("#form-search input.textfield").after("<a href=''></a>");
	$("#form-search a").click(function() {
		this.parentNode.submit();
		return false;
	});
}

// Return the value of all textfields to their default in the case where a they are blank onBlur
function swapDefault() {
	$("input[@type=text]").each(
		function() {
			$(this).focus(
				function() {
					$(this).addClass("focus");
					if(this.defaultValue && this.value == this.defaultValue) this.value = "";
				}
			).blur(function() {
				$(this).removeClass("focus");
				if(this.defaultValue && !this.value.length) this.value = this.defaultValue;
			}
		);
	});
}

// Remove useless whitespace from all unordered lists in a page
function cleanLists() {
	$("ul").each(function() {
		var node	= this.firstChild;
		while(node) {
			var nextNode	= node.nextSibling;
			if(node.nodeType == 3 && !/\S/.test(node.nodeValue))
			this.removeChild(node);
			node	= nextNode;
		}
		return this;
	});
}

function fixHeight(obj) {
	var attr	= $.browser.msie ? "height" : "minHeight";
	$(obj).css(attr, $(window).height());

}

function listSubmit() {
	$("#mList input.textfield").after("<a href='' id='listSubmit'></a>");
	$("#listSubmit").click(function() {
		this.parentNode.submit();
		return false;
	});
}

$.fn.extend({
	reset: function() {
		return this.each(function() {
			$(this).is('form') && this.reset();
		})
	}
});

function formButtons() {
	$("form:not(#mList) input[@type=submit]").each(function() {
		$(this).before("<a href='' class='submit'>" + $(this).val() + "</a>");
	});
	$("form input[@type=reset]").each(function() {
		$(this).before("<a href='' class='reset'>" + $(this).val() + "</a>");
	});
	
	$("form a.submit").click(function() { $(this).parents("form").submit(); return false });
	$("form a.reset").click(function()  { $(this).parents("form").reset(); return false });
}

function tempFunctions() {
	$("#nav li").not(".selected").hover(function() {
		$(this).addClass("hover");
	}, function() {
		$(this).removeClass("hover");
	});
	
	/*
	$("#cNews li").hover(function() {
		$(this).css("cursor", "pointer").children("h3").children("a").addClass("hover");
		$(this).children("p").addClass("hover");
	}, function() {
		$(this).css("cursor", "default").children("h3").children("a").removeClass("hover");
		$(this).children("p").removeClass("hover");
	}).click(function() {
		var loc	= $(this).children("h3").children("a").attr("href");
		if(loc)	window.location.href = loc;
	});
	*/
	
	$("body#music div#well ul li:odd").css("float", "right");

}