﻿var PvcID="0"; //全局变量 留言省份
jQuery(function () {
    //加载头部选中样式
    var location; //当前位置
    if (jQuery(".location span a").length > 1) {
        location = jQuery(".location span a").eq(1).html();
    }
    else {
        location = jQuery(".location span a").eq(0).html();
    }
    jQuery(".menu a").each(function () {
        if (jQuery(this).html() == location) {
            jQuery(this).addClass("menuhot");
        }
    });
    //如果是预览，页面功能不可用
    if (typeof isView != "undefined" && isView == "1") {
        Boxy.bgopacity = 0;
        Boxy.alert(jQuery(""), '', { "showCloseBtn": [], "hideFrame": 1 });
    }
    //图片尺寸自适应
    jQuery(".resizeImg").each(function (i) {
        new ResizePic(this);
    })
    jQuery("#myCarousel").carousel("cycle");
});



var searchindex=0;
function SearchAbout(p) //顶部搜索
{
	var web_site = document.getElementById("web_site").value;
	var keys = document.getElementById("keys").value;
	var CompanyID = document.getElementById("cid").value;
    if (keys == '请输入产品名称...' || keys =='请输入您要搜索的内容')
        keys = "";
    keys = keys.replace(/(^[^\S]+)|([^\S]+$)/g, "");
    keys = keys.replace(/\+/g, "%2b"); //替换'+'号，如果不处理‘+’号会被替换成空
    //var type = jQuery(".selectTop p").html();
    var getIndustryDomain = AjaxClass.GetIndustryDomain().value;

    if (p == 1) //搜全站
    {
        var classidBykey = AjaxClass.GetClassIDByKey(keys).value;
        var searchUrl = "";
        searchUrl = getIndustryDomain + "/product/t" + classidBykey + "/list_p0.html";
        if (searchindex == 0) {
            searchUrl = "/product/t" + classidBykey + "/list_p0.html";
            if (web_site == "zyzhan" || web_site == "hbzhan" || web_site == "nongjx"  ) {
                searchUrl = "/chanpin-0_p0.html";
            }
			else if (web_site == "gkzhan") {
                searchUrl = getIndustryDomain + "/chanpin/" + classidBykey + "_p0/";
            }
            else if (web_site == "jc35") {
                searchUrl = getIndustryDomain + "/chanpin-" + classidBykey + "_p0.html";
            }
            else if (web_site == "ybzhan") {
                searchUrl = "/chanpin-0/list_p0.html";
            }
            else if (web_site == "86175") {
                searchUrl = getIndustryDomain + "/product/list-" + classidBykey + ".html";
            }
        }
        else {
            var a = getIndustryDomain.split(".");
            searchUrl = "https://used." + web_site + "." + a[2] + "/chanpin-0.html";
        }
		//document.getElementById("searchForm").method="post";
		document.getElementById("keys").name="K";
        document.getElementById("searchForm").action = searchUrl;
		document.getElementById("searchForm").target="_blank";
    }
    else {
        //搜本商铺
        var action = "";
        if (searchindex == 0) {
            document.getElementById("searchForm").action = getIndustryDomain + "/st" + CompanyID + "/product.html";
        }
        else {
            document.getElementById("searchForm").action = getIndustryDomain + "/st" + CompanyID + "/used.html";
        }
		document.getElementById("keys").name="Keyword";
    }
	document.getElementById("searchForm").method="post";
    document.getElementById("searchForm").submit();
}
function jumphtml() {
    var CompanyID = document.getElementById("cid").value;
    var u = navigator.userAgent;
    if (!!u.match(/AppleWebKit.*Mobile.*/)) {//判断是否为手机端
        window.location.href = "/st" + CompanyID + "/inquiry.html";
    }
    else {
        $("#inquiry").show();
    }
}

var ButClickNum = 1;
function GetPrivacyNumber(cid){
	if(ButClickNum>1)
	{
		return; //防止多余请求
	}
	ButClickNum++;
	console.log("getnumber");
	var mmsgbox=document.getElementById("TelMsgBox");
	var callrst=AjaxClass.GetPrivacyNumber(cid).value;
	try
	{
		var jsonObj = eval("Data=" + callrst);
		if(jsonObj.Success)
		{
			if(jsonObj.ByCookie)
			{
				if(mmsgbox!=null)
				{
					document.getElementById("TelNo").innerHTML=jsonObj.Success;
					document.getElementById("TelMsgContent").innerHTML="隐私号码，15分钟内有效，请尽快拨打！通话录音，敬请谅解";
					document.getElementById("TelMsgBox").style.display="block";
				}
				else
				{
					alert("成功！该号码为隐私号,将在15分钟后过期 ："+jsonObj.Success);
				}
			}
			else
			{
				if(mmsgbox!=null)
				{
					document.getElementById("TelNo").innerHTML=jsonObj.Success;
					document.getElementById("TelMsgContent").innerHTML="隐私号码将失效，请尽快拨打！通话录音，敬请谅解";
					document.getElementById("TelMsgBox").style.display="block";
				}
				else
				{
					alert("隐私号码将失效，请尽快拨打！通话录音，敬请谅解 ："+jsonObj.Success);

				}
			}

		}
		else
		{

			var alertMsg="";
			if(jsonObj.Error=="号码池资源不足")
			{
				alertMsg="热线繁忙中，请15分钟后再查看";
			}
			else if(jsonObj.Error=="格式异常")
			{
				alertMsg="该供应商未提供正确电话联系方式！";
			}
			else if(jsonObj.Error=="LimFq")
			{
				alertMsg="系统提示：您的操作过于频繁";
			}
			else
			{
				alertMsg=jsonObj.Error;
			}


			if(mmsgbox!=null)
			{
			  document.getElementById("TelNo").innerHTML="";
			  document.getElementById("TelMsgContent").innerHTML=alertMsg;
			  document.getElementById("TelMsgBox").style.display="block";
			}
			else{
				alert("错误（若号码池已空 请15分钟后重试） ："+alertMsg);
			}

		}
	}
	catch(ex)
	{
		if(mmsgbox!=null)
		{
			document.getElementById("TelNo").innerHTML="";
			document.getElementById("TelMsgContent").innerHTML=callrst;
			document.getElementById("TelMsgBox").style.display="block";
		}
		else{
		alert(callrst);
		}
	}
	ButClickNum=1;

}

