function ConduitScriptRequest(fullUrl){this.fullUrl = fullUrl;this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();this.headLoc = document.getElementsByTagName("head").item(0) || document.body;this.scriptId = 'YJscriptId' + ConduitScriptRequest.scriptCounter++;this.buildScriptTag();try{this.addScriptTag();}catch (e){AddLoadMethod(this.addScriptTag);}}ConduitScriptRequest.scriptCounter = 1;ConduitScriptRequest.prototype ={buildScriptTag: function(){this.scriptObj = document.createElement("script");this.scriptObj.setAttribute("type","text/javascript");this.scriptObj.setAttribute("src",this.fullUrl + this.noCacheIE);this.scriptObj.setAttribute("id",this.scriptId);},removeScriptTag: function(){try{if (/MSIE ([0-6])/.test(window.navigator.userAgent)){return;}else{this.headLoc.removeChild(this.scriptObj);}}catch (e){}},addScriptTag: function(){this.headLoc.appendChild(this.scriptObj);}};ConduitTrackingRequest ={LogRequest: function(fullUrl){var tracker = document.getElementById('loggerObj');if (!tracker){var div = document.createElement('div');div.id = 'loggerObj';div.style.width = '1px';div.style.height = '1px';document.body.appendChild(div);tracker = div;}tracker.innerHTML = '';}};var ConduitLogger ={loggerUrl: 'http://usage.apps.conduit-services.com/report.ashx',source: 0,originPageSource: 0,requestId: null,Language:'en',LogAction: function(type,sharedItemId,actionType,channel,extra,source){try{var strUrl = ConduitLogger.loggerUrl + '?type=' + type;strUrl += '&itemid=' + sharedItemId + '&originPageSource=' + ConduitLogger.originPageSource + '&source=' + (source || ConduitLogger.source);strUrl += '&actionType=' + actionType + '&channel=' + (channel || '') + (extra || '');strUrl += '&requestId=' + (ConduitLogger.requestId || '');strUrl += '&lang=' + ConduitLogger.Language;strUrl += "&rnd=" + Math.random(9999);ConduitTrackingRequest.LogRequest(strUrl);}catch (e){}},LogUsage: function(sharedItemId,targetId,targetType,actionType,channel,source){this.LogAction('logusage',sharedItemId,actionType,channel,'&targetType=' + targetType + '&targetCTID=' + targetId,source);}};var ConduitUsageLogger ={usageLoggerUrl: 'http://apps.conduit.com/MCPContent/Services/UsageLogger.ashx',LogUsage: function(itemId,source){try{var requestData = ConduitUsageLogger.usageLoggerUrl + "?itemID=" + itemId + "&source=" + source;var req = new ConduitScriptRequest(requestData);window.setTimeout(function(){req.removeScriptTag.apply(req);},3000);}catch (e){}}};String.format = String.format || function(text){if (arguments.length <= 1 || !text) return text;var tokenCount = arguments.length - 2;for (var token = 0;token <= tokenCount;token++)text = text.replace(new RegExp("\\{" + token + "\\}","gi"),arguments[token + 1]);return text;};regNs = function(f){var d = window,c = f.split(".");for (var b = 0;b < c.length;b++){var e = c[b],a = d[e];if (!a){a = d[e] ={__namespace: true,__typeName: c.slice(0,b + 1).join(".")};a.getName = function(){return this.__typeName;};}d = a;}};regNs('SharedItems');regNs('SharedItems.Dialogs');function AddLoadMethod(method,winLoad){if (winLoad || !window.allowEarlyShow){if (window.afterLoad){method();return;}if (typeof (window.addEventListener) !== 'undefined') window.addEventListener('load',method,false);else window.attachEvent('onload',method);}else{if (window.initLoaded)method();else{if (!window.initMethods){window.initMethods = new Array();}window.initMethods.push(method);}}}SharedItems.ElementBuilder = function(type,props,parent){this._type = type;this._props = props;this._parent = parent;this._children = new Array();this._element = document.createElement(type);if (props !== null){for (x in props){if (x === 'style'){for (st in props[x]){this._element.style[st] = props[x][st];}}else{this._element[x] = props[x];}}}};SharedItems.ElementBuilder.prototype ={get_type: function(){return this._type;},get_props: function(){return this._props;},get_parent: function(){return this._parent;},get_element: function(){return this._element;},get_children: function(){return this._children;},add: function(type,props,name){var newItem = new SharedItems.ElementBuilder(type,props,this);this._element.appendChild(newItem.get_element());if (props && props.name)this._element.name = props.name;if (name)this._children[name] = newItem;else this._children.push(newItem);return newItem;},addRange: function(items){for (var idx = 0;idx < items.length;idx++){var x = items[idx];this.add(x.type,x.props,x.name);}return this;},addText: function(text){var tElm = document.createTextNode(text);this._element.appendChild(tElm);return this;},clear: function(){for (x in this._children){if (typeof this._children[x] === 'function') continue;this._element.removeChild(this._children[x]._element);}this._children = new Array();this._element.innerHTML = '';},deleteItem: function(){return this.get_parent().remove(this);},remove: function(item){this._element.removeChild(item._element);var arr = this._children;for (var idx = 0;idx < arr.length;idx++){if (arr[idx] === item){arr.splice(idx,1);break;}}return this;},findChild: function(name,recursive){if (this._children[name])return this._children[name];if (recursive){for (x in this._children){if (typeof this._children[x] === 'function') continue;var ret = this._children[x].findChild(name,true);if (ret)return ret;}}return null;}};SharedItems.Dialogs.Inwin = function(element){var self = this,topOffset = 50;element.style.position = "absolute";var opc = 0.5;var blocker = new SharedItems.ElementBuilder('div',{style:{border: 'medium none',margin: '0pt',padding: '0pt',zIndex: 1000,width: '100%',height: '100%',top: '0pt',left: '0pt',backgroundColor: 'rgb(110, 110, 110)',opacity: opc,MozOpacity: opc,KhtmlOpacity: opc,filter: "alpha(opacity=" + (opc * 100) + ")",cursor: 'default',position: 'absolute',display: 'none'},className: 'blockUI blockOverlay'});var positionHorizontal = function(width){element.style.visibility = "hidden";element.style.display = "block";if (!width){element.style.left = "50%";element.style.marginLeft = "-" + parseInt(((element.offsetWidth) / 2),10) + "px";}else{var xPos = parseInt((getViewPortWidth() / 2), 10) - parseInt((width / 2),10);element.style.left = xPos + getScrollOffset(true) + "px";}element.style.visibility = "visible";element.style.display = "none";};var positionVertical = function(height){element.style.visibility = "hidden";element.style.display = "block";var yPos = parseInt((getViewPortHeight() / 2), 10) - parseInt(((height || element.offsetHeight) / 2),10);if (yPos < 10) yPos = 10;element.style.top = yPos + getScrollOffset(false) + "px";element.style.visibility = "visible";element.style.display = "none";};function getViewPortWidth(){var viewportwidth;if (typeof window.innerWidth != 'undefined'){viewportwidth = window.innerWidth;}else if (typeof document.documentElement != 'undefined'&& typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth !== 0){viewportwidth = document.documentElement.clientWidth;}else{viewportwidth = document.getElementsByTagName('body')[0].clientWidth;}return viewportwidth;}function getViewPortHeight(){var viewportheight;if (typeof window.innerHeight != 'undefined'){viewportheight = window.innerHeight;}else if (typeof document.documentElement != 'undefined'&& typeof document.documentElement.clientHeight !='undefined' && document.documentElement.clientHeight !== 0){viewportheight = document.documentElement.clientHeight;}else{viewportheight = document.getElementsByTagName('body')[0].clientHeight;}return viewportheight;}var getScrollHeight = function(){var B = document.body;var D = document.documentElement;D = (D.clientHeight) ? D : B;return D.scrollHeight;};var getScrollOffset = function(h){if (!h && typeof pageYOffset !== 'undefined'){return pageYOffset;}else if (h && typeof pageXOffset !== 'undefined'){return pageXOffset;}else{var B = document.body;var D = document.documentElement;D = (D.clientHeight) ? D : B;return h ? D.scrollLeft : D.scrollTop;}};var win_resize = function(){var height = getViewPortHeight();var h2 = getScrollHeight();if (h2 > height) height = h2;blocker._element.style.height = (height > document.body.offsetHeight ? height : document.body.offsetHeight) + 'px';};var clearOverlay = function(){document.body.className = document.body.className.replace(/(overlay_mode[\s])|(overlay_mode$)/,'');};var addOverlay = function(){clearOverlay();document.body.className += document.body.className ? ' overlay_mode' : 'overlay_mode';};this.show = function(width,height){positionHorizontal(width);positionVertical(height);blocker._element.style.zIndex = 10000;blocker._element.style.display = "block";SharedItems.Dialogs.Manager.AttachEvent(window,'onresize',win_resize);element.style.zIndex = 10001;addOverlay();element.style.display = "block";win_resize();window.setTimeout(win_resize,100);};this.hide = function(){element.style.display = "none";blocker._element.style.display = "none";SharedItems.Dialogs.Manager.DetachEvent(window,'onresize',win_resize);clearOverlay();};var appendFunc = function(){document.body.appendChild(element);document.body.appendChild(blocker._element);};if (SharedItems.Dialogs.Inwin.windowLoaded || window.initLoaded)appendFunc();else AddLoadMethod(appendFunc);};SharedItems.Dialogs.Inwin.windowLoaded = false;AddLoadMethod(function(){SharedItems.Dialogs.Inwin.windowLoaded = true;});SharedItems.Dialogs.Dialog = function(){this._element = new SharedItems.ElementBuilder('div',{className: 'dialogs',style:{position: 'absolute',width: '481px',zIndex: 2,display: 'none'}});this._element.add('div',{className: 'inwin'},'inwin').add('div',{className: 'get_component'},'main');var elm = this._element.findChild('main',true);elm.add('div',{className: 'inwin_header'},'header').addRange([{type: 'span',props:{className: 'title',innerHTML: 'Get App'},name: 'title'},{type: 'a',props:{className: 'btn_close',innerHTML: 'Close',href: "javascript:void(0);"},name: 'close'}]);var bodyT = elm.add('div',{className: 'inwin_body'},'body').add('div',{className: 'clearfix'});bodyT.add('div',{className: 'left_image'},'contentImage').add('span',{className: 'bg_get_component'});var t = bodyT.add('div',{className: 'text'},'text').add('div',null,'content').get_parent().add('p',{className: 'button_holder'},'buttons');this.add_Button('addButton','OK',0);this.add_Button('cancelButton','Cancel',1);this._added = false;this._inwin = new SharedItems.Dialogs.Inwin(this._element.get_element());};SharedItems.Dialogs.Dialog.prototype ={set_buttonLink: function(name,href,target){var but = this._element.findChild(name,true);if (but != null){var elm = but.get_element();elm.href = href;elm.target = target;}},add_Button: function(name,text,type){var but = this._element.findChild('buttons',true);if (but){switch (type){case 0:var nBut = but.add('a',{className: 'button_1',style:{cursor: 'pointer'}},name);nBut.add('span',null,name + '_Text').addText(text);return nBut;case 1:return but.add('a',{innerHTML: text,className: 'lnk_cancel',href: "javascript:void(0);"},name);break;}}},get_itemText: function(item){var ttl = this._element.findChild(item,true);if (ttl)return ttl.get_element().innerHTML;},set_itemText: function(item,value){var ttl = this._element.findChild(item,true);if (ttl)ttl.get_element().innerHTML = value;},_trimText: function(value,maxLength){if (value && value.length > maxLength)value = value.substr(0,maxLength - 3) + '...';return value;},get_title: function(){return this.get_itemText('title');},set_title: function(value){this.set_itemText('title',this._trimText(value,30));},get_content: function(){return this._element.findChild('content',true);},get_okText: function(){return this.get_itemText('addButton_Text');},set_okText: function(value){this.set_itemText('addButton_Text',('' + value).replace(' ',' '));},get_cancelText: function(){return this.get_itemText('cancelButton');},set_cancelText: function(value){this.set_itemText('cancelButton',value);},set_okClick: function(value){var okBut = this._element.findChild('addButton',true);if (okBut)okBut.get_element().onclick = value;},set_closeClick: function(value){var cancelBut = this._element.findChild('cancelButton',true);if (cancelBut)cancelBut.get_element().onclick = value;cancelBut = this._element.findChild('close',true);if (cancelBut)cancelBut.get_element().onclick = value;},get_buttons: function(){return this._element.findChild('buttons',true);},show: function(onok,oncancel){var me = this;this.set_okClick(function(){me._inwin.hide();if (onok) onok();});this.set_closeClick(function(){me._inwin.hide();if (oncancel) oncancel();});this._inwin.show(481);}};SharedItems.Dialogs.AddComponent = function(){this._dialog = new SharedItems.Dialogs.Dialog();var cont = this._dialog.get_content();this._dialog.set_okText('Yes');cont.add('div').add('em',null,'name').get_parent().addText(' is about to be added to your toolbar.').get_parent().addText('Would you like to continue?');};SharedItems.Dialogs.AddComponent.prototype ={get_name: function(){return this._dialog.get_itemText('name');},set_name: function(value){this._dialog.set_itemText('name',value);},show: function(item,onok,oncancel){this.set_name(item.title);this._dialog.show(onok,oncancel);}};SharedItems.Dialogs.AddToolbar = function(){this._dialog = new SharedItems.Dialogs.Dialog();var cont = this._dialog.get_content();this._dialog.set_okText('OK, I want it');};SharedItems.Dialogs.AddToolbar.prototype ={show: function(item,onok,oncancel){this._dialog.set_title('Get ' + item.title);this._dialog.set_itemText('content',String.format('It comes with the {0} community toolbar.
Do you want to get the toolbar?',item.provider));this._dialog.show(onok,oncancel);}};SharedItems.Dialogs.Unsupported = function(){this._dialog = new SharedItems.Dialogs.Dialog();var cont = this._dialog.get_content();var bdy = this._dialog._element.findChild('body',true);bdy.findChild('contentImage',true).deleteItem();bdy.findChild('addButton',true).deleteItem();this._dialog.set_cancelText('Get Internet Explorer');bdy.findChild('buttons',true).add('span',{style:{marginRight: '19px',paddingRight: '1px'}});this._dialog.add_Button('addButton','Get Firefox',1);this._dialog.set_buttonLink('addButton','http://www.mozilla.com/firefox/','_blank');this._dialog.set_buttonLink('cancelButton','http://www.microsoft.com/windows/internet-explorer/default.aspx','_blank');this._dialog.set_title("We're sorry...");cont.get_parent().get_element().className = 'fulltext';cont.add('div',{className: 'strong'}).addText("You cannot add this app to your current browser.");cont.addText('We recommend that you visit this page using Microsoft Internet Explorer').add('br');cont.addText('or Mozilla Firefox.');};SharedItems.Dialogs.Unsupported.prototype ={show: function(onok,oncancel){this._dialog.show(onok,oncancel);}};SharedItems.Dialogs.AddEngine = function(){this._dialog = new SharedItems.Dialogs.Dialog();var cont = this._dialog.get_content();cont.add('span',{style:{display: 'block',width: '100%',border: '1px #000'}}).addText("The app you're about to install requires Conduit Engine. Once you've installed Conduit Engine on your computer, you'll be able to instantly add apps from all over the Web with no additional installation.");this._dialog.set_okText('OK, I want it');this._dialog.set_cancelText('Cancel');};SharedItems.Dialogs.AddEngine.prototype ={show: function(item,onok,oncancel){this._dialog.set_title('Get ' + item.title);this._dialog.show(onok,oncancel);}};SharedItems.Dialogs.SelectTarget = function(){this._dialog = new SharedItems.Dialogs.Dialog();var cont = this._dialog.get_content();this._dialog.set_okText('+ Add');cont.addText('Which toolbar do you want to add this app to?').add('div',{className: 'radio_wrapper radio_horizontal_d'},'radios');};SharedItems.Dialogs.SelectTarget.prototype ={IsIE: function(){return (window.navigator.userAgent.indexOf("MSIE") > 0);},get_radios: function(){return this._dialog.get_content().findChild('radios',true);},addTarget: function(radios,target,selected){var id = target.get_id();var cName = ' ';var iName = 'input';if (this.IsIE()){iName = '';}var t = radios.add('div',{className: 'clearfix ' + target.get_className()}).addRange([{type: iName,props:{className: cName,type: 'radio',name: 'radio_target',id: 'radio_' + id},name: id},{type: 'label',props:{htmlFor: 'radio_' + id,innerHTML: target.get_name()}}]);if (selected)t.findChild(id).get_element().checked = true;return t;},show: function(item,targets,onok,oncancel){this._dialog.set_title('Add ' + item.title);var cont = this.get_radios();cont.clear();var bSel = true;for (var i = 0;i < targets.length;i++){this.addTarget(cont,targets[i],bSel);bSel = false;}var ok = function(){var target = null;for (var i = 0;i < targets.length;i++){var inpt = cont.findChild(targets[i].get_id(),true);if (inpt && inpt.get_element().checked){target = targets[i];break;}}if (onok)onok(target);};this._dialog.show(ok,oncancel);}};SharedItems.LogTypes ={Added: 1,EngineAdd: 2,EngineDownload: 3};SharedItems.TargetContainer = function(name,id,type,className){this._name = name;this._id = id;this._className = className;this._type = type;this._isAdded = false;};SharedItems.TargetContainer.prototype ={get_type: function(){return this._type || 1;},get_name: function(){return this._name;},get_id: function(){return this._id;},get_isAdded: function(){return this._isAdded;},set_isAdded: function(isAdded){this._isAdded = isAdded;},get_className: function(){return this._className || '';},addComponent: function(item){var returnObject;if (this.get_type() === 2){SharedItems.Manager.Logger.LogUsage(item.id,this._id,2,1,item.channel,item.source);var engine = new ConduitWeb.engine();returnObject = engine.addSingleComponent(item.id,item.title,(item.source || SharedItems.Manager.Logger.source));}else{var tBar = new TPI.Toolbar(this._id);SharedItems.Manager.Logger.LogUsage(item.id,this._id,1,1,item.channel,item.source);if (item.alertId){var man = new TPI.Manager();returnObject = man.AddMyStuffAlert(item.alertId,item.provider,(item.source || SharedItems.Manager.Logger.source));}else{returnObject = tBar.AddMyStuffComponent(item.id,item.id,item.title,(item.source || SharedItems.Manager.Logger.source));}}return returnObject.returnValue;}};SharedItems.TargetContainer.ConduitEngine = new SharedItems.TargetContainer('Conduit Engine','ENGINE',2,'engine');SharedItems.TargetContainer.ChromeExtension = new SharedItems.TargetContainer('Chrome Extension','CHROME',3,'chrome');SharedItems.Dialogs.Manager ={GetEventName: function(name){return (name.indexOf('on') == 0) ? name.substring(2,name.length) : name;},AttachEvent: function(obj,eventName,delegate){if (typeof (obj.addEventListener) !== 'undefined'){obj.addEventListener(SharedItems.Dialogs.Manager.GetEventName(eventName),delegate,false);}else{obj.attachEvent(eventName,delegate);}},DetachEvent: function(obj,eventName,delegate){if (typeof (obj.addEventListener) !== 'undefined'){obj.removeEventListener(SharedItems.Dialogs.Manager.GetEventName(eventName),delegate,true);}else if (obj.detachEvent){obj.detachEvent(eventName,delegate);}},addComponenetDialog: null,get_AddComponenetDialog: function(){if (!this.addComponenetDialog)this.addComponenetDialog = new SharedItems.Dialogs.AddComponent();return this.addComponenetDialog;},addEngineDialog: null,get_AddEngineDialog: function(){if (!this.addEngineDialog)this.addEngineDialog = new SharedItems.Dialogs.AddEngine();return this.addEngineDialog;},selectTargetDialog: null,get_SelectTargetDialog: function(){if (!this.selectTargetDialog)this.selectTargetDialog = new SharedItems.Dialogs.SelectTarget();return this.selectTargetDialog;},addToolbarDialog: null,get_AddToolbarDialog: function(){if (!this.addToolbarDialog)this.addToolbarDialog = new SharedItems.Dialogs.AddToolbar();return this.addToolbarDialog;},unsupportedBrowserDialog: null,get_UnsupportedBrowserDialog: function(){if (!this.unsupportedBrowserDialog)this.unsupportedBrowserDialog = new SharedItems.Dialogs.Unsupported();return this.unsupportedBrowserDialog;}};SharedItems.Item = function(id,alertId,title,provider,type,channel,source,providerId,supportsChrome){this.id = id;this.provider = provider;this.type = type;this.title = title;this.alertId = alertId;this.channel = channel;this.source = source;this.providerId = providerId;this.supportsChrome = supportsChrome;};SharedItems.Item.prototype ={id: null,alertId: null,title: null,provider: null,providerId: null,type: null,channel: null,source: null,supportsChrome: false};SharedItems.Manager ={displaySingleTarget: true,__completeEvents: [],attach_complete: function(delegate){if (typeof delegate === 'function')SharedItems.Manager.__completeEvents.push(delegate);},onComplete: function(item,target,download){for (var i = 0;i < SharedItems.Manager.__completeEvents.length;i++){try{SharedItems.Manager.__completeEvents[i](item,target,download);}catch (e){}}},engineUrl: '',toolbarUrlFormat: 'http://CT{0}.ourtoolbar.com/exe/',suggestToolbar: false,isSupportedBrowser: 2,defaultToolbarName: '',defaultToolbarId: 0,enginePrivacyUrl: '',Logger: ConduitLogger,source: null,chromeUrlFormat: 'http://download.chrome.conduit-services.com/?appid={0}',writeDomainUsageLog: false,getSupportedToolbars: function(){var man = new TPI.Manager();var __suportedToolbars = new Array();var tBars = man.GetAllToolbarsInfo();for (var i = 0;i < tBars.length;i++){if (tBars[i].myStuffStatus != 1)continue;__suportedToolbars.push(tBars[i]);}var fSort = function(tb1,tb2){var pubCtid = SharedItems.Manager.source;if (tb1.CTID == pubCtid)return -1;else if (tb2.CTID == pubCtid)return 1;return 0;};__suportedToolbars.sort(fSort);return __suportedToolbars;},get_isSupported: function(item){if (this.isSupportedBrowser == 1) return 1;if (this.isSupportedBrowser == 2 && item.supportsChrome && (item.supportsChrome == 'true' || item.supportsChrome == true)) return 2;return 0;},addComponent: function(item){SharedItems.Manager.writeUsageLog(item.id,item.source);switch (this.get_isSupported(item)){case 2: SharedItems.Manager.Logger.LogUsage(item.id,'CHROME',3,2,item.channel,item.source);SharedItems.Manager.onComplete(item,SharedItems.TargetContainer.ChromeExtension,true);window.location = String.format(SharedItems.Manager.chromeUrlFormat,item.id,encodeURIComponent(item.title),SharedItems.Manager.Logger.originPageSource);break;default: SharedItems.Dialogs.Manager.get_UnsupportedBrowserDialog().show();return;case 1: var toolbars = this.getSupportedToolbars();var targets = new Array();var engine = new ConduitWeb.engine();if (engine.getState() !== ConduitWeb.engineState.notInstalled){targets.push(SharedItems.TargetContainer.ConduitEngine);}else{for (var i = 0;i < toolbars.length;i++){var target = new SharedItems.TargetContainer(toolbars[i].name,toolbars[i].CTID,1);targets.push(target);}}var addFunc = function(tgt){var isAdded = tgt.addComponent(item);tgt.set_isAdded(isAdded);SharedItems.Manager.onComplete(item,tgt,false);};if (targets.length === 0){if (!SharedItems.Manager.suggestToolbar){var dEngine = function(){SharedItems.Manager.Logger.LogUsage(item.id,'ENGINE',2,2,item.channel,item.source);SharedItems.Manager.onComplete(item,SharedItems.TargetContainer.ConduitEngine,true);window.location = String.format(SharedItems.Manager.engineUrl,item.id,encodeURIComponent(item.title),SharedItems.Manager.Logger.originPageSource);};SharedItems.Dialogs.Manager.get_AddEngineDialog().show(item,dEngine);}else{var dToolbar = function(){SharedItems.Manager.Logger.LogUsage(item.id,item.provider,2,2,item.channel,item.source);var target = (item.providerId === 0 || !item.providerId) ?new SharedItems.TargetContainer(SharedItems.Manager.defaultToolbarId,SharedItems.Manager.defaultToolbarName,1): new SharedItems.TargetContainer(item.providerId,item.provider,1);SharedItems.Manager.onComplete(item,target,true);window.location = String.format(SharedItems.Manager.toolbarUrlFormat,item.providerId);};SharedItems.Dialogs.Manager.get_AddToolbarDialog().show(item,dToolbar);}}else if (targets.length == 1){if (SharedItems.Manager.displaySingleTarget){SharedItems.Dialogs.Manager.get_AddComponenetDialog().show(item,function(){addFunc(targets[0]);});}else{addFunc(targets[0]);}}else{SharedItems.Dialogs.Manager.get_SelectTargetDialog().show(item,targets,addFunc);}break;}},addComponentById: function(id,alertId,title,provider,type){this.addComponent(new SharedItems.Item(id,alertId,title,provider,type));},writeUsageLog: function(appId,source){try{if (SharedItems.Manager.writeDomainUsageLog){ConduitUsageLogger.LogUsage(appId,source);}}catch (e){}}};function addCssStyles(path){var headLoc = document.getElementsByTagName("head").item(0) || document.body;var sty = document.createElement('link');sty.setAttribute('href',path);sty.setAttribute('rel','stylesheet');sty.setAttribute('type','text/css');headLoc.appendChild(sty);}regNs('SharedItems.Togo');SharedItems.Togo.Manager ={windowLoaded: false,addLoad: function(delegate,winload){if (winload){if (window.afterLoad) delegate();if (typeof (window.addEventListener) !== 'undefined') window.addEventListener('load',delegate,false);else window.attachEvent('onload',delegate);}else{if (window.initLoaded)delegate();else{if (!window.initMethods){window.initMethods = new Array();}window.initMethods.push(delegate);}}},logImpression: false,__items: [],__popup: null,maxPermaLength: 80,trimPermaAtPath: true,iframeHeight: 392,iframeWidth: 677,conduitLink: 'http://www.conduit.com',conduitImage: 'http://apps.conduit.com/images/UserComponents/conduitNew.gif',language: 'en',addTooltip: 'Make this app yours, no matter where you are on the Web',addButtonText: '+ Add to Browser',termsOfServiceText: 'By accessing and using the services available here, you are indicating that you have read, understood, and agree to the Content Sharing ',termsOfServiceLink: 'Terms of Service',visitLink: 'Visit',urlText: 'URL:',createItem: function(id,alertId,providerId,provider,name,url,popupUrl,channel,isDeleted,supportsChrome,isDirect,element){try{var item = new SharedItems.Togo.Item(id,alertId,providerId,provider,name,url,popupUrl,channel,isDeleted,supportsChrome,isDirect,element);try{if (this.logImpression){SharedItems.Manager.Logger.LogAction('TogoAction',id,5,channel);}}catch (e2){}SharedItems.Togo.Manager.__items.push(item);var engDetect = function(){ConduitWeb.events.engineOnLoad(function(){var eng = new ConduitWeb.engine();eng.displayDetectedComponent(id,SharedItems.Manager.Logger.source);});};if (typeof ConduitWeb == 'undefined'){SharedItems.Togo.Manager.addLoad(engDetect,true);}else{engDetect();}}catch (e){}},show: function(item){try{if (!SharedItems.Togo.Manager.__popup){window.allowEarlyShow = true;SharedItems.Togo.Manager.__popup = new SharedItems.Togo.Popup();}SharedItems.Togo.Manager.__popup.show(item);}catch (e){}}};SharedItems.Togo.Manager.addLoad(function(){SharedItems.Togo.Manager.windowLoaded = true;},true);SharedItems.Togo.Popup = function(){var emptyHref = 'javascript:void(0);';var me = this;this.element = new SharedItems.ElementBuilder('div',{className: 'dialogs',style:{width: SharedItems.Togo.Manager.iframeWidth + 'px',display: 'none'}});this.element.add('iframe',{allowtransparency: 1,frameBorder: 0,scrolling: 'no',style:{border: 0,width: SharedItems.Togo.Manager.iframeWidth + 'px',height: SharedItems.Togo.Manager.iframeHeight + 'px',overflow: 'hidden',display: 'none'}},'iframe').get_parent().add('div',{className: 'inwin loadDiv',style:{fontSize: '18px',verticalAlign: 'middle',borderBottom: 'none',backgroundColor: 'white',textAlign: 'center',display: 'block',height: SharedItems.Togo.Manager.iframeHeight + 'px'}},'loadDiv').add('div',{style:{paddingTop: '153px'}}).addText('Loading...').get_parent().get_parent().add('a',{href: emptyHref,className: 'conduit_iframe_btn_close'},'closeBut').addText('Close').get_parent().add('div',{className: 'inwin_bottom'},'bottom').add('div',{className: 'button_holder button_holder_component_iframe clearfix'},'buttonHolder').add('a',{className: 'button_1',href: emptyHref},'addBut').add('span',{title: SharedItems.Togo.Manager.addTooltip,innerHTML: SharedItems.Togo.Manager.addButtonText},'addButText').get_parent().get_parent().add('span',{className: 'tos'},'tos').addText(SharedItems.Togo.Manager.termsOfServiceText).add('a',{href: 'http://www.conduit.com/legal/ContentSharingTOS.aspx',target: '_blank'},'tosA').addText(SharedItems.Togo.Manager.termsOfServiceLink);this.element.findChild('bottom',true).add('div',{className: 'permalink'},'permalinkdiv').add('a',{href: SharedItems.Togo.Manager.conduitLink,className: 'lnk_by_conduit'},'conduitLink').add('img',{src: SharedItems.Togo.Manager.conduitImage},'condimg');this.element.findChild('permalinkdiv',true).add('span').addText(SharedItems.Togo.Manager.urlText).get_parent().add('input',{className: 'type_text',readonly: 'readonly',onclick: function(){this.focus();this.select();}},'permaInput').get_parent().add('a',{className: 'visit'},'permalink').addText(SharedItems.Togo.Manager.visitLink);this.element.findChild('closeBut').get_element().onclick = function(){me.hide();};this.inwin = new SharedItems.Dialogs.Inwin(this.element.get_element());};SharedItems.Togo.Popup.prototype ={__trimPerma: function(value){if (value && value.length > SharedItems.Togo.Manager.maxPermaLength){if (SharedItems.Togo.Manager.trimPermaAtPath){var iPos = value.indexOf('?');if (iPos > 0){value = value.substr(0,iPos) + '...';}if (value && value.length > SharedItems.Togo.Manager.maxPermaLength){value = value.substr(0,SharedItems.Togo.Manager.maxPermaLength - 3) + '...';}}else{value = value.substr(0,SharedItems.Togo.Manager.maxPermaLength - 3) + '...';}}return value;},get_itemText: function(item){var ttl = this.element.findChild(item,true);if (ttl)return ttl.get_element().innerHTML;},set_itemText: function(item,value){var ttl = this.element.findChild(item,true);if (ttl)ttl.get_element().innerHTML = value;},get_url: function(){var child = this.element.findChild('permalink',true);if (child){return child.get_element().href;}},set_url: function(value){var child = this.element.findChild('permalink',true);if (child){child.get_element().href = value;}child = this.element.findChild('permaInput',true);if (child){child.get_element().value = value;child.get_element().setAttribute('readonly','readonly');}},show: function(item){try{this._currentItem = item;var img = this.element.findChild('condimg',true).get_element();if (img)img.src = SharedItems.Togo.Manager.conduitImage;var ifrm = this.element.findChild('iframe',true).get_element();var loadDiv = this.element.findChild('loadDiv',true).get_element();ifrm.style.display = 'none';loadDiv.style.display = 'block';var permaDiv = this.element.findChild('permalinkdiv',true).get_element();var buttonHolder = this.element.findChild('buttonHolder',true).get_element();if (item.get_isDeleted()){permaDiv.style.display = 'none';buttonHolder.style.display = 'none';}else{permaDiv.style.display = 'block';buttonHolder.style.display = 'block';}var swapFunc = function(){ifrm.style.display = 'block';loadDiv.style.display = 'none';};ifrm.src = item.get_popupUrl() + '&lang=' + SharedItems.Togo.Manager.language;ifrm.onload = swapFunc;ifrm.onreadystatechange = function(arg){if (ifrm.readyState === 'complete'){swapFunc();}};window.setTimeout(swapFunc,5000);var me = this;this.set_url(item.get_url());if (!item.get_isDeleted()){this.element.findChild('addBut',true).get_element().onclick = function(){me.hide(true);item.addComponent();};}var f = function(){me.inwin.show(SharedItems.Togo.Manager.iframeWidth,SharedItems.Togo.Manager.iframeHeight + 50);};f();}catch (e){}},hide: function(forAdd){try{if (this._currentItem){var logType = forAdd ? 2 : 3;SharedItems.Manager.Logger.LogAction('TogoAction',this._currentItem.get_id(),logType,this._currentItem.get_channel());}}catch (ex){}this.inwin.hide();}};SharedItems.Togo.Item = function(id,alertId,providerId,provider,name,url,popupUrl,channel,isDeleted,supportsChrome,direct,element){var me = this;this._id = id;this._name = name;this._alertId = alertId;this._url = url;this._popupUrl = popupUrl;this._channel = channel;this._element = element;this._source = 1;this._providerId = providerId;this._provider = provider;this._isDeleted = isDeleted;this._supportsChrome = supportsChrome;if (element){element.style.visibility = 'visible';element.togo = this;var tElm = element;if (element.parentNode.nodeName === 'A')tElm = element.parentNode;element.onclick = null;if (direct){SharedItems.Dialogs.Manager.AttachEvent(tElm,'onclick',function(){me.addComponent.apply(me,[true]);return true;});}else{SharedItems.Dialogs.Manager.AttachEvent(tElm,'onclick',function(){me.show.apply(me);return true;});}if (element.pending)this.show();}};SharedItems.Togo.Item.prototype ={get_id: function(){return this._id;},set_id: function(value){this._id = value;},get_isDeleted: function(){return this._isDeleted;},set_isDeleted: function(value){this._isDeleted = value;},get_providerId: function(){return this._providerId;},set_providerId: function(value){this._providerId = value;},get_provider: function(){return this._provider;},set_provider: function(value){this._provider = value;},get_alertId: function(){return this._alertId;},set_alertId: function(value){this._alertId = value;},get_channel: function(){return this._channel;},set_channel: function(value){this._channel = value;},get_name: function(){return this._name;},set_name: function(value){this._name = value;},get_url: function(){return this._url;},set_url: function(value){this._url = value;},get_popupUrl: function(){return this._popupUrl;},set_popupUrl: function(value){this._popupUrl = value;},get_element: function(){return this._element;},set_element: function(value){this._element = value;},get_source: function(){return this._source;},set_source: function(value){this._source = value;},get_supportsChrome: function(){return this._supportsChrome;},set_supportsChrome: function(value){this._supportsChrome = value;},addComponent: function(direct){if (direct){SharedItems.Manager.Logger.LogAction('TogoAction',this.get_id(),1,this.get_channel());}var sItem = new SharedItems.Item(this.get_id(),this.get_alertId(),this.get_name(),this.get_provider(),null,this.get_channel(),this.get_source(),this.get_providerId(),this.get_supportsChrome());SharedItems.Manager.addComponent(sItem);},show: function(){try{var elm = this.get_element();if (elm.loader)elm.loader.style.display = 'none';SharedItems.Manager.Logger.LogAction('TogoAction',this.get_id(),1,this.get_channel());SharedItems.Togo.Manager.show(this);}catch (e){}}};if (window.initMethods){for (var x = 0;x < window.initMethods.length;x++){window.initMethods[x]();}}window.initLoaded = true;