<script type="text/javascript" src="http://j.maxmind.com/app/geoip.js"></script>
<script>
(function() {
/*確認使用者是否第一次進入本網頁*/
var ilona = checkCookie();
if (ilona != 2) {
/*判斷IP導向哪個address*/
var where = document.getElementById('header-wrapper');
var out = geoip_country_code();
var url = 'http://solutions.avermedia.com';
if (out == 'TW' || out == 'HK') {
document.location.href = url + "/zh-tw";
} else if (out == 'CN') {
document.location.href = url + "/zh-cn";
} else if (out == 'FR') {
document.location.href = url + "/fr";
} else if (out == 'DE') {
document.location.href = url + "/de";
} else if (out == 'BR') {
document.location.href = url + "/br";
} else if (out == 'RU') {
document.location.href = url + "/ru";
} else if (out == 'ES') {
document.location.href = url + "/es";
} else {
document.location.href = url;
}
}
})();
 
function getCookie(c_name) {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x == c_name) {
return unescape(y);
}
}
}
 
function setCookie(c_name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value)
+ ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
document.cookie = c_name + "=" + c_value;
}
 
function checkCookie() {
var username = getCookie("username");
if (username != null && username != "") {//第二次進來
return username;
} else {//初次訪客 輸入名稱
//username = prompt("Please enter your name:", "");
//if (username != null && username != "") {
setCookie("username", 2, 365);
}
}
</script> 

cabuchi 發表在 痞客邦 PIXNET 留言(0) 人氣()