// "Are you sure" confirmation messages
function conf(msg) {
	if (msg==undefined) {
		msg = "Are you sure?";
	}
	var conf = confirm(msg);
	if (conf) {return true} else {return false};
}

// Counter above textareas (forum)
function textAreaCounter(max, countElement, countDisplayElement){
	var charCount = $(countElement).val().length;
	charLeft = max-charCount;
	if (charLeft < 0) {
		jQuery(countDisplayElement).css("color", "red");
	} else {
		jQuery(countDisplayElement).css("color", "#999");
	}
	jQuery(countDisplayElement).html(String(charLeft));
}


$(document).ready(function(){
	// Lock submit buttons once clicked
	$("input[type='submit']").click(function() {
		var element = $(this);
		element.attr("disabled", "disabled");
		element.parents().filter('form').submit();
	});
	
	// Hover over "report as inappropriate" links
	jQuery(".userContent").hover(
	  function(){
		  jQuery(".abuse", this).fadeIn(200);
	  }, 
	  function(){
		  jQuery(".abuse", this).fadeOut(200);
	  }
	);
});


/**
Vertigo Tip
*/
this.vtip=function(){this.xOffset=-20;this.yOffset=20;$(".vtip").unbind().hover(function(a){this.t=this.title;this.title="";this.top=(a.pageY+yOffset);this.left=(a.pageX+xOffset);$("body").append('<p id="vtip"><img id="vtipArrow" />'+this.t+"</p>");$("p#vtip #vtipArrow").attr("src","/img/vtip_arrow.png");$("p#vtip").css("top",this.top+"px").css("left",this.left+"px").fadeIn("slow")},function(){this.title=this.t;$("p#vtip").fadeOut("slow").remove()}).mousemove(function(a){this.top=(a.pageY+yOffset);this.left=(a.pageX+xOffset);$("p#vtip").css("top",this.top+"px").css("left",this.left+"px")})};jQuery(document).ready(function(a){vtip()});