function PrivacyNumberCallBack()
{

}

function CloseTelMsgBox()
{
	var mmsgbox=document.getElementById("TelMsgBox");
	if(mmsgbox!=null)
	{
		document.getElementById("TelMsgBox").style.display="none";
	}
}


function setPrivacyCookie(cname,cvalue,exMin)
{
  var d = new Date();
  d.setTime(d.getTime()+(exMin*60*1000));
  var expires = "expires="+d.toGMTString();
  document.cookie = cname + "=" + cvalue + "; " + expires;

}


function getPrivacyCookie(cname)
{
  var name = cname + "=";
  var ca = document.cookie.split(';');
  for(var i=0; i<ca.length; i++)
  {
    var c = ca[i].trim();
    if (c.indexOf(name)==0) return c.substring(name.length,c.length);
  }
  return "";
}


function tab(ele,bot,className){
    jQuery(ele).find('a').mouseover(function() {
        jQuery(this).addClass(className).siblings().removeClass(className);
        var index = jQuery(this).index();
		//console.log(index);
        jQuery(bot).hide();
        jQuery(bot).eq(index).show();
    })
}

tab(".cat_nav",".categories","focus")



function SubmitMessage2(type) {
    jQuery(".Wrong").hide();
    var cid = jQuery.trim(jQuery("#cid").val());
    if (cid == null || cid == "" || cid == "0") {
        //Boxy.alert("无此公司,ID错误！", function () { location.href = "/"; });
        alertBoxShow("提示", "", "无此公司,ID错误！", function () { location.reload(); });
        return;
    }
    var InqContent = jQuery.trim(jQuery("#InqContent").val());
    var InqName = jQuery.trim(jQuery("#InqName").val());
    var InqCompany = jQuery.trim(jQuery("#InqCompany").val());
    var InqTelphone = jQuery.trim(jQuery("#InqTelphone").val());
    var InqEmail = jQuery.trim(jQuery("#InqEmail").val());
    var InqProduct = jQuery.trim(jQuery("#InqProduct").val());
    //var proID = jQuery.trim(jQuery("#proID").val());
    var InqCode = jQuery.trim(jQuery("#InqCode2").val());
    var InqAddress = jQuery.trim(jQuery("#InqAddress").val());
    var IsNoSend = jQuery('input:radio[name="isnosend1"]:checked').val();
    var WXTel = jQuery.trim(jQuery("#InqWXTel").val());
	if (typeof (IsNoSend) == "undefined") {
	    IsNoSend = "0";
	}
    if (type == "1" && (InqProduct == "" || InqProduct == "请输入你感兴趣的产品")) {
        showInputWrong(jQuery("#InqProduct"), "请输入产品名称");
        return;
    }
    if (InqContent == "" || InqContent == "如对采购产品有详细要求，请在此输入....") {
        InqContent = "";
    }
    else if (InqContent.length > 200) {
        showInputWrong(jQuery("#InqContent"), "补充说明请控制在200字以内");
        return;
    }
	//包含  http 或https 或.com  .cn  .net  .php,.asp,.jsp 的  提示
	if (InqContent.length > 0) {
		var tempInqContent=InqContent.toLowerCase();
		if ( tempInqContent.indexOf("http")>-1 || tempInqContent.indexOf("https")>-1 || tempInqContent.indexOf(".com")>-1 || tempInqContent.indexOf(".cn")>-1|| tempInqContent.indexOf(".net")>-1|| tempInqContent.indexOf(".php")>-1|| tempInqContent.indexOf(".asp")>-1|| tempInqContent.indexOf(".jsp")>-1) {
			showInputWrong(jQuery("#InqContent"),   "留言信息中请勿包含网址，请修改后再次提交。");
			return;
		}
	}
    if (InqCompany == "" || InqCompany == "请输入您的单位名称，个体经营者请填'个体经营'...") {
        InqCompany = "";
    }
    if (InqName == "" || InqName == "您的姓名...") {
        showInputWrong(jQuery("#InqName"), "请填写您的姓名");
        return;
    }
    if (InqTelphone == "" || InqTelphone == "固定电话或手机...") {
        showInputWrong(jQuery("#InqTelphone"), "请填写联系电话");
        return;
    }else {
        if (!IsTel(InqTelphone)) {
            showInputWrong(jQuery("#InqTelphone"), "联系电话输入错误");
            return;
        }
    }
    if (InqEmail == "" || InqEmail == "便于客户给您发邮件...") {
        InqEmail = "";
    }
    if (InqEmail != "" && InqEmail != "便于客户给您发邮件..." && !valid.isEMail(InqEmail)) {
        showInputWrong(jQuery("#InqEmail"), "您填写的邮箱地址有误");
        return;
    }
	if(PvcID==""||PvcID=="0" || PvcID<=0)
	{
		 PvcID="0";
	}
    if (InqCode == "" || InqCode=="请输入计算结果（填写阿拉伯数字），如：三加四=7") {
        showInputWrong(jQuery("#InqCode2"), "请填写验证码");
        return;
    }
	//包含  http 或https 或.com  .cn  .net 的  提示
	if (InqContent.length > 0) {
		var tempInqContent=InqContent.toLowerCase();
		if ( tempInqContent.indexOf("http")>-1 || tempInqContent.indexOf("或https")>-1 || tempInqContent.indexOf(".com")>-1 || tempInqContent.indexOf(".cn")>-1|| tempInqContent.indexOf(".net")>-1) {
			showInputWrong(jQuery("#InqContent"), "留言信息中请勿包含网址，请修改后再次提交。");
			return;
		}
	}

    AjaxClass.SendMessage3(cid, InqProduct, "", InqName, InqCompany, InqTelphone, InqEmail, InqContent, InqAddress, InqCode,PvcID,IsNoSend,WXTel, SendMessageCallBack2);
}

