﻿var tips; var tipss; var theTop = 80; var old = theTop;var prox; var proy; var proxc; var proyc;
    function initFloatTips() {
        tips = document.getElementById('floatDiv');
        tipss=document.getElementById('floatDivSm');
        tipsss=document.getElementById('onLineDiv');
        moveTips();
    };
    function moveTips() {
        var tt = 50;
        if (window.innerHeight) {
            pos = window.pageYOffset
        }
        else if (document.documentElement && document.documentElement.scrollTop) {
            pos = document.documentElement.scrollTop
        }
        else if (document.body) {
            pos = document.body.scrollTop;
        }
        pos = pos - tips.offsetTop + theTop;
        pos = tips.offsetTop + pos / 10;
        if (pos < theTop) pos = theTop;
        if (pos != old) {
            tips.style.top = pos + "px";
            tipss.style.top = pos + "px";
            tipsss.style.top = pos + "px";
            tt = 10;
        }
        old = pos;
        setTimeout(moveTips, tt);
    }
    function bClick() {
        document.getElementById("floatDiv").style.visibility = "visible";
        document.getElementById("floatDivSm").style.visibility = "hidden";
    }
    function sClick() {
        document.getElementById("floatDiv").style.visibility = "hidden";
        document.getElementById("floatDivSm").style.visibility = "visible";
    }
    
    
    function show(id) { clearInterval(prox); clearInterval(proy); clearInterval(proxc); clearInterval(proyc); var o = document.getElementById(id); o.style.display = "block"; o.style.width = "1px"; o.style.height = "1px"; prox = setInterval(function() { openx(o, 397) }, 10); }
    function openx(o, x) { var cx = parseInt(o.style.width); if (cx < x) { o.style.width = (cx + Math.ceil((x - cx) / 5)) + "px"; } else { clearInterval(prox); proy = setInterval(function() { openy(o, 400) }, 10); } }
    function openy(o, y) { var cy = parseInt(o.style.height); if (cy < y) { o.style.height = (cy + Math.ceil((y - cy) / 5)) + "px"; } else { clearInterval(proy); } }
    function closed(id) { clearInterval(prox); clearInterval(proy); clearInterval(proxc); clearInterval(proyc); var o = document.getElementById(id); if (o.style.display == "block") { proyc = setInterval(function() { closey(o) }, 10); } }
    function closey(o) { var cy = parseInt(o.style.height); if (cy > 0) { o.style.height = (cy - Math.ceil(cy / 5)) + "px"; } else { clearInterval(proyc); proxc = setInterval(function() { closex(o) }, 10); } }
    function closex(o) { var cx = parseInt(o.style.width); if (cx > 0) { o.style.width = (cx - Math.ceil(cx / 5)) + "px"; } else { clearInterval(proxc); o.style.display = "none"; } }
    
    
    function checkForm() {

//var f = document.form1;
        var ff = document.getElementById("name").value;
        var add=document.getElementById("address").value;
        var phone=document.getElementById("phone").value;
        var meg=document.getElementById("message").value;
        //var len = f.uid.value.length;
        var reg = new RegExp(/^(?:[\u4e00-\u9fa5]*\w*\s*)+$/);
        var reg_1 = new RegExp(/^(0\d{2}[-]?\d{8})|(0\d{3}[-]?\d{7})|(1\d{10})$/);
        var reg_4 = new RegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{3})$/);
        var reg_5 = new RegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\d|X)$/);
        if (ff.length == 0 || ff.length > 25 || !ff.match(reg)) {
            alert("请正确填写您的姓名！"); return false;
        }
        if (add.length == 0 || add.length > 30 || !add.match(reg))
        { alert("请正确填写您的地址！"); return false; }

        if (phone.length == 0 || phone.length > 12 || !phone.match(reg_1))
        { alert("请填写您的电话号码或手机号码！"); return false; }
        if (meg.length > 50 || !meg.match(reg)) {
            alert("请正确填写留言"); return false;
        }
        return true;
    }