//iGameX CAB DownLoad Init var nSpaceDate = 1; var nPopMaxTimes = 2; var naWeekTimes = 0; var nCountWeek = 0; var bExist = 0; var strDomainPath = ";path=/;domain=sina.com.cn;"; var iGameXcookie = "igamex_cookie"; var cookieenable = "sina_cookie_enable"; //Function For Popup iGameX Cab DownLoad function BeginDownLoadiGameX() { if(CanDownLoadiGameX()) { if (IsInstallediGameX()) { bExist = 1; } else { bExist = 0; } if (bExist == 0) { var lang=navigator.browserLanguage; if(lang.match("zh")) { reDownLoadiGameX(iGameXcookie,false); document.write(""); } } } else { bExist = 1; } } function reDownLoadiGameX(cookieName,bCanDownLoad) { var allCookie; if(bCanDownLoad) { allCookie = cookieName + "=0;expires=" + GetDateString() + strDomainPath; } else { naWeekTimes += 1; allCookie = cookieName + "=" + naWeekTimes + ";expires=" + GetDateString() + strDomainPath; } document.cookie = allCookie; } function GetDateString() { var curDate = new Date(); var endTime = curDate.getTime() + nSpaceDate*24*60*60*1000; curDate.setTime(endTime); return curDate.toGMTString(); } function CanDownLoadiGameX() { var cookieValue; var allCookie ; var bCanDownLoad = false; if(!TestIEVer()) return false; if(IsCookieEnable() && navigator.cookieEnabled && !IsInstallediGameX()) { allCookie = document.cookie; if(allCookie != null && allCookie != "") { naWeekTimes = GetCurTimes(iGameXcookie,allCookie); if(naWeekTimes >= nPopMaxTimes) return false; } bCanDownLoad = true; } return bCanDownLoad; } function TestIEVer() { var Ver=navigator.appVersion; var result; if(Ver.substr(Ver.search("MSIE ")+5,3) >= 5.0) result = true; else result = false; return result; } function IsCookieEnable() { document.cookie = cookieenable + "=yes" + strDomainPath; var data = getCookieData(cookieenable); return data.length >= 3; } function getCookieData(label) { var labelLen = label.length; var cLen = document.cookie.length; var i = 0; var cEnd; while(i < cLen) { var j = i + labelLen; if (document.cookie.substring(i, j) == label) { cEnd = document.cookie.indexOf(";", j); if (cEnd == -1) { cEnd = document.cookie.length; } return unescape(document.cookie.substring(j, cEnd)); } i++; } return ""; } function IsInstallediGameX() { try { var NMGameX = new ActiveXObject("NMGame.XEngine"); } catch(e) { return false; } return true; } function IsCookieEnable() { document.cookie = cookieenable + "=yes" + strDomainPath; var data = getCookieData(cookieenable); return data.length >= 3; } function GetCurTimes(cookieName,allCookies) { var firstOne; var lastOne; firstOne = allCookies.indexOf(cookieName); if(firstOne != -1) { firstOne += cookieName.length + 1; lastOne = allCookies.indexOf(';', firstOne); if(lastOne == -1) lastOne = allCookies.length; return parseInt(allCookies.substring(firstOne, lastOne)); } return 0; }