/*
Mikee: this method will keep a default value (the title) in the input fields
When you focus it'll disappear, when you blur it'll reappear if the textfield
is empty
*/
$(function(){
	$('input').each(function (){
		var self = $(this);
		self.focus(function (){
			if (self.attr("title") == self.val()){
				self.val("");
			}
		}).blur(function (){
			if (self.val() == ""){
				self.val(self.attr("title"));
			}
		});
	})
});

/*
Mikee: this method allows you to have a full panel linking to a particular
place without having to change the markup. this is a nice little addition to
make the UI easier to use. It'll change the classname to 'hover' on the div
so you can replace the styles of the link
*/
$(function (){
	$('.linkedpanel').each(function (){

		var self = $(this);
		var link = self.find("a");
		var url = link.attr("href");
		var cls = link.attr("class");

		link.attr("href", "javascript:void(0);");

		self.mouseenter(function (){
			self.toggleClass("hover", true).css("cursor", "pointer");
		}).mouseleave(function (){
			self.toggleClass("hover", false).css("cursor", "default");
		}).click(function (){
			
			if(cls.indexOf("external") != -1){
				link.attr("target", "_blank");
				link.attr("href", url);
			}else{
				location.href = url;
			}
		});
	});
});