
function showDishPic(id){
    document.getElementById(id).style.display='block';
}
function hideDishPic(id){
    document.getElementById(id).style.display='none';
}

function SearchCarLine(action,dizhi,id)
{
if(document.getElementById('txtFromAddress') == null ) return;
var address = document.getElementById('txtFromAddress').value;
 
if(address == "" || address == "请输入地址")
{
    alert("请输入出发地点！"); return ;
}
 

	 address = FormatText(address);
     address=address;
	 address =ReplaceAToC(address);
     if(action == "1")
	 {
	    var toAddress =  FormatText(dizhi);
	    var ulr = "http://ditu.google.cn/maps?dirflg=r&daddr=" + encodeURI(toAddress) + "&saddr=" + encodeURI(address);
        window.open(ulr);
        return;
	 }
     
    var mapurl = "/CarLine.aspx?wd="+encodeURI(address)+"&comid="+id+"";
    window.open(mapurl);    
}
 
function FormatText(str)
 {
      if(str == null || str.length == 0 ) return "";
      str = str.replace(/[^a-zA-Z0-9\u4E00-\u9FA5]/g,"");
      return str;
  }
 
function trim(str)
{
    return str.replace(/(^\s*)|(\s*$)/g,"");
}

function ReplaceAToC(str){
    var arraylist = ["零","一","二","三","四","五","六","七","八","九","十","十一","十二"];
    var reg = /(\d{1,})(号线)/ig;
    var re = "",sTmp="";
    while(re =reg.exec(str,"")){
        if(re[1]< arraylist.length){
            sTmp = re[0].replace(re[1],arraylist[re[1]]);
            str = str.replace(re[0],sTmp); 
        }
    } 
    return str;
}

function createsele(categoryId, productObj, elmNum, selvalue) {
    var ddlelm = document.createElement("select");
	ddlelm.name="fs";
	ddlelm.onchange = DropDownListChanges;
	document.getElementById('pro_' + productObj.productId).focus();
 
    for (var i = 1; i <= elmNum; i++) {
        var optelm = document.createElement("option");
        optelm.value = i + "_" + productObj.productName + "_" + productObj.productId + "_" + productObj.productPrice + "_" + categoryId;
        optelm.innerHTML = "×" + i + "份";
        if (elmNum == selvalue)
            optelm.selected = "selected";
        ddlelm.appendChild(optelm);
    }
    return ddlelm;
};

function ChangeCheck(categoryId, productId, productName, productPrice) {
   document.getElementById("tip_box").style.display="";
    var divsel = document.getElementById("sel_div_" + productId);
    if (document.getElementById("check_" + productId).checked == true) {
      document.getElementById("pro_" + productId).className= "black";
       document.getElementById("pro_" + productId).className= "pink";
        document.getElementById("pro_" + productId).className= "org";
        var productObj = { "productId": productId, "productName": productName, "productPrice": productPrice, "productPicture": "" };
        var ddlelm = createsele(categoryId, productObj, 50, 1);
        divsel.innerHTML = "";
        divsel.appendChild(ddlelm);
    }
    else {
       document.getElementById("pro_" + productId).className= "org";
      document.getElementById("pro_" + productId).className= "pink";
       document.getElementById("pro_" + productId).className="black";
        divsel.innerHTML = "";
    }
    DropDownListChanges();
}

function DropDownListChanges() {
    var Dropdowns = document.getElementById("divProductListView").getElementsByTagName("select");

    var totalPrice = 0.00;
    var ProductType =new Array();
    totalNum = 0;
    for (var i = 0; i < Dropdowns.length; i++) {
        if (document.getElementById("check_" + Dropdowns[i].value.split("_")[2]).checked == true)
         {
            totalPrice += parseFloat(Dropdowns[i].value.split("_")[3]) * parseInt(Dropdowns[i].value.split("_")[0], 10);
            totalNum += parseInt(Dropdowns[i].value.split("_")[0], 10);
         
              if (parseInt(Dropdowns[i].value.split("_")[0], 10) != 0) 
             {
                   if(arrayFindString(ProductType,Dropdowns[i].value.split("_")[2])==-1)
                   {
                    ProductType.push(Dropdowns[i].value.split("_")[2]);
                   }
                  
            }
        }
    }
  document.getElementById("divOrderSummary1").innerHTML  = '已选产品总计:产品共 <span style=\"color:#f00;\">' + ProductType.length + '</span> 个种类 <span style=\"color:#f00;\">' + totalNum + '</span> 份 金额共 <span style=\"color:#f00;\">' + totalPrice + '</span> 元<br><span style=font-size:12px;text-decoration: none;>[ <a href=# onclick="del()">关闭此浮动窗口</a> ]</span> </div>';


}
 
