/* TheBostonChannel.com scripts */ // Begin national js scripts // Site Info Object var siteinfo = { tld:"com", lang:"en", timezone:"EDT", id:"5161184", affiliate:"abc", owner:"hearst", is_ia:"yes", codebase:"3", sitekey:{lc:"bos", uc:"BOS" }, sitename:{lc:"thebostonchannel", mx:"TheBostonChannel", uc:"THEBOSTONCHANNEL", display:"TheBostonChannel.com" }, callletters:{lc:"wcvb", uc:"WCVB" }, statecode:{uc:"MA", lc:"ma" }, statename:{uc:"MASSACHUSETTS", lc:"massachusetts", mx:"Massachusetts" }, city:{uc:"BOSTON", lc:"boston", mx:"Boston" }, contentrights:{cnn:"yes", nbcoo:"no", group:"blue", ah:"no" }, search:{ultraseekregion:"hearst" }, thirdparty_info:{ moving:{id:"a11440"}, serviceMagic:{formId:"725564", articleId:"725563", affiliateCode:"ibsboston"}, tripadvisor:{id:"10710"}, experian_auto:{id:"1702"}, stepup:{id:"1020"}, eharmony:{cid:"1171", clicktracker_dfp:"12700794;8704162;f"}, findlaw:{clicktracker_id:"6861460;8704162;k", clicktracker_dfp:"6861460;8704162;k"}, experion:{id:"6356"}, homestore:{clicktracker_id:"3593", code:"ib", clicktracker_dfp:"7412465;8704162;i"}, monster:{lid:"462,463,464,453,893,892,20584,455,454,530"}, valpak:{clicktracker:"4784", clicktracker_dfp:"7440788;8704162;r"}, titantv:{id1:"53456"}, flustar:{id:"1017"}, coupons:{pid:"10945&zid=nz61&nid=11"}, WT_info:{id:"dcsr7z6hi10000cx5gifp0jrt_7w9n"}, smartmoney:{clicktracker:"27400142;8704162;v"} }, video:{playerversion:"5", skin:"blue", wxicons:"hearst", headerlinks:"#ffffff", cpcode:"12880" } } // GLOBAL Variables now = new Date(); expire = new Date((now.getFullYear()+1),now.getMonth(),now.getDate()); var child = 0; var rnd = new Date(); rnd = rnd.getTime(); // Deprecated variables //var IBS_Sitekey = siteinfo.sitekey.lc; var IS_IA = siteinfo.is_ia; IBSSite = new Object(); dotPosition = document.location.host.indexOf('.')+1; IBSSite.domain = document.location.host.substring(dotPosition); // Set environment variables env = new Object(); env.bVer = navigator.appVersion; env.bName = navigator.appName; env.platform = navigator.platform; env.userAgent = navigator.userAgent; env.cookies = navigator.cookieEnabled; env.NS4 = (document.layers)? 1 : 0; env.MacIE = ((navigator.userAgent.indexOf("IE 4") > -1) && (navigator.userAgent.indexOf("Mac") > -1))? 1 : 0; env.IE4 = (document.all && !env.MacIE)? 1 : 0; env.Gen4 = (document.all || document.layers)? 1 : 0; if(env.bName.indexOf('Netscape') != -1) isNN = true; else isNN = false; if(env.bName.indexOf('Microsoft') != -1) isIE = true; else isIE = false; //Open window - pass URL and Attributes function popUp(URL, ATTRIBUTES) { DEF_ATTRIB = 'width=200,height=200,top=100,left=100,resizable=yes,scrollbars'; if (ATTRIBUTES == null) { ATTRIBUTES = DEF_ATTRIB; } child = window.open(URL, "spawn", ATTRIBUTES); // child.opener = self; } // FIX THE STRINGS ( apostrophes) function fixString(strText) { var newstr = strText.replace(/~/g, "'"); return newstr; } // Replace white space around tags in teaser - used in TopStory and PhotoArray function padTags(s){ var tmp = s.replace(/(<\w)/ig, " $1"); tmp = tmp.replace(/(<\/\w>)/ig, "$1 "); return tmp; } /** * returns the parent widget ID of the given indexID, for use * with jsIndex */ function getWidgetID(indexId) { var el = document.getElementById("index"+indexId); if(el == null) return null; var p = el.parentNode; while(p) { if(p.id && p.id.match(/sw[0-9]+/)) return p.id.replace(/sw/,""); p = p.parentNode; } return null; } var XMLObj = { impl: function() { return (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new Error("No XMLHttpRequest Implementation"))); }, get: function(url, handler) { var req = XMLObj.impl(); req.open("get", url, true); req.onreadystatechange = function() { /* Opera may return status 304; unchanged */ if(req.readyState == 4) { handler(req.responseXML, req.responseText); } }; req.send(null); }, post: function(url, params, handler) { var req = XMLObj.impl(); req.open("post", url, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.setRequestHeader("Referer", document.location.href); req.onreadystatechange = function() { /* Opera may return status 304; unchanged */ if(req.readyState == 4 ) { handler(req.responseXML, req.responseText); } }; req.send(params); } }; // reload adcode function refreshAd(ad) { if (typeof bannerUrl == 'undefined') { bannerUrl = document.getElementById(ad).src; } rnd++; //increment the random number document.getElementById(ad).src = bannerUrl; } /** * Generic AdObj holds properties to ease calling pixel ads for specific uses * @constructor * @param {String} position Corresponds to ad position, like mediawidow, banner or tile * @param {String} sz Size, formatted as 2x2 * @param {String} swId Section widget id * @param {String} coId Content id * @param {String} section Section widget section */ function AdObj(position, sz, swId, coId, section) { this.position = position; this.sz = sz; this.swId = swId; this.coId = coId; this.section = section; var size = this.sz.split("x"); this.width = size[0]; this.height = size[1]; } /** * Append iframe with ad call to end of document or refresh the ad of set position * NOTE: DART key set to ibs.[sitekey].interactive */ AdObj.prototype.callAd = function() { if (!document.getElementById(this.position)) { // append iframe to document document.getElementsByTagName("body")[0].appendChild(document.createElement("span")).innerHTML = ""; } else { refreshAd(this.position); } } // Define client cookie values cookiesList = document.cookie.split('; '); myCookies = new Array(); for(c=0; c