function showReviewList(parentId,revType,cur){
	var urls = "http://"+FujkDomain.www + "/reviewList.do?"+Math.random() ;
	var param = "&parentId="+encodeURIComponent(parentId)+"&revType="+encodeURIComponent(revType);
	if(cur!=null){
		param += "&cur="+cur;
	}
	//escape(param);//	如果中文或特殊字符需要进编码
	Request.sendPOST(urls+param,null, showReviewListResult);
}

//请求评论添加表单
function showPostFormReview(parentId,revType,revContent){
	var urls = "http://"+FujkDomain.www + "/reviewPost.do?excuteFlg=addPre&"+Math.random() ;
	var param = "&parentId="+parentId+"&revType="+revType;
	if(revContent!=null && revContent!=''){
		param += "&revContent="+encodeURIComponent(revContent);
	}
	// escape(urls + param);
	Request.sendPOST(urls+param,null,showPostFormReviewResult);
}
//显示评论添加表单
function showPostFormReviewResult(req){
	var reqText = req.responseText;
	$("reviewPostForm").innerHTML=reqText;
}

//提交评论
function submitReviewForm(parentId,revType){
	var urls = "http://"+FujkDomain.www + "/reviewPost.do";
	//urls +="&parentId=100&revType=1";
	var param = "?excuteFlg="+document.addReviewForm.excuteFlg.value+"&parentId="+parentId+"&revType="+revType
				//+"&revName=金百舒"+document.addReviewForm.revName.value  //原来的评论主题
				//+"&revName="+'${allMerBase.merchandiseBase.merName}'
				+"&revContent="+encodeURIComponent(document.addReviewForm.revContent.value)
				+"&revMemid="+document.addReviewForm.revMemid.value
				+"&revMemName="+ encodeURIComponent(document.addReviewForm.revMemName.value)
				+"&rand="+document.addReviewForm.rand.value;
	//alert(urls);
	if(document.addReviewForm.excuteFlg.value == 'addRepo'){
		Request.sendPOST(urls+param,param, showPostReviewResut2);
	}else{
		Request.sendPOST(urls+param,param, showPostReviewResutl);
	}
	return false;
}
function showPostReviewResutl(req){
	var reqText = req.responseText;
	//alert(reqText);
	var obj = reqText.parseJSON();  
	var result = obj.result ;
	var parentId = obj.parentId;
	var revType = obj.revType;
	//alert(result);
	if(result=='1'){
		showReviewListResult(req);		
		showPostFormReview(parentId,revType);
		alert("发表评论成功!");
	}	
	if(result=='-1'){
		alert("请求参数有误!");
	}
	if(result=='0'){
		alert("发表评论时出错!");
	}
	if(result=='-2'){
		alert("验证码失败!");
		showPostFormReview(parentId,revType,document.addReviewForm.revContent.value);
	}	
}

function checkReview(parentId,revType){
	if(document.addReviewForm.revContent.value==null || document.addReviewForm.revContent.value==""){
		alert("您还没有填写评论内容!");
		document.addReviewForm.revContent.focus();
		return false;
	}
	if(document.addReviewForm.revContent.value.length>500){
		alert("您输入的评论内容过长,请输入500个字以内!");
		document.addReviewForm.revContent.focus();
		return false;	
	}
	if(document.addReviewForm.rand.value==null || document.addReviewForm.rand.value==""){
		alert("请输入验证码!");
		document.addReviewForm.rand.focus();
		return false;
	}
	//alert(parentId+"==========="+revType);
	submitReviewForm(parentId,revType);
	return false;
}
function alertNotLoginRev(){
	alert("对不起，您还没有登录!");
	return false;
}


//请求评论添加表单--资讯  add 2009-3-10
function showPostFormReviewRepo(parentId,revType,revContent){
	var urls = "http://"+FujkDomain.www + "/reviewPost.do?excuteFlg=addPreRepo&"+Math.random() ;
	var param = "&parentId="+parentId+"&revType="+revType;
	if(revContent!=null && revContent!=''){
		param += "&revContent="+encodeURIComponent(revContent);
	}
	Request.sendPOST(urls+param,null,showPostFormReviewResultRepo);
}
//显示评论添加表单--资讯   add 2009-3-10
function showPostFormReviewResultRepo(req){
	$("reviewPostFormRepo").innerHTML=req.responseText;
}
//显示评论添加表单--资讯   add 2009-3-10
function showPostReviewResut2(req){
	var reqText = req.responseText;
	var obj = reqText.parseJSON();  
	var result = obj.result ;
	var parentId = obj.parentId;
	var revType = obj.revType;
	if(result=='1'){
		showReviewListResult(req);		
		showPostFormReviewRepo(parentId,revType);
		alert("发表评论成功!");
	}	
	if(result=='-1'){
		alert("请求参数有误!");
	}
	if(result=='0'){
		alert("发表评论时出错!");
	}
	if(result=='-2'){
		alert("验证码失败!");
		showPostFormReviewRepo(parentId,revType,document.addReviewForm.revContent.value);
	}	
}


