﻿
function collapse(objid) {

    //collapseAll();
    if (document.getElementById(objid).style.display == 'none') {
        document.getElementById(objid).style.display = "";
        document.getElementById('g' + objid).src = "images/web2.gif";
    }
    else {

        document.getElementById(objid).style.display = "none";

        document.getElementById('g' + objid).src = "images/web1.gif";
    }
}
function collapse1(objid) {
    var obj = document.getElementById(objid);
    //collapseAll();
    if (document.getElementById(objid).style.display == 'none') {
        document.getElementById(objid).style.display = '';
        document.getElementById('g' + objid).src = "../images/web2.gif";
    }
    else {
        document.getElementById(objid).style.display = 'none';

        document.getElementById('g' + objid).src = "../images/web1.gif";
    }
}
function check1() {
    if (document.getElementById("ctl00_content_txtname").value == "") {
        alert('Please input your name');
        document.getElementById("ctl00_content_txtname").focus();
        document.getElementById("ctl00_content_txtname").select();
        return false;
        return;
    }

    else if (document.getElementById("ctl00_content_txtemail").value == "") {
        alert('Please input your Email');
        document.getElementById("ctl00_content_txtemail").focus();
        document.getElementById("ctl00_content_txtemail").select();
        return false;

    }
    else if (document.getElementById("ctl00_content_txttitle").value == "") {
        alert('Please input title');
        document.getElementById("ctl00_content_txttitle").focus();
        document.getElementById("ctl00_content_txttitle").select();
        return false;

    }
    else if (document.getElementById("ctl00_content_txtcontent").value == "") {
        alert('Please input content');
        document.getElementById("ctl00_content_txtcontent").focus();
        document.getElementById("ctl00_content_txtcontent").select();
        return false;

    }
    else if (document.getElementById("ctl00_content_txttel").value == "") {
        alert('Please input your you phone');
        document.getElementById("ctl00_content_txttel").focus();
        document.getElementById("ctl00_content_txttel").select();
        return false;
    }
//    else if (document.getElementById("ctl00_content_txtCode").value == "") {
//        alert('Please input the Verification code');
//        document.getElementById("ctl00_content_txtCode").focus();
//        document.getElementById("ctl00_content_txtCode").select();
//        return false;
//    }
    else if (document.getElementById("ctl00_content_txtemail").value != "") {
        var email = document.getElementById("ctl00_content_txtemail").value; //得到输入的邮箱
        var reg = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/; //定义验证邮件的正则表达式
        if (!email.match(reg))//验证失败，显示错误信息，返回
        {
            alert('the email Error');
            document.getElementById("ctl00_content_txtemail").focus();

            return false;
        }
    }




    //document.getElementById("ctl00_content_Button2").disabled="disabled";
}
function checkemail() {
    var email = document.getElementById("ctl00_content_txtemail").value; //得到输入的邮箱
    var reg = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/; //定义验证邮件的正则表达式
    if (!email.match(reg))//验证失败，显示错误信息，返回
    {
        alert('the email Error');
        document.getElementById("ctl00_content_txtemail").focus();
        return false;
    }

}
function check() {
    check1();

}
function DrawImage(ImgD) {//产品具体页主图
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        flag = true;
        if (image.width / image.height >= 210 / 205) {
            if (image.width > 210) {
                ImgD.width = 200;
                ImgD.height = (image.height * 200) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
        else {
            if (image.height > 205) {
                ImgD.height = 205;
                ImgD.width = (image.width * 205) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
    }
}
function DrawImage1(ImgD) {//首页
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        flag = true;
        if (image.width / image.height >= 108 / 119) {
            if (image.width > 108) {
                ImgD.width = 108;
                ImgD.height = (image.height * 108) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
        else {
            if (image.height > 119) {
                ImgD.height = 119;
                ImgD.width = (image.width * 119) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
    }
}
function DrawImage2(ImgD) {//产品页
    var image = new Image();

    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        flag = true;
        if (image.width / image.height >= 125 / 125) {
            if (image.width > 125) {
                ImgD.width = 125;
                ImgD.height = (image.height * 125) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
        else {
            if (image.height > 125) {
                ImgD.height = 125;
                ImgD.width = (image.width * 125) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
    }
}
function DrawImage3(ImgD) {//产品具体页,副大图
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        flag = true;
        if (image.width / image.height >= 507 / 450) {
            if (image.width > 507) {
                ImgD.width = 507;
                ImgD.height = (image.height * 507) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
        else {
            if (image.height > 450) {
                ImgD.height = 450;
                ImgD.width = (image.width * 450) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
    }
}
function display(obj) {
    if (obj.parentNode.children[2].style.display == "") {
        obj.parentNode.children[2].style.display = "none";
    }
    else {
        obj.parentNode.children[2].style.display = "";
    }
}