function arrayFindString(arr,string)
{
var str = arr.join(""); 
    return str.indexOf(string); 
}
function del()
{
  document.getElementById("tip_box").style.display="none";
}

    var InitDescript='如您有特殊要求，请在这里注明';
    var nMaxEatPeopleCount='50';
    var IsClient='2';
    var canwedding='True';
    var id='0';
    function DisableButton()
    {
    
      
	    var mobileReg=/^(0|1)\d{10}$/;
		var sMobile=$("txtMobile").value;
		
		if($('txtName').value.length<2){
		    alert("请输入订餐人的全名，至少两个字符！");
		    $('txtName').focus();
		    return false;
		}
		if(!$('txtName').value.trim().test(/^[\u4E00-\u9FA5]+$/g)){
		    alert("订餐人姓名必须为中文！");
		    $('txtName').focus();
		    return false;
		}
		if(!mobileReg.test(sMobile)){
			alert("请输入正确的订餐人手机号！");
			$('txtMobile').focus(); 
			return false;
		}
		if(!(isselect("xudingxingbie"))){
		    alert("请选择订餐人的性别！");
		    return false;
		   }
		if(!document.getElementById("cbxSamer").checked)
		{
		    if($('txtEatName').value.length<2){
		    alert("请输入就餐人的全名，至少两个字符！");
		    $('txtName').focus();
		    return false;
		}
		if(!$('txtEatName').value.trim().test(/^[\u4E00-\u9FA5]+$/g)){
		    alert("就餐人姓名必须为中文！");
		    $('txtName').focus();
		    return false;
		}
		if(!mobileReg.test($("txtEatMobile").value)){
			alert("请输入正确的就餐人手机号！");
			$('txtMobile').focus(); 
			return false;
		}
		if(!(isselect("rblEatSex"))){
		    alert("请选择就餐人的性别！");
		    return false;
		   }
		}
		
        if($('orderDateTime_cMainDate').value.length<4){
	        alert("请选择就餐日期");
            $('orderDateTime_cMainDate').focus();
	        return false;
	    }
	   
	    
	    var regS = new RegExp("-","gi"); 
        var date1=new Date().getYear()+"-"+(new Date().getMonth()+1)+"-"+new Date().getDate(); 
       
        var date2=$('orderDateTime_cMainDate').value; 
       
        date1=date1.replace(regS,"/"); 

        date2=date2.replace(regS,"/"); 
        var bd =new Date(Date.parse(date1)); 
        var ed =new Date(Date.parse(date2)); 
	   if(bd>ed)
	   {
	       alert("选择时间不能晚于今天当前日期！！");
            $('orderDateTime_cMainDate').focus();
	        return false;
	   }
	    if(parseInt($('orderDateTime_cMainTime').value)<10){
	        alert('请选择就餐时间');
            $('orderDateTime_cMainTime').focus();
	        return false;
	    }
	    if(parseInt($('orderDateTime_cSubTime').value)<0){
	        alert('请选择就餐时刻');
            $('orderDateTime_cSubTime').focus();
	        return false;
	    }
		if(!parseInt($('txtNumLow').value)){
			alert("请输入就餐人数下限！");
		    $('txtNumLow').focus();
			return false;
		}
	    if(!parseInt($('txtNumHigh').value)){
			$('txtNumHigh').value=$('txtNumLow').value;
		}
	     var reg =  /^[1-9]+[0-9]*$/;
        if(!reg.test($('txtNumLow').value))
        {
     
         	alert("请输入数字！");
		    $('txtNumLow').focus();
			return false;
        }
		   if(!reg.test($('txtNumHigh').value))
        {
     
         	alert("请输入数字！");
		    $('txtNumHigh').focus();
			return false;
        }
		
		if(parseInt($('txtNumHigh').value,10)<parseInt($('txtNumLow').value,10)){		   
			alert("您输入的上限小于下限，请重新输入!!");
		    $('txtNumHigh').focus();
			return false;
		}
	    var reg =  /^[1-9]+[0-9]*$/;
 
	    if($('txtAcceptableMin') && $('txtAcceptableMin').value!=$('txtAcceptableMin').defaultValue)
	    {
            if(!reg.test($("txtAcceptableMin").value))
            {
                alert("您输入的最低消费格式不正确，请重新输入!!");
                $('txtAcceptableMin').value=$('txtAcceptableMin').defaultValue;
                $('txtAcceptableMin').focus();
                return false;
            }
        }
 
		if($('txtOtherRequirement').value==InitDescript){
		   $('txtOtherRequirement').value='';
		}
	    if($('txtOtherRequirement').value.length>=20){
			alert("其他订餐要求应在20字内！");
		    $('txtOtherRequirement').focus();
			return false;
		}
		var str= new Array();   
		str=$('txtOtherDuanxin').value.split("/"); 
		
		 if(str.length>10){
			alert("发送手机号码数量限制在10个之内！");
		    $('txtOtherDuanxin').focus();
			return false;
		}

  
    }
     function DisableButtonn()
     {
    
		if(document.getElementById('txtRAddress').value==""){
		    alert("请输入送餐地址");
		    document.getElementById('txtRAddress').focus();
		    return false;
		}
	
		if(document.getElementById('txtRName').value==""){
		    alert("请输入接收人姓名");
		    document.getElementById('txtRName').focus();
		    return false;
		}
		
		if(document.getElementById('txtRPhone').value==""){
		    alert("请输入接收人联系电话");
		    document.getElementById('txtRPhone').focus();
		    return false;
		}
		  if(document.getElementById('txtRemark').value.length>=20){
			alert("备注信息应在20字内！");
		    document.getElementById('txtRemark').focus();
			return false;
		}
		
    }
    	function BuyerSame()
					{
						if(document.getElementById("cbxSamer").checked)
						{
							eval("buyer" + ".style.display=\"none\";");
						}
						else
						{
							eval("buyer" + ".style.display=\"\";");
						}
					}
				
