var umsg="http://www.play84.com/resource/";

$(document).ready(function() 
{
	$('#commentsubmit').click( function(){
		if($("#nameid").val() == ""){
			$("#errormsg").html("<font color=red>你忘了写昵称？</font>");
		}
		else if($("#contentid").val() == ""){
			$("#errormsg").html("<font color=red>你忘了写留言内容？</font>");
		}		
		else{
			$('#commentsubmit').attr("disabled","disabled");
			$.post("/loadgame.php",
				{m:"addcomment", lan:"cn", indexid: $("#indexid").val(),nameid: $("#nameid").val(), contentid: $("#contentid").val()},
				function(data){
					if(data == "ERROR"){
						$("#errormsg").html("<font color=red>提交失败！</font>");
						$('#commentsubmit').attr("disabled","");
					}else{
						$("#errormsg").html("<font color=#FFCC00>留言已成功提交！</font>");
						$("#comment_iwant2").after(data);
						$("#contentid").val('');

					}
				}			
			);
		}
	});
});


function loadcomment(fid,pid){
			
			$.post("/loadgame.php",
				{m:"loadcomment", fid:fid, pid:pid, lan:"cn"},
				function(data){
					$("#listcomment").html(data);
				}
			);

}

function setview()
{
	$.post("/myplay.php",{m:"set", vid:$("#vid").val(), vname:$("#vname").val(),vpicture:$("#vpicture").val(),vurl:$("#vurl").val(), lan:"cn"});
}

function ordmsg(str)
{
	var code = "";
	s	=	str.split("-");
	for(i=0;i<s.length-1;i++)
	{
		code   =  code + String.fromCharCode(s[i]); 
	}
	return code;
}

function deladdgame(gid){
			
			$.post("la.php",
				{m:"deladdgame", gid:gid},
				function(data){
				alert(data);
					if(data=="ok"){
						$("#line_"+gid).animate({opacity: 'hide'}, 'slow');
					}else{
						alert('Error!');
					}
				}
			);

}