redirectMobile = function() {
    var nowUrl      = location.href,
        nowHost     = location.host,
        jumpUrl     = '',
        mobileUrl   = 'https://m.zhengruan.com',
        wwwUrl   = 'https://www.zhengruan.com',
		mobileHurl	=  GetUrlRelativePath();
		var sUserAgent= navigator.userAgent.toLowerCase();
		var bIsIpad= sUserAgent.match(/ipad/i) == "ipad";

		var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os";

		var bIsMidp= sUserAgent.match(/midp/i) == "midp";

		var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";

		var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb";

		var bIsAndroid= sUserAgent.match(/android/i) == "android";

		var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce";

		var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile";
		if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {  try {

            if (nowUrl == 'https://www.dazhe.com/') {
                jumpUrl = mobileUrl;
            }
			else if (nowHost != 'm.dazhe.com') {
                jumpUrl = mobileUrl+mobileHurl;
            }

            if (jumpUrl&&nowHost!='m.zhengruan.com') location.href = jumpUrl;

        } catch (e) { }
    }else{
            try {
                if (nowUrl == 'https://m.dazhe.com/') {
                    jumpUrl = wwwUrl;
                }
                else if (nowHost != 'www.dazhe.com') {
                    jumpUrl = wwwUrl+mobileHurl;
                }

                if (jumpUrl&&nowHost!='www.zhengruan.com') location.href = jumpUrl;

            } catch (e) { }

        }
};

function GetUrlRelativePath()
{
	var url = document.location.toString();
	var arrUrl = url.split("//");
	var start = arrUrl[1].indexOf("/");
	var relUrl = arrUrl[1].substring(start);//stop省略，截取从start开始到结尾的所有字符
	if(relUrl.indexOf("?") != -1){
		relUrl = relUrl.split("?")[0];
	}
	return relUrl;
}
redirectMobile();