function isselect(listname)
{
    var objlist = document.getElements('input[name='+listname+']');
    for(var i=0;i<objlist.length;i++)
    {
            if(objlist[i].checked)
            {
                return true;
                break;
           }  
    }
    objlist[0].focus();
    return false;
}
 

 
function IsOverTextLength(obj,len,showmsg)
{
  if(obj.value.length>=len)
  {
    obj.value=obj.value.substr(0,len);
    $(showmsg).style.display="block";
    return false;
  }
  else
  {
    $(showmsg).style.display="none";
    return true;
  }
}


function email_onclick() 
{
    if(document.getElementById("txtName").value==""||document.getElementById("orderDateTime_cMainDate").value==""||document.getElementById("orderDateTime_cMainTime").value==""||document.getElementById("orderDateTime_cSubTime").value=="")
    {
    alert("请填写完整信息再进行发送操作!");
    document.getElementById("txtName").focus();
    return false;
    }
    if(document.Form1.email.checked)
	{
    document.getElementById("nr").style.display="";
    document.getElementById("txtemail").style.display="";
    var str;
    str="请柬：我订了"+document.getElementById("orderDateTime_cMainDate").value+"号"+document.getElementById("orderDateTime_cMainTime").value+"点"+document.getElementById("orderDateTime_cSubTime").value+"分的"+document.getElementById("comname").value+"，地址："+document.getElementById("comaddress").value+"一定到哦/"+document.getElementById("txtName").value;
    document.getElementById("txtnr").value=str;
    }
    else
    
    {
    document.getElementById("nr").style.display="none";
    document.getElementById("txtemail").style.display="none";
    }
}
function sj_onclick() 
{
 if(document.getElementById("txtName").value=="")
    {
    alert("请填写完整信息再进行发送操作!");
    document.getElementById("txtName").focus();
    return false;
    }
    if(document.Form1.sj.checked)
	{
    document.getElementById("nr").style.display="";
    document.getElementById("duanxin").style.display="";
    var str;
    str="请柬：我订了"+document.getElementById("orderDateTime_cMainDate").value+"号"+document.getElementById("orderDateTime_cMainTime").value+"点"+document.getElementById("orderDateTime_cSubTime").value+"分的"+document.getElementById("comname").value+"，地址："+document.getElementById("comaddress").value+"一定到哦/"+document.getElementById("txtName").value;
    document.getElementById("txtnr").value=str;
    }
    else
    
    {
    document.getElementById("nr").style.display="none";
    document.getElementById("duanxin").style.display="none";
    }
}

