﻿// JScript 文件
function MM_preloadImages() { //缓存图片 把此程序（MM_preloadImages('/images/WebResource1.gif')）加到 body 的 onLoad 事件里 
  var d=document; 
  if(d.images)
  { 
  	if(!d.MM_p)(d.MM_p=new Array());
	
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
	
	for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0)
	{
	  d.MM_p[j]=new Image;
	  d.MM_p[j++].src=a[i];}
  }
}
function request(name) //读取地址栏参数
{
  var source = location.href;
  var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");  
  if (reg.test(source)) return RegExp.$2; return "";
}
//
function twoNgChange(obj,show,oneBg) //二级栏目控制
{
    if(obj.children.length > 1)
    {
        obj.children[0].style.display = show;
    }
    obj.bgColor = oneBg
}
function productColumnListClick(obj,id) //无级分类菜单改变函数
{
    var subColumnRow = document.getElementById("productColumn" + id + "SubColumn");
    
    if(subColumnRow != null)
    {
        var show = subColumnRow.style.display;
        if(show == "block")
        {
            subColumnRow.style.display = "none";
            obj.src = "/images/WebResource1.gif";
        }
        else
        {
            subColumnRow.style.display = "block";
            obj.src = "/images/WebResource2.gif";
        }
    }
}
function siteColumnListClick(obj,id)
{
    var subColumnRow = document.getElementById("siteColumn" + id + "SubColumn");
    
    if(subColumnRow != null)
    {
        var show = subColumnRow.style.display;
        if(show == "block")
        {
            subColumnRow.style.display = "none";
            obj.src = "/images/WebResource1.gif";
        }
        else
        {
            subColumnRow.style.display = "block";
            obj.src = "/images/WebResource2.gif";
        }
    }
}

function iframeAutoFit(ifFrameID) //让浮动框架适合网页高度
{
    var work = parent.document.getElementById(ifFrameID);
    work.style.height = document.body.scrollHeight;
}

function openWindow(u, w, h)
{ 
    var l = (screen.width - w) / 2; 
    var t = (screen.height - h) / 2; 
    var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l +',menubar=no, scrollbars=no, resizable=yes, location=no, status=no'; 
    open(u, 'oWin', s); 
} 
function search1(str) //搜索
{
  
    window.open("/aspx/search.aspx?sw=" + encodeURIComponent(str));
    
}
function search2(str) //搜索
{
  
    location.href = "?sw=" + encodeURIComponent(str);
    
}
function searchParameters() //中转搜索参数
{
    
    var url = "/aspx/productsearch.aspx?pc=" + request("pc") + "&pp=" + request("pp") + "&sw=" + request("sw");
}
function addLeaveword() //留言发布
{
    var nameText = document.getElementById("nameText");
    var sex = document.getElementById("sex");
    var phone = document.getElementById("phone");
    var website = document.getElementById("website");
    var oicq = document.getElementById("oicq");
    var email = document.getElementById("email");
    var title = document.getElementById("title");
    var contentText = document.getElementById("contentText");
    
    if(nameText.value == "")
    {
        alert("姓名不能为空！");
        return;
    }
    if(!(phone.value != "" || oicq.value != "" || email.value  != "" ))
    {
        alert("联系电话、OICQ、Email必须输入其中一项！");
        return;
    }
    if(title.value == "")
    {
        alert("主题不能为空！");
        return;
    }
    if(contentText.value == "")
    {
        alert("内容不能为空！");
        return;
    }
    if(Pancy.Web.Function.AjaxClass.addLeaveowrd(nameText.value,sex.value,phone.value,website.value,oicq.value,email.value,title.value,contentText.value).vlue)
    {
        alert("留言失败！");
    }
    else
    {
        
        alert("留言提交成功，我们会尽快给您回复，感谢您的支持！");
        nameText.value = "";
        phone.value = "";
        website.value = "";
        oicq.value = "";
        email.value = "";
        title.value = "";
        contentText.value = "";
    }
}
function checkLogin(obj)
{
    if(obj.userName.value == "")
    {
        alert("请输入用户名！");
        return false;
    }
    if(obj.userPassword.value == "")
    {
        alert("请输入密码！");
        return false;
    }
    return true;
}

function certificateSearch() //证书查询
{
    
    var nameText = document.getElementById("CEName").value;
    var numberText = document.getElementById("CENumber").value;
    if(nameText =="" || nameText == null)
    {
        alert("请输入证书姓名！");
        return false;
    }
    if(numberText =="" || numberText == null)
    {
        alert("请输入证书编号！");
        return false;
    }
    Pancy.Web.Function.AjaxClass.checkCE(nameText,numberText,certificateSearch_back);
    document.getElementById("clewInfo").innerText = "正在查询．．．";

    
}

function certificateSearch_back(res)
{
    
    var recordID = res.value;
    if(recordID !=null && recordID !="")
    {
        
        var url = "/aspx/CEDetails.aspx?recordID=" + recordID;
        openWindow(url,"415","250");
        document.getElementById("clewInfo").innerText = "证书存在，请在弹出窗口中查看！";
    }
    else
    {
        document.getElementById("clewInfo").innerText = "很抱歉，您查询的证书不存在！";
    }
    
}