function SendMessageCallBack2(obj) {
    jsonStr = obj.value;
    var jsonobj = eval("rrr=" + jsonStr);
    if (jsonobj.Detail) {
        var NewOrderID = jsonobj.Detail[0].Success;
        if (NewOrderID > 0) { //留言成功
            AjaxClass.NewSendMsgOnlySaveNoSendMeg_CallBackToSend(NewOrderID, function() { return false; });
            alertBoxShow("", "1", "发送成功！", function () { location.reload(); });

        } else {
            switch (jsonobj.Detail[0].Success) {
            case -1:
                alertBoxShow("", "2", "验证码失效！请点击验证码进行刷新操作！");
                break;
            case -5:
                alertBoxShow("", "2", "很抱歉，您的信息包含了非法字符(" + jsonobj.Detail[0].DirtyWords + ")，请修改！");
                break;
            case -10:
                alertBoxShow("", "2", "留言成功，邮件发送失败！");
                break;
            case -2016001:
                alertBoxShow("", "2", "失败！您发送信息太过频繁！");
                break;
            case -2016002:
                alertBoxShow("", "2", "失败！由于您曾频繁发送IP已经被封锁！");
                break;
            default:
                alertBoxShow("", "2", "数据写入失败！");
                break;
            }
        }
    }
}
function showInputWrong2(input,txt) {
    alert(txt);
    input.focus();
}


function SelPvc(pvcid){
	PvcID=pvcid;
	//alert(PvcID);
}

function theselppp(){
	if(document.getElementById("selppp")!=null)
	{
		var myselect=document.getElementById("selppp");
		var index=myselect.selectedIndex;
		PvcID=myselect.options[index].value
	}
}

//产品列表点击最新和热门按照不同排序规则读取产品信息
function showProSortTab(cid, pageindex, categoryID, erCategoryID, brandID, keyword, sType) {
    if (cid == 0)
        return;
    var getIndustryDomain = AjaxClass.GetIndustryDomain().value;
    var getStandDomain = AjaxClass.GetStandDomain(cid).value;
    var retUrl = "";
    if (getStandDomain.indexOf("www") > -1) { //非二级域名
        if (sType == 0) {
            if (keyword != "")
                retUrl = "/st" + cid + "/product_w" + keyword + "_p" + pageindex + ".html";
            else if (categoryID > 0)
                retUrl = "/st" + cid + "/list_" + categoryID + "_p" + pageindex + ".html";
            else if (erCategoryID > 0)
                retUrl = "/st" + cid + "/erlist_" + erCategoryID + "_p" + pageindex + ".html";
            else if (brandID > 0)
                retUrl = "/st" + cid + "/bplist_" + brandID + "_p" + pageindex + ".html";
            else
                retUrl = "/st" + cid + "/product_p" + pageindex + ".html";
        } else if (sType == 1) {
            if (keyword != "")
                retUrl = "/st" + cid + "/hotproduct_w" + keyword + "_p" + pageindex + ".html";
            else if (categoryID > 0)
                retUrl = "/st" + cid + "/hotlist_" + categoryID + "_p" + pageindex + ".html";
            else if (erCategoryID > 0)
                retUrl = "/st" + cid + "/hoterlist_" + erCategoryID + "_p" + pageindex + ".html";
            else if (brandID > 0)
                retUrl = "/st" + cid + "/hotbplist_" + brandID + "_p" + pageindex + ".html";
            else
                retUrl = "/st" + cid + "/hotproduct_p" + pageindex + ".html";
        }
    }
    else {
        if (sType == 0) {
            if (keyword != "")
                retUrl = getStandDomain + "/product_w" + keyword + "_p" + pageindex + ".html";
            else if (categoryID > 0)
                retUrl = getIndustryDomain + "/company/prolist-com" + cid + "-t" + categoryID + "_p" + pageindex + ".html";
            else if (erCategoryID > 0)
                retUrl = getIndustryDomain + "/company/prolist-com" + cid + "-t" + erCategoryID + "_p" + pageindex + ".html";
            else if (brandID > 0)
                retUrl = getIndustryDomain + "/company/prolist-com" + cid + "-bt" + brandID + "_p" + pageindex + ".html";
            else
                retUrl = getIndustryDomain + "/company/prolist-com" + cid + "-t0_p" + pageindex + ".html";
        } else if (sType == 1) {
            if (keyword != "")
                retUrl = getStandDomain + "/hotproduct_w" + keyword + "_p" + pageindex + ".html";
            else if (categoryID > 0)
                retUrl = getStandDomain + "/hotlist_" + categoryID + "_p" + pageindex + ".html";
            else if (erCategoryID > 0)
                retUrl = getStandDomain + "/hoterlist_" + erCategoryID + "_p" + pageindex + ".html";
            else if (brandID > 0)
                retUrl = getStandDomain + "/hotbplist_" + brandID + "_p" + pageindex + ".html";
            else
                retUrl = getStandDomain + "/hotproduct_p" + pageindex + ".html";
        }

    }
    if (retUrl != "")
        location.href = retUrl;
    return false;
}