var xmlHttp;
function ajax()
 {

 
 try
    {
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("您的浏览器不支持AJAX！");
         return false;
         }
      }
    }

}
function myHobby(){
    var myCookie=Cookie.read("display");
    if(myCookie=='hide'){
        document.getElementById('dsp-content').style.display="none";
        document.getElementById('label-dsp-btn').setAttribute('class','viewBtn02');
        document.getElementById('label-dsp-btn').className='viewBtn02';
    }
    else{
        document.getElementById('dsp-content').style.display="block";
        document.getElementById('label-dsp-btn').setAttribute('class','viewBtn01');
        document.getElementById('label-dsp-btn').className='viewBtn01';
    }
}
function display(){
    if(Cookie.read('display')!=null) Cookie.dispose('display');
    if(document.getElementById('dsp-content').style.display == "none"){
        document.getElementById('dsp-content').style.display="block";
        document.getElementById('label-dsp-btn').setAttribute('class','viewBtn01');
        document.getElementById('label-dsp-btn').className='viewBtn01';
        Cookie.write('display','show',{duration: 365,path: '/'});
    }
    else{
        document.getElementById('dsp-content').style.display="none";
        document.getElementById('label-dsp-btn').setAttribute('class','viewBtn02');
        document.getElementById('label-dsp-btn').className='viewBtn02';
        Cookie.write('display','hide',{duration: 365,path: '/'});
    }
}
function ContentValidate()
{
    if($('txtContent').value.length==0)
    {
        alert("您还没有填写评论内容！");
        return false;
    }
    var Value=$('txtContent').value;
    if(Value.length<10)
    {
        alert("您的评论小于了10个字！");
        return false;
    }
    if(Value.length>5000)
    {
        alert("您的评论大于了5000个字！");
        return false;
    }
   return true;
}
function getRadioValue(str){
    for (var i = 0; i < document.getElementsByName(str).length; i++){
	    if (document.getElementsByName(str)[i].checked){
		    return document.getElementsByName(str)[i].value;
	    }
    }
    return "";
}
function RadioValidate(sName,sTitle)
{
    var obj=document.getElementsByName(sName);
    for(var i=0;i<obj.length;i++)
    {
        if(obj[i].checked)
        {
            return true;
        }
    }
    alert(sTitle);
    return false;
}
function AvgValidate()
{
    var Value=document.getElementById("txtAvg").value;
    if(!IsNull('txtAvg'))
    {
        alert("您还没有填写人均！");
        return false;
    }
	Value=DBC2SBC(Value).trim();
	document.getElementById("txtAvg").value=Value;
    var Rex=/^[0-9]*$/;
    if(Rex.test(Value))
    {
        return true;
    }
    alert("人均请输入整数");
    return false;
}
function IsNull(sId)
{
    var Value=document.getElementById(sId).value;
    if(Value!="")
    {
        return true;
    }
    return false;
}
function ContentLength()
{
    var val=$('txtContent').value;
    var obj=document.getElementById("leftnum");
    obj.innerHTML=(5000-val.length);
}
function GetMore(resid,cid){
    PostData='resid='+resid+'&step=4&cid='+cid+'&t='+Math.random();
    new AjaxReq({
        url: "/adentity/docomment.aspx",
        anysc: false,
        method: 'get',
        callType: 'html',
        data: PostData,
        onSuccess: function(data){
            $('cc_'+cid).innerHTML=this.ajax.response.html;
        }
    }).send();
}
function PostComment(){
    if(!IsNull('adentityId')) {
        alert("无相关餐厅！");
        return false;
    }
    if(!IsNull('taste')) {
        alert("您还没有为餐厅口味打分呢！");
        return false;
    }
    if(!IsNull('environment')) {
        alert("您还没有为餐厅环境打分呢！");
        return false;
    }
    if(!IsNull('service')) {
        alert("您还没有为餐厅服务打分呢！");
        return false;
    }
    if(!AvgValidate()) return false;
    if(!ContentValidate()) return false;
    if(!RadioValidate('rblAppraise','您还没有对餐厅做评价！')){
        return false;
    }
	var aid=$('adentityId').value;
	PostData = 'do=postcomment&ad='+$('adentityId').value
	    +'&ap='+getRadioValue('rblAppraise')
	    +'&tb='+getRadioValue('rblBackAgain')
	    +'&ta='+$('taste').value
	    +'&en='+$('environment').value
	    +'&se='+$('service').value
	    +'&av='+$('txtAvg').value
	    +'&di='+$('txtDish').value.cnEncode()
	    +'&pa='+$('txtParking').value.cnEncode()
	    +'&co='+$('txtContent').value.cnEncode()
	    +"&ti="+$('txtTitle').value.cnEncode();
    $('btnPost').innerHTML="正在发表您的评论，请稍候......";
	new AjaxReq({
		url: "/postcomm.aspx",
		method: 'post',
		data: PostData,
		onSuccess: function(data) {
			if(data.code==200){
				showStep2(aid,data.msg);
			}
			else if(data.code==401){
			    alert(data.msg);
			    $('btnPost').innerHTML="input id=\"btnPost\" type=\"button\" class=\"longBtn\" value=\"提交\" onclick=\"PostComment();return false;\" /></span>";
			}
		}
	}).send();
}
var xmlHttp;

