// Copyright 2007 Microsoft Corporation.  All rights reserved.
// Build: 3486
function $clean(data){switch(typeof(data)){case"string":return encodeURIComponent(data);break;default:return data;break;}};function $assertValue(data){return typeof(data)!="undefined"&&data!=null;};function $assertType(data,dataType){return $assertValue(data)&&typeof(data)==dataType;};function $createFrame(fId,fSrc){var intF=document.createElement("iframe");intF.id=fId;intF.src=fSrc;intF.style.zIndex="-1";intF.style.height="1px";intF.style.width="1px";intF.style.visibility="hidden";intF.style.display="none";return intF;};function $sync(aqnt){if(location.protocol.indexOf("http")<0||window.navigator.userAgent.indexOf("MSIE 5")>0){return;} var livePage=location.protocol+"//analytics.live.com/Sync.html?V=3486";if(aqnt===true){livePage+="&AQNT=1";} if(window._syncUrl){var u,su=window._syncUrl;for(u in su){if(su[u]==livePage){return;}}} else{window._syncUrl=[];} window._syncUrl.push(livePage);var loadScript=function(lP){if(document.body){var liveFrame=$createFrame("_syncFrame",lP);document.body.appendChild(liveFrame);} else{document.write("<iframe id=\"_syncFrame\" src=\""+lP+"\" style=\"z-index:-1;height:1px;width:1px;display:none;visibility:hidden;\"></iframe>");}};if(window.attachEvent){window.attachEvent('onload',function(){loadScript(livePage);});} else{window.addEventListener('load',function(){loadScript(livePage);},false);}};PayloadType={PageView:"view",Event:"evnt",Link:"lnk",Cart:"crt"};LinkType={Outbound:"o",Download:"d"};EventPriority={Critical:1};DebugMessageType={CriticalError:0,Error:1,Information:2};(function(){function AnalyticsBase(){this.DebugEnabled=false;this.DebugLevel=DebugMessageType.Error;this.ScriptVersion=3486;this.MaxUrlLength=2048;this.PageViewRegistered=false;this.ImageList=new Array();this.Taxonomy=new List();};var GlobalDebugWindow=null;AnalyticsBase.prototype.DebugMessage=function(message,level){if(!$assertType(level,"number")){return;} if(this.DebugEnabled===true&&level<=this.DebugLevel){if(!$assertValue(GlobalDebugWindow)||GlobalDebugWindow.closed){GlobalDebugWindow=window.open("about:blank","AnalyticsDebug","height=480,width=640,location=1,resizable=1,scrollbars=1");if(navigator.userAgent.indexOf("MSIE")>=0){if(GlobalDebugWindow){GlobalDebugWindow.close();} GlobalDebugWindow=window.open("about:blank","AnalyticsDebug","height=480,width=640,location=1,resizable=1,scrollbars=1");} this.PopupBlocked=!$assertValue(GlobalDebugWindow);if(!this.PopupBlocked){GlobalDebugWindow.document.clear();GlobalDebugWindow.document.write("<html><head><title>Analytics Debug</title></head><body></body></html>");}} else{GlobalDebugWindow.focus();} switch(level){case DebugMessageType.CriticalError:var debugText="Debug::CRITICAL: "+message;this.PopupBlocked?alert(debugText):GlobalDebugWindow.document.write("<span style=\"font-family:Courier New;font-size:16pt;color:Red;\">"+debugText+"</span><br />");break;case DebugMessageType.Error:var debugText="Debug::ERROR: "+message;this.PopupBlocked?alert(debugText):GlobalDebugWindow.document.write("<span style=\"font-family:Courier New;font-size:12pt;color:Red\">"+debugText+"</span><br />");break;case DebugMessageType.Information:var debugText="Debug::INFORMATION: "+message;this.PopupBlocked?alert(debugText):GlobalDebugWindow.document.write("<span style=\"font-family:Courier New;font-size:12pt;color:Blue\">"+debugText+"</span><br />");break;}}};AnalyticsBase.prototype.SubmitPayload=function(payloadType){this.DebugMessage("Base class has no implementation details, override in subclasses",DebugMessageType.CriticalError);};AnalyticsBase.prototype.TrackPage=function(pageAlias){if(!this.PageViewRegistered){if($assertType(pageAlias,"string")&&pageAlias.length>0){this.Taxonomy.Add("PageAlias","als",ListNodeType.Variable);this.PageAlias=$clean(pageAlias);} var eventPayload=this.SubmitPayload(PayloadType.PageView);if(!$assertValue(eventPayload)){return;} this.ImageRequest(eventPayload);this.PageViewRegistered=true;} else{this.DebugMessage("Page View call can only be made once",DebugMessageType.Error);}};AnalyticsBase.prototype.ImageRequest=function(imageUrl,callbackFunction){if(!$assertType(imageUrl,"string")){this.DebugMessage("Image URL error: "+imageUrl,DebugMessageType.Error);return false;} this.DebugMessage(imageUrl,DebugMessageType.Information);var imageRequest=new Image();imageRequest.LoggingObject=this;if($assertType(callbackFunction,"function")){imageRequest.onload=callbackFunction;imageRequest.onerror=callbackFunction;} else{imageRequest.onload=function(){return;};imageRequest.onerror=function(){return;};} imageRequest.src=imageUrl;this.ImageList.push(imageRequest);return false;};AnalyticsBase.prototype.AddAttribute=function(currentNode){if(this.InternalValidateNode(currentNode)){return currentNode.Data+"="+encodeURIComponent(this[currentNode.Key.toString()])+"&";} return"";};AnalyticsBase.prototype.AddVariable=function(currentNode){if(this.InternalValidateNode(currentNode)){return currentNode.Data+":"+encodeURIComponent(this[currentNode.Key.toString()])+";";} return"";};AnalyticsBase.prototype.ProcessTaxonomy=function(baseUrl){if(typeof(baseUrl)!="string"){return"";} var attributePayload="data=";var current=this.Taxonomy.Root;var lengthRemaining=this.MaxUrlLength;var randomData="&rnd="+new Date().getTime();lengthRemaining-=randomData.length;lengthRemaining-=baseUrl.length;lengthRemaining-=attributePayload.length;while(current!=null&&lengthRemaining>0){if(current.Type==ListNodeType.Attribute){var queryStringVar=this.AddAttribute(current);lengthRemaining-queryStringVar.length>0?baseUrl+=queryStringVar:current=this.Taxonomy.Last;lengthRemaining-=queryStringVar.length;} else{var dataVar=this.AddVariable(current);if(lengthRemaining-dataVar.length>0){attributePayload+=dataVar;lengthRemaining-=dataVar.length;delete this[current.Key.toString()];current=this.Taxonomy.Remove(current);}} current=current.Next;} if(attributePayload.length>5){baseUrl+=attributePayload;} else{baseUrl=baseUrl.substr(0,baseUrl.length-1);} baseUrl+=randomData;return baseUrl;};AnalyticsBase.prototype.InternalValidateNode=function(currentNode){var nodeDataType=typeof(this[currentNode.Key.toString()]);switch(nodeDataType){case"undefined":return false;break;case"object":if(this[currentNode.Key]instanceof List){return($assertValue(this[currentNode.Key.toString()])&&this[currentNode.Key.toString()].Count>0&&currentNode.Type==ListNodeType.Variable);} else{return($assertValue(this[currentNode.Key.toString()])&&currentNode.Type==ListNodeType.Variable);} break;case"string":var stringData=this[currentNode.Key.toString()];return(stringData!=null&&stringData.length>0);break;default:return($assertValue(this[currentNode.Key.toString()]));break;}};AnalyticsBase.prototype.CalculateTimezone=function(){var now=new Date();var later=new Date();later.setMonth(now.getMonth()+6);var x=Math.round(now.getTimezoneOffset()/60)*-1;var y=Math.round(later.getTimezoneOffset()/60)*-1;return(x<y)?x:y;};AnalyticsBase.prototype.PauseLink=function(timeoutExpiry){if(!$assertType(timeoutExpiry,"number")){return;} var endAt=new Date().getTime()+timeoutExpiry;var rightNow;while(true){rightNow=new Date();if(rightNow.getTime()>=endAt){return;}}};function List(){this.Root=null;this.Last=null;this.Count=0;}List.prototype.Add=function(nodeKey,nodeValue,nodeType){if($assertType(nodeKey,"object")){return false;} if($assertValue(this.Find(nodeKey))){return false;} var newNode=new ListNode(nodeKey,nodeValue,nodeType);if(!$assertValue(this.Root)){this.Root=newNode;this.Last=newNode;} else{newNode.Previous=this.Last;this.Last.Next=newNode;this.Last=newNode;} this.Count++;return true;};List.prototype.AddRange=function(listData){if(!$assertType(listData,"string")||listData.length==0){return false;} var listNodeCollection=listData.split(";");for(var i=0;i<listNodeCollection.length;i++){var listNodeAttributes=listNodeCollection[i].split(":");switch(listNodeAttributes.length){case 1:this.Add(listNodeAttributes[0]);break;case 2:this.Add(listNodeAttributes[0],listNodeAttributes[1]);break;case 3:this.Add(listNodeAttributes[0],listNodeAttributes[1],listNodeAttributes[2]);break;default:break;}} return true;};List.prototype.Find=function(searchKey){var start=this.Root;var end=this.Last;if(!$assertValue(start)||!$assertValue(end)){return null;} if($assertType(searchKey,"string")){searchKey=searchKey.toLowerCase();} while(start!=null&&end!=null){var sK=$assertType(start.Key,"string")?start.Key.toLowerCase():start.Key;var eK=$assertType(end.Key,"string")?end.Key.toLowerCase():end.Key;if(sK==searchKey||eK==searchKey){return sK==searchKey?start:end;} if(start==end){break;} start=start.Next;end=end.Previous;} return null;};List.prototype.RemoveAll=function(){this.Root=null;this.Last=null;this.Count=0;};List.prototype.Remove=function(nodeToRemove){var nodeNext=nodeToRemove.Next;var nodePrevious=nodeToRemove.Previous;nodePrevious.Next=nodeNext;if($assertValue(nodeNext)){nodeNext.Previous=nodePrevious;} if(this.Last==nodeToRemove){this.Last=nodePrevious;} this.Count--;return nodePrevious;};List.prototype.toString=function(){var current=this.Root;var dataString="";while(current!=null){dataString+=current.Data.toString();current=current.Next;} return dataString;};function ListNode(nodeKey,nodeValue,nodeType){if(nodeKey){this.Key=nodeKey;} if(nodeValue){this.Data=nodeValue;} else{this.Data=nodeKey;} if(nodeType){this.Type=nodeType;} else{this.Type=ListNodeType.Variable;} this.Next=null;this.Previous=null;};ListNodeType=new function(){this.Attribute=1;this.Variable=2;};function MicrosoftAnalytics(){this.CookieName="_msaId";this.IdentityRegex="("+this.CookieName+"=)([a-zA-Z0-9_]*)(;|\w)?";this.EnableLinkTimeout=true;this.LinkTimeout=250;this.Taxonomy.Add("ProfileId","pid",ListNodeType.Attribute);this.Taxonomy.Add("UserIdentity","uid",ListNodeType.Attribute);this.Taxonomy.Add("TargetPage","tp",ListNodeType.Attribute);this.Taxonomy.Add("Referrer","rf",ListNodeType.Attribute);this.Taxonomy.Add("Language","lng",ListNodeType.Attribute);this.Taxonomy.Add("Timezone","tz",ListNodeType.Attribute);this.Taxonomy.Add("Screen","scr",ListNodeType.Attribute);this.Extensions=new List();this.Extensions.AddRange("arc;arj;asf;asx;avi;bin;doc;exe;gz;gzip;");this.Extensions.AddRange("hqx;mov;movie;mp2;mp3;mpeg;mpg;msi;pdf;");this.Extensions.AddRange("ppt;qt;ra;ram;sea;sit;tar;z;tgz;wav;wmv;");this.Extensions.AddRange("zip;msp;rar;wpd;qtm;");$sync();};MicrosoftAnalytics.prototype=new AnalyticsBase();MicrosoftAnalytics.prototype.EnableLinkTracking=function(){var _this=this;if(window.attachEvent){window.attachEvent('onload',function(){_this.AttachLinkEvent();});} else{window.addEventListener('load',function(){_this.AttachLinkEvent();},false);}};MicrosoftAnalytics.prototype.AttachLinkEvent=function(){var mouseEvent="onclick";for(var i=0;i<document.links.length;i++){document.links[i].LoggingObject=this;if(typeof(document.links[i][mouseEvent])!="function"&&document.links[i].href.indexOf("javascript:")<0){document.links[i][mouseEvent]=this.OnTrackLink;} else{this.DebugMessage("Link: Id:"+document.links[i].id+" Ref:"+document.links[i]+" not instrustmented, existing handlers found",DebugMessageType.Information);}}};MicrosoftAnalytics.prototype.TrackLink=function(linkUrl,linkType,linkAlias){if(!$assertType(linkUrl,"string")||linkUrl.length==0){this.DebugMessage("URL must be provided to track a link",DebugMessageType.Error);return;} var linkUrlType=LinkType.Outbound;if($assertType(linkType,"string")&&linkType.length==1){linkUrlType=linkType;} if(!$assertValue(this.Links)){this.Links=new List();this.Taxonomy.Add("Links","lnk",ListNodeType.Variable);} this.Links.Add(linkUrl,new SimpleLink(linkUrl,linkUrlType));if($assertType(linkAlias,"string")&&linkAlias.length>0){this.Taxonomy.Add("LinkAlias","als",ListNodeType.Variable);this.LinkAlias=$clean(linkAlias);} var eventPayload=this.SubmitPayload(PayloadType.Link);if($assertValue(eventPayload)){this.ImageRequest(eventPayload);} if(this.EnableLinkTimeout==true){this.PauseLink(this.LinkTimeout);}};MicrosoftAnalytics.prototype.OnTrackLink=function(evt){var srcElement=typeof(event)!="undefined"&&$assertValue(event)?event.srcElement:this;if(srcElement.tagName=="IMG"){do{srcElement=$assertValue(srcElement.parentElement)?srcElement.parentElement:srcElement.parentNode;} while($assertValue(srcElement)&&srcElement.tagName!="A");if(!$assertValue(srcElement)){return true;}} var loggingObject=srcElement.LoggingObject;var urlPath=srcElement.pathname;var dotIndex=urlPath.lastIndexOf(".");var foundMatch=false;if(dotIndex>=0){var fileExt=urlPath.substring(dotIndex+1);if(srcElement.LoggingObject.Extensions){foundMatch=loggingObject.Extensions.Find(fileExt)!=null;}} if(!foundMatch&&srcElement.host.indexOf(location.host)>=0){return true;} if(!$assertValue(loggingObject.Links)){loggingObject.Links=new List();loggingObject.Taxonomy.Add("Links","lnk",ListNodeType.Variable);} loggingObject.Links.Add(srcElement.href,new SimpleLink(srcElement.href,foundMatch?LinkType.Download:LinkType.Outbound));var eventPayload=loggingObject.SubmitPayload(PayloadType.Link);if($assertValue(eventPayload)){loggingObject.ImageRequest(eventPayload);} if(loggingObject.EnableLinkTimeout==true){loggingObject.PauseLink(loggingObject.LinkTimeout);} return true;};MicrosoftAnalytics.prototype.GetUserIdentity=function(){var userId=this.ParseUserIdentity();if(userId.length==0){userId=this.GenerateUserIdentity();if(!this.SetUserIdentity(userId)){return"0";}} return userId;};MicrosoftAnalytics.prototype.SetUserIdentity=function(userId){if(!userId||userId.length==0){return false;} var domainString="";if(this.CookieDomain&&this.CookieDomain.length>0){domainString="; domain="+this.CookieDomain+";";} else{var hostName=location.host;if($assertType(hostName,"string")&&hostName.length>0){if(hostName.substring(0,4)=="www."){domainString="; domain=";domainString+=hostName.substring(4,hostName.length);}}} var userIdCookie=this.CookieName+"="+userId+domainString+"; expires=Fri, 01-Jan-2021 00:00:00 GMT; path=/;";document.cookie=userIdCookie;var newUserId=this.ParseUserIdentity();return newUserId.length>0;};MicrosoftAnalytics.prototype.ParseUserIdentity=function(){var userId="";var cookieString=document.cookie.toString();var expRegex=new RegExp(this.IdentityRegex);var regexMatch=expRegex.exec(cookieString);if(regexMatch){userId=regexMatch[2];} return userId;};MicrosoftAnalytics.prototype.GenerateUserIdentity=function(){var vals=new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');var key="";var last=-1;var idx=-1;for(var i=0;i<8;i++){while(last==idx){idx=Math.floor(Math.random()*16);} last=idx;key+=vals[idx];} var x=0;if(screen){x=(screen.width+screen.height)/screen.colorDepth;} if(x==0){x=Math.random()*65536;} x=Math.floor(x%256);key+='_'+vals[Math.floor(x/16)]+vals[x%16];var s=new Date();x=s.getTime()%16777216;x=x.toString();while(x.length<8)x='0'+x;{key+='_'+x;} return key;};MicrosoftAnalytics.prototype.SubmitPayload=function(payloadType){this.DebugMessage("MicrosoftAnalytics Payload",DebugMessageType.Information);if(!$assertType(this.ProfileId,"string")||this.ProfileId.length==0){this.DebugMessage("Profile Id must be defined",DebugMessageType.CriticalError);return null;} if(location.protocol.indexOf("http")==-1){this.DebugMessage("Unsupported Protocol -- supported protocols are http and https",DebugMessageType.CriticalError);return null;} var scriptAction=payloadType&&payloadType.length>0?"&jsa="+payloadType:"&jsa="+PayloadType.PageView;var imageServer="analytics.r.msn.com";if(this.ServerId){var newServerEndpoint=".analytics.live.com";if(!$assertType(this.ServerId,"string")||this.ServerId.length==0||(this.ServerId.length+newServerEndpoint.length)>255){this.DebugMessage("Hostname is invalid",DebugMessageType.CriticalError);return null;} imageServer=this.ServerId+newServerEndpoint;} var queryUrl=location.protocol+"//"+imageServer+"/x.gif?jsv="+this.ScriptVersion+scriptAction+"&";this.UserIdentity=this.GetUserIdentity();this.Language=((!document.all||navigator.userAgent.match('Opera'))?navigator.language:navigator.userLanguage);this.Screen=screen.width+"x"+screen.height+"x"+screen.colorDepth;if(!this.TargetPage){this.TargetPage=location.href;} if(document.referrer.indexOf(location.host)==-1){this.Referrer=document.referrer;} this.Timezone=this.CalculateTimezone();queryUrl=this.ProcessTaxonomy(queryUrl);return queryUrl;};MicrosoftAnalytics.prototype.SetCartItem=function(productName,unitPrice,quantity){if(!$assertType(productName,"string")){this.DebugMessage("Product Name is a string and must be defined",DebugMessageType.Error);return false;} if(!$assertType(unitPrice,"number")){this.DebugMessage("Unit Price is a number and must be defined",DebugMessageType.Error);return false;} if(!$assertType(quantity,"number")){this.DebugMessage("Quantity is a number and must be defined",DebugMessageType.Error);return false;} if(!$assertValue(this.ShoppingCart)){this.ShoppingCart=new List();this.Taxonomy.Add("ShoppingCart","crt",ListNodeType.Variable);} return this.ShoppingCart.Add(this.ShoppingCart.Count,new CartItem(productName,unitPrice,quantity));};MicrosoftAnalytics.prototype.TrackCart=function(){if(!$assertValue(this.ShoppingCart)||this.ShoppingCart.Count==0){return;} var eventPayload=this.SubmitPayload(PayloadType.Cart);if(!$assertValue(eventPayload)){return;} this.ImageRequest(eventPayload);};MicrosoftAnalytics.prototype.TrackPurchase=function(){if($assertValue(this.PurchaseRegistered)&&this.PurchaseRegistered==true){this.DebugMessage("TrackPurchase can only be called once",DebugMessageType.Error);return;} this.TrackEvent("crtp",1);if(!this.PageViewRegistered){var eventPayload=this.SubmitPayload(PayloadType.Cart);if(!$assertValue(eventPayload)){return;} this.ImageRequest(eventPayload);} this.PurchaseRegistered=true;};MicrosoftAnalytics.prototype.SetView=function(viewId,viewHierarchy){if(!$assertValue(viewId)||!$assertValue(viewHierarchy)){this.DebugMessage("View Details must be defined",DebugMessageType.Error);return false;} if(viewId.toString().length==0||viewHierarchy.toString().length==0){this.DebugMessage("View Details must be defined",DebugMessageType.Error);return false;} if(!$assertValue(this.Views)){this.Views=new List();this.Taxonomy.Add("Views","vh",ListNodeType.Variable);} return this.Views.Add(viewId,new ViewHierarchy(viewId,viewHierarchy));};MicrosoftAnalytics.prototype.TrackEvent=function(eventName,eventData,priority){if(!$assertValue(eventName)||!$assertValue(eventData)){this.DebugMessage("Event Details must be defined",DebugMessageType.Error);return false;} if(!$assertValue(this.Events)){this.Events=new List();this.Taxonomy.Add("Events","evt",ListNodeType.Variable);} this.Events.Add(this.Events.Count,new SimpleEvent(eventName,eventData));if(this.PageViewRegistered){this.ImageRequest(this.SubmitPayload(PayloadType.Event));}};function CartItem(productName,unitPrice,quantity){this.Name=$clean(productName);if($assertType(unitPrice,"number")){this.Price=unitPrice;this.Quantity=1;} else{this.Price=0;this.Quantity=0;} if($assertType(quantity,"number")){this.Quantity=quantity;} this.TotalPrice=this.Price*this.Quantity;};CartItem.prototype.toString=function(){return"prd:"+this.Name+";"+this.Price+";"+this.Quantity+"|";};function ViewHierarchy(viewId,viewStructure){this.Id=$clean(viewId);this.Structure=$clean(viewStructure);};ViewHierarchy.prototype.toString=function(){return"v:"+this.Id+";"+this.Structure+"|";};function SimpleEvent(eventName,eventDetail){this.Name=$clean(eventName);this.Detail=$clean(eventDetail);};SimpleEvent.prototype.toString=function(){return"e:"+this.Name+";"+this.Detail+"|";};function SimpleLink(linkUrl,linkType){this.Url=$clean(linkUrl);this.Type=linkType;};SimpleLink.prototype.toString=function(){return"l:"+this.Url+";"+this.Type+"|";};window["MicrosoftAnalytics"]=MicrosoftAnalytics;})();var msAnalytics=new MicrosoftAnalytics();