/*
功能:图片自适应高宽，支持原图片已限高宽的情况，支持显示图片加载中效果
作者:dxx
参数说明:pic:图片对象
maxW:限制的最大宽度
maxH:限制的最大高度，若不传，则与maxW相同
errorImg:图片加载错误时加载的图片
*/
function ResizePic(pic, maxW, maxH, errorImg) {
    this.pic = pic;
    this.maxW = maxW || jQuery(this.pic).attr("maxW") || 111;
    this.maxH = maxH || jQuery(this.pic).attr("maxH") || this.maxW;
    this.errorImg = errorImg || jQuery(this.pic).attr("errorImg") || "/NewShowStand/images/smallno.jpg";
    this.trueSrc = jQuery(pic).attr("trueSrc");
    if (this.trueSrc == null || this.trueSrc == "" || this.trueSrc == jQuery(pic).attr("src"))
        return;
    if (this.trueSrc == "/NewShowStand/images/smallno.jpg" || this.trueSrc == "/NewShowStand/images/bigno.jpg") {
        jQuery(this.pic).attr("src", this.trueSrc);
        return;
    }
    var thisObj = this;
    this.tmpJqPic = jQuery("<img style=\"visibility:hidden;position:absolute;left:0;top:0;\" src='" + this.trueSrc
        + "'/>");
    this.tmpJqPic.bind("load", function () { thisObj.Resize(); }).bind("error", function () { thisObj.Error(); });
    jQuery(document.body).append(this.tmpJqPic);
}

ResizePic.prototype = {
    Resize: function () {
        var thisObj = this;
        var targetPic = this.pic;
        var sourcePic = this.tmpJqPic.get(0);
        imgWidth = sourcePic.width;
        imgHeight = sourcePic.height;
        setTimeout(function () { thisObj.tmpJqPic.remove(); }, 1);
        targetPic.removeAttribute('src');
        if (imgWidth > this.maxW || imgHeight > this.maxH) {
            if (imgWidth / imgHeight > this.maxW / this.maxH) {
                targetPic.style.width = this.maxW + "px";
                targetPic.style.height = this.maxW * (imgHeight / imgWidth) + "px";
            }
            else {
                targetPic.style.height = this.maxH + "px";
                targetPic.style.width = this.maxH * (imgWidth / imgHeight) + "px";
            }
        }
        else {
            targetPic.style.width = imgWidth + "px";
            targetPic.style.height = imgHeight + "px";
        }
        jQuery(this.pic).attr("src", jQuery(targetPic).attr("trueSrc"));
    },
    Error: function () {
        var thisObj = this;
        var targetPic = this.pic;
        var sourcePic = this.tmpJqPic.get(0);
        setTimeout(function () { thisObj.tmpJqPic.remove(); }, 1);
        jQuery(this.pic).attr("src", this.errorImg);
    }
};

function DrawImage(ImgD, FitWidth, FitHeight) {
    var image = new Image();
    image.src = ImgD.src;
    var nwidth = 0;
    var nheight = 0;
    image.src = ImgD.src;
    image.onload = function () {
        if (image.width > 0 && image.height > 0) {
            if (image.width / image.height >= FitWidth / FitHeight) {
                if (image.width > FitWidth) {
                    nwidth = FitWidth;
                    nheight = (image.height * FitWidth) / image.width;
                } else {
                    nwidth = image.width;
                    nheight = image.height;
                }
            } else {
                if (image.height > FitHeight) {
                    nheight = FitHeight;
                    nwidth = (image.width * FitHeight) / image.height;
                } else {
                    nwidth = image.width;
                    nheight = image.height;
                }
            }
            ImgD.width = nwidth;
            ImgD.height = nheight;
        }
        ImgD.style.width = nwidth + "px";
        ImgD.style.height = nheight + "px";
    }
}

//退出登陆
function outLogin() {
    AjaxClass.OutLogin();
    location.reload();
}

//导航栏高亮
function NavigationHightLight(id){
	if(document.getElementById("HeadNavigation_"+id)!=null){
	document.getElementById("HeadNavigation_"+id).className="";
	}
}