function showStep1(resid){
	new AjaxReq({
		url: "/adentity/docomment.aspx",
		async:false,
		method: 'get',
		callType: 'html',
		data: 'resid='+resid+'&step=1&k='+Math.random(),
		onSuccess: function(data) {
            Mbox.openLite(this.ajax.response.html,619,'auto',{closable:true});
		}
	}).send();
}
function showStep2(resid,commentid){
	new AjaxReq({
		url: "/adentity/docomment.aspx",
		async:false,
		method: 'get',
		callType: 'html',
		data: 'resid='+resid+'&cid='+commentid+'&step=2&k='+Math.random(),
		onSuccess: function(data) {
            Mbox.openLite(this.ajax.response.html,719,'auto',{closable:true});
		}
	}).send();
}
function Showd(id)
{
	document.getElementById(id).style.display='block';
	document.getElementById(id).style.left = document.body.clientWidth/2-200+"px";
  
}
function Showds(id)
{
	document.getElementById(id).style.display='block';
	document.getElementById(id).style.left = document.body.clientWidth/2-400+"px";
  
}
function cal(id) {
  
  document.getElementById(id).style.display = 'none';

}
function cals(id) {
  
  document.getElementById(id).style.display = 'none';

}
function showUpload(cid){
    ajax();

     
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
		  
           document.getElementById('scc').innerHTML=xmlHttp.responseText;
		   Showd('smw');
           }
		}
	
	 var weburl = "/MoreUpload.aspx?cid="+cid+"&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	 
}
function showSend(cid){
    ajax();

     
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
		  
           document.getElementById('ssj').innerHTML=xmlHttp.responseText;
		   Showds('sendsj');
           }
		}
	
	 var weburl = "/SendMoblie.aspx?cid="+cid+"&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	 
}
function addjfSend(zf){
    ajax();

    
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
		  
          //alert(xmlHttp.responseText);
		  // Showds('sendsj');
           }
		}
	
	 var weburl = "/addjf.aspx?str=info&mem="+zf+"&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	 
}
function chekdl(){
    ajax();

     
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
		  if(xmlHttp.responseText=="0")
		  {
		  alert("请先填写会员账号和密码");
		  return false;
		  }
       
           }
		}
	
	 var weburl = "/AJAX.aspx?str=dl&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	 
}
function GetReply(cid){
    ajax();
    var flag=document.getElementById('Reply_'+cid).style.display=='none'?true:false;
    if(flag){
        document.getElementById('Reply_'+cid).style.display="";
		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
           document.getElementById('Reply_'+cid).innerHTML=xmlHttp.responseText;
           }
		} 
		
	var weburl = "/DoReplay.aspx?str=getreply&cid="+cid+"&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	}
	else
	{
        document.getElementById('Reply_'+cid).style.display="none";
	} 
	
	
}
function Getjb(cid){
    ajax();
    var flag=document.getElementById('jb_'+cid).style.display=='none'?true:false;
    if(flag){
        document.getElementById('jb_'+cid).style.display="";
		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
           document.getElementById('jb_'+cid).innerHTML=xmlHttp.responseText;
           }
		}
	}
	else
	{
        document.getElementById('jb_'+cid).style.display="none";
	} 
	 var weburl = "/report.aspx?str=getjb&cid="+cid+"&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	
}
function Getdl(){
    ajax();
 
     
		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
		   
              if(xmlHttp.responseText=="0")
		      {
			  
			    alert("你还未登陆!请先填写会员登陆信息");
				document.getElementById("dl").style.display="";
				document.getElementById("uName").focus();
				return false;
				
		     }
           }
		}
	
	 var weburl = "/Islogin.aspx?str=getdl&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	
}
function Getzx(cid){
    ajax();
    var flag=document.getElementById('zx_'+cid).style.display=='none'?true:false;
    if(flag){
        document.getElementById('zx_'+cid).style.display="";
		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
           document.getElementById('zx_'+cid).innerHTML=xmlHttp.responseText;
           }
		}
	}
	else
	{
        document.getElementById('zx_'+cid).style.display="none";
	} 
	 var weburl = "/zx.aspx?str=getzx&cid="+cid+"&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	
}
function Getpwd(){
    ajax();
    var flag=document.getElementById('zx').style.display=='none'?true:false;
    if(flag){
        document.getElementById('zx').style.display="";
		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
           document.getElementById('zx').innerHTML=xmlHttp.responseText;
           }
		}
	}
	else
	{
        document.getElementById('zx').style.display="none";
	} 
	 var weburl = "/Getp.aspx?str=getzx&t="+Math.random(); 
	 xmlHttp.open("GET",weburl,true);
     xmlHttp.send(null);
	
}

