baynote_globals.TagsURLPrefix="/baynote/tags3/";baynote_globals.CustomScript="customScript";baynote_globals.GuideSet="GuideSet";baynote_globals.ScriptWebapp="r";baynote_globals.ScriptResourceId="Custom";baynote_globals.guideContainerId="baynote_guides";baynote_globals.DefaultCookieAge=10*365*24*60*60*1000;baynote_globals.WindowNameDelimBegin="bAyNoTe>-";baynote_globals.WindowNameDelimEnd="-';};BNTag.prototype.getTotalPurchases=function(){if(typeof(bnOrderId)!="undefined"&&bnCommon.isNotEmpty(bnOrderId)) this.attrs.purchaseId=bnOrderId;if(typeof(bnOrderTotal)!="undefined"&&bnCommon.isNotEmpty(bnOrderTotal)) this.attrs.totalPurchases=parseFloat(bnOrderTotal);if(typeof(bnOrderDetails)!="undefined"&&bnCommon.isNotEmpty(bnOrderDetails)) this.attrs.purchaseDetails=bnOrderDetails;};BNCommon=function(){};BNCommon.prototype.stringToBoolean=function(str){if(!str)return false;str=str.toLowerCase();if(str==""||str=="false"||str=="f"||str=="0"||str=="no"||str=="n")return false;return true;};BNCommon.prototype.copyObj=function(obj,props){var newObj=new Object();for(var prop in obj){var child=obj[prop];if(typeof(child)=="undefined"||typeof(child)=="function")continue;if(child!=null)newObj[prop]=child;} return newObj;};BNCommon.prototype.copyProperties=function(src,dst,props){for(var i=0;iMAX_DUMP_DEPTH){return indent+name+": -Maximum Depth Reached-"+ret;} if(typeof obj=="object"){var child=null;var output=name?(indent+name+ret):"";indent+=ind;var numFunctions=0;for(var item in obj){try{child=obj[item];}catch(e){child="-Unable to Evaluate-";} if(child==null)output+=indent+item+": "+ret;else if(typeof child=="function")++numFunctions;else if(typeof child=="object")output+=this.dumpObj(child,item,indent,depth+1,asHTML);else output+=indent+item+": "+child+ret;} if(numFunctions>0)output+=indent+"<"+numFunctions+" function(s)>"+ret;return output;}else return obj;};BNCommon.prototype.dump=function(obj){return this.dumpObj(obj,""," ",5,false);};BNCommon.prototype.dumpHTML=function(obj){return this.dumpObj(obj,""," ",5,true);};BNCommon.prototype.getURLParams=function(url){if(!url)var url=window.location.href;var urlParams=new Object();var tmp=url.split("?");if(tmp.length>1&&tmp[1]!=""){tmp=tmp[1];tmp=tmp.split("#");tmp=tmp[0];var params=tmp.split("&");var nameValuePair;for(var i=0;i=0){baseUrl=url.substring(0,anchorIndex);if(baseUrl=="")return url;baseUrlLength=baseUrl.length;anchor=url.substring(anchorIndex,urlLength);} var lastChar=baseUrl.charAt(baseUrlLength-1);if(lastChar=='?'||lastChar=='&'){insertedChar=null;}else if(baseUrl.indexOf('?')>=0){insertedChar='&';}else{insertedChar='?';} newUrl.append(baseUrl);if(insertedChar)newUrl.append(insertedChar);newUrl.append(paramName);newUrl.append('=');newUrl.append(value);if(anchor)newUrl.append(anchor);return newUrl.toString();};BNCommon.prototype.addURLMetaKeys=function(url,metaKeyList){if(!metaKeyList)return url;var newUrl=url;var metaKeys=metaKeyList.split(",");for(var i=0;itag.bnProxyPrefix.length){return url.substring(tag.bnProxyPrefix.length,url.length);} return url;};BNCommon.prototype.arrayToJSON=function(arr){var a=['['],b,i,l=arr.length,v;function p(s){if(b){a.push(',');} a.push(s);b=true;} for(i=0;i0)title=metas[0].content;if(!title)title=document.title;} this.title=title?title:"";};BNPageInfo.prototype.checkIf404=function(){this.iAm404=false;var metas=document.getElementsByName(bnConstants.META_PAGE_STATUS);if(metas&&metas.length>0){var status=parseInt(metas[0].content);if(status==404)this.iAm404=true;}};BNPageInfo.prototype.checkWordCount=function(){if(typeof(baynote_globals)!="undefined"&&baynote_globals.skipWordCount){this.wordCount=-1;return;} if(!document.body){this.wordCount=-1;this.linkCount=-1;setTimeout("bnPageInfo.checkWordCount()",200);return;} this.wordCount=null;var bodyTags=document.getElementsByTagName("body");if(bodyTags.length==0)return;var bodyText=bnCommon.getInnerText(bodyTags[0]);var wordCountRE=new RegExp("\\S+","g");var words=bodyText.match(wordCountRE);if(!words)this.wordCount=0;else this.wordCount=words.length;};BNPageInfo.prototype.checkLinkCount=function(){if(typeof(baynote_globals)!="undefined"&&baynote_globals.skipLinkCount){this.linkCount=-1;return;} this.linkCount=null;var linkTags=document.getElementsByTagName("a");if(!linkTags)this.linkCount=0;else this.linkCount=linkTags.length;};BNPageInfo.prototype.getWindowName=function(){return window.name;};BNPageInfo.prototype.getWordCount=function(){return this.wordCount;};BNPageInfo.prototype.getLinkCount=function(){return this.linkCount;};BNPageInfo.prototype.getTitle=function(){return this.title;};BNPageInfo.prototype.is404=function(){return this.iAm404;};BNPageInfo.prototype.cookiesAreEnabled=function(){if(typeof(baynote_globals)!="undefined"&&baynote_globals.cookiesDisabled)return false;else return true;};BNPageInfo.prototype.getURL=function(){return this.url;};BNPageInfo.prototype.getFullURL=function(){return this.fullUrl;};BNPageInfo.prototype.getURLParams=function(){return this.urlParams;};BNPageInfo.prototype.getURLParam=function(paramName){return this.urlParams[paramName];};BNPageInfo.prototype.getBNParams=function(){return this.bnParams;};BNPageInfo.prototype.getBNParam=function(paramName){return this.bnParams[paramName];};BNPageInfo.prototype.getReferrerURL=function(){if(!this.referrer)return null;return this.referrer.url;};BNPageInfo.prototype.isBinary=function(url){if(!url)return false;if(url.match(/^[^?]*\.(pdf|doc|xls|ppt)(\?.*)?$/i))return true;if(url.match(/^.*\/m?getfile\?.*$/i))return true;return false;};bnPageInfo=new BNPageInfo();BNUser=function(){this.userId=null;this.extUserId=null;var extUserId=bnCommon.getCookieValue(baynote_globals.ExternalUserIdCookieName);var userFromURL=this.getUserFromURL();if(userFromURL){this.setUserId(userFromURL);return;} var oldUserId=bnCommon.getCookieValue("_baynote_anon_user");if(oldUserId){this.setUserId(oldUserId);bnCommon.removeCookie("_baynote_anon_user");return;} var userId;if(baynote_globals.UseWindowName){userId=this.readUserCookieFromWindowName();} if(!userId){userId=bnCommon.getCookieValue("bn_u");if(baynote_globals.UseWindowName&&userId){this.writeUserCookieToWindowName(userId);}} if(userId){this.setUserId(userId,true);return;} this.setUserId(bnConstants.UNASSIGNED_USER_ID);userId=bnCommon.getCookieValue("bn_u");if(!userId)this.setUserId(bnConstants.ANONYMOUS_USER_ID,true);};BNUser.prototype.getUserFromURL=function(){var userParam=bnPageInfo.getBNParam("bn_u");var user=null;if(userParam!=null){if(userParam=="")user=bnConstants.UNASSIGNED_USER_ID;else user=userParam;} return user;};BNUser.prototype.getUserId=function(tag){if(tag&&tag.userId)return tag.userId;return this.userId;};BNUser.prototype.getExtUserId=function(){return this.extUserId;};BNUser.prototype.setUserId=function(userId,skipWrite){if(bnPageInfo.cookiesAreEnabled()&&!skipWrite){if(baynote_globals.UseWindowName){this.writeUserCookieToWindowName(userId);} this.writeUserCookie(userId);} this.userId=userId;};BNUser.prototype.setExtUserId=function(extUserId){if(bnPageInfo.cookiesAreEnabled()){this.writeExtUserCookie(extUserId);} this.extUserId=extUserId;};BNUser.prototype.resetExtUserId=function(){if(bnPageInfo.cookiesAreEnabled()){bnCommon.removeCookie(baynote_globals.ExternalUserIdCookieName);} this.extUserId=null;};BNUser.prototype.readUserCookieFromWindowName=function(){var cky;var re=new RegExp(baynote_globals.WindowNameDelimBegin+"({.*})"+ baynote_globals.WindowNameDelimEnd);var m=re.exec(window.name);var custCodeKey=baynote_tag.customerId+'_'+baynote_tag.code;if(m!=null){var mapStr=RegExp.$1;var objStr="var ckObj = "+mapStr+";";eval(objStr);var currCkMap=ckObj[custCodeKey];if(currCkMap){cky=currCkMap["bn_u"];}} return cky;};BNUser.prototype.writeUserCookieToWindowName=function(userId){var re=new RegExp(baynote_globals.WindowNameDelimBegin+"({.*})"+ baynote_globals.WindowNameDelimEnd);var m=re.exec(window.name);var custCodeKey=baynote_tag.customerId+'_'+baynote_tag.code;var ckObj,remaining="";if(m!=null){var mapStr=RegExp.$1;var objStr="ckObj = "+mapStr+";";eval(objStr);var currCkMap=ckObj[custCodeKey]||{};currCkMap["bn_u"]=userId;ckObj[custCodeKey]=currCkMap;remaining=window.name.replace(re,'');}else{ckObj={};ckObj[custCodeKey]={"bn_u":userId};remaining=window.name;} var newCookieStr=baynote_globals.WindowNameDelimBegin +bnCommon.objectToJSON(ckObj) +baynote_globals.WindowNameDelimEnd;window.name=newCookieStr+remaining;};BNUser.prototype.reWriteUserCookie=function(){this.writeUserCookie(this.userId);};BNUser.prototype.writeUserCookie=function(userId){this.writeCookie("bn_u",userId);};BNUser.prototype.writeExtUserCookie=function(userId){this.writeCookie(baynote_globals.ExternalUserIdCookieName,userId);};BNUser.prototype.writeCookie=function(name,val){var cookieExpires=this.getDefaultCookieExpiry();bnCommon.setCookie(name,val,"/",cookieExpires);};BNUser.prototype.getDefaultCookieExpiry=function(){var age=baynote_globals.DefaultCookieAge;if(typeof bnPolicy!='undefined'){age=parseFloat(bnPolicy.userCookieAge);} var currTimestamp=new Date();var currTime=currTimestamp.getTime();currTimestamp.setTime(currTime+age);return currTimestamp.toGMTString();};bnUser=new BNUser();BNPolicy=function(){this.data=null;this.overrides=null;this.userId=null;this.disableAll=bnPageInfo.getBNParam("bn_disable");this.customScriptPresent=false;this.elementIds=null;this.userCookieAge=null;};BNPolicy.prototype.get=function(pId,param){if(!pId)return this.data;if(!this.data)return null;if(!param)return this.data[pId];if(!this.data[pId])return null;return this.data[pId][param];};BNPolicy.prototype.getCondition=function(tag){var origCondition=this.get("inf","cd");if(tag&&tag.conditionName){return origCondition.replace(/^([0-9]+)[.]([A-Z]+)(.*)/,"$1."+tag.conditionName+"$3");} return origCondition;};BNPolicy.prototype.getOverride=function(pId){if(!pId)return this.overrides;if(!this.overrides)return null;return this.overrides[pId];};BNPolicy.prototype.allowTag=function(tag){if(this.disableAll)return false;var pTag=this.get(tag.type);if(!pTag)return true;if(typeof(pTag.ok)=="undefined")return true;if(!pTag.ok){if(typeof(pTag.load)=="undefined")return false;else return pTag.load;} return pTag.ok;};BNPolicy.prototype.showTag=function(tag){if(this.disableAll)return false;var pTag=this.get(tag.type);if(!pTag)return true;if(typeof(pTag.ok)=="undefined")return true;return pTag.ok;};BNPolicy.prototype.isNew=function(){return this.isNewPolicy;};BNPolicy.prototype.getGuideElementIds=function(){return this.elementIds;};BNPolicy.prototype.load=function(server,custName,custCode,userId){this.userId=userId;var needUserPolicy=true;bnResourceManager.loadResource(bnConstants.POLICY_RESOURCE_ID,this.getPolicyResourceAddress(server,custName,custCode,userId,needUserPolicy));};BNPolicy.prototype.useExternalId=function(externalId,remove){var needUserPolicy=true;var s=baynote_tag.server;var cn=baynote_tag.customerId;var cc=baynote_tag.code;var u=bnUser.getUserId();var extId=remove?null:externalId;bnResourceManager.removeResource(bnConstants.POLICY_RESOURCE_ID);bnResourceManager.loadResource(bnConstants.POLICY_RESOURCE_ID,this.getPolicyAddressForExtUserId(s,cn,cc,u,needUserPolicy,extId));};BNPolicy.prototype.registerPolicy=function(basePolicyJSON,userPolicyJSON){this.data=this.importData(basePolicyJSON);if(userPolicyJSON){var userPolicy=bnCommon.parseJSON(userPolicyJSON);for(var category in userPolicy){if(typeof(userPolicy[category])=="function")continue;for(var paramName in userPolicy[category]){if(typeof(userPolicy[category][paramName])=="function")continue;this.setPolicyData(this.data,category,paramName,userPolicy[category][paramName]);}}} this.overrides=this.computeOverrides();this.applyOverrides(this.overrides);this.userCookieAge=this.get(bnConstants.OBSERVER_TAG,"uca");this.applyDirectives();this.customScriptPresent=this.get(baynote_globals.CustomScript,"hn")!=null;this.elementIds=this.get(baynote_globals.GuideSet,"eids");bnResourceManager.registerResource(bnConstants.POLICY_RESOURCE_ID);};BNPolicy.prototype.getPolicyResourceAddress=function(server,custName,custCode,userId,needUserPolicy){var subDomain="";if(typeof(baynote_globals)!="undefined"&&baynote_globals.cookieSubDomain)subDomain=baynote_globals.cookieSubDomain;return(server+baynote_globals.TagsURLPrefix+"policy?customerId="+custName+"&code="+custCode+"&subdomain="+subDomain+"&userId="+userId+"&userPolicyRequested="+needUserPolicy);};BNPolicy.prototype.importData=function(jsonStr){var data=bnCommon.parseJSON(jsonStr);if(!data)data=new Object();return data;};BNPolicy.prototype.getPolicyAddressForExtUserId=function(server,custName,custCode,userId,needUserPolicy,extUId){var subDomain="";if(typeof(baynote_globals)!="undefined"&&baynote_globals.cookieSubDomain) subDomain=baynote_globals.cookieSubDomain;if(extUId){return(server+baynote_globals.TagsURLPrefix+"policy?customerId=" +custName+"&code="+custCode+"&subdomain="+subDomain +"&userId="+userId +"&extUserId="+extUId +"&userPolicyRequested="+needUserPolicy);} return(server+baynote_globals.TagsURLPrefix+"policy?customerId=" +custName+"&code="+custCode+"&subdomain="+subDomain +"&userId="+bnConstants.UNASSIGNED_USER_ID +"&ts="+(new Date().getTime()) +"&userPolicyRequested="+needUserPolicy);};BNPolicy.prototype.importData=function(jsonStr){var data=bnCommon.parseJSON(jsonStr);if(!data)data=new Object();return data;};BNPolicy.prototype.applyOverrides=function(overrideData){if(!overrideData)return;var atLeastOne=false;for(var cat in overrideData){if(typeof(overrideData[cat])=="function")continue;for(var key in overrideData[cat]){if(typeof(overrideData[cat][key])=="function")continue;this.setPolicyData(this.data,cat,key,overrideData[cat][key]);atLeastOne=true;}} var testServer=bnSystem.getTestServer();if(testServer){this.setPolicyData(overrideData,"inf","server",testServer);atLeastOne=true;} if(atLeastOne)bnCommon.setDisplayBox(bnCommon.dumpHTML(overrideData));};BNPolicy.prototype.computeTagOverrides=function(){var tagOverrides=this.importData("{}");var bn_ov=typeof(baynote_globals)!="undefined"?baynote_globals.bn_ov:null;if(bn_ov){var categories=bn_ov.split(";");for(var i=0;i0);event.pageX=event.clientX+document.body.scrollLeft;event.pageY=event.clientY+document.body.scrollTop;event.target=event.srcElement;event.time=(new Date).getTime();if(event.type=="mouseout")event.relatedTarget=event.toElement;else if(event.type=="mouseover")event.relatedTarget=event.fromElement;event.preventDefault=function(){this.returnValue=false;} event.stopPropagation=function(){this.cancelBubble=true;} return event;};bnEvent=new BNEvent();BNTrail=function(){this.data=new Array();this.initialized=false;};BNTrail.prototype.initialize=function(maxLength){this.maxLength=maxLength;this.load();this.initialized=true;};BNTrail.prototype.getUrls=function(maxLength){if(!this.initialized)this.initialize(maxLength);return this.data;};BNTrail.prototype.addUrl=function(url,maxLength,sessionOnly){if(!this.initialized)this.initialize(maxLength);var index=this.getIndex(url);if(index!=-1&&this.data.length>0){if(index==(this.data.length-1))return;if(index!=-1)this.data.splice(index,1);} this.data.push(url);this.crop();this.save(sessionOnly);};BNTrail.prototype.crop=function(){if(this.data.length>this.maxLength){var numSplice=this.data.length-this.maxLength;this.data.splice(0,numSplice);}};BNTrail.prototype.getIndex=function(url){for(i=0;i=0){this.resultResourceId="Message"+this.messageNum;bnResourceManager.loadResource(this.resultResourceId,fullMsg,"img");this.messageNum++;bnTagManager.invokeCallBack(this.resultResourceId,this.myTag);} return spaceLeft;} BNMessenger.prototype.canItFit=function(msg){var msgStr=bnCommon.valueToJSON(msg);var msgStrTobeSent=encodeURIComponent(msgStr);return this.eventDetailsLimit-msgStrTobeSent.length>=0;} var bnMessenger=new BNMessenger();function BNBehavior() {this.numSamples=0;this.numMouseMoves=0;this.numScrolls=0;this.lastMousePos=new Object();this.lastMousePos.x=this.lastMousePos.y=0;this.curMousePos=new Object();this.curMousePos.x=this.curMousePos.y=0;this.lastScroll=new Object();this.lastScroll.x=this.lastScroll.y=0;this.curScroll=new Object();this.curScroll.x=this.curScroll.y=0;this.maxScrollPercent=0;} BNBehavior.prototype.activityCheck=function() {this.numSamples++;if(this.lastMousePos.x&&this.lastMousePos.x!=this.curMousePos.x)this.numMouseMoves++;else if(this.lastMousePos.y&&this.lastMousePos.y!=this.curMousePos.y)this.numMouseMoves++;this.lastMousePos.x=this.curMousePos.x;this.lastMousePos.y=this.curMousePos.y;if(bnIsIE)this.curScroll.y=document.body.scrollTop;else this.curScroll.y=window.pageYOffset;if(this.lastScroll.y&&this.lastScroll.y!=this.curScroll.y)this.numScrolls++;this.lastScroll.y=this.curScroll.y;var curScrollPercent=this.getScrollScope();if(curScrollPercent>this.maxScrollPercent) this.maxScrollPercent=curScrollPercent;setTimeout("bnBehavior.activityCheck()",500);} BNBehavior.prototype.getScrollTop=function() {if(document.documentElement&&document.documentElement.scrollTop) return document.documentElement.scrollTop;if(document.body)return document.body.scrollTop;return window.pageYOffset;} BNBehavior.prototype.getScrollHeight=function() {if(document.documentElement&&document.documentElement.scrollHeight) return Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight,document.body.scrollHeight);return document.body.scrollHeight;} BNBehavior.prototype.getClientHeight=function() {if(typeof(window.innerWidth)=='number') return window.innerHeight;else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)) return document.documentElement.clientHeight;else if(document.body&&(document.body.clientWidth||document.body.clientHeight)) return document.body.clientHeight;} BNBehavior.prototype.getScrollScope=function() {return Math.round((this.getScrollTop()+this.getClientHeight())*100/this.getScrollHeight());} BNBehavior.prototype.mouseHandler=function(e) {this.curMousePos.x=e.pageX;this.curMousePos.y=e.pageY;} var bnBehavior=new BNBehavior();function BNObserver(){this.lingerCancelled=false;this.sendRecImpression=false;this.myType="baynoteObserver";this.myTag=null;this.startTime=new Date().getTime();this.networkInfo=null;this.pageEvent=true;this.name="defaultHandler";} BNObserver.prototype.createSearchBox=function(){var actionUrl=this.myTag.server+"/search/query2";var searchButtonHTML;var searchButtonImg=this.myTag.getParam("searchButtonImg",null);if(searchButtonImg){searchButtonHTML='';searchImgParam='';} else{searchButtonHTML='';searchImgParam='';} var key=this.myTag.key?this.myTag.key:"";var searchboxHtml='' +'' +'' +'' +'
' +'
' +'' +'' +'' +'' +'' +searchImgParam+'' +searchButtonHTML+'
' +'
';var searchboxDiv=document.createElement("div");searchboxDiv.innerHTML=searchboxHtml;return searchboxDiv;} BNObserver.prototype.shouldSendEvent=function(){if(this.soEnabled)return true;if(this.stEnabled&&this.isSpecial)return true;if(this.isSpecialUser)return true;return false;} BNObserver.prototype.sendEvent=function(evJSON,force){if(!this.shouldSendEvent()&&(typeof(force)=="undefined"||!force))return;if(!bnMessenger.initialized){setTimeout("bnObserver.sendEvent('"+evJSON+"')",100);return;} var result=bnMessenger.sendMessage(evJSON);while(result<0){var newEv=bnCommon.parseJSON(evJSON);if(newEv.de){delete newEv.de;evJSON=bnCommon.valueToJSON(newEv);result=bnMessenger.sendMessage(evJSON);}else if(newEv.at&&newEv.at.rt){delete newEv.at.rt;evJSON=bnCommon.valueToJSON(newEv);result=bnMessenger.sendMessage(evJSON);}else{if(typeof baynote_globals.messageDropped=='function'){baynote_globals.messageDropped({result:result,msg:evJSON});} result=0;}}} BNObserver.prototype.makeEvent=function(action){var ev=new Object();ev.a=action;if(typeof(bnPolicy.getCondition)!="undefined"){ev.c=bnPolicy.getCondition(this.myTag);} else{ev.c=bnPolicy.get("inf","cd");} ev.d=this.url;if(this.myTag.iFrame){ev.r=parent.document.referrer;ev.p=parent.location.href.split("#")[0];ev.p=bnCommon.getURL(ev.p);}else{ev.r=document.referrer;} ev.t=new Date().getTime();ev.u=bnUser.getUserId(this.myTag);if(bnCommon.hasAnyProperty(this.myTag.attrs))ev.at=this.myTag.attrs;this.checkForSpecialTarget(ev);if(!this.soEnabled&&this.stEnabled&&this.isSpecial){if(!ev.at)ev.at=new Object();ev.at.st="true";} if(this.isSpecialUser){if(!ev.at)ev.at=new Object();ev.at.su="true";} if(typeof(this.networkInfo)!="undefined"&&this.networkInfo){if(!this.networkInfo.userIds.isEmpty()){ev.at.networkUserIds=this.networkInfo.userIds.toString();if(!this.networkInfo.groupIds.isEmpty())ev.at.networkGroupIds=this.networkInfo.groupIds.toString();}} if(action=='c'||action=='C'){if(baynote_globals.RecImpressionList&&baynote_globals.RecImpressionList.length>0&&this.sendRecImpression){ev.at=ev.at||{};ev.at.rt=baynote_globals.RecImpressionList;}} var extUid=bnUser.getExtUserId();if(extUid){if(!ev.at)ev.at=new Object();ev.at.extUid=extUid;} if(typeof baynote_globals.verifyEvent==='function'){baynote_globals.verifyEvent(ev);} return ev;} BNObserver.prototype.makeDetails=function(){var de=new Object();if(bnPolicy.get("baynoteObserver","cds")){var summary=this.myTag.getParam("summary",null);if(summary&&summary.length>0)de.su=summary;} if(bnPolicy.get("baynoteObserver","cdt")){var title=this.myTag.getParam("title",bnPageInfo.getTitle());if(title&&title.length>0)de.ti=title;} de.nw=bnPageInfo.getWordCount();de.nl=bnPageInfo.getLinkCount();return de;} BNObserver.prototype.makeBehavior=function(){var bi=new Object();if(typeof(bnBehavior)=="object"){bi.ps=bnBehavior.maxScrollPercent;bi.ma=bnBehavior.numMouseMoves;bi.sa=bnBehavior.numScrolls;} else{return null;} return bi;} BNObserver.prototype.networkLogin=function(networkInfo){this.networkInfo=networkInfo;} BNObserver.prototype.networkLogout=function(networkInfo){this.networkInfo=networkInfo;} BNObserver.prototype.cancelLinger=function(){this.lingerCancelled=true;} BNObserver.prototype.clickOccurred=function(clicked){var exitInfo=new Object();var result=false;if(typeof(this.myTag.exitConfirmation)=="function"){result=this.myTag.exitConfirmation(clicked,exitInfo);}else{result=this.defaultExitConfirmation(clicked,exitInfo);} if(result)this.exitOccurred(exitInfo);} BNObserver.prototype.defaultExitConfirmation=function(clicked,exitInfo){var target=clicked;while(target){if(target.tagName=="A")break;target=target.parentNode;} if(!target)return false;exitInfo.dest=target.href;var gt=target.getAttribute("baynote_guide");if(typeof(gt)!="undefined"&>)exitInfo.baynote_guide=gt;var gr=target.getAttribute("baynote_req");if(typeof(gr)!="undefined"&&gr)exitInfo.baynote_req=gr;var bn=target.getAttribute("baynote_bnrank");if(typeof(bn)!="undefined"&&bn)exitInfo.baynote_bnrank=bn;var ir=target.getAttribute("baynote_irrank");if(typeof(ir)!="undefined"&&ir)exitInfo.baynote_irrank=ir;var lt=bnCommon.getInnerText(target);if(!lt&&bnPolicy.get("baynoteObserver","alt")){if(clicked&&clicked.tagName=="IMG"){lt=clicked.getAttribute("ALT");var src=clicked.getAttribute("SRC");if(lt&&(src.indexOf(lt)==(src.length-lt.length)))lt=null;}} if(lt)exitInfo.link=lt;var attrs=this.myTag.attrs;if(typeof(attrs)=="object"&&bnCommon.hasAnyProperty(attrs)){exitInfo.attrs=bnCommon.copyObj(attrs);} return true;} BNObserver.prototype.exitOccurred=function(exitInfo){var ev=this.makeEvent("c");var dd=exitInfo.dest;if(typeof(dd)!="undefined"&&dd)ev.dd=dd;else ev.dd="bn_ignore=t";var lt=exitInfo.link;if(typeof(lt)!="undefined"&<)ev.l=lt;var ea=exitInfo.attrs;if(typeof(ea)=="object"){ev.at=ea;} var gt=exitInfo.baynote_guide;if(typeof(gt)!="undefined"&>)ev.gt=gt;var gr=exitInfo.baynote_req;if(typeof(gr)!="undefined"&&gr)ev.gr=gr;var bn=exitInfo.baynote_bnrank;if(typeof(bn)!="undefined"&&bn){ev.rb=bn;if(!this.soEnabled&&this.stEnabled){this.isSpecial=true;if(!ev.at)ev.at=new Object();ev.at.st="true";} if(this.isSpecialUser){if(!ev.at)ev.at=new Object();ev.at.su="true";}} var ir=exitInfo.baynote_irrank;if(typeof(ir)!="undefined"&&ir)ev.ri=ir;var gat=exitInfo.baynote_guide_target;if(typeof(gat)!="undefined"&&gat)ev.gat=gat;var iq=exitInfo.implicitQuery;if(typeof(iq)!="undefined"&&iq){if(!ev.at)ev.at=new Object();ev.at.implicitQuery=iq;} if(!this.myTag.iFrame){var details=this.makeDetails();if(details!=null)ev.de=details;} if(bnPolicy.get("baynoteObserver","ub")){var bi=this.makeBehavior();if(bi!=null)ev.bi=bi;} if(!this.shouldSendEvent())return;var u=bnCommon.getCookieValue("bn_u");var sEvt=bnCommon.valueToJSON(ev);var fCookie=false;if(bnPolicy.get("baynoteObserver","ec")&&(typeof(u)!="undefined"&&u)&&bnPageInfo.cookiesAreEnabled){var msgStrTobeSet=encodeURIComponent(sEvt);var lenDiff=this.eventDetailsLimit-msgStrTobeSet.length;if(lenDiff>=0){bnCommon.setCookie("bn_ec",sEvt,"/","SESSION");fCookie=true;}else{if(typeof baynote_globals.messageDropped=='function'){baynote_globals.messageDropped({result:lenDiff,msg:sEvt});}}} if(!fCookie||(bnPolicy.get("baynoteObserver","eec"))){this.sendEvent(sEvt);this.exitPause();}} BNObserver.prototype.lingerOccurred=function(ds){if(!this.shouldFireLinger())return;var ev=this.makeEvent("l");ev.du=ds;if(bnPolicy.get("baynoteObserver","sdl")){var details=this.makeDetails();if(details!=null)ev.de=details;} this.sendEvent(bnCommon.valueToJSON(ev));if(bnTrail&&bnPolicy.get("trail","ok"))bnTrail.addUrl(this.url,bnPolicy.get("trail","tl"),bnPolicy.get("trail","so"));} BNObserver.prototype.visitOccurred=function(){if(bnPolicy.get("baynoteObserver","ec")){var sEvt=bnCommon.getCookieValue("bn_ec");if(typeof(sEvt)!="undefined"&&sEvt&&sEvt.length>0){this.sendEvent(sEvt,true);} bnCommon.removeCookie("bn_ec");} if(!this.shouldFireVisit())return;var ev=this.makeEvent("v");this.sendEvent(bnCommon.valueToJSON(ev));} BNObserver.prototype.shouldFireLinger=function(){if(this.lingerCancelled)return false;if(this.myTag.iFrame)return false;return true;} BNObserver.prototype.shouldFireVisit=function(){if(this.myTag.iFrame)return false;if(bnPolicy.get("baynoteObserver","sv"))return true;if(this.myTag.getParam("fireVisit"))return true;if(!this.myTag.attrs)return false;if(this.myTag.attrs.totalPurchases)return true;if(this.myTag.attrs.query)return true;if(this.myTag.attrs.pageStatus)return true;return false;} BNObserver.prototype.openMedia=function(mediaURL,linkText){this.cancelLinger();var ev=this.makeEvent("c");ev.dd=mediaURL;if(linkText)ev.l=linkText;this.sendEvent(bnCommon.valueToJSON(ev));} BNObserver.prototype.closeMedia=function(mediaURL){var ev=this.makeEvent("c");ev.r=ev.d;ev.dd=ev.d;ev.d=mediaURL;this.sendEvent(bnCommon.valueToJSON(ev));} BNObserver.prototype.queryExitOccurred=function(query,dest){var ev=this.makeEvent("c");ev.dd=dest;var details=this.makeDetails();if(details!=null)ev.de=details;if(!ev.at)ev.at=new Object();ev.at.implicitQuery=query;this.sendEvent(bnCommon.valueToJSON(ev));this.exitPause();} BNObserver.prototype.exitPause=function(){var delayMS=bnPolicy.get(this.myType,"ep");if(delayMS==null||delayMS<=0)return;var maxIter=bnPolicy.get(this.myType,"epmi");if(maxIter==null)maxIter=1000000;var startTime=new Date().getTime();var nowTime=new Date().getTime();var iterations=0;while(nowTime-startTimemaxIter)break;}} BNObserver.prototype.actionOccurred=function(obj){} BNObserver.prototype.instrumentLinks=function(){bnEvent.addHandler(document.body,"click",function(){var evt=bnEvent.getEvent();if(evt.target)bnObserver.clickOccurred(evt.target);});bnLog.log("onclick handler installed");} BNObserver.prototype.instrumentBehavior=function(){if(typeof(bnBehavior)=="object"&&bnBehavior!=null){bnEvent.addHandler(document,"mousemove",function(){var evt=bnEvent.getEvent();bnBehavior.mouseHandler(evt);});setTimeout("bnBehavior.activityCheck()",500);}} BNObserver.prototype.captureValue=function(cap){var result;if(cap.st=="dp"){if(cap.sn.indexOf(bnConstants.BN_PARAM_PREFIX)==0)result=bnPageInfo.getBNParam(cap.sn);else result=bnPageInfo.getURLParam(cap.sn);}else if(cap.st=="mt"){var metas=document.getElementsByName(cap.sn);if(metas){for(var i=0;i0)return;this.myTag.attrs[cap.dn]=value;}else if(cap.dt=="da"){if(!this.myTag.docAttrs)this.myTag.docAttrs=new Object();if(this.myTag.docAttrs[cap.dn]&&this.myTag.docAttrs[cap.dn].length>0)return this.myTag.docAttrs[cap.dn]=value;}else if(this.debug){alert("Invalid capture destination type "+cap.dt);}} BNObserver.prototype.show=function(obsTag){this.lingerCancelled=false;this.myTag=obsTag;this.debug=bnPolicy.get(this.myType,"debug");this.soEnabled=bnPolicy.get(this.myType,"so");this.stEnabled=bnPolicy.get(this.myType,"st");if(this.myTag.searchbox){var ph=document.getElementById(this.myTag.placeHolderId);if(bnPolicy.get("search","ok"))ph.appendChild(this.createSearchBox());else if(this.myTag.noload)ph.innerHTML=this.myTag.noload;} var obsHandler="/tags3/baynoteObserver/listener2";bnMessenger.initialize(this.myTag.server,obsHandler,this.myTag.customerId,this.myTag.code,this.myTag.key,this.debug);this.url=this.myTag.getParam("url",bnPageInfo.getURL());this.url=bnCommon.addURLMetaKeys(this.url,this.myTag.metaKeys);var oldPS=this.myTag.getParam("page_status");if(!oldPS&&bnPageInfo.is404())oldPS=404;var oldTP=this.myTag.getParam("totalPurchases");var oldQ=this.myTag.getParam("query");if(oldTP||oldQ||oldPS){if(!this.myTag.attrs)this.myTag.attrs=new Object();if(!this.myTag.attrs.totalPurchases&&oldTP)this.myTag.attrs.totalPurchases=oldTP;if(!this.myTag.attrs.query&&oldQ)this.myTag.attrs.query=oldQ;if(!this.myTag.attrs.pageStatus&&oldPS)this.myTag.attrs.pageStatus=oldPS;} var caps=bnPolicy.get(this.myType,"cap");if(caps!=null&&caps instanceof Array){for(var i=0;i0){dwellTime=this.myTag.attrs.expectedDuration*dlThreshold;} var dwellMSec=dwellTime*1000;setTimeout("bnObserver.lingerOccurred("+dwellTime+")",dwellMSec);this.instrumentLinks();if(bnPolicy.get("baynoteObserver","ub")){this.instrumentBehavior();} if(bnPolicy.get("baynoteObserver","bpe"))this.pageEvent=false;bnResourceManager.registerAndAddResource(this.myType,bnObserver);return true;} BNObserver.prototype.pageAction=function(param){if(typeof param=='undefined')return;if(this.debug)bnLog.log("pageAction invoked with param:\n"+bnCommon.dump(param));var attrs=param.attrs;if(typeof(attrs)=="undefined"||!attrs){if(this.debug)bnLog.log("No attribute 'attrs' was specified");return;} var evType=attrs.evType;if(typeof(evType)=="undefined"||!evType){if(this.debug)bnLog.log("No event type 'evType' was specified in 'attrs'");return;} var evTarget=attrs.evTarget;if(typeof(evTarget)=="undefined"||!evTarget){if(this.debug)bnLog.log("No event target 'evTarget' was specified in 'attrs'");return;} var doc=param.d;if(typeof(doc)=="undefined"||!doc){if(this.debug)bnLog.log("No document was specified");return;} var ev=this.makeEvent("p");this.checkIsSpecial(param);this.setEventAttrs(ev,param);ev.d=doc;this.firePageEvent(ev);} BNObserver.prototype.firePageEvent=function(ev){if(!this.pageEvent)return;this.sendEvent(bnCommon.valueToJSON(ev));} BNObserver.prototype.checkIsSpecial=function(param){var specialTarget=param.specialTarget;if(typeof(specialTarget)!="undefined"&&specialTarget){this.isSpecial=true;delete param.specialTarget;}else{this.isSpecial=false;}} BNObserver.prototype.setEventAttrs=function(ev,param){if(param==null)return;if(!bnCommon.hasAnyProperty(param.attrs))return;if(!ev.at)ev.at=new Object();for(var prop in param.attrs){var child=param.attrs[prop];if(typeof(child)=="undefined"||typeof(child)=="function")continue;if(child!=null)ev.at[prop]=child;}} BNObserver.prototype.clearObserverAttributes=function(attrList){if(!this.myTag||!this.myTag.attrs)return;for(var i in attrList){var theEvtAttr=attrList[i];if(typeof this.myTag.attrs[theEvtAttr]!='undefined'){delete this.myTag.attrs[theEvtAttr];}}};BNObserver.prototype.checkForSpecialTarget=function(ev){this.setSpecialTarget(baynote_globals.ReferrerPatterns,ev.r);this.setSpecialTarget(baynote_globals.DocumentPatterns,ev.d);this.setSpecialTarget(baynote_globals.DocDestinationPatterns,ev.dd);};BNObserver.prototype.setSpecialTarget=function(arrayOfPatterns,url){if(!url||!bnCommon.isNotEmpty(url))return;if(arrayOfPatterns&&bnCommon.isArray(arrayOfPatterns)){for(var i in arrayOfPatterns){var rxPattern=arrayOfPatterns[i];if(bnCommon.checkType(rxPattern,'RegExp')){if(rxPattern.test(url)){this.isSpecial=true;break;}}}}};var bnObserver=new BNObserver();bnTagManager.registerTagHandler(bnObserver.myType,bnObserver); function BNGuideLiteHandler(){this.myType="guide";this.myTag=null;this.guide=null;this.socialGuide=null;this.socialShow=false;this.socialLoggedIn=false;this.networkInfo=null;} bnConstants.GUIDE_RESULTS_RESOURCE_PREFIX="GLResults";bnConstants.GUIDE_SOCIAL_SHOW_LOGIN="showLogin";bnConstants.GUIDE_SOCIAL_HIDE_LOGIN="hideLogin";bnConstants.GUIDE_SOCIAL_SHOW_GUIDE="showGuide";BNGuideLiteHandler.prototype.gotoPage=function(tagId,guideRank,gotoURL){with(this){if(typeof(bnTrailMgr)!="undefined"&&bnTrailMgr){var guideType=bnTagManager.getTag(tagId).guide;bnTrailMgr.guideResultClick(guideType,guideRank,gotoURL);} if(gotoURL) {if(bnIsIE)window.event.returnValue=false;window.location.href=gotoURL;}}} BNGuideLiteHandler.prototype.getResultsHandlerAddress=function(guideTag){var resultsFormat=guideTag.getParam("format",bnPolicy.get(this.myType,"fmt"));if(!resultsFormat){resultsFormat="results-xsl";};var srcPreamble=guideTag.server+baynote_globals.TagsURLPrefix+this.myType+"/"+resultsFormat+"/"+guideTag.customerId+"-"+guideTag.code;var guideScriptSrc="";guideScriptSrc+=srcPreamble;guideScriptSrc+="?userId="+bnUser.getUserId(guideTag);guideScriptSrc+="&customerId="+guideTag.customerId;guideScriptSrc+="&code="+guideTag.code;if(guideTag.key)guideScriptSrc+="&key="+guideTag.key;guideScriptSrc+="&id="+guideTag.id;if(this.socialShow&&this.socialGuide){guideScriptSrc+="&guide="+encodeURIComponent(this.socialGuide);} if(guideTag.listSize)guideScriptSrc+="&resultsPerPage="+guideTag.listSize;if(guideTag.startingDocNum)guideScriptSrc+="&startingDocNum="+guideTag.startingDocNum;var query=bnPageInfo.getBNParams()["bn_q"];if(!query)query=guideTag.query;if(!query){guideTag.referrer=bnPageInfo.getReferrerURL();} if(query){guideScriptSrc+="&query="+encodeURIComponent(query);guideTag.query=query;} var referrer=guideTag.referrer;if(referrer){guideScriptSrc+="&referrer="+encodeURIComponent(referrer);} guideTag.isFallback=false;var fallback=guideTag.fallback;if(fallback){guideScriptSrc+="&fallback="+encodeURIComponent(fallback);} var pageURL=guideTag.getParam("url",bnPageInfo.getURL());var listUrls=guideTag.getParam("listUrls",null);if(listUrls&&listUrls.length>0){for(var ixUrl=0;ixUrl0){for(ixTrail=listUrls.length-1;ixTrail>=0;ixTrail--){var trailUrl=listUrls[ixTrail];if(trailUrl==pageURL)continue;guideScriptSrc+="&url="+encodeURIComponent(trailUrl);}}} else{pageURL=bnCommon.addURLMetaKeys(pageURL,guideTag.metaKeys);guideScriptSrc+="&url="+encodeURIComponent(pageURL);} guideScriptSrc+="&appendParams="+encodeURIComponent(guideTag.getParam("appendParams",""));guideScriptSrc+="&rankParam="+encodeURIComponent(guideTag.getParam("rankParam",""));if(guideTag.urlFilter)guideScriptSrc+="&urlFilter="+encodeURIComponent(guideTag.urlFilter);if(guideTag.attrFilter)guideScriptSrc+="&attrFilter="+encodeURIComponent(guideTag.attrFilter);if(guideTag.ctxAttrList)guideScriptSrc+="&ctxAttrList="+encodeURIComponent(guideTag.ctxAttrList);if(guideTag.attrSort)guideScriptSrc+="&attrSort="+encodeURIComponent(guideTag.attrSort);if(guideTag.sortSize)guideScriptSrc+="&sortSize="+guideTag.sortSize;if(guideTag.days)guideScriptSrc+="&days="+guideTag.days;if(guideTag.oe)guideScriptSrc+="&oe="+guideTag.oe;if(bnCommon.hasAnyProperty(guideTag.attrs)) {guideScriptSrc+="&contextAttrs="+bnCommon.objectToJSON(guideTag.attrs);} var cond=bnPolicy.get("inf","cd");if(cond)guideScriptSrc+="&condition="+encodeURIComponent(cond);if(this.socialGuide){guideScriptSrc+="&social=";if(this.socialShow){if(this.socialLoggedIn)guideScriptSrc+=bnConstants.GUIDE_SOCIAL_SHOW_GUIDE;else guideScriptSrc+=bnConstants.GUIDE_SOCIAL_SHOW_LOGIN;} else{guideScriptSrc+=bnConstants.GUIDE_SOCIAL_HIDE_LOGIN;}} if(this.socialShow){if(this.networkInfo){networkInfo=this.networkInfo;if(networkInfo.groupIds&&!networkInfo.groupIds.isEmpty()){var param="&groupIds=";var limit=bnConstants.MAX_URL_LENGTH-guideScriptSrc.length-param.length-4;if(limit<0)limit=0;var value=networkInfo.groupIds.toString(limit);if(value&&value!=""){guideScriptSrc+=param;guideScriptSrc+=value;}} if(networkInfo.friendIds&&!networkInfo.friendIds.isEmpty()){var param="&friendIds=";var limit=bnConstants.MAX_URL_LENGTH-guideScriptSrc.length-param.length-4;if(limit<0)limit=0;var value=networkInfo.friendIds.toString(limit);if(value&&value!=""){guideScriptSrc+=param;guideScriptSrc+=value;}}}} var eids=bnCommon.getAllGuideContainersPresent();if(eids.length>0){var eidstr='';for(var i=0;i0){if(rtObj.bnURL.substr(l-6)!=bnConstants.AJAX_URL){bnURL+=bnConstants.AJAX_URL;}} bnURL+="?reqID="+this.ajaxResourceId;bnURL+="&userId="+bnUser.getUserId(this.myTag);bnURL+="&customerId="+this.myTag.customerId;bnURL+="&code="+this.myTag.code;var referrer=bnPageInfo.getReferrerURL();if(referrer)bnURL+="&referrer="+encodeURIComponent(referrer);var cond=bnPolicy.get("inf","cd");if(cond)bnURL+="&condition="+encodeURIComponent(cond);for(var attr in rtObj.params){bnURL+="&"+attr+"="+encodeURIComponent(rtObj.params[attr]);} bnURL+="&v=1";return bnURL;} BNAjaxHandler.prototype.show=function(theTag){this.myTag=theTag;this.myRegistry=new Object();this.initialized=true;} BNAjaxHandler.prototype.send=function(rtObj){if(!this.initialized){bnLog.log("WARN: ajax handler is not initialized - call execute on it");return;} this.lastReqId++;this.ajaxResourceId=bnConstants.AJAX_RESOURCE_PREFIX+this.lastReqId;this.myRegistry[this.ajaxResourceId]=rtObj;bnResourceManager.waitForResource(this.ajaxResourceId,"bnAjaxHandler.resultsAreIn('"+this.ajaxResourceId+"')",this.getHandlerAddress(rtObj));bnTagManager.invokeCallBack(this.ajaxResourceId,this.myTag);} BNAjaxHandler.prototype.resultsAreIn=function(reqId){var rtObj=this.getRTObject(reqId);if(!rtObj){bnLog.log('AJAX RESULTS HANDLER - empty runtime object');return;} if(rtObj.isSuccess){rtObj.onSuccess(rtObj.responseText);}else{rtObj.onFailure(rtObj.responseText);}} BNAjaxHandler.prototype.getRTObject=function(reqId){return this.myRegistry[reqId];} var bnAjaxHandler=new BNAjaxHandler();bnTagManager.registerTagHandler(bnAjaxHandler.myType,bnAjaxHandler);