function bottomsearch(p) {
    var web_site = document.getElementById("web_site").value;
    var keys = document.getElementById("BotKeys").value;
    if (keys == '请输入产品名称...')
        keys = "";
    keys = keys.replace(/(^[^\S]+)|([^\S]+$)/g, "");
    keys = keys.replace(/\+/g, "%2b"); //替换'+'号，如果不处理‘+’号会被替换成空
    var getIndustryDomain = AjaxClass.GetIndustryDomain().value;
    if (p == 1) //搜全站
    {
		var classidBykey = AjaxClass.GetClassIDByKey(keys).value;
        var searchUrl = "/product/t" + classidBykey + "/list_p0.html";
        if (web_site == "zyzhan" || web_site == "hbzhan" || web_site == "nongjx"  ) {
            searchUrl = "/chanpin-0_p0.html";
        }
		else if (web_site == "gkzhan") {
               searchUrl = "/chanpin/0_p0/";
            }
        else if (web_site == "ybzhan") {
            searchUrl = "http://www.ybzhan.cn/chanpin-0/list_p0.html";
        }
        else if (web_site == "jc35") {
            if (window.location.href.indexOf('used') > -1) {
                searchUrl = "http://used.jc35.com/chanpin-0.html";
            }
            else {
                searchUrl = getIndustryDomain + "/chanpin-" + classidBykey + "_p0.html";
            }
        }
        else if (web_site == "86175") {
            searchUrl = getIndustryDomain + "/product/list-" + classidBykey + ".html";
        }

        document.getElementById("botSearchForm").action = searchUrl;
    }
    document.getElementById("botSearchForm").submit();
}

function showInquiry()
{
	jumphtml()
}
function showInquiry2()
{
	jumphtml()
}
function jumphtml()
{
	document.getElementById("inquiry").style.display="block";
}


function Clearvalue() {
    var RandNum = $.trim($("#ranNum").val());
    var detail = "detail_" + RandNum;
    var title = "title_" + RandNum;
    var companyName = "companyName_" + RandNum;
    var linkMan = "linkMan_" + RandNum;
    var email = "email_" + RandNum;
    var tel = "tel_" + RandNum;
    var addr = "addr_" + RandNum;
	PvcID="0";
    document.getElementById(detail).value = "";
    document.getElementById(title).value = "";
    document.getElementById(companyName).value = "";
    document.getElementById(linkMan).value = "";
    document.getElementById(email).value = "";
    document.getElementById(tel).value = "";
    document.getElementById(addr).value = "";
    document.getElementById("Provinces").innerHTML = "请选择省份";
    document.getElementById("valCode").value = "";
}

function InquirySubmitMessage2(type) {
	$(".Wrong").hide();
	var cid = $.trim($("#cid").val());
	if (cid == null || cid == "" || cid == "0") {
		//Boxy.alert("无此公司,ID错误！", function () { location.href = "/"; });
		alertBoxShow("提示", "", "无此公司,ID错误！", function() {
			location.reload();
		});
		return;
	}
	var ranNum = $.trim($("#ranNum").val());
	var detail = $.trim($("#detail_" + ranNum).val());
	var linkMan = $.trim($("#linkMan_" + ranNum).val());
	var companyName = $.trim($("#companyName_" + ranNum).val());
	var tel = $.trim($("#tel_" + ranNum).val());
	var email = $.trim($("#email_" + ranNum).val());
	var title = $.trim($("#title_" + ranNum).val());
	var proID = $.trim($("#proID_" + ranNum).val());
	var valCode = $.trim($("#valCode").val());
	var addr = $.trim($("#addr_" + ranNum).val());
	var orderType = "0";
    var IsNoSend = $('input:radio[name="isnosend"]:checked').val();
	var WXTel = $.trim($("#WX_" + ranNum).val());
	if (typeof (IsNoSend) == "undefined") {
	    IsNoSend = "0";
	}
	if ($("#orderType").length > 0) {
	    orderType = $("#orderType").val();
	}
	if (type == "1" && (title == "" || title == "请输入你感兴趣的产品")) {
		showInputWrong($("#title_" + ranNum), "请输入产品名称");
		return;
	}
	if (linkMan == "" || linkMan == "您的姓名...") {
		showInputWrong($("#linkMan_" + ranNum), "请填写您的姓名");
		return;
	}
	if (companyName == "" || companyName == "请输入您的单位名称，个体经营者请填'个体经营'...") {
		companyName = "";
	}
	if (tel == "" || tel == "固定电话或手机...") {
		showInputWrong($("#tel_" + ranNum), "请填写联系电话");
		return;
	}else {
        if (!IsTel(tel)) {
            showInputWrong($("#tel_" + ranNum), "联系电话输入错误");
            return;
        }
    }
	if (email == "" || email == "便于客户给您发邮件...") {
		email = "";
	}
	if (email != "" && email != "便于客户给您发邮件..." && !valid.isEMail(email)) {
		showInputWrong($("#email_" + ranNum), "您填写的邮箱地址有误");
		return;
	}
	if (detail == "" || detail == "如对采购产品有详细要求，请在此输入....") {
		detail = "";
	} else if (detail.length > 200) {
		showInputWrong($("#detail_" + ranNum), "补充说明请控制在200字以内");
		return;
	}
	//包含  http 或https 或.com  .cn  .net  .php,.asp,.jsp 的  提示
	if (detail.length > 0) {
		var tempInqContent=detail.toLowerCase();
		if ( tempInqContent.indexOf("http")>-1 || tempInqContent.indexOf("https")>-1 || tempInqContent.indexOf(".com")>-1 || tempInqContent.indexOf(".cn")>-1|| tempInqContent.indexOf(".net")>-1|| tempInqContent.indexOf(".php")>-1|| tempInqContent.indexOf(".asp")>-1|| tempInqContent.indexOf(".jsp")>-1) {
			showInputWrong(jq("#detail_" + ranNum),  "留言信息中请勿包含网址，请修改后再次提交。");
			return;
		}
	}
	if (PvcID == "" || PvcID == "0") {
	    PvcID = "0";
	}
	if (valCode == "") {
		showInputWrong($("#valCode"), "请填写验证码");
		return;
    }
    AjaxClass.NewSendMessage4(cid, title, proID, linkMan, companyName, tel, email, detail, addr, valCode, PvcID,orderType,"",IsNoSend,WXTel, InquirySendMessage2CallBack);
}