function Postp(){
    var co=document.getElementById('txtReplyContent').value;
    if(co.length=="")
    {
        alert("请填写你的手机号码");
        return false;
    }
  
        ajax();


		
		xmlHttp.onreadystatechange=function()
        {
           if(xmlHttp.readyState==4)
           {
              alert(xmlHttp.responseText);
			  if(xmlHttp.responseText=="密码已经发送到你的手机,请牢记")
			  {
			  document.getElementById('zx').style.display="none";
			  }
           }
		}
	
	 var weburl = "/Getp.aspx?str=Postzx&t="+Math.random()+"&co="+co; 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}
function Postzx(cid){
    var co=document.getElementById('txtReplyContent_'+cid).value;
    if(co.length<5)
    {
        alert("您的咨询内容太短了！");
        return false;
    }
    if(co.length>500)
    {
        alert("您的咨询内容太长了！");
        return false;
    }

        ajax();


		
		xmlHttp.onreadystatechange=function()
        {
           if(xmlHttp.readyState==4)
           {
              alert(xmlHttp.responseText);
			  if(xmlHttp.responseText=="咨询成功，请等待店主回复")
			  {
			  document.getElementById('zx_'+cid).style.display="none";
			  }
           }
		}
	
	 var weburl = "/zx.aspx?str=Postzx&cid="+cid+"&t="+Math.random()+"&co="+ encodeURI(co); 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}
function Postjb(cid){
    var co=document.getElementById('txtReplyContent_'+cid).value;
    if(co.length<5)
    {
        alert("您的举报太短了！");
        return false;
    }
    if(co.length>500)
    {
        alert("您的举报太长了！");
        return false;
    }

        ajax();


		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
            alert('举报成功!感谢你的参与,我们会在第一时间处理');
			  document.getElementById('jb_'+cid).style.display="none";
           }
		}
	
	 var weburl = "/report.aspx?str=Postjb&cid="+cid+"&t="+Math.random()+"&co="+ encodeURI(co); 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}
function PostReply(cid){
    var co=document.getElementById('txtReplyContent_'+cid).value;
    if(co.length<5)
    {
        alert("您的回复太短了！");
        return false;
    }
    if(co.length>500)
    {
        alert("您的回复太长了！");
        return false;
    }

        ajax();


		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
            document.getElementById('Reply_'+cid).innerHTML=xmlHttp.responseText;
		    var val = document.getElementById('RC_'+cid).innerHTML;
			document.getElementById('RC_'+cid).innerHTML=Number(val)+1;
           }
		}
	
	 var weburl = "/DoReplay.aspx?str=PostReply&cid="+cid+"&t="+Math.random()+"&co="+ encodeURI(co); 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}

