(function(tbar,args){var o=this,l=location,qsn=args.qsName,msnOpen=Msn.Util.Open,id=qs(qsn),ttl=encodeURIComponent(document.title),pp=args.printPath,emailMsg=args.emailMsg;o.items=tbar.getElementsByTagName("SPAN");var i=o.items.length-1;if(i===-1)return;do hookItem(o.items[i]);while(i--);function encodedPath(url){var aurls=url.split("?"),aurl=aurls[1];return encodeURI(aurls[0])+(aurl?"?"+encodeURIComponent(aurl):"")}function printPath(){var prnt,isImg=pp.indexOf("ss")>-1;if(!isImg)prnt=ff("http://{0}/{1}?{2}={3}",l.hostname,pp,qsn,id);else{var ii="imageindex";prnt=ff("http://{0}/{1}?{2}={3}&{4}={5}",l.hostname,pp,qsn,id,ii,qs(ii))}return prnt}var templates={win1:"width=800,height=600,resizable=1,toolbar=0,scrollbars=1,status=0",win2:"width=800,height=600,resizable=1,toolbar=1,scrollbars=1,status=1,menubar=1,location=1",tbEmail:"mailto:?subject={1}&body="+emailMsg+" {0}",tbPrint:printPath(),tbBlog:"http://spaces.live.com/BlogIt.aspx?Title={1}&SourceURL={0}?affid=spaces",tbDigg:"http://digg.com/remote-submit?phase=2&url={0}&title={1}&bodytext={1}",tbFbook:"http://www.facebook.com/sharer.php?u={0}&t={1}",tbNvine:"http://www.newsvine.com/_tools/seed&save?u={0}&h={1}"};function hookItem(item){var cn=item.className;o[cn]=(function(){if(o.noClick)return;o.noClick=setTimeout(function(){o.noClick=0},500);switch(cn){case "tbEmail":window.location.href=f(templates[cn],encodedPath(l.href),ttl);break;case "tbPrint":msnOpen(f(templates[cn],encodedPath(l.href),ttl),cn,templates.win1);break;default:msnOpen(f(templates[cn],encodedPath(l.href),ttl),cn,templates.win2)}}).hook(item,"click")}function f(str){for(var i=1;i<arguments.length;i++)str=str.replace(new RegExp("\\{"+(i-1)+"\\}","gm"),arguments[i]);return str}function ff(str){for(var i=1;i<arguments.length;i++)str=str.replace("{"+(i-1)+"}",arguments[i]);return str}function qs(key){var x="[?&]";x+=key;x+="=([^&$]*)";return location.search.search(new RegExp(x,"i"))===-1?0:encodeURIComponent(RegExp.$1)}o.dispose=function(){i=o.items.length-1;do{var item=o.items[i],cn=item.className;o[cn].unhook(item,"click")}while(i--);o.items=0;tbar=0;args=0;o=0}}).as("Msn.Lifestyle.LifestyleToolbar")