var playtm = {
	init: function(){
		playtm.png.init()
		playtm.comments.validate.init()
	},
	png: {
		init: function() {
			if ($.browser.msie && $.browser.version == "6.0") {
				$("*").each(function(){
					if ($(this).css("background-image").indexOf(".png") != -1) {
						$(this).css("background-image","none");
					}
				})
			}
		}
	},
	comments: {
		deleteme: function(comment,from){
			if(confirm("Sure you want to delete that comment?")) {
				window.location='/forum/deletecomment/'+comment+'/from'+from
			}
		},
		validate: {
			init: function(){
				$("#comments form").submit(function(){
					playtm.comments.validate.error.clear()
					loggedIn = ($("#comments .name").length == 0)
					if (loggedIn) {
						if ($.trim($("#comments textarea").val()).length == 0) {
							isValid = false
						} else {
							isValid = true
						}
					} else {
						if ($.trim($("#comments textarea").val()).length == 0 || $.trim($("#comments .name").val()).length == 0) {
							isValid = false
						} else {
							isValid = true
						}
					}
					if (!isValid) {playtm.comments.validate.error.show()}
					return isValid
				})
			},
			error: {
				show: function() {
					$("#comments form").prepend("<p class=\"error\">Sorry, please make sure you have filled out all fields</p>")
				},
				clear:function() {
					$("#comments .error").remove()
				}
			}
		}
	}
}
$(function(){playtm.init()});