//刷新页面
function parentref(s)
{
	if(!document.all)
	{
		window.$("infos").src  = s;
	}
	else
	{
		parent.frames["infos"].document.location= s ;
	}
}

//发送评论
function postComment( id )
{	
	var vew = $("playTextBox1").value ;
	var val = $("TextBox1").value ;
	if ( vew == "" || vew.length < 6 ) 
	{
		alert("少于 6 个字！");
		$("playTextBox1").focus();
		return;
	}
	
	var pars = "step=1&ID="+id+"&q="+encodeURIComponent(vew)+"&validateCode="+val;
	var myAjax = new Ajax.Request(
	"/post.aspx" ,
	{
	method: 'POST',
	parameters: pars,
	onComplete: pro_comment_xml,
	onFailure: showError,
	onException: showError
	});
}

//成功能表评论
function pro_comment_xml(originalRequest)
{
	var XO = originalRequest.responseXML;
	var code = XO.getElementsByTagName("code");
	var message = XO.getElementsByTagName("message");
	var viewer =parent.$("infoLayer");
	if ( !viewer ) return;
	if ( message[0].firstChild.nodeValue == "Failure" )
	{
		if(code[0].firstChild.nodeValue == "-1")
		{
			alert("验证码不正确！");
			$("TextBox1").focus();
			return ;
		}
		else if(code[0].firstChild.nodeValue == "0")
		{
			var hrefName = window.location.href.toLowerCase();
			if(confirm("登录才能发表评论, 现在要登录吗？")){window.location.href="/passport.aspx?ReturnUrl="+encodeURI(hrefName);return true;}return false;
		}
	}
	else
	{
		parentref("/Comment.aspx?id=" + code[0].firstChild.nodeValue) ;
	}
}

//发表失败
function showError()
{
	alert("很抱歉, 请稍后再试 !");
}