var links = [
  "https://linkjb88.com/1",
  "https://linkjb88.com/2",
  "https://linkjb88.com/3"
];

// Lấy subdomain nếu có, không thì dùng mặc định
var fullHost = window.location.hostname;
var sub = fullHost.split(".");
var qhost = (sub.length > 2) ? sub[0] : "jb88";

// Chọn ngẫu nhiên 1 link
var randomIndex = Math.floor(Math.random() * links.length);
var selected = links[randomIndex];

// Chuyển hướng người dùng
window.location.href = selected + "/?affiliateCode=" + qhost;
