﻿function GetUrlPath() {
    //获取完整的URL地址
    var allUrl = document.URL;
    //URL域名后的地址
    var DomainUrl = "";
    //获取域名
    var thisHost = location.hostname;
    switch (thisHost.toUpperCase()) {
        case "NEWS.CCNF.COM": //新闻
            //当是旧的二级域名跳转到新二级域名
            if (allUrl.toUpperCase().indexOf("HTTP://NEWS.CCNF.COM/NEWS") == -1) {
                DomainUrl = allUrl.substr(20);
                window.location.href = "http://" + thisHost + "/news" + DomainUrl;
            }
            break;
        case "PHOTO.CCNF.COM": //图片
            if (allUrl.toUpperCase().indexOf("HTTP://PHOTO.CCNF.COM/PHOTO") == -1) {
                DomainUrl = allUrl.substr(21);
                window.location.href = "http://" + thisHost + "/photo" + DomainUrl;
            }
            break;
        case "TV.CCNF.COM": //视频
            if (allUrl.toUpperCase().indexOf("HTTP://TV.CCNF.COM/TV") == -1) {
                DomainUrl = allUrl.substr(18);
                window.location.href = "http://" + thisHost + "/tv" + DomainUrl;
            }
            break;
        case "FAIR.CCNF.COM": //展会
            if (allUrl.toUpperCase().indexOf("HTTP://FAIR.CCNF.COM/FAIR") == -1) {
                DomainUrl = allUrl.substr(20);
                window.location.href = "http://" + thisHost + "/fair" + DomainUrl;
            }
            break;
        case "EXHIBITOR.CCNF.COM": //展商
            if (allUrl.toUpperCase().indexOf("HTTP://EXHIBITOR.CCNF.COM/EXHIBITOR") == -1) {
                DomainUrl = allUrl.substr(25);
                window.location.href = "http://" + thisHost + "/exhibitor" + DomainUrl;
            }
            break;
        case "HALL.CCNF.COM": //展馆
            if (allUrl.toUpperCase().indexOf("HTTP://HALL.CCNF.COM/HALL") == -1) {
                DomainUrl = allUrl.substr(20);
                window.location.href = "http://" + thisHost + "/hall" + DomainUrl;
            }
            break;
        case "ORGANIZER.CCNF.COM": //办展单位
            if (allUrl.toUpperCase().indexOf("HTTP://ORGANIZER.CCNF.COM/ORGANIZER") == -1) {
                DomainUrl = allUrl.substr(25);
                window.location.href = "http://" + thisHost + "/organizer" + DomainUrl;
            }
            break;
        case "SUPPLIER.CCNF.COM": //服务商
            if (allUrl.toUpperCase().indexOf("HTTP://SUPPLIER.CCNF.COM/SUPPLIER") == -1) {
                DomainUrl = allUrl.substr(24);
                window.location.href = "http://" + thisHost + "/supplier" + DomainUrl;
            }
            break;
        case "TRADE.CCNF.COM": //供求
            if (allUrl.toUpperCase().indexOf("HTTP://TRADE.CCNF.COM/TRADE") == -1) {
                DomainUrl = allUrl.substr(21);
                window.location.href = "http://" + thisHost + "/trade" + DomainUrl;
            }
            break;
        default:
            window.location.href = "http://www.ccnf.com/default.shtml";
            break;
    }
}