//修改口碑购车意向调查数据
function toupiao(id,serid){
var objName="toupiao"+serid;
var objValue="toupiao_value";
var allcookies = document.cookie;
var cookie_pos = allcookies.indexOf(objName);
if (cookie_pos != -1) {
alert('您已经投过票了,请不要重复投票!')
} else
{
addTPCookie(objName, objValue);
var num1= document.getElementById("num1").innerHTML;
var num2= document.getElementById("num2").innerHTML;
var num3= document.getElementById("num3").innerHTML;
var num4= document.getElementById("num4").innerHTML;
var num5= document.getElementById("num5").innerHTML;
var num6= document.getElementById("num6").innerHTML;
var sum=parseInt(num1)+parseInt(num2)+parseInt(num3)+parseInt(num4)+parseInt(num5)+parseInt(num6)+1;
for(var i=1;i<7;i++){
if(i==id){
var a=parseInt((parseInt(document.getElementById("num"+i).innerHTML)+1)/sum*80);
document.getElementById("numimg"+id).style.height=a.toString()+"px";
}else{
var b=parseInt(parseInt(document.getElementById("num"+i).innerHTML)/sum*80);
document.getElementById("numimg"+i).style.height=b.toString()+"px";
}
}
document.getElementById("num"+id).innerHTML=parseInt(document.getElementById("num"+id).innerHTML)+1;
var url = 'http://www.bj-hdhj.com/auto/interface/webKoubei.ashx?method=TouPiao&str='+id+'&objid='+serid;
$.post(url,showResponsetoupiao,showErr);
}
}
function addTPCookie(objName, objValue)
{/*添加cookie objName:cookie名称,objValue:cookie存储的值*/
var str = objName + "=" + escape(objValue);
document.cookie = str;
}
function getCookie(objName) {//获取指定名称的cookie的值
var arrStr = document.cookie.split("; ");
for (var i = 0; i < arrStr.length; i++) {
var temp = arrStr[i].split("=");
if (temp[0] == objName) return unescape(temp[1]);
}
}
function showResponsetoupiao(obj){
var strReturn =obj;
if(strReturn == '1'){
alert('投票成功!');
}
else{
alert('您已经投过票了,请不要重复投票!');
}
}
function showErr(){
alert('网络故障,提交失败!');
}
function zhichi(id){
var objName="zhichi"+id;
var objValue="zhichi_value";
var allcookies = document.cookie;
var cookie_pos = allcookies.indexOf(objName);
if (cookie_pos != -1) {
alert('您已经投过票了,请不要重复投票!')
} else
{
addTPCookie(objName, objValue);
var url = 'http://www.bj-hdhj.com/auto/interface/webKoubei.ashx?method=Zhichi&str='+id;
$.post(url,showResponsetoupiao,showErr);
document.getElementById("zhichi"+id).innerHTML=parseInt(document.getElementById("zhichi"+id).innerHTML)+1;
}
}
//初始加载口碑购车意向调查数据
$(document).ready(function(){
init_BrandType("DDL_","");
var url = 'http://www.bj-hdhj.com/auto/interface/webKoubei.ashx?method=TouPiaoLoad&str=1006';
$.post(url,toupiaoload,showErr);
getgrdp();
pagekb(1,1006,0);
pagekb(1,1006,3);
pagekb(1,1006,1);
});
function toupiaoload(obj){
var strReturn =obj;
document.getElementById("attitude").innerHTML=strReturn;
}
function getgrdp(){
var url='http://www.bj-hdhj.com/auto/interface/webKoubei.ashx?method=GrdpKB&str=1006';
$.post(url,function(data){
var strReturn =data;
document.getElementById("grdp").innerHTML=strReturn.split(',')[0];
document.getElementById("grdps").innerHTML=strReturn.split(',')[1];
},showErr);
}
function pagekb(index,serid,pingfen){
var url= 'http://www.bj-hdhj.com/auto/interface/webKoubei.ashx?method=PageKB&pageIndex='+index+'&serid='+serid+'&pingfen='+pingfen;
$.post(url,function(data){
var strReturn=data;
if(pingfen==0){
document.getElementById("dp_a1").innerHTML=strReturn;
}else if(pingfen==3){
document.getElementById("dp_a2").innerHTML=strReturn;
}else{
document.getElementById("dp_a3").innerHTML=strReturn;
}
},showErr);
}
function Breply(url,id){
alert("1");
var replyform=document.getElementById(url);
var txt=$(".textareabg")[0].innerHTML;
var url= "http://www.bj-hdhj.com/auto/interface/webKoubei.ashx?method=Addcomment&ser_id=0&hf_id="+id+"&title=\"\"&pcontent="+escape(txt)+"&pingfen=0";
$.post(url,function(data){
var strReturn =data;
pagekb(1,1006,0);
pagekb(1,1006,3);
pagekb(1,1006,1);
},showErr);
replyform.style.display="none";
}
function addcomment(){
var serid=1006;
var title=document.getElementById("title").value;
var pcontent=document.getElementById("review").value;
var pingfen=parseInt(document.getElementById("rating").value)+1;
var url= "http://www.bj-hdhj.com/auto/interface/webKoubei.ashx?method=Addcomment&ser_id="+serid+"&hf_id=0&title="+escape(title)+"&pcontent="+escape(pcontent)+"&pingfen="+pingfen;
$.post(url,function(data){
var strReturn =data;
if(parseInt(strReturn)>0){
alert("点评成功!");
}
pagekb(1,1006,0);
pagekb(1,1006,3);
pagekb(1,1006,1);
document.getElementById("title").value="";
document.getElementById("review").value="";
ckpingjia(2);
getgrdp();
},showErr);
}
function openreply(url,id){
$(".replyform fieldset").remove();
var replyform=document.getElementById(url);
replyform.innerHTML="";
replyform.style.display="block";
}
function closereply(url){
var replyform=document.getElementById(url);
replyform.style.display="none";
}