function InquirySendMessage2CallBack(obj) {
    var jsonStr1 = obj.value;
    var jsonobj = eval("rrr=" + jsonStr1);
    var ranNum = $.trim($("#ranNum").val());
    var Detail = "detail_" + ranNum;
    if (jsonobj.Detail) {
        var NewOrderID = jsonobj.Detail[0].Success;
        if (NewOrderID > 0) { //留言成功
            AjaxClass.NewSendMsgOnlySaveNoSendMeg_CallBackToSend(NewOrderID, function() { return false; });
            alertBoxShow("提示", 1, "您的留言已提交成功！我们将在第一时间回复您~", function() { location.reload(); });
            document.getElementById(Detail).value = "";

        } else {
            switch (jsonobj.Detail[0].Success) {
            case -1:
                alert("验证码错误！请点击验证码进行刷新操作重新填写！");
                break;
            case -5:
                alert("很抱歉，您的信息包含了非法字符(" + jsonobj.Detail[0].DirtyWords + ")，请修改！");
                break;
            case -10:
                alert("留言成功，邮件发送失败！");
                break;
            case -11:
                alert("留言信息中请勿包含网址，请修改后再次提交！");
                break;
            default:
                alert("数据写入失败!");
                break;
            }
        }
    } else {
        alert(jsonobj.Error);
    }
}
//utils.select(".provinceTop", ".provinceBot");






//-----------------------------------------新留言框2019 金色的

//window.onload=function(){
//	setTimeout(ShowNewBox(),3000);
//}
jQuery(document).ready(function(){
	setTimeout(ShowNewBox(),3000);
});

function inStartCol(){

}

var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for IE7, Firefox, Opera, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("GET",url,false);
  xmlhttp.send(null);

  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}


function state_Change(){
  if (xmlhttp.readyState==4)
  {
    if (xmlhttp.status==200)
    {

		var mycode=AjaxClass.EncryptVerCode().value;
		if(mycode!=null && mycode!="")
		{
			//var rst= AjaxClass.CkVCode(mycode).value;
			//alert(rst);
			var detail = document.getElementById("new_detail").value;
            var linkMan = document.getElementById("new_linkname").value;
            var companyName =document.getElementById("new_companyname").value;
            var tel = document.getElementById("new_telphone").value;
            var email = document.getElementById("new_email").value;
            var title = document.getElementById("new_title").value;
            var addr = document.getElementById("new_Address").value;
	        var cid=document.getElementById("cid").value;
			var pid=document.getElementById("Pid").value;
			var IsNoSend =  jQuery('input:radio[name="isnosend3"]:checked').val();
            var wxtel = document.getElementById("new_wxtel").value;
				if (typeof (IsNoSend) == "undefined") {
					IsNoSend = "0";//默认不转发
				 }
				AjaxClass.SendMessage3(cid, title, pid, linkMan, companyName, tel, email, detail, addr, mycode, "0",IsNoSend,wxtel, InquirySendMessageCallBack2).value;
		}
		else{
			alert("发生错误，刷新重试");
			document.getElementById("btnsubmit").innerHTML="提交留言";
	        document.getElementById("btnsubmit").setAttribute("onclick","NewOderMessage()");
	        document.getElementById("btnsubmit").onclick=function(){NewOderMessage();};
		}
    }
    else
    {
      alert("Problem retrieving XML data");
	  document.getElementById("btnsubmit").innerHTML="提交留言";
	  document.getElementById("btnsubmit").setAttribute("onclick","NewOderMessage()");
	  document.getElementById("btnsubmit").onclick=function(){NewOderMessage();};
    }
  }
}


function NewOderMessage(){
	var detail = document.getElementById("new_detail").value;
	if(detail=="" || detail=="详细需求："){alert("请填写详细！"); return;}
    var linkMan = document.getElementById("new_linkname").value;
	if(linkMan=="" || linkMan=="联系人"){alert("请填写联系人！");return;}
    var companyName =document.getElementById("new_companyname").value;
	if(companyName=="" || companyName=="公司"){document.getElementById("new_companyname").value="";}
    var tel = document.getElementById("new_telphone").value;
	if(tel=="" || tel=="手机" ){alert("请填写联系电话！");return;}else {
        if (!IsTel(tel)) {
            alert("联系电话输入错误")
            return;
        }
    }
	if(checkPhone(tel)==false && checkTel(tel)==false){alert("请填写正确的联系方式");return;}
    var email = document.getElementById("new_email").value;
	if(email=="" || email=="邮箱"){document.getElementById("new_email").value="";}
	try{if(!valid.isEMail(email)){ alert("填写的邮箱有误.");return; } }catch(err){}
    var title = document.getElementById("new_title").value;
    var addr = document.getElementById("new_Address").value;
	var cid=document.getElementById("cid").value;
	var pid=document.getElementById("Pid").value;
	document.getElementById("btnsubmit").innerHTML="提交中...";
	document.getElementById("btnsubmit").setAttribute("onclick","");
	document.getElementById("btnsubmit").onclick=function(){};
	loadXMLDoc('/NewShowStand/Image.aspx?'+Math.random());

}


