﻿
    $(function () {
        var domain = "lintoptech.com"; //官方域名
        var Ndomain = getHost(); //获取当前域名
        var c1 = "欢迎访问凌钦科技公司网站，我们是一家专门从事电子商务网站建设及企业应用软件开发的软件公司。如果网站上没有您想要的资料，请来电咨询，我们将竭诚为您服务。我们的服务热线是：020-32031193,32209346";
        var c2 = "本公司合法域名是：<a href='http://www.lintop.cn'>lintop.cn</a> 和 <a href='http://www.lintoptech.com'>lintoptech.com</a>。如果页面没有自动跳转，请点击上面的链接。"
        if (Ndomain.indexOf(domain)<0 && Ndomain.indexOf("lintop.cn")<0) {
            createDomainDiv(c1, c2) 
            $(".DomainDiv").css({ "display": "block" });
            var time = 10; //倒计算
            setInterval(function () {
                time = time - 1;
                $(".gotime").html("(" + time + ")");
                if (time <= 0) {
                document.location.href = window.location.href.replace(Ndomain, domain);
                }
            }, 1000);

        }
    })



    function getHost(url) {
        var host = "null";
        if (typeof url == "undefined" || null == url) {
            url = window.location.href;
        }
        var regex = /.*\:\/\/([^\/]*).*/;
        var match = url.match(regex);
        if (typeof match != "undefined" && null != match)
            host = match[1];
        return host.toLowerCase();
    }

    function createDomainDiv(c1,c2) { 
    var domainhtml = '<div class="DomainDiv">';
    domainhtml += '<p class="line"></p>';
    domainhtml += '<p class="c1">'+c1+'</p>';
    domainhtml += '<p class="c1">' + c2 + '</p>';
    domainhtml += '<p class="gotime">(10)</p>';
    domainhtml += "</div>";
    $("body").append($(domainhtml));
    }
