﻿// 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 "";
}

//下拉二级栏目控制开始
var twong = null;
var ii = 0;
var jj = 100;
var oldid = "";
function twoNgChange(obj,show,oneBg,columnid) 
{

    if (obj.children.length > 1) {
        obj.children[0].style.display = show;
        
        twong = obj.children[0];
        
        
        if (show == "block") {
            obj.children[1].children[0].className = "oneNg_2";
            if (oldid != columnid) {
                oldid = columnid;
                ii = 0;
                showTwoNg();                
            }
        }
        else {
            obj.children[1].children[0].className = "oneNg";
            if (oldid != columnid) {
                oldid = columnid;
                jj = 100;
                hideTwoNg();                
            }
        }
        
    }

    obj.background = oneBg

}
function showTwoNg() {
    ii = ii + 10;
    twong.style.filter = "alpha(opacity=" + ii + ")";
    if (ii <= 100) {
        setTimeout("showTwoNg()", 5);
    }
}
function hideTwoNg() {
    jj = jj - 10;
    twong.style.filter = "alpha(opacity=" + jj + ")";
    if (jj > 0) {
        setTimeout("hideTwoNg()", 5);
    }
}

//下拉二级栏目控制结束



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=yes, resizable=yes, location=no, status=no'; 
    open(u, 'oWin', s);
    return false; 
} 

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 emailtext = document.getElementById("emailtext");
    var title = document.getElementById("title");
    var contentText = document.getElementById("contentText");
    
    var errinfo = "";
    if(nameText.value == "")
    {
        errinfo +="·姓名不能为空！\n";
    }
    if(!(phone.value != "" || oicq.value != "" || emailtext.value  != "" ))
    {
        errinfo +="·联系电话、OICQ、Email必须输入其中一项！\n";
    }
    if(title.value == "")
    {
        errinfo +="·主题不能为空！\n";
    }
    if(contentText.value == "")
    {
        errinfo +="·内容不能为空！";
    }
    if(errinfo != "")
    {
        alert(errinfo);
        return;
    }
    
    Pancy.Entity.AjaxClass.AddLeaveowrd(nameText.value,sex.value,phone.value,website.value,oicq.value,emailtext.value,title.value,contentText.value,callBack)
    
    document.getElementById("clewText").innerText = " ※ 留言正提交．．．请稍后！";

}
function callBack(ve)
{
    document.getElementById("clewText").innerText = "";

    if(ve.value)
    {
        alert("留言失败！");
    }
    else
    {
        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 emailtext = document.getElementById("emailtext");
        var title = document.getElementById("title");
        var contentText = document.getElementById("contentText");
        
        alert("留言提交成功，我们会尽快给您回复，感谢您的支持！");
        nameText.value = "";
        phone.value = "";
        website.value = "";
        oicq.value = "";
        emailtext.value = "";
        title.value = "";
        contentText.value = "";    
    }
}

function getweb(st)
{
    if(st.value != "0")
    {
        window.open(st.value)
    }
    st.selectedIndex = 0;
}

function openInfoWin(rel,width,height) {
    openWindow(rel, width, height);
    return false;
}
function openWindow(url, width, height) {
    var window_top = (screen.height - height) / 2;
    var window_left = (screen.width - width) / 2;


    var newfeatures = 'scrollbars=0,resizable=no,status=no,width=' + width + ',height=' + height + ',top=' + window_top + ',left=' + window_left;
    newWindow = window.open(url, '', newfeatures);

    if (newWindow == null) {
        alert("你的浏览器打开了弹出窗口拦截功能，系统窗口无法自动打开，请选关闭拦截功能再试或点击打开按钮！")
    }
    else {
        window.opener = null;
        newWindow.focus();
    }
}


function checkLogin(lform) {
    alert("抱歉，会员功能还在建设中！");
    return false;
}
function checkSearch(sform) {
    if (sform.sw.value == "") {
        alert("请输入搜索关键字！");
        return false;
    }
    else {
        return true;
    }
}