function InquirySendMessageCallBack2(obj){
    jsonStr = obj.value;
    var jsonobj = eval("rrr=" + jsonStr);
    if (jsonobj.Detail) {
        var NewOrderID = jsonobj.Detail[0].Success;
        if (NewOrderID > 0) { //留言成功
            AjaxClass.NewSendMsgOnlySaveNoSendMeg_CallBackToSend(NewOrderID, function() { return false; });
            alert("您的留言已提交成功！我们将在第一时间回复您~");
            ClearUpNewBox();

        } else {
            switch (jsonobj.Detail[0].Success) {
            case -1:
                alert("验证失效！请重试！");
                break;
            case -5:

                alert("很抱歉，您的信息包含了非法字符(" + jsonobj.Detail[0].DirtyWords + ")，请修改！");
                break;
            case -10:
                alert("留言成功，邮件发送失败！");
                ClearUpNewBox();
                break;
            default:
                alert("数据写入失败,请重试!");
                break;
            }
        }
    } else {

       alert("失败："+  jsonobj.Error);
    }
	document.getElementById("btnsubmit").innerHTML="提交留言";
	document.getElementById("btnsubmit").setAttribute("onclick","NewOderMessage()");
	document.getElementById("btnsubmit").onclick=function(){NewOderMessage();};
}

function ClearUpNewBox(){
	if(document.getElementById("popCol")!=null){
    document.getElementById("new_detail").value="";
    document.getElementById("new_linkname").value="";
    document.getElementById("new_companyname").value="";
    document.getElementById("new_telphone").value="";
    document.getElementById("new_email").value="";
	//document.getElementById("popCol").style.display="none";
	}
}
//var  ShowNewBoxSite=["www.gkzhan.com","www.a-bm.cn","www.jc35.com"];
var  ShowNewBoxSite=[""];//--202208171611 胡杨提直接不要了
function ShowNewBox(){
	if(IsShowSite(ShowNewBoxSite)  && window.location.href.indexOf("product")>-1)
	{
	 if(document.getElementById("Pid")!=null)
	 {
		 if(document.getElementById("Pid").value=="")
		 {
			 return;
		 }
	 }
	 else
	 {
		 return;
	 }

	 if(document.getElementById("popCol")!=null){
	   document.getElementById("popCol").style.display="block";
	 }
	 setTimeout(function(){
	 try{
		var kfr= document.getElementById("KFRightScreen");
		if(kfr!=null)
		{
			var tmepClassName=kfr.className;
			if(tmepClassName.charAt(tmepClassName.length-1)!="2")
			{
			 kfr.setAttribute("class",kfr.className+"2");
			}
		}
		else
		{
			console.log("KFRightScreen notfind");
		}

	 }catch(Err){console.log("error");}},500);

	}
}
function zxjl_Help(){
	if(IsShowSite(ShowNewBoxSite) && window.location.href.indexOf("product")>-1)
	{
	 if(document.getElementById("Pid")!=null)
	 {
		 if(document.getElementById("Pid").value=="")
		 {
			 return;
		 }
	 }
	 else
	 {
		 return;
	 }
	}
	else
	{
		return;
	}
	 setTimeout(function(){
	 try{
		var kfr= document.getElementById("KFRightScreen");
		if(kfr!=null)
		{
			var tmepClassName=kfr.className;
			if(tmepClassName.charAt(tmepClassName.length-1)!="2")
			{
			 kfr.setAttribute("class",kfr.className+"2");
			}
		}
		else
		{
			console.log("KFRightScreen notfind");
		}

	 }catch(Err){console.log("error");}},500);
}

function IsShowSite(SiteName){
	var tempsitename=window.location.hostname;
	for(var i=0;i<SiteName.length;i++){
		if(tempsitename==SiteName[i]){
			return true;
		}
	}
	return false;
}

function CloseNewBox(){
	//if(document.getElementById("popCol")!=null)
	//document.getElementById("popCol").style.display="none";
    if(document.getElementById("popCol")!=null){
		//document.getElementById("box_close").style.display="none";
		//document.getElementById("popBody").style.display="none";
		//document.getElementById("box_open").style.display="block";
		jQuery("#popCol").animate({right:'-360px'}); //动画消失；
		setTimeout(function(){document.getElementById("PopHelp").style.display="block"},500);
		try{
		 var kfr= document.getElementById("KFRightScreen");
		 if(kfr!=null)
		 {
			var tmepClassName=kfr.className;
			if(tmepClassName.charAt(tmepClassName.length-1)=="2")
			{
			  kfr.setAttribute("class",tmepClassName.substring(0,tmepClassName.length-1));
			}
		 }
		 else
		 {
			console.log("KFRightScreen notfind");
		 }

	    }catch(Err){console.log("error2");}


		if(ChatCompanyID!=null && ChatCompanyID!="undefined")
		{
			try{
				//setCookie("KFRightScreenLeft_"+ChatCompanyID,"",-1);
				document.getElementById("KFRightScreen").style.left="";
				document.getElementById("KFRightScreen").style.top=PaddingTopLoad+"px";
				document.getElementById("KFRightScreen").style.right="2px";
			}
			catch(errr)
			{

			}
		}

	}

}
function OpenNewBox(){
	if(document.getElementById("popCol")!=null){
		//document.getElementById("box_open").style.display="none";
		//document.getElementById("popBody").style.display="block";
		//document.getElementById("box_close").style.display="block";
		document.getElementById("PopHelp").style.display="none";
		jQuery("#popCol").animate({right:'0px'}); //动画出现
		try{
		 var kfr= document.getElementById("KFRightScreen");
		 if(kfr!=null)
		 {
			var tmepClassName=kfr.className;
			if(tmepClassName.charAt(tmepClassName.length-1)!="2")
			{
			  kfr.setAttribute("class",tmepClassName+"2");
			}
		 }
		 else
		 {
			console.log("KFRightScreen notfind");
		 }

	    }catch(Err){console.log("error3");}

		if(ChatCompanyID!=null && ChatCompanyID!="undefined")
		{
			try{
				//setCookie("KFRightScreenLeft_"+ChatCompanyID,"",-1);
				document.getElementById("KFRightScreen").style.left="";
				document.getElementById("KFRightScreen").style.top=PaddingTopLoad+"px";
				document.getElementById("KFRightScreen").style.right="2px";
			}
			catch(errr)
			{

			}
		}
	}
}
function checkPhone(str){
    var phone = str;
    if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone))){
        return false;
    }
    else{
		 return true;
	}
}
 function checkTel(str){
 var tel = str;
if(!/^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/.test(tel)){
return false;
}
else
{
 return true;
}

}