function yy(cid)
{


  ajax();


		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
            alert(xmlHttp.responseText);
			
			document.getElementById('yy_'+cid).innerHTML=xmlHttp.responseText;
           }
		}
	
	 var weburl = "/AJAX_Comment.aspx?str=yy&cid="+cid+"&t="+Math.random(); 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}
function my(cid)
{


  ajax();


		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
           alert(xmlHttp.responseText);
			
			document.getElementById('my_'+cid).innerHTML=xmlHttp.responseText;
           }
		}
	
	 var weburl = "/AJAX_Comment.aspx?str=my&cid="+cid+"&t="+Math.random(); 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}
function sc(cid)
{


  ajax();


		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
           alert(xmlHttp.responseText);
	
           }
		}
	
	 var weburl = "/Actions.aspx?action=Favoritef&ProductID="+cid+"&t="+Math.random(); 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}
function scdp(cid)
{


  ajax();


		
		xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4)
           {
           alert(xmlHttp.responseText);
	
           }
		}
	
	 var weburl = "/Actions.aspx?action=Favorite&ProductID="+cid+"&t="+Math.random(); 
	 xmlHttp.open("post",weburl,true);
     xmlHttp.send(null);

}
function ResTipContentLength()
{
    var val=document.getElementById("txtContent").value;
    var obj=document.getElementById("leftnum");
    obj.innerHTML=(2000-val.length);
}


function DoReport(){
    var cnt = ($('RContent').value+'').replace(/(\s+)$/g, '').replace(/^\s+/g, '');
    var rid = $('Rid').value;
    var tid = $('RType').value
    if(cnt=='请输入举报原因'){
        $('RContent').focus();
        return false;
    }
    if(cnt.length<2){
        alert('举报原因不能小于2个字符');
        $('RContent').focus();
        return false;  
    }
    PostData = "id=" + rid +"&report=1&typeId=" + tid + "&title="+escape(cnt);
    new AjaxReq({
        url: '/AJAX_Comment.aspx',
        method: 'post',
        callType: 'html',
        data: PostData,
        onSuccess: function(data) {
            Mbox.close();
            $('Report_' + rid).set('html',this.ajax.response.html);
        }
    }).send();
}
function NoLoginFav(){
	alert('您好,只有登录后才能使用收藏功能!');
	return false;
}
function doDisplayFav(id,typeid){
    var gdata="id="+id+"&type="+typeid+"&r="+Math.random();
    var idReg=/^\d+$/;
    if(!idReg.test(id))
    {
        GetBankContent('/Members/myFavorites.aspx',gdata,'JfavBar');
    }
    else
    {
        GetBankContent('/Members/myFavorites.aspx',gdata,'JfavBar'+id);
    }
}
function doAddFav(varst,typeid){
    var gdata="ajax=1&resid="+varst+"&typeid="+typeid;
    var idReg=/^\d+$/;
    if(!idReg.test(varst))
    GetBankContent('/Members/myFavorites.aspx',gdata,'JfavBar');
    else
    GetBankContent('/Members/myFavorites.aspx',gdata,'JfavBar'+varst);
}

function GetBankContent(sUrl,sPara,obj){
    $(obj).set('html','<img src="/image/loading.gif"/>');
    PostData = sPara;
    new AjaxReq({
        url: sUrl,
        method: 'post',
        callType: 'html',
        data: PostData,
        onSuccess: function(data) {
            $(obj).set('html',this.ajax.response.html);
        }
    }).send();
}



function setStars(n,t,o){
    var target = document.getElementById(t);
    var obj = document.getElementById(o);
    target.value = n;
    switch(n){
        case 1:
            obj.style.backgroundPosition = '-80px top';
            break;
        case 2:
            obj.style.backgroundPosition = '-60px top';
            break;
        case 4:
            obj.style.backgroundPosition = '-20px top';
            break;
        case 5:
            obj.style.backgroundPosition = '0px top';
            break;
        case 3:
        default:
            obj.style.backgroundPosition = '-40px top';
            break;
    }
}