//*****************以下是表情部分JS 2009-3-13 *********************
//插入表情
function insert_face(sid){
	if(sid){
		var textObj = $('revContent');
		textObj.focus();
		var html = "[:s"+sid+"]";
		//if(Prototype.Browser.IE){
		//	document.selection.createRange().text = html;
		//}else{
		  var rangeStart=textObj.selectionStart;       
		  var rangeEnd=textObj.selectionEnd;       
		  var tempStr1=textObj.value.substring(0,rangeStart);       
		  var tempStr2=textObj.value.substring(rangeEnd);       
		  //textObj.value=tempStr1+html+tempStr2;	//原来的
		  textObj.value=tempStr2+html;
		//}
	}
}

//表情解析
function replaceVar(content, picPath){	

	content = content.replace(/([[]\:s54[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/54.gif' />");
	content = content.replace(/([[]\:s36[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/36.gif' />");	
	content = content.replace(/([[]\:s11[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/11.gif' />");
	content = content.replace(/([[]\:s35[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/35.gif' />");	
	content = content.replace(/([[]\:s28[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/28.gif' />");
	content = content.replace(/([[]\:s67[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/67.gif' />");	
	content = content.replace(/([[]\:s31[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/31.gif' />");	
	content = content.replace(/([[]\:s34[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/34.gif' />");
	
	content = content.replace(/([[]\:s17[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/17.gif' />");
	content = content.replace(/([[]\:s42[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/42.gif' />");
	content = content.replace(/([[]\:s16[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/16.gif' />");
	content = content.replace(/([[]\:s21[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/21.gif' />");
	content = content.replace(/([[]\:s22[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/22.gif' />");
	content = content.replace(/([[]\:s33[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/33.gif' />");
	content = content.replace(/([[]\:s18[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/18.gif' />");
	content = content.replace(/([[]\:s1[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/1.gif' />");
	
	content = content.replace(/([[]\:s24[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/24.gif' />");
	content = content.replace(/([[]\:s69[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/69.gif' />");
	content = content.replace(/([[]\:s10[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/10.gif' />");
	content = content.replace(/([[]\:s37[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/37.gif' />");	
	content = content.replace(/([[]\:s66[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/66.gif' />");
	content = content.replace(/([[]\:s40[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/40.gif' />");
	content = content.replace(/([[]\:s6[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/6.gif' />");
	content = content.replace(/([[]\:s43[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/43.gif' />");

	content = content.replace(/([[]\:s32[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/32.gif' />");
	content = content.replace(/([[]\:s20[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/20.gif' />");
	content = content.replace(/([[]\:s70[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/70.gif' />");
	content = content.replace(/([[]\:s5[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/5.gif' />");		
	content = content.replace(/([[]\:s3[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/3.gif' />");
	content = content.replace(/([[]\:s14[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/14.gif' />");
	content = content.replace(/([[]\:s58[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/58.gif' />");
	content = content.replace(/([[]\:s51[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/51.gif' />");
	
	content = content.replace(/([[]\:s26[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/26.gif' />");
	content = content.replace(/([[]\:s47[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/47.gif' />");
	content = content.replace(/([[]\:s4[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/4.gif' />");
	content = content.replace(/([[]\:s23[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/23.gif' />");	
	content = content.replace(/([[]\:s53[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/53.gif' />");
	content = content.replace(/([[]\:s19[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/19.gif' />");
	content = content.replace(/([[]\:s50[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/50.gif' />");
	content = content.replace(/([[]\:s29[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/29.gif' />");	
	
	content = content.replace(/([[]\:s68[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/68.gif' />");
	content = content.replace(/([[]\:s7[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/7.gif' />");
	content = content.replace(/([[]\:s65[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/65.gif' />");
	content = content.replace(/([[]\:s27[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/27.gif' />");	
	content = content.replace(/([[]\:s13[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/13.gif' />");
	content = content.replace(/([[]\:s61[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/61.gif' />");
	content = content.replace(/([[]\:s44[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/44.gif' />");
	content = content.replace(/([[]\:s9[]]){1}/g, "<img src='" + picPath + "/imagesV3.0/zixun/face/9.gif' />");
	
	return content;
}

//评论表情更多更少(未用)
function show_more_face(){
	if($("reply_content").className == "small"){
		$("reply_content").className = "big";
		$("icons").className = "allface";
		$("face_button").innerHTML = "↑收起";
	}else{
		$("reply_content").className = "small";
		$("icons").className = "liteface";
		$("face_button").innerHTML = "更多表情↓";
	}
}