
function ReView(gid,page){var time=new Date().getTime();var url="/reviewlist?gid="+gid+'&page='+page+'&time='+time;xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=reviewmsg;xmlHttp.send(null);}
function reviewmsg(){if(xmlHttp.readyState==2){document.getElementById('review').innerHTML='Please Waiting,Data Loading...';}
if(xmlHttp.readyState==4){var response=xmlHttp.responseText;var re='';response=response.replace(/<TD align=\"middle\" width=\"20%\"><img src=\"\/html\/images\/FrontViews\/star.gif\" \/><\/TD>/g,'');document.getElementById('review').innerHTML=response;}}
function PostReView(code,gid,name,level,content,mail){var time=new Date().getTime();var url="/review?code="+code+"&gid="+gid+"&name="+name+"&level="+level+"&content="+content+"&mail="+mail+"&time="+time;xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=postreviewmsg;xmlHttp.send(null);}
function postreviewmsg(){if(xmlHttp.readyState==4){var response=xmlHttp.responseText;if(response==3)
{alert('Verification yard is wrong！');return;}
response=response.split('||||');if(response[0]==1){alert('Thank you for your comment on this product, your comment will appear after the adoption of the review!');}
else if(response[0]==2)alert('Comments that contain sensitive phrases, please re-fill!');RefreshImage();}}
function Lod(){var time=new Date().getTime();var url="/reviewlist?gid={$new[id]}&page=1&time="+time;xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=reviewmsg;xmlHttp.send(null);}
function Reviewhelp(val)
{$.ajax({type:"POST",url:"A-Help",data:'help='+val+"&id="+'{$new[id]}',success:function(msg){alert('Thanks for your help!')}});}
function CheckSubmit(){var name=document.getElementById('name');var mail=document.getElementById('mail');var content=document.getElementById('content');var gid=document.getElementById('gid');var code=document.getElementById('code');var level=document.getElementsByName('level');for(var i=0;i<5;i++){if(level[i].checked==true)levelvalue=level[i].value;}
if(name.value==''||content.value==''||mail.value==''){alert("Please fill in the full");return false;}
var mailmatch=mail.value.match(/[a-zA-Z0-9_]+@[a-zA-Z0-9_]+.[a-zA-Z]+/);var contentmatch=content.value.match(/[&]+/);var codematch=code.value.match(/[&]+/);var namematch=name.value.match(/[&]+/);if(mailmatch==null){alert("E-mail format must be,Please re-enter!");return false;}
if(contentmatch||codematch||namematch){alert("format error '&',Please re-enter!");return false;}
if(content.value.length>500){alert("content's length is too long ");return false;}
PostReView(code.value,gid.value,name.value,levelvalue,content.value,mail.value);content.value='';}
function RefreshImage(){var el=document.getElementById("code");var src=$("#code").attr("src");$("#code").attr("src",src+"?");}
