/* -- BEGIN SPHERE JS -- */ // site id for bookmarket var SPHERE_SITE_ID = ""; SPHERE_SITE_ID = "tribune_chicagotrib"; //MediaPixel Removed // Omniture /* The core url used by all methods to make calls to the remote omniture code. the 'action' arg will be the name of a method to be called by eval in the sphereomni_api js code. */ function getSphereOmnitureRemoteActionUrl(action){ return "http://www.surphace.com/partner/omniture/sphereomni_api.php?siteid=tribune_chicagotrib&evt="+action+"&omid="+Math.ceil(Math.random()*100000000); } function getSphereOmnitureQueueActionUrl(action){ return "http://www.surphace.com/partner/omniture/sphereomni_queue.php?evt="+action+"&siteid=tribune_chicagotrib"; } Sphere = {} Sphere.addStylesheet = function(stylesheet_href) { var stylesheet = document.createElement("link"); stylesheet.rel = "stylesheet"; stylesheet.type = "text/css"; stylesheet.href = stylesheet_href; stylesheet.media = "all"; document.lastChild.firstChild.appendChild(stylesheet); } Sphere.Browser = new function() { var ua, s, i; this.isIE = false; this.isNS = false; this.version = null; ua = navigator.userAgent; s = "MSIE"; if ((i = ua.indexOf(s)) >= 0) { this.isIE = true; this.version = parseFloat(ua.substr(i + s.length)); return; } s = "Netscape6/"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = parseFloat(ua.substr(i + s.length)); return; } // Treat any other "Gecko" browser as NS 6.1. s = "Gecko"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = 6.1; return; } } Sphere.Tracker = new function() { this.track = function ( ele, site, area, quadtitle,sphereid,metadata) { if( !ele.href ) return; /* -- the following may or may not be present, so check and init if necessary -- sphereid is used by ssi and represents site id by proxy -- metadata should be in the form of a pipe-delimited string e.g. k=v|b=y */ try{ if(!quadtitle){ quadtitle = '';} }catch(anErr){ quadtitle = ''; } try{ if(!sphereid){ sphereid = '';} }catch(anErr){ sphereid = ''; } try{ if(!metadata){ metadata = '';} }catch(anErr){ metadata = ''; } // put document referrer metadata in it's own try/catch block so that it is set even if metadata isn't init'd try{ if (document.referrer != ''){ metadata += "|referrer=" + document.referrer; } }catch(anErr){ } sphereom = new SphereOmniture(); sphereom.click(ele.href, area, site, quadtitle,sphereid,metadata); } } Sphere.Inline = new function() { var content; this.processContent = function (content) { if( !content || !content.content || content.content=="") return; // append content and omniture frame // ******************************** document.getElementById(content.location).innerHTML = content.content+ "<div style='visibility:hidden;display:none'><iframe name='sphereomnitureframe' id='sphereomnitureframe' src='http://www.surphace.com/partner/omniture/sphereomni_api.php?siteid=tribune_chicagotrib&evt=fireSphereOmInitAction&omid=340860' frameborder='0' style='width:10px;height:10px;' ></iframe></div>" ; // omniture init // deprecated. now called when content loads //sphereom = new SphereOmniture(); //sphereom.init(); } this.search = function(posStr, local, auxVars) { var url = escape(local || location.href); if(auxVars) url = url+'&auxVars='+escape(auxVars); document.write("<script src='http://www.surphace.com/widgets/sphereit/content?siteid=tribune_chicagotrib_inline&type="+posStr+"&url="+url+"'></script>"); } function zoomToFull() { //alert("zoomToFull"); Animator.add( { process: function() { if( sideBar.clientHeight >= sideBar.scrollHeight-20) { sideBar.style.height = sideBar.scrollHeight+'px'; return false; } sideBar.style.height = (sideBar.clientHeight + 15) +'px'; return true; } }); } } Sphere.Widget = new function() { var SKELETON_MARKUP = '<iframe id="sphereiframeblock"></iframe> <div class="widgetWrapper"> <div id="sphere_widget_roundtop" class="roundTop"></div> <div id="widget"> <div id="sphere_widget_header" class="headerBar"><h1>Related Blogs and Articles</h1> <div onclick="Sphere.Widget.close()" class="closeBtn" title="Close"></div> </div> <div id="sphere_widget_loading" class="loadingArea"> <div><img src="http://www.surphace.com/widgets/sphereit/images/LoadingGraphic.gif" alt="loading" />We\'re getting you the good stuff...</div> </div> <div id="sphere_widget_content" class="sphereMainContentArea"></div> <div class="footerBar"> <a target="_blank" href="http://www.surphace.com/tools?requestform=1" class="getThis">Get this Widget for Your Site »</a> <a class="footerBarSphereLogo" href="http://www.surphace.com" target="new"><img id=\'sphereAolLogo\' src=\'http://www.surphace.com/widgets/sphereit/images/SphereAol.png\'></a> </div> </div> <div id="roundBot"></div> </div>'; var CONTENT_URL = 'http://www.surphace.com/widgets/sphereit/content?siteid=tribune_chicagotrib'; if(document.characterSet) CONTENT_URL += ('&cset='+escape(document.characterSet)); CONTENT_URL += '&CXNID=1000009.430098529NXC&url='; var widget; var widgetContent; var widgetLoading; var content; var dragObj = {}; if(document.getElementsByTagName('base').length>0) { if (window.addEventListener){ window.addEventListener('load', appendStylesheet, false); } else if (window.attachEvent){ window.attachEvent('onload', appendStylesheet); } } else { appendStylesheet(); } if (Math.random() <= 0.1) { try{ sphereom = new SphereOmniture(); sphereom.track('popup_view', 'tribune_chicagotrib_popup_view','','',''); }catch(anErr){} } this.search = function( source ) { if( !content || (source && content.source!=source ) ) { requestContent( source ); dragObj.elNode = null; if( widget ){ widget.parentNode.removeChild(widget); content=null; widget=null; } } if( !widget ) draw(); show(); /* var reqimgurl = 'http://stats.surphace.com/widgets/sphereit/?action=display&siteid=tribune_chicagotrib'; var reqimg = new Image(); reqimg.src = reqimgurl; if (reqimg.style) { // In Safari 2.0.x, reqimg has no style until it's appended, so skip this (fixed in Safari 3) reqimg.style.display = 'none'; document.body.appendChild(reqimg); } */ return false; } this.close = function() { if( widget ) widget.style.display ='none'; } this.processContent = function (incomingContent) { content = incomingContent; for(i=0;i<1000;i++){ test='444'}; if( !widgetContent ) return; widgetContent.innerHTML = content.content+ "<div style='visibility:hidden;display:none'><iframe name='sphereomnitureframe' id='sphereomnitureframe' src='http://www.surphace.com/partner/omniture/sphereomni_api.php' frameborder='0' style='width:10px;height:10px;' ></iframe></div>" ; widgetContent.style.height = widgetLoading.clientHeight +'px'; widgetLoading.style.display = 'none'; widgetContent.style.display = 'block'; zoomToFull(); // moved from search for popup sphereom = new SphereOmniture(); sphereom.popup(); } function requestContent( local ) { //alert("requestContent"); Sphere.Widget.script = document.createElement('script'); Sphere.Widget.script.src = CONTENT_URL + escape(local || location.href); setTimeout(function(){ document.body.appendChild(Sphere.Widget.script);}, 1); } function zoomToFull() { //alert("zoomToFull"); Animator.add( { process: function() { if( widgetContent.clientHeight >= widgetContent.scrollHeight-20) { widgetContent.style.height = widgetContent.scrollHeight+'px'; if( iecheck() ) { ieahack(widget.getElementsByTagName("a")); document.getElementById("sphereiframeblock").style.height = (Number(widget.scrollHeight)-24)+'px'; document.getElementById("sphereiframeblock").style.display = 'block'; alphaBackgrounds(); } center(); return false; } widgetContent.style.height = (widgetContent.clientHeight + 20) +'px'; center(); return true; } }); } function ieahack( col ) { for( var i=0; i<col.length; i++) { col[i].style.position = "relative"; } } function center() { if( !widget || (iecheck((document.compatMode=='BackCompat')?true:false)) ) return; if( dragObj.elNode != undefined) return; windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; widget.style.left = (windowWidth/2 - widget.scrollWidth/2) +'px'; widget.style.top = (windowHeight/2 - widget.scrollHeight/2) +'px'; } function show() { if( widget ) widget.style.display ='block'; if( widget ) widget.style.visibility ='visible'; } function draw() { if( SKELETON_MARKUP ) { widget = document.createElement( "div" ); widget.id = "sphere_widget"; widget.style.position = (iecheck((document.compatMode=='BackCompat')?true:false))?'absolute':'fixed'; widget.innerHTML = SKELETON_MARKUP; document.body.appendChild( widget ); alphaBackgrounds(); center(); window.onresize = center; } //alert("end draw"); widgetContent = document.getElementById('sphere_widget_content'); widgetLoading = document.getElementById('sphere_widget_loading'); widgetHeader = document.getElementById('sphere_widget_header'); if (Sphere.Browser.isIE) { widgetHeader.attachEvent("onmousedown", dragStart); } if (Sphere.Browser.isNS) { widgetHeader.addEventListener("mousedown", dragStart, true); } if( content ) Sphere.Widget.processContent( content ); } function dragStart(event, id) { dragObj = {}; dragObj.elNode = widget; if (Sphere.Browser.isIE) { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } if (Sphere.Browser.isNS) { x = event.clientX + window.scrollX; y = event.clientY + window.scrollY; } dragObj.cursorStartX = x; dragObj.cursorStartY = y; dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10); dragObj.elStartTop = parseInt(dragObj.elNode.style.top, 10); if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0; if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = 0; if (Sphere.Browser.isIE) { document.attachEvent("onmousemove", dragGo); document.attachEvent("onmouseup", dragStop); window.event.cancelBubble = true; window.event.returnValue = false; } if (Sphere.Browser.isNS) { document.addEventListener("mousemove", dragGo, true); document.addEventListener("mouseup", dragStop, true); event.preventDefault(); } } function dragGo(event) { var x, y; if (Sphere.Browser.isIE) { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } if (Sphere.Browser.isNS) { x = event.clientX + window.scrollX; y = event.clientY + window.scrollY; } dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px"; dragObj.elNode.style.top = (dragObj.elStartTop + y - dragObj.cursorStartY) + "px"; if (Sphere.Browser.isIE) { window.event.cancelBubble = true; window.event.returnValue = false; } if (Sphere.Browser.isNS) event.preventDefault(); } function dragStop(event) { if (Sphere.Browser.isIE) { document.detachEvent("onmousemove", dragGo); document.detachEvent("onmouseup", dragStop); } if (Sphere.Browser.isNS) { document.removeEventListener("mousemove", dragGo, true); document.removeEventListener("mouseup", dragStop, true); } } function appendStylesheet() { Sphere.addStylesheet("http://www.sphere.com/widgets/sphereit/css?siteid=tribune_chicagotrib"); } function appendGlamThemeStylesheet(){ } } Animator = new function() { var interval; var effects = []; this.add = function( effect ) { effects.push( effect ); if( !interval ) start(); } function remove() { effect = effects.pop(); if( effect.after_process ) effect.after_process(); if( effects.length==0 ) stop(); } function start() { interval = setInterval(heartbeat, 1); //alert("Start Animator "+typeof(interval)); } function stop() { //alert("stop animator"); clearInterval( interval ); interval = null; } function heartbeat() { if( effects.length==0 ) { stop(); return; } if( effects[0].process) { if( effects[0].process() ) effects[0].counter++; else remove(); } } } function trace( val ) { var output = document.getElementById("output"); if(output) output.innerHTML += (val + "<br/>"); } function iecheck(inc_seven) { if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) { var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, ''); var iever = (inc_seven)?(rslt != null && Number(rslt[1]) >= 5.5):(rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) < 7 ); } return iever; } function wait(ms){ var now=new Date();var exitTime=now.getTime()+ms;while(true){now=new Date();if(now.getTime()>exitTime){return;}}} function alphaBackgrounds() { //alert('alphaBackgrounds()'); if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) { var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, ''); var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) < 7 ); for (i=0; i<document.all.length; i++){ var bg = document.all[i].currentStyle.backgroundImage; if (itsAllGood && bg!='none'){ if (bg.match(/(_Bot|_Mid|_Top|_Btn|_alpha_)\.png/i) != null){ var mypng = bg.substring(5,bg.length-2); document.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='scale')"; document.all[i].style.backgroundImage = "none"; } } } } } // Omniture object //******************************** OMNITURE_INIT = false; OMNI_POPUP_INIT = false; OMNI_AOL_POPUP_INIT = false; function SphereOmniture(){ this.omniobj = null; } function _initSphereOm(){ //alert("init: "+this.omniobj); if(OMNITURE_INIT){ return; } else { OMNITURE_INIT = true; } theURL = getSphereOmnitureRemoteActionUrl("fireSphereOmInitAction"); getSphereRemoteFrame().src = theURL; wait(200); } function _initSphereOmPopup(){ if(OMNI_POPUP_INIT){ return false; } else { OMNI_POPUP_INIT = true; } theURL = getSphereOmnitureRemoteActionUrl("fireSphereOmInitPopupAction"); getSphereRemoteFrame().src = theURL; wait(200); } function _clickSphereOm(lnk,quad,context,quadtitle,sphereid,metadata){ appendPopup = ''; if(new String(context).indexOf("_popup") > -1){ appendPopup = "_popup"; } try{ if(!quadtitle){ quadtitle = '';} }catch(anErr){ quadtitle = ''; } theURL = getSphereOmnitureQueueActionUrl("fireSphereOmClickAction"); theURL += appendPopup+"&quad="+quad+"&fquadname="+quadtitle+"&context="+context+"&lnk="+escape(lnk)+"&loc="+escape(window.location)+"&sphereid="+sphereid+"&metadata="+escape(metadata); // getSphereRemoteFrame().src = theURL; omImg = new Image(); omImg.src = theURL; } function _trackSphereOm(quad,context,quadtitle,sphereid,metadata){ try{ if(!quadtitle){ quadtitle = '';} }catch(anErr){ quadtitle = ''; } theURL = getSphereOmnitureQueueActionUrl("fireSphereOmTrackAction"); theURL += "&quad="+quad+"&fquadname="+quadtitle+"&context="+context+"&loc="+escape(window.location)+"&sphereid="+sphereid+"&metadata="+escape(metadata); // getSphereRemoteFrame().src = theURL; omImg = new Image(); omImg.src = theURL; } function _trackAOLPopup(quad, context){ if(OMNI_AOL_POPUP_INIT){ return false; } else { OMNI_AOL_POPUP_INIT = true; } theURL = getSphereOmnitureRemoteActionUrl("fireSphereOmTrackAction"); theURL += "&quad="+quad+"&context="+context; getSphereRemoteFrame().src = theURL; wait(400); } function _trackAolOm(lnk,lnkType,lnkName,lnkPos){ theURL = getSphereOmnitureRemoteActionUrl("fireSphereOmTrackAction"); theURL += "&lnk="+escape(lnk)+"&lnkType="+lnkType+"&lnkName="+lnkName+"&lnkPos="+lnkPos; getSphereRemoteFrame().src = theURL; wait(200); } function _initAolOm(){ theURL = getSphereOmnitureRemoteActionUrl("fireSphereOmInitAolAction"); getSphereRemoteFrame().src = theURL; wait(200); } SphereOmniture.prototype.init = _initSphereOm; SphereOmniture.prototype.popup = _initSphereOmPopup; SphereOmniture.prototype.initaol = _initAolOm; SphereOmniture.prototype.track = _trackSphereOm; SphereOmniture.prototype.click = _clickSphereOm; SphereOmniture.prototype.trackaol = _trackAolOm; SphereOmniture.prototype.trackAOLPopup = _trackAOLPopup; /***************************** SphereOm Remote object api -- This was put in place to isolate the omniture.js code, which causes conflicts with our partner's omniture implementations. It creates an IMG with an exposed set of pass-thru functions that access the omniture code. ******************************/ function getSphereRemoteFrame(){ iele = document.getElementById("sphereomnitureframe"); return iele; } //***************** END OBJ ******************* // added this method so that gadget would call search after data had loaded. //----------------------------------- function loadGadgetView(permlnk){ if(Sphere.Inline){ //alert("found an inline"); Sphere.Inline.search("sphereInline", permlnk); } else { //alert("no inline"); } } /* -- END SPHERE JS -- */