// Inheritance Object.prototype.extend = function(vSuper) { oSuper = (typeof(vSuper) == 'string') ? eval('new '+vSuper+'()') : vSuper; for (sProperty in oSuper) { this[sProperty] = oSuper[sProperty]; } delete(oSuper); }; // Add a method Object.prototype.method = function(name, func){ this.prototype[name] = func; return this; } // Add a property, getter, and setter Object.prototype.addProperty = function (sType, sName, vValue) { if (sType != '' && sType != null && typeof(vValue) != sType) { alert('Property ' + sName + ' must be of type ' + sType + ', was ' + typeof(vValue) + '.'); } this[sName] = vValue; var sFuncName = sName.charAt(0).toUpperCase() + sName.substring(1, sName.length); this['get' + sFuncName] = function () { return this[sName] }; this['set' + sFuncName] = function (vNewValue) { if (sType != '' && sType != null && typeof(vNewValue) != sType) { alert('Property ' + sName + ' must be of type ' + sType + ', was ' + typeof(vValue) + '.'); } this[sName] = vNewValue; }; } var CONST_CACHE_ELEMENT_SEPERATOR = '%!%'; var CONST_CACHE_VALUE_SEPERATOR = '~!~'; function Cache(){ this.addProperty('', 'dictionary', new Object()); with(Cache){ method('get', function(key){ if(this.getDictionary()[key] == undefined){ return null; } return this.getDictionary()[key].value; }); method('put', function(key, value){ var val = new Object; val.key = key; val.value = value; this.getDictionary()[key] = val; }); method('remove', function(key){ this.getDictionary()[key] = undefined; }); method('toMemento', function(){ var str = ''; for(x in this.getDictionary()){ if(this.getDictionary()[x] == undefined || this.getDictionary()[x].key == undefined){ continue; } str += this.getDictionary()[x].key + CONST_CACHE_VALUE_SEPERATOR + this.getDictionary()[x].value + CONST_CACHE_ELEMENT_SEPERATOR; } return str; }); method('fromMemento', function(memento){ var array = memento.split(CONST_CACHE_ELEMENT_SEPERATOR); this.setDictionary(new Object()); for(x in array){ if(array[x] == '' || array[x] == undefined || array[x] == null || typeof(array[x]) == 'function'){ continue; } var item = array[x].split(CONST_CACHE_VALUE_SEPERATOR); this.put(item[0], item[1]); } }); } } // name - name of the cookie // value - value of the cookie // [expires] - expiration date of the cookie (defaults to end of current session) // [path] - path for which the cookie is valid (defaults to path of calling document) // [domain] - domain for which the cookie is valid (defaults to domain of calling document) // [secure] - Boolean value indicating if the cookie transmission requires a secure transmission // * an argument defaults when it is assigned null as a placeholder // * a null placeholder is not required for trailing omitted arguments function setIFILMCookie(name, value) { if (setIFILMCookie.arguments.length<2) { alert("bad cookie"); return; } var expireDate = new Date(); expireDate.setTime(expireDate.getTime() + (24*60*60*1000*365)); var memento = getRawCookie("ifilmMetaCookie"); var cache = new Cache(); if(memento != "" && memento != undefined){ cache.fromMemento(memento); } cache.put(name, value); memento = cache.toMemento(); var curCookie = "ifilmMetaCookie" + "=" + escape(memento) + "; path=/; expires=" + expireDate.toGMTString(); document.cookie = curCookie; } // name - name of the desired cookie // * return string containing value of specified cookie or null if cookie does not exist function getIFILMCookie(name) { var dc = document.cookie; var index = dc.indexOf("ifilmMetaCookie="); if (index == -1) return null; index = dc.indexOf("=", index) + 1; // first character var endstr = dc.indexOf(";", index); if (endstr == -1) endstr = dc.length; // last character var coo = unescape(dc.substring(index, endstr)); if(coo.indexOf("%!%") < 1){ return null; } var cache = new Cache(); cache.fromMemento(coo); return cache.get(name); } function getRawCookie(name) { var dc = document.cookie; var index = dc.indexOf(name + "="); if (index == -1) return null; index = dc.indexOf("=", index) + 1; // first character var endstr = dc.indexOf(";", index); if (endstr == -1) endstr = dc.length; // last character return unescape(dc.substring(index, endstr)); } function setRawCookie(name, value, expires, path, domain, secure) { if (setRawCookie.arguments.length<2) { alert("bad cookie"); return; } var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } // name - name of the cookie // [path] - path of the cookie (must be same as path used to create cookie) // [domain] - domain of the cookie (must be same as domain used to create cookie) // * path and domain default if assigned null or omitted if no explicit argument proceeds function deleteIFILMCookie(name, path, domain) { if (deleteIFILMCookie.arguments.length<1) { alert("bad cookie delete"); return; } if (getIFILMCookie(name)) { var expireDate = new Date(); expireDate.setTime(expireDate.getTime() + (24*60*60*1000*365)); var memento = getRawCookie("ifilmMetaCookie"); var cache = new Cache(); cache.fromMemento(memento); cache.remove(name); memento = cache.toMemento(); var curCookie = "ifilmMetaCookie" + "=" + escape(memento) + "; path=/; expires=" + expireDate.toGMTString(); document.cookie = curCookie; } } function setIFILMChip(cookieName, chipName, chipValue, expires, path, domain, secure) { var strNotSoYummyCookie = ""; var strYummyCookie = ""; strNotSoYummyCookie = getRawCookie(cookieName); if (strNotSoYummyCookie == null) { strYummyCookie = chipName + "_CP_" + chipValue; } else { var chips = strNotSoYummyCookie.split("_DH_"); var existingChip; var existingChipName; var existingChipValue; var bChipFound = false; for (var i = 0; i < chips.length; ++i) { existingChip = ""; existingChipName = ""; existingChipValue = ""; existingChip = chips[i].split("_CP_"); existingChipName = existingChip[0]; if (existingChip.length > 1) { existingChipValue = existingChip[1]; } else { existingChipValue = ""; } if (strYummyCookie != "") { strYummyCookie += "_DH_"; } if (existingChipName == chipName) { strYummyCookie += chipName + "_CP_" + escape(chipValue); bChipFound = true; } else { strYummyCookie += existingChipName + "_CP_" + existingChipValue; } } if (!bChipFound) { if (strYummyCookie != "") { strYummyCookie += "_DH_"; } strYummyCookie += chipName + "_CP_" + escape(chipValue); } } setRawCookie(cookieName, strYummyCookie, expires, path, domain, secure); } function getIFILMChip(cookieName, chipName) { var strNotSoYummyCookie = ""; var strYummyCookie = ""; strNotSoYummyCookie = getRawCookie(cookieName); if (strNotSoYummyCookie == null) { return null; } else { var chips = strNotSoYummyCookie.split("_DH_"); var existingChip; var existingChipName; var existingChipValue; var bChipFound = false; for (var i = 0; i < chips.length; ++i) { existingChip = ""; existingChipName = ""; existingChipValue = ""; existingChip = chips[i].split("_CP_"); existingChipName = existingChip[0]; if (existingChip.length > 1) { existingChipValue = existingChip[1]; } else { existingChipValue = ""; } if (strYummyCookie != "") { strYummyCookie += "_DH_"; } if (existingChipName == chipName) { return unescape(existingChipValue); bChipFound = true; } } if (!bChipFound) { return null; } } } // date - any instance of the Date object // * hand all instances of the Date object to this function for "repairs" function fixIFILMDate(date) { var base = new Date(0); var skew = base.getTime(); if (skew > 0) date.setTime(date.getTime() - skew); } var featureBits = ""; function setFeatureValue(bit, aValue) { var newFeatures = ""; for (var i = 0; i < featureBits.length || i <= bit; i++) { if (i == bit) { if (aValue) { newFeatures += "1"; } else { newFeatures += "0"; } } else { if (featureBits.charAt(i) != "") { newFeatures += featureBits.charAt(i); } else { newFeatures += "n"; } } } featureBits = newFeatures; setIFILMChip("ifilm_pers","ft",featureBits); } function getFeatureValue(bit) { featureBits = getIFILMChip("ifilm_pers","ft"); if (featureBits != null) { if (bit > featureBits.length) { return null; } else { if (featureBits.charAt(bit) == "n") { return null; } else { if (featureBits.charAt(bit) == "1") { return true; } else { return false; } } } } else { return null; } } function getFeature() { return featureBits; } // convert all characters to lowercase to simplify testing var agt=navigator.userAgent.toLowerCase(); var appVer = navigator.appVersion.toLowerCase(); // *** BROWSER VERSION **** var is_minor = parseFloat(appVer); var is_major = parseInt(is_minor); var is_sp2 = (agt.indexOf("sv1") != -1); // Note: On IE, start of appVersion return 3 or 4 // which supposedly is the version of Netscape it is compatible with. // So we look for the real version further on in the string var iePos = agt.indexOf('msie'); if (iePos !=-1) { is_minor = agt.substring(iePos+5,agt.indexOf(';',iePos)); //is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos))) is_major = parseInt(is_minor); } // Netscape6 is mozilla/5 + Netscape6/6.0!!! // Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0 var nav6Pos = agt.indexOf('netscape6'); if (nav6Pos !=-1) { is_minor = parseFloat(agt.substring(nav6Pos+10)) is_major = parseInt(is_minor) } var is_getElementById = (document.getElementById) ? "true" : "false"; // 001121-abk var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false"; // 001127-abk var is_documentElement = (document.documentElement) ? "true" : "false"; // 001121-abk var is_opera = (agt.indexOf("opera") != -1); var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1); var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1); var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1); var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1); var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1); // new 020128- abk var is_opera7 = (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1); // new 021205- dmr var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4); var is_opera6up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5); // new020128 var is_opera7up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5 && !is_opera6); // new021205 -- dmr var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false; var is_gecko = ((!is_safari)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false; var is_gver = 0; if (is_gecko) is_gver=navigator.productSub; var is_moz = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1) && (is_gecko) && ((navigator.vendor=="")||(navigator.vendor=="Mozilla"))); var is_fx = (agt.indexOf('firefox')!=-1); if (is_moz) { var is_moz_ver = (navigator.vendorSub)?navigator.vendorSub:0; if(!(is_moz_ver)) { is_moz_ver = agt.indexOf('rv:'); is_moz_ver = agt.substring(is_moz_ver+3); is_paren = is_moz_ver.indexOf(')'); is_moz_ver = is_moz_ver.substring(0,is_paren); } is_minor = is_moz_ver; is_major = parseInt(is_moz_ver); } if (is_safari) { safariPos = agt.indexOf('safari/'); is_safari_ver = agt.substring(safariPos + 7); is_minor = is_safari_ver; is_major = parseInt(is_safari_ver); } // Does not include Mozilla in is_nav //var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) // && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) // && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1) // && (!is_safari) && (!(is_moz))); var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1) && (!is_safari)); var is_nav2 = (is_nav && (is_major == 2)); var is_nav3 = (is_nav && (is_major == 3)); var is_nav4 = (is_nav && (is_major == 4)); var is_nav4up = (is_nav && is_minor >= 4); // changed to is_minor for // consistency - dmr, 011001 var is_nav4_5up = (is_nav && is_minor >= 4.5); var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) ); var is_nav7 = (is_nav && is_major == 7); var is_nav7up = (is_nav && is_minor >= 7); /* var is_nav6 = (is_nav && (agt.indexOf('netscape6') != -1)); // new 001120 - abk var is_nav6up = (is_nav && is_getElementById); // new 001121 - abk */ var is_nav6 = (is_nav && is_major==6); // new 010118 mhp var is_nav6up = (is_nav && is_minor >= 6) // new 010118 mhp var is_nav6_2up = (is_nav && is_minor >= 6.2) // new 010118 mhp var is_nav5 = (is_nav && is_major == 5 && !is_nav6); // checked for ns6 var is_nav5up = (is_nav && is_minor >= 5); var is_ie = (iePos!=-1); var is_ie3 = (is_ie && (is_major < 4)); var is_ie4 = (is_ie && is_major == 4); var is_ie4up = (is_ie && is_minor >= 4); var is_ie4_5 = (is_ie && is_minor == 4.5); var is_ie4_5up = (is_ie && is_minor >= 4.5); var is_ie5 = (is_ie && is_major == 5); var is_ie5up = (is_ie && is_minor >= 5); var is_ie6 = (is_ie && is_major == 6); var is_ie6up = (is_ie && is_minor >= 6); // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser // or if this is the first browser window opened. Thus the // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable. var is_aol = (agt.indexOf("aol") != -1); var is_aol3 = (is_aol && is_ie3); var is_aol4 = (is_aol && is_ie4); var is_aol5 = (agt.indexOf("aol 5") != -1); var is_aol6 = (agt.indexOf("aol 6") != -1); var is_aol7 = ((agt.indexOf("aol 7")!=-1) || (agt.indexOf("aol7")!=-1)); var is_aol8 = ((agt.indexOf("aol 8")!=-1) || (agt.indexOf("aol8")!=-1)); var is_webtv = (agt.indexOf("webtv") != -1); var is_r1 = (agt.indexOf("(r1 ") != -1); // *** JAVASCRIPT VERSION CHECK *** // Useful to workaround Nav3 bug in which Nav3 // loads