//-----2019金色留言框 结束------------------------------------



function Clearvalue2() {
	jQuery(".Wrong").hide();
	PvcID="0";
    document.getElementById("InqProduct").value = "";
    document.getElementById("InqEmail").value = "";
    document.getElementById("InqCompany").value = "";
    document.getElementById("InqName").value = "";
    document.getElementById("InqAddress").value = "";
    document.getElementById("InqTelphone").value = "";
    document.getElementById("InqCode2").value = "";
    document.getElementById("selppp")[0].selected=true;
	document.getElementById("InqContent").value="";
}

//左边分类的产品搜索
function LeftClassSeach(stype)
{
	 if(document.getElementById("inpt_LeftClass")!=null && document.getElementById("inpt_LeftClass").value.trim()!=null )
	 {
		   var skvalue=document.getElementById("inpt_LeftClass").value;
		    skvalue = skvalue.replace(/(^[^\S]+)|([^\S]+$)/g, "");
			skvalue = skvalue.replace(/\+/g, "%2b"); //替换'+'号，如果不处理‘+’号会被替换成空

		   var getIndustryDomain = AjaxClass.GetIndustryDomain().value;
		   var CompanyID = document.getElementById("cid").value;
		   var surls= getIndustryDomain + "/st" + CompanyID + "/product.html";
		   if(stype==2)//二手页面
		   {
			   surls= getIndustryDomain + "/st" + CompanyID + "/used.html";
		   }
		   var ExportForm = document.createElement("FORM");
			document.body.appendChild(ExportForm);
			ExportForm.method = "POST";
			var newElementK = document.createElement("input");
            newElementK.setAttribute("name", "Keyword");
            newElementK.setAttribute("type", "hidden");
			ExportForm.appendChild(newElementK);
            newElementK.value = decodeURIComponent(skvalue);
			//newElementK.value = skvalue;
			ExportForm.action = surls;
			ExportForm.submit();
	 }

}

function isNull(_sVal){
	return (_sVal === "" || _sVal == null || _sVal == "undefined");
}


//百度流量日志
var _IsPlayed = false;
function PlayVideo(mda) {
    if (_IsPlayed == false) {
        _IsPlayed = true;
        AjaxClass.AddVideoUsageLog(mda, backinfo);
    }
}
function backinfo() {
    return;
}
$(function(){
	 var swiper2 = new Swiper('.swiper-container2', {
	      slidesPerView: 4,
	      spaceBetween: 25,
	      pagination: {
	        el: '.swiper-pagination2',
	        clickable: true,
	      },
	    });
		var swiper3 = new Swiper('.swiper-container3', {
		     slidesPerView: 2,
		     spaceBetween: 15,
		     pagination: {
		       el: '.swiper-pagination3',
		       clickable: true,
		     },
         });

	var mySwiper = new Swiper('.swiper-container4',{
		slidesPerView:2.2,
	});
})

 $(".dialogTxt").find("a").click(function () {
                $(".login").toggleClass("show");
                $(".btn").toggle();
                if ($(this).html() == "[登录]") {
                    $(this).html("[取消登录]");
                } else {
                    $(this).html("[登录]");
                }
});
function SetClickNumber(Cid, Position) {
    var href = window.location.href;
    var json = AjaxClass.InsertClickCompanyLink(Cid, href).value;
    var jsonObj = eval("Data=" + json);
    if (jsonObj.Detail && jsonObj.Detail[0].Success == "1") {
        if (Position=="0") {
            document.getElementById("ClickPhone").style.display = "none";
            document.getElementById("StandTopPhone").style.display = "block";
        }
        else if(Position=="1"){
            document.getElementById("BotClick").style.display = "none";
            document.getElementById("StandBotPhone").style.display = "block";
        }
        else if (Position == "2") {
            document.getElementById("BotMobilePhone").style.display = "none";
            document.getElementById("StandBotMobile").style.display = "inline";
        }

    }
}
//检测手机号
function IsTel(s) {
    var patrn = /^[/0-9-/u9fa5]*$/; ///^(\(\d{3,4}\)|\d{3,4}-)?\d{7,8}$/;
    if (!patrn.exec(s))
        return false
    else
        return true
}