Sunteți pe pagina 1din 20

/* Copyright (C) 2012 Microsoft Corporation */(function(){var f=window,d=[],e=[] ,g=0;function a(a,b,f,e){var c,d;try{c=a.__lookupGetter__&&a.__lookupGetter__(b) !==undefined;d=a.__lookupSetter__&&a.__lookupSetter__(b)!==undefined;if(!c)a.__d efineGetter__(b,f);if(!d&&e)a.__defineSetter__(b,e)}catch(g){}}function b(d,e,a, b){c(d,e,a,b)}function c(a,b,d,c){if(c||!a[b])a[b]=d}f.

$Browser={Button:{LEFT:0, RIGHT:2,MIDDLE:1},attachEventCompatibility:function(c){var h=c.HTMLElement.proto type,d=c.Event.prototype;d.__proto__={__proto__:d.__proto__};function i(a){var b ={x:0,y:0};while(a){b.x+=a.offsetLeft;b.y+=a.offsetTop;a=a.offsetParent}return b }b(h,"fireEvent",function(b){var a=c.document.createEvent("Event"),d=c.event;a.i nitEvent(b.substring(2),true,false);c.event=a;this.dispatchEvent(a);c.event=d}); a(d,"srcElt",function(){var a=this._FixOffset;return a?a:$Browser._Private.getNo nTextNode(this.target)});a(d,"srcElement",function(){return this.srcElt});a(d,"c ancelBubble",function(){return this._bubblingCanceled||false},function(a){if(a){ this._bubblingCanceled=true;this.stopPropagation()}});a(d,"offsetX",function(){r eturn c.pageXOffset+this.clientX-i(this.srcElt).x});a(d,"offsetY",function(){ret urn c.pageYOffset+this.clientY-i(this.srcElt).y});a(d,"x",function(){return this .offsetX});a(d,"y",function(){return this.offsetY});a(d,"returnValue",function() {return this.cancelDefault},function(a){if(!a)this.preventDefault();this.cancelD efault=a;return a});a(d,"button",function(){return this.which==1?1:this.which==3 ?2:0});a(d,"fromElement",function(){var a;if(this.type=="mouseover")a=this.relat edTarget;else if(this.type=="mouseout")a=this.target;else if(this.type=="focusin ")a=$Browser._lastElt;return $Browser._Private.getNonTextNode(a)});a(d,"toElemen t",function(){var a=null,b;try{if(this.type=="mouseout")a=this.relatedTarget;els e if(this.type=="mouseover")a=this.target;else if(this.type=="focusout")a=$Brows er._lastElt}catch(c){}return $Browser._Private.getNonTextNode(a)});function g(a) {c.event=a}function m(b,c,d){var a=c.slice(2);if(a=="mousewheel"&&!$B.Safari)a=" DOMMouseScroll";if(a!="mouseenter"&&a!="mouseleave")b.addEventListener(a,g,true) ;else{b.addEventListener("mouseover",g,true);b.addEventListener("mouseout",g,tru e);b.addEventListener("mouseover",j,false);b.addEventListener("mouseout",k,false )}b.addEventListener(a,d,false)}function j(b){if(!this.contains(b.fromElement)){ var a=c.document.createEvent("MouseEvents");a.initEvent("mouseenter",false,false );this.dispatchEvent(a)}}function k(b){if(!this.contains(b.toElement)){var a=c.d ocument.createEvent("MouseEvents");a.initEvent("mouseleave",false,false);this.di spatchEvent(a)}}function l(d,b,c){var a=b.slice(2);if(a=="mousewheel"&&!$B.Safar i)a="DOMMouseScroll";d.removeEventListener(a,c,false)}function e(b,a){m(this,b,a );return true}b(c,"attachEvent",e,$B.Opera);b(c.HTMLDocument.prototype,"attachEv ent",e,$B.Opera);a(c.HTMLDocument.prototype,"activeElement",function(){return $B rowser._lastElt});b(h,"attachEvent",e,$B.Opera);function f(b,a){l(this,b,a);retu rn true}b(c,"detachEvent",f,$B.Opera);b(c.HTMLDocument.prototype,"detachEvent",f ,$B.Opera);b(h,"detachEvent",f,$B.Opera)},attachStyleCompatibility:function(c){v ar b=c.CSSStyleDeclaration.prototype,g=c.HTMLElement.prototype,e=c.HTMLStyleElem ent.prototype,d=c.CSSStyleSheet.prototype;function f(g){var f=["Top","Left","Rig ht","Bottom"],a=c.document.defaultView.getComputedStyle(g,null),e=a.getPropertyV alue("background-position").split(" ");for(var d=0;d<f.length;d++){var b=f[d];th is["border"+b+"Width"]=a.getPropertyValue("border-"+b+"-width");this["margin"+b] =a.getPropertyValue("margin-"+b);this["padding"+b]=a.getPropertyValue("padding-" +b)}this["position"]=a.getPropertyValue("position");this["right"]=a.getPropertyV alue("right");this["left"]=a.getPropertyValue("left");this["top"]=a.getPropertyV alue("top");this["height"]=a.getPropertyValue("height");this["width"]=a.getPrope rtyValue("width");this["zIndex"]=a.getPropertyValue("z-index");this["color"]=a.g etPropertyValue("color");this["direction"]=a.getPropertyValue("direction");this[ "overflowY"]=a.getPropertyValue("overflow-y");this["display"]=a.getPropertyValue ("display");this["backgroundImage"]=a.getPropertyValue("background-image");this[ "backgroundColor"]=a.getPropertyValue("background-color");this["fontFamily"]=a.g etPropertyValue("font-family");this["backgroundPositionX"]=e[0];this["background PositionY"]=e[1];return this}a(g,"currentStyle",function(){return new f(this)}); b.__proto__={__proto__:b.__proto__};a(b,"pixelLeft",function(){return parseInt(t his.left,10)||0},function(a){this.left=a+"px"});a(b,"pixelHeight",function(){ret urn parseInt(this.height,10)||0},function(a){this.height=a+"px"});a(b,"pixelTop" ,function(){return parseInt(this.top,10)||0},function(a){this.top=a+"px"});a(b,"

pixelWidth",function(){return parseInt(this.width,10)||0},function(a){this.width =a+"px"});a(b,"filter",function(){return undefined},function(a){$Browser._Privat e.Filters.applyFilter(this,a)});a(b,"styleFloat",function(){return this.cssFloat },function(a){this.cssFloat=a});a(b,"cssText",function(){var b="";for(var a=0;a< this.cssRules.length;a++)b+=this.cssRules[a].cssText;return b});if(c.StyleSheet) {var h=c.StyleSheet.prototype;a(h,"cssText",function(){return this.ownerNode.inn erHTML},function(a){try{this.ownerNode.innerHTML=a}catch(c){var b=document.creat eTextNode(a);this.ownerNode.appendChild(b)}})}a(e,"styleSheet",function(){return this.sheet});a(e,"cssText",function(){return this.innerHTML},function(a){this.i nnerHTML=a});a(d,"rules",function(){return this.cssRules});a(d,"addRule",functio n(a,c,b){this.insertRule(a+"{"+c+"}",b)});a(d,"removeRule",function(a){this.dele teRule(a)})},attachElementCompatibility:function(e){var c=e.HTMLElement.prototyp e;c.__proto__={__proto__:c.__proto__};b(c,"contains",function(a){while(a!=null&& a!=this)a=a.parentElement;return a!=null});b(c,"filters",$Browser._Private.Mozil laFilterSub());b(c,"insertAdjacentElement",function(b,a){switch(b.toLowerCase()) {case "beforebegin":return this.parentNode.insertBefore(a,this);break;case "befo reend":return this.appendChild(a);break;case "afterbegin":return this.insertBefo re(a,this.firstChild);break;case "afterend":if(this.nextSibling)return this.pare ntNode.insertBefore(a,this.nextSibling);else return this.parentNode.appendChild( a);break;default:throw"Invalid Argument";}return null});a(c,"children",function( ){var b=[],d=this.childNodes.length;for(var a=0;a<d;a++){var c=this.childNodes[a ];if(c.nodeType==1)b.push(c)}return b});a(c,"parentElement",function(){return $B rowser._Private.getNonTextNode(this.parentNode)});a(c,"document",function(){retu rn this.ownerDocument});a(c,"onfilterchange",function(){return this.filters.onfi lterchange},function(a){this.filters.onfilterchange=a});a(c,"filters",function() {return []});a(c,"innerText",function(){try{return this.textContent}catch(c){var b="";for(var a=0;a<this.childNodes.length;a++)if(this.childNodes[a].nodeType==3 )b+=this.childNodes[a].textContent;return b}},function(a){if(a)this.innerHTML=d( a);else this.innerHTML=""});function d(e){var a=[],f=e.length,d;for(var c=0;c<f; c++){var b=e.charAt(c);switch(b){case "<":a.push("&lt;");break;case ">":a.push(" &gt;");break;case '"':a.push("&quot;");break;case "&":a.push("&amp;");break;case " ":if(d==" ")a.push("&nbsp;");else a.push(" ");break;case "\r":break;case "\n" :a.push("\r\n\r\n<br />");break;default:a.push(b)}d=b}return a.join("")}b(c,"rem oveNode",function(){return this.parentNode?this.parentNode.removeChild(this):thi s});a(c,"uniqueID",function(){var a=this._uniqueID;if(!a)a=this._uniqueID="ms_id "+g++;return a});b(c,"insertAdjacentHTML",function(d,c){var b,a=this.ownerDocume nt.createRange();switch(d.toLowerCase()){case "beforebegin":a.setStartBefore(thi s);b=a.createContextualFragment(c);return this.parentNode.insertBefore(b,this);c ase "afterbegin":a.selectNodeContents(this);a.collapse(true);b=a.createContextua lFragment(c);return this.insertBefore(b,this.firstChild);case "beforeend":a.sele ctNodeContents(this);a.collapse(false);b=a.createContextualFragment(c);return th is.appendChild(b);case "afterend":a.setStartAfter(this);b=a.createContextualFrag ment(c);return this.parentNode.insertBefore(b,this.nextSibling);default:throw"In valid Argument";}});b(c,"swapNode",function(a){var b=this.nextSibling,c=this.par entNode;a.parentNode.replaceChild(this,a);c.insertBefore(a,b)});b(c,"replaceNode ",function(a){this.parentNode.replaceChild(a,this)})},attachXmlCompatibility:fun ction(d){if(typeof d.XMLDocument=="undefined"&&typeof d.Document!="undefined")d. XMLDocument=d.Document;var i=d.Document.prototype,l=d.HTMLElement.prototype,e=d. Node.prototype,f=d.XMLDocument.prototype,g=d.DocumentFragment.prototype;e.__prot o__={__proto__:e.__proto__};a(i,"xml",function(){return (new XMLSerializer).seri alizeToString(this)});function h(a,g,b){b=b?b:a;if(!(a instanceof d.Document))a= a.ownerDocument;var e=a.evaluate(g,b,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ,null),f=new Array(e.snapshotLength);for(var c=0;c<e.snapshotLength;c++)f[c]=e.s napshotItem(c);return f}b(l,"selectNodes",function(b,a){return h(this,b,a)});b(i ,"selectNodes",function(b,a){return h(this,b,a)});b(i,"selectSingleNode",functio n(c,d){c+="[1]";var a=h(this,c,d);if(a.length!=0)for(var b=0;b<a.length;b++)if(a [b])return a[b];return null});if(d.DOMParser)c(d,"XMLDOMParser",d.DOMParser);b(f ,"transformNodeToObject",function(c){var a=new XSLTProcessor;a.importStylesheet( c);var b=d.document.implementation.createDocument("","",null);return a.transform ToFragment(this,b)});b(f,"loadXML",function(c){var b=(new DOMParser).parseFromSt

ring(c,"text/xml");while(this.hasChildNodes())this.removeChild(this.lastChild);f or(var a=0;a<b.childNodes.length;a++)this.appendChild(this.importNode(b.childNod es[a],true))});b(f,"transformNode",function(c){var a=new d.XSLTProcessor;a.impor tStylesheet(c);var e=d.document.implementation.createDocument("","",null),b=a.tr ansformToDocument(this);return b.xml});b(f,"setProperty",function(){return null} );b(f,"selectNodes",function(b,a){return j(this,b,a)});b(f,"selectSingleNode",fu nction(b,a){return k(this,b,a)});b(g,"getElementById",function(e){var d=[],c=thi s.childNodes,a,b;for(b=0;b<c.length;b++){a=c[b];if(a.nodeType==1)d.queue(a)}whil e(d.length){a=d.dequeue();if(a.id==e)return a;c=a.childNodes;if(c.length!=0)for( b=0;b<c.length;b++){a=c[b];if(a.nodeType==1)d.queue(a)}}return null});b(g,"creat eElement",function(a){return d.document.createElement(a)});b(g,"getElementsByTag Name",function(f){var e=[],d=[],c=this.childNodes,a,b;for(b=0;b<c.length;b++){a= c[b];if(a.nodeType==1)d.push(a)}while(d.length){a=Array.dequeue(d);if(f=="*"||a. tagName==f)Array.add(e,a);c=a.childNodes;if(c.length!=0)for(b=0;b<c.length;b++){ a=c[b];if(a.nodeType==1)d.push(a)}}return e});function j(d,g,a){a=a?a:d;var f=ne w XPathEvaluator,c=f.evaluate(g,a,d.createNSResolver(d.documentElement),XPathRes ult.ORDERED_NODE_SNAPSHOT_TYPE,null),e=new Array(c.snapshotLength);for(var b=0;b <c.snapshotLength;b++)e[b]=c.snapshotItem(b);return e}function k(e,c,d){c+="[1]" ;var a=j(e,c,d);if(a.length!=0)for(var b=0;b<a.length;b++)if(a[b])return a[b];re turn null}b(e,"selectNodes",function(a){var b=this.ownerDocument;return b.select Nodes(a,this)});b(e,"selectSingleNode",function(a){var b=this.ownerDocument;retu rn b.selectSingleNode(a,this)});a(e,"baseName",function(){return this.localName} );a(e,"xml",function(){return (new XMLSerializer).serializeToString(this)});a(e, "text",function(){return this.textContent},function(a){this.textContent=a})},att achMozillaCompatibility:function(a){var d=a.HTMLElement.prototype,c=a.Document.p rototype;a.document.documentElement.className+=" Mozilla";var b=a.document.getEl ementsByName("Web.moz-custom");if(b.length>0)$Browser.MozillaCompatMode=b[0].get Attribute("content").toLowerCase()=="enabled";else $Browser.MozillaCompatMode=fa lse;c.scripts=a.document.getElementsByTagName("script")},attachOperaCompatibilit y:function(a){var b=a.Element.prototype;try{a.maxConnectionsPerServer=parseInt(a .maxConnectionsPerServer)||8}catch(c){}a.document.documentElement.className+=" O pera"},attachWebKitCompatibility:function(a){var b=a.Element.prototype;a.documen t.documentElement.className+=" Safari"},attachCaptureCompatibility:function(a){b (a.HTMLElement.prototype,"setCapture",function d(){var b=this;b.events=["click", "mousedown","mouseup","mousemove","mouseover","mouseout"];b._capture=function(c) {if(!c.isCapturing){if(c.type=="mousedown"&&$B.Opera)return;c.stopPropagation(); c.preventDefault();var d=a.document.createEvent("MouseEvents"),f=c.bubbles,e=c.c ancelable;if(c.type=="mouseup"){f=false;e=false}d.initMouseEvent(c.type,f,e,c.vi ew,c.detail,c.screenX,c.screenY,c.clientX,c.clientY,c.ctrlKey,c.altKey,c.shiftKe y,c.metaKey,c.button,c.relatedTarget);d._data=c.target;d._FixOffset=$Browser._Pr ivate.getNonTextNode(c.target);if(d._FixOffset==a.document.getElementsByTagName( "HTML")[0])d._FixOffset=a.document.body;d.isCapturing=true;b.dispatchEvent(d)}}; for(var c=b.events.length-1;c>=0;c--)a.addEventListener(this.events[c],b._captur e,true)});b(a.HTMLElement.prototype,"releaseCapture",function c(){var b=this;if( b.events){for(var c=b.events.length-1;c>=0;c--)a.removeEventListener(b.events[c] ,b._capture,true);b.events=null;b._capture=null}})},attachClickCompatibility:fun ction(a){function b(a){if(a.button!=0&&a.button!=1)a.stopPropagation()}function c(){a.detachEvent("onunload",c,true);a.document.removeEventListener("click",b,tr ue)}a.attachEvent("onunload",c,true);a.document.addEventListener("click",b,true) },attachSharedCompatibility:function(d){var e=d.Document.prototype;e.__proto__={ __proto__:e.__proto__};c(e,"selection",{clear:function(){d.getSelection().delete FromDocument()},empty:function(){d.getSelection().removeAllRanges()},createRange :function(){var a;try{a=d.getSelection().getRangeAt(0)}catch(b){a=d.document.cre ateRange()}return a}});b(e,"createStyleSheet",function(){var a=d.document.create Element("style");a.type="text/css";d.document.getElementsByTagName("head")[0].ap pendChild(a);return a});b(d,"CollectGarbage",function(){});b(d,"createPopup",$Br owser._Private.CreatePopup);b(d,"navigate",function(a){d.setTimeout('window.loca tion = "'+a+'";',0)});a(d.HTMLDocument.prototype,"parentWindow",function(){retur n d});$Browser.attachElementCompatibility(d);$Browser.attachEventCompatibility(d );$Browser.attachStyleCompatibility(d);$Browser.attachXmlCompatibility(d);$Brows

er.attachCaptureCompatibility(d);$Browser.attachClickCompatibility(d)},_Private: {cleanupFirefox:function(a){var b,e;try{e=a.status}catch(k){}var c={};function g (b){var a=b.split(":");if(a[1])c[a[0]]=a[1].trim()}if(e==200)try{var i=a.respons eXML.documentElement}catch(k){if(w.DOMParser)try{var h=new DOMParser,f=h.parseFr omString(a.responseText.toString(),"text/xml");b={};b.responseText=a.responseTex t;b.responseXML=f;var d=a.getAllResponseHeaders();d.split("\n").forEach(g);b.get AllResponseHeaders=function(){return d};b.getResponseHeader=function(a){return c [a]};b.statusText=a.statusText;b.status=a.status;a=b}catch(l){a=null}else a=null }return a},getNonTextNode:function(a){try{while(a&&a.nodeType!=1)a=a.parentNode} catch(b){a=null}return a},CreatePopup:function(){var a=new w.Object;a.document=w .document.createDocumentFragment();a.document.body=a.document.appendChild(_ce("d iv"));a.document.close=a.document.open=function(){};a.document.write=function(b) {a.document.body.innerHTML+=b};a.show=function(i,j,h,g,c){if(!Web.Dom)throw new Error("Missing Coreui.js");if(!c)c=w.document.body;var d=Web.Dom.GetLocation(c); a.document.body.style.cssText="z-index:100;position:absolute;margin:0px;padding: 0px;top:{0}px;left:{1}px;width:{2}px;height:{3}px;background:white".format(j+d.t op,i+d.left,h,g);var b=w.document.body.appendChild(a.document.body);w.document.a ddEventListener("mousedown",e,true);b.onclicktemp=a.document.onclick;b.onclick=f ;function e(c){if(!a.document.body.contains(c.target)){c.stopPropagation();b.rem oveNode()}w.document.removeEventListener("mousedown",e,true)}function f(){if(thi s.onclicktemp)this.onclicktemp();b.removeNode()}};return a},MozillaModal:functio n(p,o,f,j){if(!f)f="";f=f.removeSpaces();var i=f.split(","),b=f="",k=false,g=fal se,c=0,e=0;for(var h=0;h<i.length;h++){var l=i[h].split(":"),n=l[0].toLowerCase( ),d=l[1];switch(n){case "dialogheight":b+="height="+d;c=d;break;case "dialogwidt h":b+="width="+d;e=d;break;case "dialogtop":b+="top="+d;g=true;break;case "dialo gleft":b+="left="+d;g=true;break;case "resizable":b+="resizable="+d;break;case " status":b+="status="+d;break;case "center":k=true}if(n!="center")b+=","}if(k&&!g ){if(c!=0)c=$Number.coerceInt(c);else c=300;if(e!=0)e=$Number.coerceInt(e);else e=300;if(c!=""||e!=""){b+="screenX="+(screen.availHeight-e)/2+",";b+="screenY="+ (screen.availWidth-c)/2}}var a=c.open(p,"",b);$Browser.attachCompatabilities(a); a.dialogArguments=o;resetModal=function(b){if(a&&!a.closed){b.stopPropagation(); a.focus()}};var m="";grabReturn=function(){if(a&&!a.closed){m=a.returnValue;setT imeout(CheckClose,0)}};CheckClose=function(){if(a.closed){if(j)j(m);c.removeEven tListener("focus",resetModal,true)}};hookEvents=function(){a.onunload=grabReturn ;c.addEventListener("focus",resetModal,true)};setTimeout(hookEvents,0)},MozillaF ilterMethods:["addAmbient","addCone","addPoint","apply","changeColor","changeStr ength","clear","moveLight"],MozillaFilterEventMethods:["play","stop"],MozillaFil terSub:function(){var b=$Browser._Private;for(var a=0;a<b.MozillaFilterMethods.l ength;a++)this[b.MozillaFilterMethods[a]]=c;for(var a=0;a<b.MozillaFilterEventMe thods.length;a++)this[b.MozillaFilterEventMethods[a]]=d;function c(){}function d (){if(this.onfilterchange)this.onfilterchange()}return this},Filters:{_filterDec larationExpression:/progid:([^\(]+)\(([^\)]+)\)/gi,applyFilter:function(c,e){var a,b={};while(a=$Browser._Private.Filters._filterDeclarationExpression.exec(e)){ var d=Object.resolve("$Browser._Private.Filters."+a[1]);if(d)b[a[1]]=new d(c,$Br owser._Private.Filters.parseParams(a[2]))}c.filters=b},parseParams:function(e){v ar b=e.split(","),d={};for(var a=0;a<b.length;a++){var c=b[a].split("=");d[c[0]. toLowerCase()]=$Browser._Private.Filters.cleanParam(c[1])}return d},cleanParam:f unction(a){if(a.indexOf("'")==0)return a.substring(1,a.length-1);return a.toLowe rCase()},DXImageTransform:{Microsoft:{Alpha:function(a,b){var c=Number(b.opacity );a.opacity=Number.coerceFloat(b.opacity)/100;a.mozOpacity=a.opacity},AlphaImage Loader:function(a,b){a.backgroundImage="url("+b.src+")";switch(b.sizingMethod){c ase "crop":a.backgroundRepeat="no-repeat"}},Blur:function(a,c){if(c.makeshadow== "true"){var b=Number.coerceFloat(c.shadowopacity);a.opacity=b;a.mozOpacity=b;a.b ackgroundColor="#000000";a.margin="3px"}}}}}},attachCompatabilities:function(a){ d.push(a);if($B.Safari){a.HTMLDocument={prototype:a.document.__proto__};a.Docume nt={prototype:a.document.__proto__}}$Browser.attachSharedCompatibility(a);if($B. Opera)$Browser.attachOperaCompatibility(a);else if($B.RE_WebKit)$Browser.attachW ebKitCompatibility(a);else $Browser.attachMozillaCompatibility(a);for(var b=0,c= e.length;b<c;b++)try{e[b](a)}catch(f){}},addExtension:function(b){for(var a=0,c= d.length;a<c;a++)try{b(d[a])}catch(f){}e.push(b)}};$Browser.attachCompatabilitie

s(f)})();String._format=function(a,b){if(!String._formatRE)String._formatRE=/(\{ [^\}^\{]+\})/g;return a.replace(String._formatRE,function(e,d){var c=parseInt(d. substr(1)),a=b[c+1];if(a===null||a===undefined)return "";return a.toString()})}; String.format=function(a){return String._format(a,arguments,false)};Array.protot ype.add=function(a){this[this.length]=a};Array.prototype.indexOf=function(c){var b=this.length;if(b)for(var a=0;a<b;a++)if(this[a]===c)return a;return -1};Array .prototype.contains=function(b){var a=this.indexOf(b);return a>=0};function _ge( a){return document.getElementById(a)}function $tag(b,a){return (b||document).get ElementsByTagName(a)}if(Function.wrapMethod===undefined){Function.wrapMethod=Fun ction.wrapTopLevelMethod=function(c,b,a){return a};Function.isSpecialMember=Func tion.needsWrapping=function(){return false}}window.__classes={};function Delegat e(){}Delegate.Null=function(){};Delegate._create=function(a){var b=function(){if (a.length==2)return a[1].apply(a[0],arguments);else{for(var b=0;b<a.length;b+=2) a[b+1].apply(a[b],arguments);return null}};b.invoke=b;b._targets=a;return b};Del egate.create=function(b,a){if(!b){a.invoke=a;return a}return Delegate._create([b ,a])};Delegate.combine=function(a,b){if(!a){if(!b._targets)return Delegate.creat e(null,b);return b}if(!b){if(!a._targets)return Delegate.create(null,a);return a }var c=a._targets?a._targets:[null,a],d=b._targets?b._targets:[null,b];return De legate._create(c.concat(d))};Delegate.remove=function(c,a){if(!c||c===a)return n ull;if(!a)return c;var b=c._targets,f=null,e;if(a._targets){f=a._targets[0];e=a. _targets[1]}else e=a;for(var d=0;d<b.length;d+=2)if(b[d]===f&&b[d+1]===e){if(b.l ength==2)return null;b.splice(d,2);return Delegate._create(b)}return c};var Even ts={};Events.init=function(a){a._events={}};Events._attachEvent=function(a,b){th is._events[a]=Delegate.combine(this._events[a],b);return this._events[a]};Events ._detachEvent=function(a,b){if(!this._events[a])return;this._events[a]=Delegate. remove(this._events[a],b);if(!this._events[a])delete this._events[a]};Events._fi reEvent=function(a,b){if(!this._events[a])return;this._events[a].apply(this,b)}; Events.addEventing=function(b){var a=b.prototype;if(a){a._events=null;a.attachEv ent=Events._attachEvent;a.detachEvent=Events._detachEvent;a.fireEvent=Events._fi reEvent}b._events={};b.attachEvent=Events._attachEvent;b.detachEvent=Events._det achEvent;b.fireEvent=Events._fireEvent};var WLHMType=Function;WLHMType.registerN amespace=function(b){if(window.__namespaces[b])return;var a=window,e=b.split("." ),g=e.length;for(var d=0;d<g;d++){var f=e[d],c=a[f];if(!c)a[f]=c={};a=c}window._ _namespaces[b]=a};window.__namespaces={};WLHMType.getType=function(a){return win dow.__classes[a]};WLHMType.prototype.createClass=function(b,a){WLHMType.createSt aticClass(this,b);this.prototype.constructor=this;if(a)this.extendFrom(a)};WLHMT ype.createStaticClass=function(b,a){b.__typeName=a;window.__classes[a]=b};__clas ses["Type"]=WLHMType;var Control={};Control.onPreInvoke=Control.onPostInvoke=Con trol.onError=function(){};Control.create=function(a,b){a.elt=b;b["__"+a.construc tor.__typeName]=a};Control.destroy=function(a){var b=a.elt;b["__"+a.constructor. __typeName]=a.elt=null;b=null};Control.findControl=function(a,c){var b="__"+WLHM Type.getType(c).__typeName;while(a!=document.body){if(a[b])return a[b];a=a.paren tNode}return null};Control._invokeImpl=function(b,a,e,f,h){if(window.Event&&wind ow.Event.prototype)window.event=e;Control.onPreInvoke(b,a,f);var c=null;if(h){va r d=Control.findControl(e.srcElement,b);if(!d||!d[a]){Control.onError({method:"C ontrol.invoke",message:String.format("Unable to invoke {0}.{1}. (Control instanc e or method not found or does not exist)",b,a)});return}c=d[a](f)}else{var g=WLH MType.getType(b);if(!g||!g[a]){Control.onError({method:"Control.invokeStatic",me ssage:String.format("Unable to invoke {0}.{1}. (Type or static method not found or does not exist)",b,a)});return}c=g[a](f)}if(window.Event&&window.Event.protot ype)c=e.returnValue;Control.onPostInvoke();return c};Control.invoke=function(b,a ,c,d){return Control._invokeImpl(b,a,c,d,true)};Control.invokeStatic=function(b, a,c,d){return Control._invokeImpl(b,a,c,d,false)};Control.getAncestorByAttr=func tion(a,b){while(a&&a!=document.body&&!a.getAttribute(b))a=a.parentElement;return a!=document.body?a:null};WLHMType.createStaticClass(Control,"Control");function $callFocus(a){setTimeout(function(){a.focus()},0)}function $containsClass(c,a){ var b=c.className.split(" ");return b.contains(a)}function $addClass(b,a){if(!b. className.split(" ").contains(a)){b.className+=" "+a;return true}return false}fu nction $removeClass(d,b){var a=d.className.split(" ");if(a.contains(b)){var c=a. indexOf(b);if(c>=0)a.splice(c,1);d.className=a.join(" ");return true}return fals

e}var ContactPickerConstants={};ContactPickerConstants.KeyCodes={NONE_SELECTED:1,BACK_BUTTON:8,TAB:9,RETURN:13,SHIFT:16,ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT: 39,KEY_DOWN:40,FF_SEMICOLON:59,SEMICOLON:186,COMMA:188,DELETE:46,SPACE:32};Conta ctPickerConstants.Constants={NONE:-1,IE:1,FIREFOX:2,FIREFOX3:5,SAFARI:3,OTHER_BR OWSER:4,ROWS_PER_CONTAINER:6,PEOPLE:1,CATEGORIES:2,FAVORITES:3,ADD:1,REMOVE:2,GL OBAL_ARRAY_EMAIL_INDEX:7,SAFARI_INPUT_WIDTH:18,PERSIST_SERVER_SIDE_ID:0,PERSIST_ FULL_NAME:1,PERSIST_EMAIL:2,ONE_COL_DEFAULT_THRESHOLD:450,RESULTS_DDOWN_MAX_WIDT H:600,RESULTS_DDOWN_MIN_WIDTH:250,RESULTS_CELL_MARGIN:50,DEFAULT_ROWS_PER_CONTAI NER:6,ONECOL_ROWS_PER_CONTAINER:3};ContactPickerConstants.Instrumentation={Peopl eTab:0,CategoryTab:1,FavoritesTab:2,ExpandCategory:3,ShowAutoComplete:4};var Abc hElement=function(a,j,c){var b=ContactPickerCore.contactData;if(b){if(a==null){t his.email="";this.fullName="";this._isNew=true;this.isCategory=false;this.isGrou p=false;this.isFavorite=false;this.isSpacesFriend=false;return}this.fullName=b[a ][2];this._clientID=a;if(!j)this.serverSideID=b[a][1];if(a<ContactPickerCore.con tactCount){if(!c)c=0;this.emailIndex=c;if(b[a][6])if(a<ContactPickerCore.personC ount){var d=b[a][6],k=d.length,e=0;this._emailArray=[];var h=false;for(var f=0;f <k;f++){var g=d[f][1],i=g.length;this._emailArray=this._emailArray.concat(g);if( e<=c&&c<e+i){h=true;this.serverSideContactID=d[f][0];this.email=g[c-e]}e+=i}if(! h&&k>0)this.serverSideContactID=d[0][0]}else{this._emailArray=b[a][6];if(b[a][6] .length>c)this.email=b[a][6][c]}this.isSpacesFriend=b[a][5]==0||b[a][5]==""?fals e:true;if(!j){this.isGroup=b[a][3]==0||b[a][3]==""?false:true;this.isFavorite=b[ a][4]==0||b[a][4]==""?false:true;this.isCategory=false}}else{this.isFavorite=fal se;this.isSpacesFriend=false;this.isGroup=false;this.users=b[a][3];this.isCatego ry=true}}};AbchElement.prototype={_clientID:ContactPickerConstants.Constants.NON E,_isNew:false,_uniqueSelectedElementID:0,_emailArray:null,email:null,isValid:tr ue,getClientId:function(){return this._clientID},getEmailArray:function(){return this._emailArray},setUniqueId:function(a){this._uniqueSelectedElementID=a},getU niqueId:function(){return this._uniqueSelectedElementID}};AbchElement.isFavorite =function(a){if(!AbchElement.isCategory(a))return ContactPickerCore.contactData[ a][4];return false};AbchElement.isCategory=function(a){return a>=ContactPickerCo re.contactCount};var CPDictionary=function(){this._dictionary={};this.count=0};C PDictionary.prototype={add:function(a,b){if(this._dictionary[a])return;this._dic tionary[a]=b;this.count++},clear:function(){this.count=0;this._dictionary={}},re move:function(a){delete this._dictionary[a];this.count--},getPrimitive:function( ){return this._dictionary},getItem:function(b){var a=this._dictionary[b];if(type of a=="undefined")return null;return a}};WLHMType.registerNamespace("Microsoft.L ive.ContactPicker.Util");Microsoft.Live.ContactPicker.Util={isNullOrEmpty:functi on(a){return a==null||a==""},escapeRegex:function(a){return a.escapeRegex()},get CharCode:function(b){var a=String.fromCharCode(b).toLowerCase();return a.charCod eAt(0)},concat:function(){var c=arguments.length,b=[];for(var a=0;a<c;a++)b[a]=a rguments[a];return b.join("")},getBrowser:function(){if(navigator.appName=="Micr osoft Internet Explorer")return ContactPickerConstants.Constants.IE;if(navigator .appName=="Netscape")if(navigator.appVersion.indexOf("Safari")>-1)return Contact PickerConstants.Constants.SAFARI;else if(navigator.userAgent.indexOf("Firefox/3" )!=-1)return ContactPickerConstants.Constants.FIREFOX3;else return ContactPicker Constants.Constants.FIREFOX},htmlEncode:function(a){if(Microsoft.Live.ContactPic ker.Util.isNullOrEmpty(a))return a;return a.encodeHtml()},instrumentWrapper:func tion(a){if(window.fireCPIEvent)fireCPIEvent(a)},getPrivateMessageString:function (){return '<span title="'+ContactPickerStrings.pmtt+'">'+"&lt;"+ContactPickerStr ings.privateMessage+"&gt;"+"</span>"}};WLHMType.registerNamespace("Microsoft.Liv e.ContactPicker");Microsoft.Live.ContactPicker.Search=function(a,b){this._instan ceName=a;this._base=_ge(this._instanceName+"$SearchBox");this._overlay=_ge(this. _instanceName+"$SearchBoxOverlay");Control.create(this,this._base);this._input=_ ge(this._instanceName+"$SearchInput");this._parent=b;this._searchImg=_ge(this._i nstanceName+"$SearchImg");this._searchCancelImg=_ge(this._instanceName+"$SearchC ancelImg")};Microsoft.Live.ContactPicker.Search.prototype={isVisible:true,isInpu tVisible:true,_sourceList:null,_viewlist:null,_resultsList:null,_resultsBackbuff er:null,_prevQuery:"",_lastInput:"",_click:function(){if(this._input.style.displ ay!="none")$callFocus(this._input)},clear:function(){this._lastInput="";this._in put.value="";if(this._resultsList!=null){this._prevQuery="";this._resultsBackbuf

fer=null;this._hideResults();this._resultsList=null;this._viewlist=null}this._pa rent._showSelectAll()},dispose:function(){Control.destroy(this);this._base=null; this._searchImg=null;this._searchCancelImg=null;this._input=null;this._overlay=n ull;this._parent=null},cutHandler:function(){setTimeout(Delegate.create(this,thi s.searchHandler),0)},pasteHandler:function(){if(!event.ctrlKey)setTimeout(Delega te.create(this,this.searchHandler),0)},_onChangeHandler:function(){var c=Microso ft.Live.ContactPicker.Util.getBrowser();if(c!=ContactPickerConstants.Constants.F IREFOX||c==ContactPickerConstants.Constants.FIREFOX3)return;var a=false,b=this._ input.value.length-this._lastInput.length;if(!b)if(this._input.value!=this._last Input)a=true;else a=false;else if(-1<=b&&b<=1)a=false;else if(b>1)a=true;else a= true;this._lastInput=this._input.value;if(a)this.pasteHandler()},searchKeyDown:f unction(){if(this._viewlist==null)this._updateLists();var a=Microsoft.Live.Conta ctPicker.Util.getCharCode(event.keyCode);switch(a){case ContactPickerConstants.K eyCodes.RETURN:event.returnValue=false;return false;break;case ContactPickerCons tants.KeyCodes.ESC:setTimeout(Delegate.create(this,this.clear),0);return;break;c ase ContactPickerConstants.KeyCodes.BACK_BUTTON:return;break;case ContactPickerC onstants.KeyCodes.DELETE:return;break;case ContactPickerConstants.KeyCodes.SHIFT :return}},_populateBackbuffer:function(c){var a=this._getResultsList(c);if(a){va r b=null;b=this._getFormattedResults(a,this._viewlist.id.indexOf("FavoritesList" )!=-1);this._resultsBackbuffer=b}},searchHandler:function(){if(this._input.value ==""){this.clear();return}if(this._viewlist==null)this._updateLists();this._popu lateBackbuffer(this._input.value.toLowerCase().charCodeAt(0));var a="",b=this._i nput.value;if(b=="")return;else if(b!=this._prevQuery){a=this._getResults(b);set Timeout(Delegate.create(this,function(){this._syncSelectionBetweenSearch()}),0); this._prevQuery=b}else return;if(a==""&&this._viewlist.childNodes.length!=0)a=St ring.format('<div class="NoResults">{0}</div>',ContactPickerStrings.noResults);t his._resultsList.innerHTML=a;this._showResults()},_getResults:function(a){var c= "";a=Microsoft.Live.ContactPicker.Util.escapeRegex(a);a=a.replace(/</gi,"&lt;"); a=a.replace(/>/gi,"&gt;");if(this._resultsBackbuffer==null)return "";var n=this. _resultsBackbuffer.length,h='([3][\\"]?>)('+a+")([^<]*?)",i='([3][\\"]?>)([^<]*? )('+a+")([^<]*?</div>)",j='([4][\\"]?>)('+a+")([^<]*?</div>)";for(var d=0;d<n;d ++){var b=this._resultsBackbuffer[d],e=new RegExp(h,"gi"),k=e.exec(b);if(k)c+=b. replace(e,'$1<span class="FontWeight">$2</span>$3');else{var f=new RegExp(i,"gi" ),m=f.exec(b);if(m)c+=b.replace(f,'$1$2<span class="FontWeight">$3</span>$4');el se{var g=new RegExp(j,"gi"),l=g.exec(b);if(l)c+=b.replace(g,'$1<span class="Font Weight">$2</span>$3')}}}return c},_processResults:function(d){var a=d,b="people, |favorites,",c=new RegExp(b,"gi");a=a.replace(c,"results,");b="<a .*?</a>";c=new RegExp(b,"gi");a=a.replace(c,"&nbsp;");b='tabIndex=[\\"]?-1[\\"]?';c=new RegExp (b,"gi");a=a.replace(c,"tabIndex=0");b="</span>";c=new RegExp(b,"gi");a=a.replac e(c,"");b="<span class=[^>]*?>";c=new RegExp(b,"gi");a=a.replace(c,"");if(Micros oft.Live.ContactPicker.Util.getBrowser()!=ContactPickerConstants.Constants.IE)a= this._shouldCheckElt(a);return a},_syncSelectionBetweenSearch:function(){var a=t his._parent.getSelectedContacts();for(var b=a.length;b--;)if(a[b]!=null){var d=a [b].getClientId(),e=a[b].emailIndex>=0?a[b].emailIndex:0,c=_ge([this._parent._in stanceName,"results",d,e].join(","));if(c)this._parent._updateCheckedElement(c.p arentNode.parentNode,c,false,true)}},_shouldCheckElt:function(e){var b=e,a="",i= /results,[0-9]+,[0-9]+\"/gi,c=e.match(i);if(c!=null){var g=this._parent.__getSel ectContactsDictionary(),j=c.length;for(var f=j;f--;){a=c[f];var d=a.replace(/res ults,/,""),d=d.replace(/\"/,"");if(g.getItem(d)){var h=new RegExp(a,"i");b=b.rep lace(h,a+' CHECKED _selected="true" ')}}}return b},_getFormattedResults:function (b,d){var a=[],e=b.length;for(var c=e;c--;)if(!AbchElement.isCategory(b[c]))if(! d)a[a.length]=Microsoft.Live.ContactPicker.Util.concat('<div class="RowContainer ">',this._processResults(this._sourceList.childNodes[b[c]].innerHTML),"</div>"); else if(AbchElement.isFavorite(b[c]))a[a.length]=Microsoft.Live.ContactPicker.Ut il.concat('<div class="RowContainer">',this._processResults(this._sourceList.chi ldNodes[b[c]].innerHTML),"</div>");return a},_getResultsList:function(b){var a=n ull;if(ContactPickerCore.searchIndex)a=ContactPickerCore.searchIndex[b];return a },_showResults:function(){if(this._resultsList.style.display=="block")return;thi s._resultsList.style.display="block";this._viewlist.style.display="none";this._s earchImg.style.display="none";this._searchCancelImg.style.display="block";this._

parent._hideSelectAll()},_hideResults:function(){if(this._resultsList.style.disp lay=="none")return;this._resultsList.style.display="none";this._viewlist.style.d isplay="block";this._searchImg.style.display="block";this._searchCancelImg.style .display="none"},_updateLists:function(){this._sourceList=this._parent.getSource List();this._viewlist=this._parent.getWorkingList();this._resultsList=this._pare nt.getWorkingList(true)},hide:function(){this._base.style.display="none";this.is Visible=false},hideOverlay:function(){this._overlay.style.display="none";this._i nput.style.display="block";this.isInputVisible=true},show:function(){this._base. style.display="block";this.isVisible=true},showOverlay:function(){this._overlay. style.display="block";this._input.style.display="none";this.isInputVisible=false },isActive:function(){return this._resultsList.style.display=="block"},resultLis t:function(){return this._resultsList},focus:function(){if(this.isInputVisible)$ callFocus(this._input)}};Microsoft.Live.ContactPicker.Search.createClass("Micros oft.Live.ContactPicker.Search");WLHMType.registerNamespace("Microsoft.Live.Conta ctPicker");Microsoft.Live.ContactPicker.SearchIndexer=function(){Events.init(thi s);this._iCallback=Delegate.create(this,this._indexCallBack)};Microsoft.Live.Con tactPicker.SearchIndexer.prototype={_timerId:0,RETRY_INTERVAL:1e3,RETRY_PROCESSI NG:500,start:function(){this._indexCallBack()},_buildIndex:function(){ContactPic kerCore.searchIndex=[];for(var b=ContactPickerCore.contactData.length;b--;){var d=ContactPickerCore.contactData[b][0],e=d.length,f=0;for(var c=0;c<e;c++){var a= d.charCodeAt(c);if(ContactPickerCore.searchIndex[a]==undefined)ContactPickerCore .searchIndex[a]=[];ContactPickerCore.searchIndex[a][ContactPickerCore.searchInde x[a].length]=b}}},_checkTransform:function(){if(typeof ContactPickerCore=="undef ined")setTimeout(this._iCallback,this.RETRY_INTERVAL);else if(typeof ContactPick erCore.searchIndex=="undefined")setTimeout(this._iCallback,this.RETRY_INTERVAL); else if(ContactPickerCore.lock)setTimeout(this._iCallback,this.RETRY_PROCESSING) ;else if(ContactPickerCore.searchIndex!=null){if(ContactPickerCore.searchIndex.l ength>=0)return true}else return this._indexList();return false},_indexCallBack: function(){var a=this._checkTransform();if(a)this.fireEvent("onsearchindexready" ,[this])},_indexList:function(){this._LOCKRESOURCE();this._buildIndex();this._UN LOCKRESOURCE();return true},_LOCKRESOURCE:function(){ContactPickerCore.lock=true },_UNLOCKRESOURCE:function(){ContactPickerCore.lock=false}};Microsoft.Live.Conta ctPicker.SearchIndexer.createClass("Microsoft.Live.ContactPicker.SearchIndexer") ;Events.addEventing(Microsoft.Live.ContactPicker.SearchIndexer);WLHMType.registe rNamespace("Microsoft.Live.ContactPicker");Microsoft.Live.ContactPicker.ContactP icker=function(instance_name){this._instanceName=instance_name;this._base=_ge(th is._instanceName+"$ContactPickerContainer");Control.create(this,this._base);if(t his._base.style.display.toLowerCase()=="none")this.isVisible=false;this._selecte dTab=this._getSelectedTab();Events.init(this);this._search=new Microsoft.Live.Co ntactPicker.Search(this._instanceName,this);this._peopleListContainer=_ge(this._ instanceName+"$PeopleListContainer");this._categoryListContainer=_ge(this._insta nceName+"$CategoryListContainer");this._favoriteListContainer=_ge(this._instance Name+"$FavoritesListContainer");this._peopleList=_ge(this._instanceName+"$People List");this._categoryList=_ge(this._instanceName+"$CategoryList");this._favorite List=_ge(this._instanceName+"$FavoritesList");this._initializeControl();this._fa voritesContacts=[];this._selectAll=_ge(this._instanceName+"$SelectAllCheckbox"); this._selectAllCategory=_ge(this._instanceName+"$SelectAllCheckboxCategory");thi s._selectedSelectAll=this._selectAll;this._selectAllText=_ge(this._instanceName+ "$SelectAllText");this._selectedContacts=new CPDictionary;this._selectedContacts Server=_ge(this._instanceName+"$SelectedContacts");this._selectedContactsServer. value="";eval(String.format("this._selectedLookup = {0}$Lookup;",this._instanceN ame));this._preSelectedContacts=[];this._peopleListNoContacts=_ge(this._instance Name+"$NoContacts");this._categoryListNoContacts=_ge(this._instanceName+"$NoCate gories");this._favoriteListNoContacts=_ge(this._instanceName+"$NoFavorites");thi s._searchIndexer=new Microsoft.Live.ContactPicker.SearchIndexer;this._searchInde xer.attachEvent("onsearchindexready",Delegate.create(this,this._onSearchIndexRea dy));this._searchIndexer.start();this._suppressSelectAll=false};Microsoft.Live.C ontactPicker.ContactPicker.prototype={isVisible:true,_onContactAddedDelegate:nul l,_onContactRemovedDelegate:null,_onCategoryExpandedDelegate:null,base:function( ){return this._base},_initializeControl:function(){this.READY=0;this.NOT_READY=1

;this._state=this.NOT_READY},_onSearchIndexReady:function(){this._populateContac ts();this._populateCategories();this._selectedContactsServer.value="";this._pres elect();this._handleNoContacts();_ge(this._instanceName+"$Loading").style.displa y="none";this._state=this.READY},_handleNoContacts:function(){if(this._peopleLis t.childNodes.length==0)this._peopleListNoContacts.style.display="block";if(this. _categoryList.childNodes.length==0)this._categoryListNoContacts.style.display="b lock";if(this._favoriteList.childNodes.length==0)this._favoriteListNoContacts.st yle.display="block"},_preselect:function(){for(var a=this._preSelectedContacts.l ength;a--;)this.onContactAdded(this,this._preSelectedContacts[a])},_populateCate gories:function(){var m='<div class="CategoryRowContainer CategoryUnselected"><d iv class="CategorySubContainer" onmouseover="if(window.Control)Control.invoke(\' Microsoft.Live.ContactPicker.ContactPicker\', \'_onMouseOverCategory\', event, t his);" onmouseout="if(window.Control)Control.invoke(\'Microsoft.Live.ContactPick er.ContactPicker\', \'_onMouseOutCategory\', event, this);" onclick="if(window.C ontrol)Control.invoke(\'Microsoft.Live.ContactPicker.ContactPicker\', \'_onToggl eSelection\', event);"><div class="CategoryRow"><div class="Cell1">{0}</div><div class="Cell2"><input class="Checkbox" id="{1}" type="checkbox" /></div><div cla ss="Cell3"><span class="FontWeight">{2}</span></div><div class="Cell4">{3} {4}</ div></div>',n='<div class="CategoryContainer" style="display: none;"><div class= "CategoryRow"><div class="Cell1"></div><div class="Cell2">{0}</div><div class="C ell3">{1}</div><div class="Cell4">{2}</div></div>',s='<div class="CategoryRow" s tyle="display: none;"><div class="SubCell">{0}</div></div>',p='<a href="javascri pt:;" onkeydown="if(window.Control)Control.invoke(\'Microsoft.Live.ContactPicker .ContactPicker\', \'_onToggle\', event);if(event.keyCode != ContactPickerConstan ts.KeyCodes.TAB)return false;"><img alt="'+ContactPickerStrings.expand+'" class= "Collapsed" border="0" onclick="if(window.Control)Control.invoke(\'Microsoft.Liv e.ContactPicker.ContactPicker\', \'_onToggle\', event);" src="'+ContactPickerStr ings.expandImg+'" /></a>',k="",o=ContactPickerCore.contactData.length;for(var e= ContactPickerCore.contactCount;e<o;e++){var d=new AbchElement(e),r=d.fullName,l= d.users,c=l.length,b="";this._shouldPreselect(d);var h="(.*)\\{0\\}(.*)\\{1\\}(. *)\\{2\\}(.*)\\{3\\} \\{4\\}(.*)",i=new RegExp(h,"gi"),f=Microsoft.Live.ContactP icker.Util.concat("$1",c>0?p:"&nbsp;","$2",this._instanceName,",category,",e,"$3 ",'<span class="FontWeight">',r,"</span>","$4",c," ",c==1?ContactPickerStrings.c ategoryCountSingular:ContactPickerStrings.categoryCountPlural,"$5");b=m.replace( i,f);for(var j=0;j<c;j++){var a=new AbchElement(l[j]),q=a.getEmailArray();if(q!= null){var g="";h="(.*)\\{0\\}(.*)\\{1\\}(.*)\\{2\\}(.*)";i=new RegExp(h,"gi");f= Microsoft.Live.ContactPicker.Util.concat("$1","&nbsp;","$2",a.fullName==""?a.ema il:a.fullName,"$3",a.isSpacesFriend&&Microsoft.Live.ContactPicker.Util.isNullOrE mpty(a.email)&&!ContactPickerCore.hideEmails?Microsoft.Live.ContactPicker.Util.g etPrivateMessageString():a.email,"$4");g+=n.replace(i,f)}g+="</div>";b+=g;delete a}delete d;b+="</div></div>";k+=b}this._categoryList.innerHTML=k},_populateCont acts:function(){var n=ContactPickerCore.contactData.length-ContactPickerCore.cat egoryCount,l='<div class="RowContainer Visibility"><div class="Row Unselected" o nmouseover="if(window.Control)Control.invoke(\'Microsoft.Live.ContactPicker.Cont actPicker\', \'_onMouseOverContact\', event, this);" onmouseout="if(window.Contr ol)Control.invoke(\'Microsoft.Live.ContactPicker.ContactPicker\', \'_onMouseFrom Contact\', event, this);" onclick="if(window.Control)Control.invoke(\'Microsoft. Live.ContactPicker.ContactPicker\', \'_onToggleSelection\', event);"><div class= "Cell1">{0}</div><div class="Cell2"><input class="Checkbox" id="{1},0" type="che ckbox" /></div><div class="Cell3">{2}</div><div class="Cell4">{3}</div></div>',o ='<a href="javascript:;" onkeydown="if(window.Control)Control.invoke(\'Microsoft .Live.ContactPicker.ContactPicker\', \'_onToggle\', event);if(event.keyCode != C ontactPickerConstants.KeyCodes.TAB)return false;"><img alt="'+ContactPickerStrin gs.expand+'" class="Collapsed" border="0" onclick="if(window.Control)Control.inv oke(\'Microsoft.Live.ContactPicker.ContactPicker\', \'_onToggle\', event);" src= "'+ContactPickerStrings.expandImg+'" /></a>',m='<div class="Row Unselected" onmo useover="if(window.Control)Control.invoke(\'Microsoft.Live.ContactPicker.Contact Picker\', \'_onMouseOverContact\', event, this);" onmouseout="if(window.Control) Control.invoke(\'Microsoft.Live.ContactPicker.ContactPicker\', \'_onMouseFromCon tact\', event, this);" onclick="if(window.Control)Control.invoke(\'Microsoft.Liv

e.ContactPicker.ContactPicker\', \'_onToggleSelection\', event);"><div class="Ce ll1">&nbsp;</div><div class="Cell2"><input class="Checkbox" id="{0},{1}" tabInde x="-1" type="checkbox" /></div><div class="FontSecondaryColor Cell3">{2}</div><d iv class="Cell4">{3}</div></div>',j="",h="";for(var b=0;b<n;b++){var a=new AbchE lement(b),d=a.getEmailArray(),g=d.length,c="";this._shouldPreselect(a);var i="(. *)\\{0\\}(.*)\\{1\\}(.*)\\{2\\}(.*)\\{3\\}(.*)",k=new RegExp(i,"gi"),f=Microsoft .Live.ContactPicker.Util.concat("$1",g>1?o:"&nbsp;","$2",this._instanceName,",{f avorite}",b,"$3",a.isGroup?'<span class="FontWeight">'+a.fullName+"</span>":a.fu llName==""?a.email:a.fullName,"$4",a.isSpacesFriend&&Microsoft.Live.ContactPicke r.Util.isNullOrEmpty(d[0])&&!ContactPickerCore.hideEmails?Microsoft.Live.Contact Picker.Util.getPrivateMessageString():d[0],"$5");c=l.replace(k,f);for(var e=1;e< g;e++){var i="(.*)\\{0\\},\\{1\\}(.*)\\{2\\}(.*)\\{3\\}(.*)",k=new RegExp(i,"gi" );f=Microsoft.Live.ContactPicker.Util.concat("$1",this._instanceName,",{favorite }",b,",",e,"$2",a.fullName!=""?a.fullName:d[e],"$3",d[e],"$4");c+=m.replace(k,f) }c+="</div>";delete a;j+=c.replace(/\{favorite\}/g,"people,");if(a.isFavorite){h +=c.replace(/\{favorite\}/g,"favorite,");this._favoritesContacts[b]=true}}this._ peopleList.innerHTML=j;this._favoriteList.innerHTML=h},_shouldPreselect:function (a){var f=a.serverSideID?a.serverSideID:a.serverSideContactID;if(this._selectedL ookup[f]==true){var d=0;if(!a.isCategory&&!a.isGroup){var c=a.getEmailArray();fo r(var b=c.length;b--;)if(this._selectedLookup[c[b].toLowerCase()]==true){d++;var e=new AbchElement(a.getClientId(),false,b);this._preSelectedContacts[this._preS electedContacts.length]=e}}if(d==0)this._preSelectedContacts[this._preSelectedCo ntacts.length]=a}else if(!a.isCategory&&!a.isGroup){var c=a.getEmailArray();for( var b=c.length;b--;)if(this._selectedLookup[c[b].toLowerCase()]==true){var e=new AbchElement(a.getClientId(),false,b);this._preSelectedContacts[this._preSelecte dContacts.length]=e}}else if(this._selectedLookup[a.fullName.toLowerCase()]==tru e)this._preSelectedContacts[this._preSelectedContacts.length]=a},_selectAllHandl er:function(){if(this._state!=this.READY)return;var b=event.srcElement,a=b.check ed;switch(this._selectedTabName){case "PeopleTab":this.fireEvent(a?"onAllSelecte d":"onAllDeselected",[this,ContactPickerConstants.Constants.PEOPLE]);this._check All(this._peopleList,a);break;case "CategoryTab":this.fireEvent(a?"onAllSelected ":"onAllDeselected",[this,ContactPickerConstants.Constants.CATEGORIES]);this._ch eckAll(this._categoryList,a,true);break;case "FavoritesTab":this.fireEvent(a?"on AllSelected":"onAllDeselected",[this,ContactPickerConstants.Constants.FAVORITES] );this._checkAll(this._favoriteList,a)}},_checkAll:function(e,d,c){var a=$tag(e, "input");for(var b=a.length;b--;){this._updateCheckedElement(c?a[b].parentNode.p arentNode.parentNode.parentNode:a[b].parentNode.parentNode,a[b],c,d);if(!c)this. _syncSelection(a[b])}},_onMouseOverCategory:function(b){if(!b)return;var a=b.par entNode;if($containsClass(a,"CategorySelected"))return;$addClass(a,"CategoryHove r")},_onMouseOutCategory:function(b){if(!b)return;var a=b.parentNode;if(a._selec ted=="false"||!a._selected)a.className="CategoryRowContainer CategoryUnselected" },_onMouseOverContact:function(a){if(!a)return;if($containsClass(a,"Selected"))r eturn;$addClass(a,"Hover")},_onMouseFromContact:function(a){if(Microsoft.Live.Co ntactPicker.Util.getBrowser()!=ContactPickerConstants.Constants.IE){var b=a.chil dren[1].children[0].checked;if(!b)a.className="Row Unselected"}else if(a._select ed=="false"||!a._selected)a.className="Row Unselected"},_onTabChanged:function() {var a=window.event.srcElement;while(a.tagName.toLowerCase()!="li")a=a.parentNod e;if(a==this._selectedTab)return;a.className="Selected";this._selectedTab.classN ame="";this._selectedTab=a;this._selectedTabName=this._getTabName();this._update UI()},_onToggle:function(c){var a=c||event.srcElement;if(a.tagName.toLowerCase() =="a"){if(event.keyCode!=ContactPickerConstants.KeyCodes.RETURN)return;a=a.first Child}var b=a.className;switch(b){case "Collapsed":a.title=ContactPickerStrings. collapse;a.className="Expanded";a.src=ContactPickerStrings.collapseImg;this._tog gleAllSubNodes(a,0);break;case "Expanded":a.title=ContactPickerStrings.expand;a. className="Collapsed";a.src=ContactPickerStrings.expandImg;this._toggleAllSubNod es(a,-1)}},_toggleAllSubNodes:function(d,c){var b=d.parentNode.parentNode.parent Node,a=b.parentNode;if(a.className.indexOf("CategorySubContainer")!=-1||a.classN ame=="CategoryContainer"){this._toggleAllCategorySubNodes(a,c==0?"block":"none") ;return}if(c==-1)a.className="RowContainer Visibility";else a.className="RowCont ainer";while(b=b.nextSibling)b.childNodes[1].firstChild.tabIndex=c},_toggleAllCa

tegorySubNodes:function(c,b){var a=c.firstChild;while(a=a.nextSibling)a.style.di splay=b},_onToggleSelection:function(){var c=false,a=event.srcElement,d=a.tagNam e.toLowerCase();if(this._shouldToggleExpand(a))return;if(d=="img")return;else if (d=="input"){var b=a;a=a.parentNode.parentNode;if(a.className.indexOf("CategoryR ow")!=-1){c=true;while(a.className.indexOf("CategoryRowContainer")==-1)a=a.paren tNode}this._updateCheckedElement(a,b,c,b.checked);this._syncSelection(b);this._u pdateAssociatedControl(b);return}else if(a.className.indexOf("CategoryRow")!=-1) {c=true;while(a.className.indexOf("CategoryRowContainer")==-1)a=a.parentNode}els e if(a.className.indexOf("Row")==-1){while(a.className.indexOf("Row")==-1)a=a.pa rentNode;if(a.className.indexOf("CategoryRow")!=-1){c=true;while(a.className.ind exOf("CategoryRowContainer")==-1)a=a.parentNode}}if(!c)var b=a.childNodes[1].fir stChild;else var b=a.firstChild.firstChild.childNodes[1].firstChild;this._update CheckedElement(a,b,c);this._syncSelection(b);this._updateAssociatedControl(b)},_ shouldToggleExpand:function(b){if(b.className.indexOf("Cell1")!=-1){var a=b;whil e(a){if(a.nodeType==1)if(a.tagName.toLowerCase()=="img")break;a=a.firstChild}if( a){this._onToggle(a);return true}}return false},_updateAssociatedControl:functio n(c){var d=c.id,a=d.split(","),b=null;if(a.length==4)b=new AbchElement(a[2],fals e,a[3]);else if(a.length==3)b=new AbchElement(a[2],false);if(c.checked)this.fire Event("onContactAdded",[this,b]);else this.fireEvent("onContactRemoved",[this,b] )},_updateCheckedElement:function(d,a,e,c){if(typeof c!="undefined")a.checked=c; else a.checked=!a.checked;if(this._selectedSelectAll.checked&&!a.checked)this._s electedSelectAll.checked=false;this._updateSelectedItems(a);var b=e==true?"Categ oryRowContainer Category":"Row ";b+=a.checked==true?"Selected":"Unselected";d._s elected=a.checked;d.className=b},_updateSelectedItems:function(c){var d=c.getAtt ribute("id"),b=d.split(","),e=b.length,a=b[2]+(e==4?","+b[3]:"");if(c.checked){t his._updateServerSelectedContacts(a,true);this._selectedContacts.add(a,true)}els e{this._selectedContacts.remove(a);this._updateServerSelectedContacts(a,false)}} ,_updateServerSelectedContacts:function(d,e){var c=d.split(","),f=c.length,a=nul l;if(c.length==2)a=new AbchElement(c[0],false,c[1]);else a=new AbchElement(d);va r b=["[",a.serverSideID,";",escape(a.fullName),";",escape(a.email),";",a.isGroup ,";",a.isCategory,";",a.serverSideContactID?a.serverSideContactID:0,"]"].join("" );if(!this._selectedContacts.getItem(d)&&e)this._selectedContactsServer.value=(t his._selectedContactsServer.value==""?"":this._selectedContactsServer.value+",") +b;if(!e){this._selectedContactsServer.value=this._selectedContactsServer.value. replace(","+b,"");this._selectedContactsServer.value=this._selectedContactsServe r.value.replace(b+",","");this._selectedContactsServer.value=this._selectedConta ctsServer.value.replace(b,"")}},_updateUI:function(){this._search.clear();switch (this._selectedTabName){case "PeopleTab":if(!this._suppressSelectAll)this._manag eSelectAllCheckbox(false);this._search.hideOverlay();this._search.clear();this._ updatePageVisibility("block","none","none");Microsoft.Live.ContactPicker.Util.in strumentWrapper(ContactPickerConstants.Instrumentation.PeopleTab);break;case "Ca tegoryTab":if(!this._suppressSelectAll)this._manageSelectAllCheckbox(true);this. _search.showOverlay();this._search.clear();this._updatePageVisibility("none","bl ock","none");Microsoft.Live.ContactPicker.Util.instrumentWrapper(ContactPickerCo nstants.Instrumentation.CategoryTab);break;case "FavoritesTab":if(!this._suppres sSelectAll)this._manageSelectAllCheckbox(false);this._search.hideOverlay();this. _search.clear();this._updatePageVisibility("none","none","block");Microsoft.Live .ContactPicker.Util.instrumentWrapper(ContactPickerConstants.Instrumentation.Fav oritesTab)}},_manageSelectAllCheckbox:function(a){this._selectAll.style.display= a?"none":"block";this._selectAllCategory.style.display=a?"block":"none";this._se lectedSelectAll=a?this._selectAllCategory:this._selectAll;this._selectedSelectAl l.checked=this._shouldChecked(a)},_shouldChecked:function(f){if(!f){var c=(this. _selectedTabName=="PeopleTab"?this._peopleList:this._favoriteList).innerHTML;if( c=="")return false;var g='class=["]?Row Unselected["]?',i=new RegExp(g,"gi"),h=i .exec(c);if(h)return false;return true}else{var b=this._categoryList.childNodes. length,d=this.getSelectedContacts(),a=0;for(var e=d.length;e--;)if(d[e].isCatego ry)a++;return b>0&&b==a}return false},_updatePageVisibility:function(c,a,b){this ._peopleListContainer.style.display=c;this._categoryListContainer.style.display= a;this._favoriteListContainer.style.display=b},_syncSelection:function(a){if(thi s._isSyncFromSearchResult(a))a=this._syncSearchResult(a);switch(this._selectedTa

bName){case "PeopleTab":this._syncWithFavorites(a);break;case "FavoritesTab":thi s._syncWithPeople(a)}},_syncSearchResult:function(c){var a=c.getAttribute("id"), b=a.split(",");b[1]=this._selectedTabName=="PeopleTab"?"people":"favorite";a=b.j oin(",");this._syncUpdate(a,c.checked);return _ge(a)},_isSyncFromSearchResult:fu nction(a){var b=a.getAttribute("id");return b.indexOf("results")!=-1?true:false} ,_syncUpdate:function(c,b){var a=_ge(c);if(a==null)return;this._updateCheckedEle ment(a.parentNode.parentNode,a,false,b)},_syncWithPeople:function(a){var b=this. _getFavoritesId(a);this._syncUpdate(b,a.checked)},_syncWithFavorites:function(a) {var d=a.getAttribute("id"),c=d.split(","),b=c[2];if(this._favoritesContacts[b]= =true){b=this._getPeopleId(a);this._syncUpdate(b,a.checked)}},_getFavoritesId:fu nction(b){var a=b.getAttribute("id");return a.replace(/favorite,/g,"people,")},_ getPeopleId:function(b){var a=b.getAttribute("id");return a.replace(/people,/g," favorite,")},_getSelectedTab:function(){var a=_ge(this._instanceName+"$PeopleTab ");while(a){if(a.className){this._selectedTabName=this._getTabName(a);return a}a =a.nextSibiling}return null},_getTabName:function(a){return (a||this._selectedTa b).id.substring(this._instanceName.length+1)},dispose:function(){Control.destroy (this);if(this._search)this._search.dispose();this._base=null},hide:function(){t his._base.style.display="none";this.isVisible=false;this.fireEvent("onHide",[thi s])},show:function(){this._base.style.display="block";this.isVisible=true;if(thi s._selectedTabName=="CategoryTab"){if(this._selectedSelectAll!=null)this._select edSelectAll.focus()}else if(this._search!=null)this._search.focus();this.fireEve nt("onShow",[this])},reAssociateControl:function(a){if(!this._onContactAddedDele gate||!a)return;this.clearAll();if(this._associatedControl){this._associatedCont rol.detachEvent("onContactAdded",this._onContactAddedDelegate);this._associatedC ontrol.detachEvent("onContactRemoved",this._onContactRemovedDelegate);this._asso ciatedControl.detachEvent("onCategoryExpand",this._onCategoryExpandedDelegate);t his._associatedControl.detachAssociatedCPEvents()}var c=a.selectedAbchElements.l ength;for(var b=c;b--;)this.onContactAdded(null,a.selectedAbchElements[b]);this. associateControl(a);a.associateControl(this)},getSourceList:function(){var a=thi s._instanceName+"$PeopleList";return _ge(a)},getWorkingList:function(a){switch(t his._selectedTabName){case "PeopleTab":var b=a?this._instanceName+"$PeopleResult sList":this._instanceName+"$PeopleList";return _ge(b);break;case "FavoritesTab": var b=a?this._instanceName+"$FavoritesResultsList":this._instanceName+"$Favorite sList";return _ge(b)}return null},_hideSelectAll:function(){this._selectedSelect All.style.display="none";this._selectAllText.style.display="none"},hideSelectAll :function(){this._hideSelectAll();this._suppressSelectAll=true},_showSelectAll:f unction(){if(this._suppressSelectAll)return;this._selectedSelectAll.style.displa y="block";this._selectAllText.style.display="block"},showSelectAll:function(){th is._suppressSelectAll=false;this._showSelectAll()},associateControl:function(a){ this._associatedControl=a;this._onContactAddedDelegate=Delegate.create(this,this .onContactAdded);this._onContactRemovedDelegate=Delegate.create(this,this.onCont actRemoved);this._onCategoryExpandedDelegate=Delegate.create(this,this.onCategor yExpand);this._associatedControl.attachEvent("onContactAdded",this._onContactAdd edDelegate);this._associatedControl.attachEvent("onContactRemoved",this._onConta ctRemovedDelegate);this._associatedControl.attachEvent("onCategoryExpand",this._ onCategoryExpandedDelegate)},makeCheckboxId:function(b,a,c){if(b==ContactPickerC onstants.Constants.PEOPLE)return Microsoft.Live.ContactPicker.Util.concat(this._ instanceName,",people,",a,",",c);else if(b==ContactPickerConstants.Constants.CAT EGORIES)return Microsoft.Live.ContactPicker.Util.concat(this._instanceName,",cat egory,",a);return null},onContactAdded:function(g,c){var b=c.getClientId();if(b= =ContactPickerConstants.Constants.NONE)return;var f=null,a=AbchElement.isCategor y(b),d=a?null:c.emailIndex,e=this.makeCheckboxId(a?ContactPickerConstants.Consta nts.CATEGORIES:ContactPickerConstants.Constants.PEOPLE,b,d);this._updateContactF romEvent(e,a,true)},onContactRemoved:function(g,c){var b=c.getClientId();if(b==C ontactPickerConstants.Constants.NONE)return;var f=null,a=AbchElement.isCategory( b),d=a?null:c.emailIndex,e=this.makeCheckboxId(a?ContactPickerConstants.Constant s.CATEGORIES:ContactPickerConstants.Constants.PEOPLE,b,d);this._updateContactFro mEvent(e,a,false)},_updateContactFromEvent:function(e,d,c){var a=_ge(e);if(d){va r b=a;while(b.className.indexOf("CategoryRowContainer")==-1)b=b.parentNode;this. _updateCheckedElement(b,a,true,c)}else{a.checked=c;this._syncWithPeople(a);this.

_syncWithFavorites(a)}},onCategoryExpand:function(h,a){var f=a.getClientId();if( f==ContactPickerConstants.Constants.NONE)return;var g=null,b=a.users,d=b.length; this.onContactRemoved(this,a);for(var c=d;c--;){var e=new AbchElement(b[c]);this .onContactAdded(this,e)}},__getSelectContactsDictionary:function(){return this._ selectedContacts},getSelectedContacts:function(){var d=this._selectedContacts.ge tPrimitive(),b=[],c=0;for(keys in d){var a=keys.split(",");if(a.length==2)b[c]=n ew AbchElement(a[0],false,a[1]);else b[c]=new AbchElement(a[0]);c++}return b},cl earAll:function(){this._checkAll(this._peopleList,false);this._checkAll(this._ca tegoryList,false,true);this._checkAll(this._favoriteList,false);this._search.cle ar()}};Microsoft.Live.ContactPicker.ContactPicker.createClass("Microsoft.Live.Co ntactPicker.ContactPicker");Events.addEventing(Microsoft.Live.ContactPicker.Cont actPicker);WLHMType.registerNamespace("Microsoft.Live.ContactPicker");Microsoft. Live.ContactPicker.AutoComplete=function(instanceName){this._instanceName=instan ceName;this._elt=_ge(this._instanceName+"$AutoComplete");Control.create(this,thi s._elt);this._input=_ge(this._instanceName+"$InputBox");this._resultsContainer=_ ge(this._instanceName+"$ResultsContainer");this._inputDiv=_ge(this._instanceName +"$InputDiv");this._inputUL=_ge(this._instanceName+"$InputUL");this._inputULInit ialContents=this._inputUL.innerHTML;this._inputBoxLi=_ge(this._instanceName+"$In putBoxLi");this._browserType=Microsoft.Live.ContactPicker.Util.getBrowser();Even ts.init(this);this.selectedAbchElements=[];this._selectedContactsServer=_ge(this ._instanceName+"$SelectedContacts");eval(String.format("this._selectedLookup = { 0}$Lookup;",this._instanceName));eval(String.format("this._freeSelectedLookup = {0}$FreeSelected;",this._instanceName));jQuery(this._inputBoxLi).bind("click",De legate.create(this,this._acCancelBubble));jQuery(document).bind("click",Delegate .create(this,this._globalClickHandler));this._setTimeOutHandle=0;this._lastInput ="";this._textRuler=_ge(this._instanceName+"$TextRuler");this._currentKeyFocusEl t=-1;this._previousSelectedElt=null;this._searchIndexer=new Microsoft.Live.Conta ctPicker.SearchIndexer;this._searchIndexer.attachEvent("onsearchindexready",Dele gate.create(this,this._onSearchIndexReady));this._searchIndexer.start()};Microso ft.Live.ContactPicker.AutoComplete.prototype={_resultRowCount:0,_currentAutoComp leteSelectedIndex:ContactPickerConstants.KeyCodes.NONE_SELECTED,_lastAutoComplet eSelectedIndex:ContactPickerConstants.KeyCodes.NONE_SELECTED,_isWaitingOnReadyNo tification:false,_isReady:false,_scrollBottomAnchor:0,_uniqueElementID:0,_inputU LInitialContents:"",_origMarkup:"",_countIt:0,_onContactAddedDelegate:null,_onCo ntactRemovedDelegate:null,_onCategoryExpandedDelegate:null,_onAllSelectedDelegat e:null,_onAllDeselectedDelegate:null,_associatedControl:null,_emailPattern:"[a-z 0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0 -9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",_keyHandled:false,_pasteWhi leInitializing:false,_resultsDropDownContactNameWidth:"",_resultsDropDownEmailWi dth:"",_displayResultsInOneColumn:false,_rowsPerContainer:ContactPickerConstants .Constants.DEFAULT_ROWS_PER_CONTAINER,synchResultsDropDownWidthToSearchBox:false ,resultsDropDownOneColumnWidthThreshold:ContactPickerConstants.Constants.ONE_COL _DEFAULT_THRESHOLD,autoExpandCategories:false,populateInput:function(a){if(Micro soft.Live.ContactPicker.Util.isNullOrEmpty(a))return;this._input.value=a;this._d oSearch()},_setResultsDropDownWidth:function(a){var b;if(a<ContactPickerConstant s.Constants.RESULTS_DDOWN_MIN_WIDTH)a=ContactPickerConstants.Constants.RESULTS_D DOWN_MIN_WIDTH;if(a>ContactPickerConstants.Constants.RESULTS_DDOWN_MAX_WIDTH)a=C ontactPickerConstants.Constants.RESULTS_DDOWN_MAX_WIDTH;if(a<this.resultsDropDow nOneColumnWidthThreshold){this._rowsPerContainer=ContactPickerConstants.Constant s.ONECOL_ROWS_PER_CONTAINER;this._displayResultsInOneColumn=true;b=a-ContactPick erConstants.Constants.RESULTS_CELL_MARGIN}else{this._rowsPerContainer=ContactPic kerConstants.Constants.DEFAULT_ROWS_PER_CONTAINER;this._displayResultsInOneColum n=false;b=a/2-ContactPickerConstants.Constants.RESULTS_CELL_MARGIN}var c=_ge(thi s._instanceName+"$ResultsContainer");if(c)c.style.width=a+"px";this._resultsDrop DownContactNameWidth=b+"px";this._resultsDropDownEmailWidth=b+"px"},_measureStri ng:function(a){if(a==" "||a=="")return 50;var b=Microsoft.Live.ContactPicker.Uti l.htmlEncode(a);this._textRuler.innerHTML=b;var c=this._textRuler.offsetWidth;re turn c+25},_rowClickHandler:function(){this._acCancelBubble();var a=event.srcEle ment;while(a&&a!=this._resultsContainer){if(a.tagName.toLowerCase()=="tr"){this. _makeSelection(a.getAttribute("cid"),a.getAttribute("eid"),true);break}a=a.paren

tElement}},_globalClickHandler:function(){this._createElementFromInput(false)},_ inputUlClickHandler:function(){this._createElementFromInput(false);this._acCance lBubble()},_autoCompleteClickHandler:function(){this._createElementFromInput(tru e);this._acCancelBubble()},_scrollInputToBottom:function(){this._inputDiv.scroll Top=this._inputDiv.scrollHeight},_onChangeHandler:function(){if(this._browserTyp e!=ContactPickerConstants.Constants.FIREFOX)return;var a=false,b=this._input.val ue.length-this._lastInput.length;if(!b)if(this._input.value!=this._lastInput)a=t rue;else a=false;else if(-1<=b&&b<=1)a=false;else if(b>1)a=true;else a=true;this ._lastInput=this._input.value;if(a){this._setInputWidth(this._input.value);this. _doPaste()}else this._doSearch()},_pasteHandler:function(){if(this._browserType= =ContactPickerConstants.Constants.FIREFOX)return;setTimeout(Delegate.create(this ,this._doPaste),0)},_doPaste:function(){if(!this._isReady){this._pasteWhileIniti alizing=true;return}if(ContactPickerCore.isManagedRestricted){this._input.value= "";this.fireEvent("onIsManagedRestricted",[this,null])}var a=this._input.value;i f(a==""){this._setInputWidth(" ");this._clearResults();return}if(this._addElemen tsByString(a)){this._input.value="";this._lastInput="";this._setInputWidth(" "); setTimeout(Delegate.create(this,this._scrollInputToBottom),50);return}if(a)this. _doSearch()},completeFreeFormEmail:function(){if(this._input.value!=""){if(Conta ctPickerCore.isManagedRestricted){this._input.value="";this.fireEvent("onIsManag edRestricted",[this,null]);return}this._currentAutoCompleteSelectedIndex=Contact PickerConstants.Constants.NONE;this._completeEntry(true,false)}},_delayedComplet eBlock:function(){this._setTimeOutHandle=setTimeout(Delegate.create(this,this.co mpleteFreeFormEmail),200)},_preselect:function(){if(this._selectedLookup==null|| this._freeSelectedLookup==null)return;var e=ContactPickerCore.contactData.length ;for(var b=e;b--;){var f=new AbchElement(b),a=this._shouldPreselect(f);if(a)this ._addAbchElement(a,false)}var d=this._freeSelectedLookup.length;for(var c=d;c--; ){var g=this._freeSelectedLookup[c],a=new AbchElement;a.email=g;this._addAbchEle ment(a,false)}this._persistState()},_persistState:function(){this._selectedConta ctsServer.value="";var e=this.selectedAbchElements.length,c=[];for(var b=0;b<e;b ++){var d="",a=this.selectedAbchElements[b];if(!a.isValid)continue;if(a.fullName ==null)a.fullName="";if(a.email==null)a.email="";var f=["[",a.serverSideID,";",e scape(a.fullName),";",escape(a.email),";",a.isGroup,";",a.isCategory,";",a.serve rSideContactID?a.serverSideContactID:0,"]"].join("");c[b]=f}d=c.join(",");this._ selectedContactsServer.value=d},_shouldPreselect:function(a){var e=a.serverSideI D?a.serverSideID:a.serverSideContactID;if(e&&this._selectedLookup[e]==true){var d=0;if(!a.isCategory&&!a.isGroup){var b=a.getEmailArray();if(b)for(var c=b.lengt h;c--;)if(this._selectedLookup[b[c].toLowerCase()]==true){d++;var f=new AbchElem ent(a.getClientId(),false,c);return f}}if(d==0)return a}if(!a.isCategory&&!a.isG roup){var b=a.getEmailArray();if(b)for(var c=b.length;c--;)if(this._selectedLook up[b[c].toLowerCase()]==true){var f=new AbchElement(a.getClientId(),false,c);ret urn f}}else if(this._selectedLookup[a.fullName.toLowerCase()])return a;return nu ll},_reset:function(){if(this._input)this._input.value="";if(this._resultsContai ner)this._resultsContainer.style.display="none";this._currentAutoCompleteSelecte dIndex=ContactPickerConstants.KeyCodes.NONE_SELECTED;this._lastAutoCompleteSelec tedIndex=ContactPickerConstants.KeyCodes.NONE_SELECTED},_clearResults:function() {this._resultsContainer.innerHTML="";this._resultsContainer.style.display="none" },_isEmailValid:function(a){if(Microsoft.Live.ContactPicker.Util.isNullOrEmpty(a ))return false;var b=new RegExp(this._emailPattern,"ig"),c=b.test(a);return c},_ isDomainValid:function(a){if(Microsoft.Live.ContactPicker.Util.isNullOrEmpty(a)) return false;var b=";home.com;attbi.com;example.com;hotmail.co;yaho.com;hotmai.c om;yahoo.co;yahoomail.com;direcway.com;homail.com;ims-ms-daemon;local.transport; ethome.net.tw;ethome.net.tw;hotmil.com;hotmial.com;yhoo.com;collegeclub.com;sbcg lobal.com;hotamil.com;yaoo.com;yahoo.net;yhaoo.com;mail.hotmail.com;passport.com ;kimo.com.tw;yahooo.com;yahho.com;ol.com;gateway.net;hotmail.com.mx;otmail.com;h tomail.com;aol.co;altavista.com;hotmaill.com;taiwan.com;hotmail.con;ahoo.com;hot mail.om;hotmail.net;hormail.com;hotail.com;hotamail.com;yahoo.om;homtail.com;msn .net;sprint.ca;angelfire.com;cm1.ethome.net.tw;yohoo.com;a0l.com;alo.com;msn.de; gmail.co;",c=this._getBetween(a,"@","");return !this._containsOneOf(b,c)},_conta insOneOf:function(b,a){if(Microsoft.Live.ContactPicker.Util.isNullOrEmpty(a))ret urn false;return b.indexOf(";"+a.toLowerCase()+";")>-1},_containsStartsWith:func

tion(b,a){if(Microsoft.Live.ContactPicker.Util.isNullOrEmpty(a))return false;ret urn b.indexOf(";"+a.toLowerCase())>-1},_isInWhiteList:function(a,b){return b?thi s._containsStartsWith(ContactPickerCore.emailWhiteList,a):this._containsOneOf(Co ntactPickerCore.emailWhiteList,a)},_isEmailAndDomainValid:function(a){var c=this ._isEmailValid(a),b=this._isDomainValid(a);return (c||!ContactPickerCore.perform ValidEmailCheck)&&b},_completeEntry:function(f,c){var d=_ge(this._instanceName+" $R"+(this._currentAutoCompleteSelectedIndex+1));if(d==null){if(ContactPickerCore .isManagedRestricted){this._input.value="";this.fireEvent("onIsManagedRestricted ",[this,null]);return}var a=this._input.value;if(a=="")return;var e=this._isEmai lAndDomainValid(a),g=e||this._isInWhiteList(a,false),b=new AbchElement;a=Microso ft.Live.ContactPicker.Util.htmlEncode(a.replace(/^\s+|\s+$/g,""));if(g){if(e)b.e mail=a;else b.fullName=a;this._addAbchElement(b,c);this.fireEvent("onContactAdde d",[this,b])}else{if(this._isEmailValid(a))b.email=a;else b.fullName=a;if(!f||!C ontactPickerCore.performValidEmailCheck){b.isValid=false;this._addAbchElement(b, c);this.fireEvent("onContactAdded",[this,b])}}this._persistState()}else this._ma keSelection(d.getAttribute("cid"),d.getAttribute("eid"),c)},_clearLostFocusTimeo ut:function(){clearTimeout(this._setTimeOutHandle)},_makeSelection:function(d,a, b){this._clearLostFocusTimeout();abchElement=new AbchElement(d);if(abchElement._ emailArray)abchElement.email=abchElement._emailArray[a];abchElement._selectedEle mentID=Microsoft.Live.ContactPicker.Util.concat(abchElement._clientID," ",a);if( !ContactPickerCore.allowDuplicateSelection){var c=this._isAlreadySelected(abchEl ement);this._reset();if(c)return}abchElement._selectedElementID=Microsoft.Live.C ontactPicker.Util.concat(abchElement._clientID,"-",a);abchElement.emailIndex=a;t his._addAbchElement(abchElement,b);this.fireEvent("onContactAdded",[this,abchEle ment]);this._persistState()},_isAlreadySelected:function(a){var d=false;if(a){va r f=!a.isCategory&&!a.isGroup,e=this.selectedAbchElements.length;for(var c=0;c<e ;++c){var b=this.selectedAbchElements[c];if(b&&b._clientID==a._clientID&&(!f||b. email==a.email)){d=true;break}}}return d},_removeContact:function(c){var b=c["Un iqueSelectedElementID"],g=c["FireEvent"],h=Microsoft.Live.ContactPicker.Util.con cat(this._instanceName,"$",b),d=_ge(h);if(d){var e=this.selectedAbchElements.len gth;this._inputUL.removeChild(d);for(var a=0;a<e;a++)if(this.selectedAbchElement s[a]._uniqueSelectedElementID==b){var f=this.selectedAbchElements[a];this.select edAbchElements.splice(a,1);if(g){this.fireEvent("onContactRemoved",[this,f]);thi s._persistState()}break}}},_keyUp:function(b){var a=b||Microsoft.Live.ContactPic ker.Util.getCharCode(event.keyCode);if(a==ContactPickerConstants.KeyCodes.SHIFT) this._isSpecialKey=false;if(ContactPickerCore.selectionMaximum>0&&this.selectedA bchElements.length>=ContactPickerCore.selectionMaximum){event.returnValue=false; return}else if(this._keyHandled){this._keyHandled=false;if(!this._input.value.le ngth){this._setInputWidth(" ");this._clearResults()}return}else if(!this._input. value.length){this._setInputWidth(" ");this._clearResults();return}this._doSearc h()},_clearInput:function(){this._input.value=""},_deleteElement:function(){if(t his.selectedAbchElements.length>0){var b=this.selectedAbchElements[this.selected AbchElements.length-1],a=this.selectedAbchElements[this.selectedAbchElements.len gth-1]._uniqueSelectedElementID;this._removeContact({UniqueSelectedElementID:a,F ireEvent:true});this._clearResults();if(this.selectedAbchElements.length==0){thi s._reset();return}}},deleteAllElements:function(){var c=this.selectedAbchElement s.length;for(var a=c-1;a>=0;a--){var b=this.selectedAbchElements[a]._uniqueSelec tedElementID;this._removeContact({UniqueSelectedElementID:b,FireEvent:true})}thi s._reset();this._lastInput="";this._setInputWidth(" ");this._clearResults()},_cr eateElementFromInput:function(a){var b=this._input.value.replace(/^\s+|\s+$/g,"" );if(b==""){if(a)setTimeout(Delegate.create(this,this._setInputFocus),50)}else t his._completeEntry(false,a)},_checkIfMatch:function(a){a=a.toLowerCase();return this._getContactRows(a.charCodeAt(0),a)||this._isInWhiteList(a,true)},_focusOutI nput:function(){if(this._browserType==ContactPickerConstants.Constants.FIREFOX3| |this._browserType==ContactPickerConstants.Constants.SAFARI)this._updateSelected Elt(true)},_focusOutMainDiv:function(){if(this._currentKeyFocusElt!=-1)this._upd ateSelectedElt(true)},_keyDownForContainer:function(b){if(event.srcElement==this ._input&&!b)return;var a=b||Microsoft.Live.ContactPicker.Util.getCharCode(event. keyCode);switch(a){case ContactPickerConstants.KeyCodes.KEY_LEFT:case ContactPic kerConstants.KeyCodes.KEY_RIGHT:this._keyHandled=true;this._selectByKeyboard(a);

break;case ContactPickerConstants.KeyCodes.BACK_BUTTON:case ContactPickerConstan ts.KeyCodes.DELETE:this._acCancelBubble();this._deleteSelectedElt();$callFocus(t his._input);break;case ContactPickerConstants.KeyCodes.TAB:break;default:this._i nput.focus();this._keyDown(a)}},_assignFromChar:function(a,b){if(a=="")return b; else return a},_keyDown:function(c){if(c)this._updateSelectedElt(true);var b=c|| Microsoft.Live.ContactPicker.Util.getCharCode(event.keyCode),a="";if(this._brows erType==ContactPickerConstants.Constants.FIREFOX3||this._browserType==ContactPic kerConstants.Constants.SAFARI)if(b!=ContactPickerConstants.KeyCodes.KEY_LEFT&&b! =ContactPickerConstants.KeyCodes.KEY_RIGHT&&b!=ContactPickerConstants.KeyCodes.D ELETE&&b!=ContactPickerConstants.KeyCodes.BACK_BUTTON)this._updateSelectedElt(tr ue);switch(b){case ContactPickerConstants.KeyCodes.FF_SEMICOLON:a=this._assignFr omChar(a,";");if(this._browserType!=ContactPickerConstants.Constants.FIREFOX&&th is._browserType!=ContactPickerConstants.Constants.FIREFOX3)break;case ContactPic kerConstants.KeyCodes.COMMA:a=this._assignFromChar(a,",");case ContactPickerCons tants.KeyCodes.SEMICOLON:a=this._assignFromChar(a,";");if(this._isSpecialKey)bre ak;case ContactPickerConstants.KeyCodes.SPACE:a=this._assignFromChar(a," ");var d=this._input.value+a;if(this._checkIfMatch(d))break;case ContactPickerConstants .KeyCodes.TAB:if(!this._checkIfMatch(this._input.value)&&!this._input.value)brea k;case ContactPickerConstants.KeyCodes.RETURN:this._keyHandled=true;this._create ElementFromInput(true);event.returnValue=false;return false;break;case ContactPi ckerConstants.KeyCodes.ESC:if(this._resultsContainer.style.display=="block")setT imeout(Delegate.create(this,this._clearResults),0);else setTimeout(Delegate.crea te(this,this._clearInput),0);this._keyHandled=true;return false;break;case Conta ctPickerConstants.KeyCodes.BACK_BUTTON:if(this._input.value.length==0){if(this._ browserType==ContactPickerConstants.Constants.FIREFOX3||this._browserType==Conta ctPickerConstants.Constants.SAFARI)if(this._currentKeyFocusElt!=-1){this._delete SelectedElt();return}this._deleteElement();this._keyHandled=true}break;case Cont actPickerConstants.KeyCodes.DELETE:if(this._currentKeyFocusElt!=-1)this._deleteS electedElt();break;case ContactPickerConstants.KeyCodes.SHIFT:this._isSpecialKey =true;return;break;case ContactPickerConstants.KeyCodes.KEY_UP:case ContactPicke rConstants.KeyCodes.KEY_DOWN:this._keyHandled=true;this._selectByArrowKeys(b);re turn;break;case ContactPickerConstants.KeyCodes.KEY_LEFT:case ContactPickerConst ants.KeyCodes.KEY_RIGHT:if(this._browserType==ContactPickerConstants.Constants.F IREFOX3)this._inputDiv.focus();this._keyDownForContainer(b)}if(c)this._keyUp(b)} ,_selectByKeyboard:function(a){if(a!=ContactPickerConstants.KeyCodes.KEY_LEFT&&a !=ContactPickerConstants.KeyCodes.KEY_RIGHT)return;if(ContactPickerCore.isRTL)if (a==ContactPickerConstants.KeyCodes.KEY_LEFT)a=ContactPickerConstants.KeyCodes.K EY_RIGHT;else if(a==ContactPickerConstants.KeyCodes.KEY_RIGHT)a=ContactPickerCon stants.KeyCodes.KEY_LEFT;var c=this._input.value,b=this._inputUL.children;if(a== ContactPickerConstants.KeyCodes.KEY_LEFT){if(c=="")if(this._currentKeyFocusElt== -1){if(b.length==2)return;this._currentKeyFocusElt=b.length-2}else if(this._curr entKeyFocusElt>1)this._currentKeyFocusElt--}else if(this._currentKeyFocusElt==-1 )return;else if(this._currentKeyFocusElt+1!=b.length-1)this._currentKeyFocusElt+ +;this._updateSelectedElt(false)},_deleteSelectedElt:function(){if(this._current KeyFocusElt==-1||!this._previousSelectedElt)return;var b=this._previousSelectedE lt.id,a=b.split("$");if(a&&a.length==2)b=a[1];this._currentKeyFocusElt=-1;this._ removeContact({UniqueSelectedElementID:b,FireEvent:true})},_updateSelectedElt:fu nction(a){if(this._currentKeyFocusElt==-1)return;if(this._previousSelectedElt||a )if($containsClass(this._previousSelectedElt,"BlockInvalid"))$removeClass(this._ previousSelectedElt,"SelectedInvalid");else $removeClass(this._previousSelectedE lt,"Selected");if(a){this._currentKeyFocusElt=-1;this._previousSelectedElt=null} else{this._previousSelectedElt=this._inputUL.children[this._currentKeyFocusElt]; if(this._previousSelectedElt){this._inputDiv.scrollTop=this._previousSelectedElt .offsetTop;this._inputDiv.focus();if($containsClass(this._previousSelectedElt,"B lockInvalid"))$addClass(this._previousSelectedElt,"SelectedInvalid");else $addCl ass(this._previousSelectedElt,"Selected")}}},_setInputWidth:function(a){var b=th is._measureString(a);this._input.style.width=b+"px"},_setLoadingIndicator:functi on(){this._resultsContainer.innerHTML='&nbsp;<img class="LoadingIcon" src="'+Con tactPickerStrings.loadingSmallImg+'"/>';this._resultsContainer.style.display="bl ock";this._isWaitingOnReadyNotification=true},_doSearch:function(){if(this.synch

ResultsDropDownWidthToSearchBox&&this._inputDiv)this._setResultsDropDownWidth(th is._inputDiv.offsetWidth);this._setInputWidth(this._input.value);var b=this._inp ut.value.toLowerCase(),a=b.charCodeAt(0);if(!this._isReady){this._setLoadingIndi cator();return}var d=ContactPickerCore.searchIndex[a];if(!d){this._clearResults( );return}var c=this._getContactRows(a,b);if(c!=""){if(this._resultsContainer){th is._resultsContainer.innerHTML=['<table cellpadding="0" cellspacing="0" class="R esultsTable">',c,"</table>"].join("");if(this._resultsContainer.style.display!=" block"){this._resultsContainer.style.display="block";Microsoft.Live.ContactPicke r.Util.instrumentWrapper(ContactPickerConstants.Instrumentation.ShowAutoComplete )}}this._selectRow(0);if(this._browserType==ContactPickerConstants.Constants.IE) setTimeout(Delegate.create(this,this._selectFirstRow),50);this._resultsContainer .scrollTop=0}else this._clearResults()},_selectFirstRow:function(){this._selectR ow(0)},_selectByArrowKeys:function(a){if(a==ContactPickerConstants.KeyCodes.KEY_ DOWN){if(this._currentAutoCompleteSelectedIndex<this._resultRowCount-1)this._sel ectRow(this._currentAutoCompleteSelectedIndex+1)}else if(this._currentAutoComple teSelectedIndex>0)this._selectRow(this._currentAutoCompleteSelectedIndex-1)},_se lectRow:function(d){this._lastAutoCompleteSelectedIndex=this._currentAutoComplet eSelectedIndex;this._currentAutoCompleteSelectedIndex=d;if(this._lastAutoComplet eSelectedIndex!=ContactPickerConstants.Constants.NONE){var b=_ge(this._instanceN ame+"$R"+(this._lastAutoCompleteSelectedIndex+1));if(b)this._onResultLeave(b)}if (this._currentAutoCompleteSelectedIndex!=ContactPickerConstants.Constants.NONE){ var c=_ge(this._instanceName+"$R"+(this._currentAutoCompleteSelectedIndex+1));if (c)this._onResultHover(c);if(this._currentAutoCompleteSelectedIndex>this._scroll BottomAnchor)this._scrollBottomAnchor=this._currentAutoCompleteSelectedIndex;if( this._currentAutoCompleteSelectedIndex<this._scrollBottomAnchor-this._rowsPerCon tainer)this._scrollBottomAnchor=this._currentAutoCompleteSelectedIndex+(this._ro wsPerContainer+1);if(this._lastAutoCompleteSelectedIndex!=ContactPickerConstants .KeyCodes.NONE_SELECTED)if(this._currentAutoCompleteSelectedIndex>this._lastAuto CompleteSelectedIndex){if(this._currentAutoCompleteSelectedIndex>=this._scrollBo ttomAnchor){var a=_ge(this._instanceName+"$R"+(this._currentAutoCompleteSelected Index-this._rowsPerContainer));if(a)this._resultsContainer.scrollTop=a.offsetTop }}else if(this._currentAutoCompleteSelectedIndex<this._scrollBottomAnchor-this._ rowsPerContainer){var a=_ge(this._instanceName+"$R"+(this._currentAutoCompleteSe lectedIndex+1));if(a)this._resultsContainer.scrollTop=a.offsetTop}}},_addAbchEle ment:function(a,k,e){var h="",j="";if(a.isCategory||a.isGroup){h="<b>";j="</b>"} if(a._isNew){a._clientID=ContactPickerConstants.Constants.NONE;a._selectedElemen tID=a._clientID}var m=this._inputUL;if(a._uniqueSelectedElementID==0)a._uniqueSe lectedElementID=++this._uniqueElementID;var c,f;if(!a.isValid){c="BlockInvalid"; f="BlockEmailInvalid"}else{c="Block";f="BlockEmail"}var b="";if(e)b=Microsoft.Li ve.ContactPicker.Util.concat('<li class="',c,'" id="',this._instanceName,"$",a._ uniqueSelectedElementID,'">');if(a.isCategory&&(a._isNew||a.users.length>0)){b+= Microsoft.Live.ContactPicker.Util.concat('<img class="ExpandCategory" alt="',Con tactPickerStrings.expandCategory,'" title="',ContactPickerStrings.expandCategory ,'" border="0" src="'+ContactPickerStrings.expandAcImg+"\" onclick=\"if(window.C ontrol)Control.invoke('Microsoft.Live.ContactPicker.AutoComplete', '_doExpansion ', event,{'id':",a._clientID,", 'UniqueSelectedElementID':",a._uniqueSelectedEle mentID,", 'FireEvent':true",", 'ExpandDuplicates':false",'})"/>');if(this.autoEx pandCategories){var l=this;setTimeout(function(){l._doExpansion({id:a._clientID, UniqueSelectedElementID:a._uniqueSelectedElementID,FireEvent:true,ExpandDuplicat es:false})},0)}}if(a.fullName!="")b+=Microsoft.Live.ContactPicker.Util.concat('< span class="BlockName">',h,a.fullName,j,"</span>");var g="",i="";if(a.fullName!= null&&a.fullName!=""&&a.email!=null&&a.email!=""){g="<span dir='ltr'>(</span>";i ="<span dir='ltr'>)</span>"}if(!a.isCategory)b+=Microsoft.Live.ContactPicker.Uti l.concat('<span class="'+f+'">',g,a.email,i,"</span>");b+=Microsoft.Live.Contact Picker.Util.concat('<img class="CloseLi" alt="',ContactPickerStrings.removeConta ct,'" title="',ContactPickerStrings.removeContact,'" border="0" src="'+ContactPi ckerStrings.deleteContactImg+"\" onclick=\"if(window.Control)Control.invoke('Mic rosoft.Live.ContactPicker.AutoComplete', '_removeContactAndSetFocus', event,","{ 'UniqueSelectedElementID':"+a._uniqueSelectedElementID+",'FireEvent':true}",')"/ >');if(e)b+="</li>";this.selectedAbchElements.add(a);if(e)return b;else{this._re

set();var d=document.createElement("li");d.className=c;d.id=Microsoft.Live.Conta ctPicker.Util.concat(this._instanceName,"$",a._uniqueSelectedElementID);d.innerH TML=b;this._inputUL.insertBefore(d,this._inputBoxLi)}if(k==true)setTimeout(Deleg ate.create(this,this._setInputFocus),50)},_removeContactAndSetFocus:function(a){ this._removeContact(a);$callFocus(this._input);this._acCancelBubble()},_setInput Focus:function(){try{this._input.focus()}catch(b){}if(this._browserType==Contact PickerConstants.Constants.SAFARI)this._inputDiv.scrollTop=this._input.offsetTop; if(this._input.createTextRange){var a=this._input.createTextRange();a.moveStart( "character",this._input.value.length);a.collapse();a.select()}},_getContactEltBy Email:function(a){a=Microsoft.Live.ContactPicker.Util.htmlEncode(a);a=a.toLowerC ase();var g=a.charCodeAt(0),e=ContactPickerCore.searchIndex[g];if(!e)return null ;for(var f=e.length;f--;){var h=e[f],b=new AbchElement(h),c=b.getEmailArray();if (!c)continue;for(var d=c.length;d--;)if(c[d].toLowerCase()==a){b.email=c[d];b.em ailIndex=d;return b}}return null},_getContactRows:function(s,f){var j=[],z=Conta ctPickerCore.contactData,h=0,m=[],r;f=f.toLowerCase();try{r=ContactPickerCore.se archIndex[s].length}catch(A){return ""}var l=Microsoft.Live.ContactPicker.Util.h tmlEncode(f),q=l.length;for(var v=r;v--;){var n=ContactPickerCore.searchIndex[s] [v],u=document.createElement("div"),c=new AbchElement(n,true);u.innerHTML=c.full Name;var a=u.innerText,g=false,e=false,y="(^|\\s)"+Microsoft.Live.ContactPicker. Util.escapeRegex(f),k;try{k=new RegExp(y,"i")}catch(A){return}var o=k.exec(a);if (o){var w=o.length;a=Microsoft.Live.ContactPicker.Util.htmlEncode(a.replace(k,"1 AUTOCOMPLETEPLACEHOLDERUNIQUE"));for(var p=0;p<w;p++)a=a.replace(/1AUTOCOMPLETEP LACEHOLDERUNIQUE/,"<b>"+Microsoft.Live.ContactPicker.Util.htmlEncode(o[p])+"</b> ");if(a.indexOf(" ")==0)a=a.substring(1,a.length);g=true}else a=Microsoft.Live.C ontactPicker.Util.htmlEncode(a);k=null;var i=0;if(c._emailArray){i=c._emailArray .length;if(!g)for(var d=0;d<i;d++){b=c._emailArray[d];if(b!=null&&b.toLowerCase( ).indexOf(l)==0){e=true;break}}}if(f.length>1)if(!(g||e))continue;if(i==0){var b =c.isSpacesFriend?Microsoft.Live.ContactPicker.Util.getPrivateMessageString():"" ;this._populateContactRow(j,++h,n,0,c._clientID,a,b);m[h]=j.join("")}else{var t= c.isSpacesFriend;for(var d=0;d<i;d++){var b=c._emailArray[d];e=false;if(!g&&b.to LowerCase().indexOf(l)==0){b=Microsoft.Live.ContactPicker.Util.concat("<b>",b.su bstring(0,q),"</b>",b.substring(q,b.length));e=true}if(g||e){if(a==""&&b!="")a=b ;else if(a!=""&&b=="")if(t)b=ContactPickerStrings.privateMessage;this._populateC ontactRow(j,++h,n,d,c._clientID,a,b,t);m[h]=j.join("")}}}delete c}this._resultRo wCount=h;var x=m.join("");return x},_populateContactRow:function(a,m,k,j,n,l,g,h ){var e="ResultRow",d="",c="",b="</td>",f='<td class="PadderBorderRight">';if(th is.synchResultsDropDownWidthToSearchBox){if(this._displayResultsInOneColumn)e="R esultRow ResultRowOneColumn";if(this._resultsDropDownContactNameWidth!="")c=Micr osoft.Live.ContactPicker.Util.concat(' style="width:',this._resultsDropDownConta ctNameWidth,'"');if(this._resultsDropDownEmailWidth!="")d=Microsoft.Live.Contact Picker.Util.concat(' style="width:',this._resultsDropDownEmailWidth,'"');if(this ._displayResultsInOneColumn){f="";b=""}}a[0]=Microsoft.Live.ContactPicker.Util.c oncat('<tr id="',this._instanceName,"$R",m,'"',' cid="',k,'" eid="',j,'" class=" ',e,"\" onmouseover=\"if(window.Control)Control.invoke('Microsoft.Live.ContactPi cker.AutoComplete', '_onResultHover', event, this)\" onmouseout=\"if(window.Cont rol)Control.invoke('Microsoft.Live.ContactPicker.AutoComplete', '_onResultLeave' , event, this)\"");a[1]=" onclick=\"if(window.Control)Control.invoke('Microsoft. Live.ContactPicker.AutoComplete', '_rowClickHandler', event)\">";a[2]=Microsoft. Live.ContactPicker.Util.concat('<td class="PadderBorderLeft"><div ',c,' class="C ontactName">',l,"</div>",b);var i=h?' title="'+ContactPickerStrings.pmtt+'"':""; a[3]=Microsoft.Live.ContactPicker.Util.concat(f,"<div",i,d,' class="ContactEmail ">',g?g:"&nbsp;","</div>",b);if(this._displayResultsInOneColumn)a[4]="</td></tr> ";else a[4]="</tr>"},_onResultHover:function(b){if(!b)return;$addClass(b,"Hover" );var a=b.children;if(a)if(this._displayResultsInOneColumn)$addClass(a[0],"Hover BorderOneColumn");else{$addClass(a[0],"HoverBorderLeft");$addClass(a[1],"HoverBo rderRight")}},_onResultLeave:function(b){if(!b)return;$removeClass(b,"Hover");va r a=b.children;if(a)if(this._displayResultsInOneColumn)$removeClass(a[0],"HoverB orderOneColumn");else{$removeClass(a[0],"HoverBorderLeft");$removeClass(a[1],"Ho verBorderRight")}},_acCancelBubble:function(){if(event){event.cancelBubble=true; event.returnValue=false}},_doExpansion:function(d){this._acCancelBubble();Micros

oft.Live.ContactPicker.Util.instrumentWrapper(ContactPickerConstants.Instrumenta tion.ExpandCategory);var c=[],n=d["id"],o=d["UniqueSelectedElementID"],q=d["Expa ndDuplicates"],f=new AbchElement(n),p=f.users.length,b,m=d["FireEvent"],i=this.s electedAbchElements.length;for(var a=0;a<i;a++){var g,j=this.selectedAbchElement s[a];if(q)g=j._clientID==n;else g=j._uniqueSelectedElementID==o;if(g)for(var e=0 ;e<p;e++){b=new AbchElement(f.users[e]);b._selectedElementID=Microsoft.Live.Cont actPicker.Util.concat(b._clientID,"-0");c.add(b)}else{b=this.selectedAbchElement s[a];c.add(b)}}this._inputUL.innerHTML=this._inputULInitialContents;this._inputB oxLi=_ge(this._instanceName+"$InputBoxLi");this._input=_ge(this._instanceName+"$ InputBox");this.selectedAbchElements=null;this.selectedAbchElements=[];var r=c.l ength,k=false;for(a=0;a<r;a++){var i=this.selectedAbchElements.length,l=false;if (!ContactPickerCore.allowDuplicateSelection)for(var h=0;h<i;h++)if(this.selected AbchElements[h]._selectedElementID==c[a]._selectedElementID){l=true;break}if(!l) {this._addAbchElement(c[a],false);k=true}}if(m&&k){this.fireEvent("onCategoryExp and",[this,f]);m=false}this._persistState();setTimeout(Delegate.create(this,this ._setInputFocus),50)},_onSearchIndexReady:function(){if(!this._isReady)this._pre select();this._isReady=true;if(this._isWaitingOnReadyNotification){this._isWaiti ngOnReadyNotification=false;this._doSearch("")}if(this._pasteWhileInitializing)t his._doPaste()},_isTypeElementMatch:function(b,a){switch(b){case ContactPickerCo nstants.Constants.PEOPLE:if(!a.isCategory)return true;break;case ContactPickerCo nstants.Constants.FAVORITES:if(a.isFavorite)return true;break;case ContactPicker Constants.Constants.CATEGORIES:if(a.isCategory)return true}return false},hmAddEl ementsByString:function(){},_addElementsByString:function(d){if(!d)return;var g= new RegExp(this._emailPattern,"gi"),c=null,e=false;while((c=g.exec(d))!=null){va r a=c[0];if(!a)continue;if(a.charAt(0)=="'"){var f=c!=null&&c.index>=0?c.index:d .indexOf(a);if(f!=-1)if(d.charAt(f+a.length)=="'")a=a.slice(1)}var b=this._getCo ntactEltByEmail(a);if(!b){b=new AbchElement;b.email=Microsoft.Live.ContactPicker .Util.htmlEncode(a);b._clientID=ContactPickerConstants.Constants.NONE;if(b.fullN ame==""&&b.email!="")b.isValid=this._isEmailAndDomainValid(a)||this._isInWhiteLi st(a,false)}this._addAbchElement(b,false);this._persistState();this._scrollInput ToBottom();this.fireEvent("onContactAdded",[this,b]);e=true}return e},_getBetwee n:function(c,e,d){var b,a,b=c.indexOf(e,0);if(b>-1){a=c.indexOf(d,b+1);if(a==-1| |d=="")a=c.length}if(b>-1&&a>-1&&a>b)return c.substring(b+1,a);return ""},dispos e:function(){Control.destroy(this);this._elt=null},setFocus:function(){this._set InputWidth(this._input.value);setTimeout(Delegate.create(this,this._setInputFocu s),50)},onContactAddedHandler:function(b,a){a._selectedElementID=Microsoft.Live. ContactPicker.Util.concat(a._clientID,"-",a.emailIndex);this._addAbchElement(a,f alse);this._persistState();this._scrollInputToBottom()},onContactRemovedHandler: function(e,a){var d=this.selectedAbchElements.length;if(a.email==null)a.email="" ;for(var c=d;c--;){var b=this.selectedAbchElements[c];if(b._clientID==a._clientI D&&b.email==a.email)this._removeContact({UniqueSelectedElementID:b._uniqueSelect edElementID,FireEvent:false})}this._persistState();this._scrollInputToBottom()}, onAllDeselectedHandler:function(e,d){var c=this.selectedAbchElements.length;for( var b=c;b--;){var a=this.selectedAbchElements[b];if(a&&a.getClientId()!=ContactP ickerConstants.Constants.NONE&&this._isTypeElementMatch(d,a))this._removeContact ({UniqueSelectedElementID:a._uniqueSelectedElementID,FireEvent:false})}this._per sistState();this._scrollInputToBottom()},onAllSelectedHandler:function(j,i){var f="",h=ContactPickerCore.contactData.length;for(var d=0;d<h;d++){var b=new AbchE lement(d,false);if(!this._isTypeElementMatch(i,b))continue;if(b.isCategory)email Count=1;else emailCount=b._emailArray.length;if(emailCount)for(var c=0;c<emailCo unt;c++){var a=new AbchElement(d,false,c);if(!this._isAlreadySelected(a)){a._sel ectedElementID=Microsoft.Live.ContactPicker.Util.concat(a._clientID,"-",c);f+=th is._addAbchElement(a,false,true)}delete a}else f+=this._addAbchElement(b,false,t rue)}var g=Microsoft.Live.ContactPicker.Util.concat(this._instanceName,"$InputBo xLi"),e=_ge(g);this._inputUL.removeChild(e);this._inputUL.innerHTML+=f;this._inp utUL.appendChild(e);this._inputBoxLi=e;g=Microsoft.Live.ContactPicker.Util.conca t(this._instanceName,"$InputBox");this._input=_ge(g);this._persistState();this._ scrollInputToBottom()},associateControl:function(a){this._onContactAddedDelegate =Delegate.create(this,this.onContactAddedHandler);this._onContactRemovedDelegate =Delegate.create(this,this.onContactRemovedHandler);this._onAllSelectedDelegate=

Delegate.create(this,this.onAllSelectedHandler);this._onAllDeselectedDelegate=De legate.create(this,this.onAllDeselectedHandler);a.attachEvent("onContactAdded",t his._onContactAddedDelegate);a.attachEvent("onContactRemoved",this._onContactRem ovedDelegate);a.attachEvent("onAllSelected",this._onAllSelectedDelegate);a.attac hEvent("onAllDeselected",this._onAllDeselectedDelegate);this._associatedControl= a},detachAssociatedCPEvents:function(a){if(!this._onContactAddedDelegate)return; var a=this._associatedControl;a.detachEvent("onContactAdded",this._onContactAdde dDelegate);a.detachEvent("onContactRemoved",this._onContactRemovedDelegate);a.de tachEvent("onAllSelected",this._onAllSelectedDelegate);a.detachEvent("onAllDesel ected",this._onAllDeselectedDelegate)},_getMatchesArray:function(h){if(h==0)retu rn;var c="";for(var d=0;d<h;d++){var a=this.selectedAbchElements[d];if(a.isCateg ory)c+=a.fullName+";";else c+=a.email+";"}c=c.toLowerCase();var k=ContactPickerC ore.contactData.length,e=[],i=0;for(d=k;d--;){var a=new AbchElement(d);if(!a.isG roup){var b;if(a.isCategory){b=a.fullName+";";b=b.toLowerCase();if(c.indexOf(b)> -1){e[b]=a;i++}continue}else b=a.email+";";var g=a.getEmailArray();if(g)for(var f=g.length;f--;){var j=g[f];b=j+";";b=b.toLowerCase();if(c.indexOf(b)>-1){a.emai lIndex=f;a.email=j;e[b]=a;i++}}}}return e}};Microsoft.Live.ContactPicker.AutoCom plete.createClass("Microsoft.Live.ContactPicker.AutoComplete");Events.addEventin g(Microsoft.Live.ContactPicker.AutoComplete)

S-ar putea să vă placă și