/*
 * Copyright 2009 Apple Inc. All rights reserved. 
 * IMPORTANT NOTE: This file is licensed only for use in providing the iWork.com
 * service, or any part thereof, and is subject to the iWork.com Terms of Service.
 */

Object.extend(String.German,{"Invalid.CreditCard(%@)":"Die Kreditkartennummer ist ungültig.","Invalid.Email(%@)":"Die E-Mail-Adresse ist ungültig.","Invalid.NotEmpty(%@)":"Angabe in diesem Feld erforderlich.","Invalid.Password":"Die Passwörter stimmen nicht überein. Bitte versuchen Sie es erneut.","Invalid.General(%@)":"Die Eingabe ist ungültig. Bitte versuchen Sie es erneut.","Invalid.Date(%@)":"Das Datum ist ungültig.","Invalid.Number(%@)":"Geben Sie in dieses Feld nur Zahlen ein."});Mac=SC;Mac.PanelView.prototype.wrapperView=SC.View.extend({content:null,emptyElement:'<div class="panel"><div class="inner"></div><div class="panel-left"></div><div class="panel-right"></div><div class="panel-bottom"></div><div class="panel-bottom-left"></div><div class="panel-bottom-right"></div></div>',outlets:["containerView"],containerView:SC.ContainerView.extend({contentBinding:"*owner.content"}).outletFor(".inner?"),visibleAnimation:{visible:"top: 0px",hidden:"top: -500px",duration:500,onComplete:function(a){if(!a.get("isVisible")){Mac.panels.hidePanelDidComplete(a)}}}});Mac.INITIAL_FADE_IN_DURATION=150;require("core");Mac.ColumnController=SC.Object.extend({content:null,selection:[],columnView:null,nextColumnController:null,previousColumnController:null,managedView:null,isBranch:null,isLoading:false,addingNewFolderindex:null,newFolderNameRefer:null,didLoadingStatusChanged:function(){if(this.isLoading){if(this.isBranch){this.managedView.removeClassName("dragger");this.managedView.setClassName("spinner",true)}}else{this.managedView.removeClassName("spinner");this.managedView.setClassName("dragger",true);var b=null;var a=this.get("content");if(a){b=a.childRecords().get("records")}if(!(CoreFiles.canvasController.selectedSourceListItem.get("name")=="Shared Files"&CoreFiles.canvasController.selectedSourceListItem.get("listHeading")=="idisk")){this.managedView.set("content",b)}}}.observes("isLoading"),contentDidChange:function(){console.log("column controller-> contentDidChange");var b=this.get("content");var e=null;if(!this.content){this.removeManagedView();if(this.nextColumnController){this.clearNextColumnController()}if(this.previousColumnController){this.columnView.set("selectionContent",this.previousColumnController.get("content"))}else{this.columnView.set("selectionContent",null)}}else{var a=null;if(b.get("isDirectory")==null){b.set("isDirectory",true)}if(b.get("isDirectory")){e=this.updateManagedViewToBranch(true);this.columnView.set("selectionContent",b);e.delegate=this}else{e=this.updateManagedViewToBranch(false)}e.setClassName("branch_width",true);if(this.isBranch){var d=null;if(b){CoreFiles.adaptor.set("columnController",this);var c=this.get("content").get("guid");(c.indexOf("/")==0)?c=c.substring(1):c;if(CoreFiles.canvasController.selectedSourceListItem.get("listHeading")!="Sites"){if(CoreFiles.canvasController.selectedSourceListItem.get("name")=="Shared Files"){var d=CoreFiles.File.findAll({isShared:true});this.managedView.set("content",d)}else{CoreFiles.adaptor.retrieveChildRecords(c)}}else{CoreFiles.adaptor.columnController.set("isLoading",false)}}}else{if(e){e.set("content",b)}}this.managedView.set("selection",[]);e.setClassName("dragger",true)}}.observes("content"),selectionDidChange:function(){console.log("column controller-> selectionDidChange");console.log(this.managedView.get("selection"));console.log("column controller-> selectionDidChange");var a=(this.managedView)?this.managedView.get("selection"):[];if(a){if(a.length==1){if(!this.nextColumnController){this.createNextColumnController()}this.nextColumnController.set("isLoading",true);this.nextColumnController.set("content",a[0])}else{if(a.length>1){if(this.nextColumnController){this.clearNextColumnController()}this.columnView.set("selection",a)}else{if(this.nextColumnController){this.clearNextColumnController()}this.columnView.set("selection",(this.previousColumnController)?this.previousColumnController.get("selection"):[])}}}else{if(this.nextColumnController){this.clearNextColumnController()}}}.observes("selection"),createNextColumnController:function(){console.log("column controller-> cReateNextColumnController");this.nextColumnController=Mac.ColumnController.create({columnView:this.columnView,previousColumnController:this});var b=this.columnView.childNodes;var a=0;for(iLoop=0;iLoop<b.length;iLoop++){a+=parseInt(b[iLoop].getStyle("width"),10)}a+=400;this.columnView.setStyle({width:a+"px"});this.columnView.parentNode.parentNode.get("rootElement").scrollLeft=a},clearNextColumnController:function(){console.log("column controller-> cLearNextColumnController");this.nextColumnController.set("content",null);this.nextColumnController=null;var b=this.columnView.childNodes;var a=0;for(iLoop=0;iLoop<(b.length-2);iLoop++){a+=parseInt(b[iLoop].getStyle("width"),10)}a+=400;this.columnView.setStyle({width:a+"px"});this.columnView.parentNode.parentNode.get("rootElement").scrollLeft=a},removeManagedView:function(){var a=this._boundManagedViewSelectionDidChange;if(!this._boundManagedViewSelectionDidChange){this._boundManagedViewSelectionDidChange=this.managedViewSelectionDidChange.bind(this)}if(this.managedView){this.managedView.removeFromParent();this.managedView.removeObserver("selection",a);this.managedView=this.isBranch=null}},updateManagedViewToBranch:function(d){if(!this._boundManagedViewSelectionDidChange){this._boundManagedViewSelectionDidChange=this.managedViewSelectionDidChange.bind(this)}var b=this._boundManagedViewSelectionDidChange;if(this.managedView){if(this.isBranch==d){return this.managedView}this.removeManagedView()}var c=null;var a=this.previousColumnController;while(a&&!c){c=a.managedView}if(d){newView=null;if(this._cachedBranchView&&this._cachedBranchView.isBranch){newView=this._cachedBranchView}if(!newView){newView=this._cachedBranchView=this.columnView.insertBranchColumnAfter(c)}}else{newView=this.columnView.insertLeafColumnAfter(c)}this.managedView=newView;this.isBranch=d;if(newView){newView.columnView=this.columnView;newView.addObserver("selection",b);newView.columnController=this}this.columnView.layoutColumns();return newView},canRemoveSelection:function(){console.log("Column Controller ->canRemoveSelection ... eeehooooo ..");return true},confirmRemoveSelection:function(){console.log("Column Controller->confirmRemoveSelection .....");var c=this.get("selection");if(!c.length){return}if(!this.executeRemoveSelectionHandler){this.executeRemoveSelectionHandler=this.executeRemoveSelection.bind(this)}if(c.get("name").length>1){msgTitle="Dialog.Files.Title".loc(c.length);msgLine1="Dialog.Files.Confirm".loc(c.length)}else{var e=c.get("name");if(c.get("name").toString().length>28){e=c.get("name").toString();var d=e.length;var a=e.substr(0,12);var b=e.substr(d-12,d-1);e=a+"..."+b}msgTitle="Dialog.File.Title".loc(e);msgLine1="Dialog.File.Confirm".loc(e)}CoreFiles.confirmController.showPanel({msgType:"deleteSource",msgTitle:msgTitle,msgLine1:msgLine1,canCancel:true,action:this.executeRemoveSelectionHandler})},executeRemoveSelection:function(){console.log("Column Controller->executeRemoveSelection .....");console.log(this.get("content"));var d=CoreFiles.Source.findAll();var a=d.get("root");var c;var b=this.get("selection").get("guid");for(c=0;c<d.length;c++){if(a[c].match(b)){CoreFiles.sourceController.executeRemoveSelection(d[c])}}this.get("content").removeRecords(this.get("selection"));this.selectViewAfterDelete()},addNewFolder:function(){var e=this.get("selection")[0];var g=null;var d=e.childRecords()._records.get("name");var c=0;var f=1;var b="";var a=e.get("guid");newFolderName="New Folder ";while(c!=1){if(f==1){b=""}else{b=f.toString()}newFolderName="New Folder "+b;if(d.indexOf(newFolderName)==-1){c=1}f++}this.newFolderNameRefer=newFolderName;this.addingNewFolderindex=1;g=a+"/"+newFolderName;e.createFolder(g);this.selectViewAfterAddFolder()},addToSidebar:function(){var b=this.get("selection");if(b){if(b.get("isDirectory").toString()=="true"){var a=b.get("name");var i=b.get("guid");var j=b.get("guid").toString();var c=CoreFiles.sourceController.get("content")._records.length+1;var g="";if(b.get("isDirectory")==false||b.get("isDirectory")=="false"){g=false}else{g=true}if(!CoreFiles.Source.find({root:i.toString()})){var d=10+this.managedView.parentNode.parentNode.parentNode.owner.childNodes[0].childNodes[0].childNodes[1].childNodes.length;var h=escape(a.toString());var e="{guid:'"+d+"', type:'Source', isDirectory: '"+b.get("isDirectory").toString()+"' ,listHeading: 'idisk' , displayOrder:"+c+", name:'"+a+"', root:'"+j+"', parent:null }";var f="{'records':["+e+" ], 'statusString':'Success', 'status':1 }";CoreFiles.adaptor.addToServer(e)}}}},duplicateSelection:function(){var k=this.get("content");var m=null;var j=k.childRecords()._records.get("name");var e=0;var h=0;var p="";var b=k.get("guid");var a=null;var g=null;var l=null;var n=new Array();var d=new Array();console.log("nameArray->");console.log(j);n=this.get("selection").get("name");d=this.get("selection").get("guid");for(var f=0;f<n.length;f++){e=0;l=n[f];var o="";if(this.get("selection").get("isDirectory")=="false"){o="."+this.get("selection").get("extension");a=l.substring(0,l.lastIndexOf(o))+" copy"}else{if(l.indexOf("copy")<0){a=l+" copy "}else{a=l.substr(0,(l.indexOf("copy")+4))+" "}}console.log(this.get("selection").get("extension"));while(e!=1){g=a;if(h==0){p=""}else{p=""+h.toString()}a=a+p;var i=a+o;console.log("With file Extension : "+(a+o));console.log("With file Extension : "+j.indexOf(a+o));console.log("With file Extension with Test : "+j.indexOf(i));if(j.indexOf(i.trim())==-1){e=1}else{a=g}h++}m=b+"/"+a+o;var c=d[f];(c.indexOf("/")==0)?c=c.substring(1):c;console.log("selectedRecord="+c);k.createDuplicate(c,m)}this.set("content",k);this.selectViewAfterDuplicateFolder()},duplicateChildren:function(g,a){var b=a;var i=g;var j=null;var h=i.childRecords()._records.get("name");var d=0;var f=1;var k="";var c=b;for(var e=0;e<i.childRecords()._records.length;e++){childFolderName=i.childRecords().get("records")[e].get("name");j=c+"/"+childFolderName;i.createFolder(j);this.duplicateChildren(i.childRecords().get("records")[e],j)}this.selectViewAfterDuplicateFolder()},selectViewAfterAddFolder:function(){this.nextColumnController.set("content",this.nextColumnController.get("content"));this.managedView.becomeFirstResponder()},selectViewAfterDuplicateFolder:function(){this.set("content",this.get("content"));this.managedView.becomeFirstResponder()},downloadSelection:function(){console.log("column controller-> downloadSelection");this.get("content").downloadSelection(this.get("selection"))},selectViewAfterDelete:function(){console.log("column controller -> selectViewAfterDelete");if(this.managedView.nextSibling){if(this.managedView.nextSibling.get("content").length>0){this.childNodesDelete(this.managedView.nextSibling.get("content").get("parent")[0])}this.managedView.nextSibling.get("content").get("parent")}var b=null;var a=this.get("content");b=a.childRecords().get("records");console.log(b);console.log(b.length);if(b.length>0){this.managedView.set("content",b)}else{this.managedView.set("content",null)}this.managedView.set("selection",[]);if(this.previousColumnController){this.previousColumnController.managedView.becomeFirstResponder()}},childNodesDelete:function(b){if(b.childRecords().get("records").length>0){var c=b.childRecords().get("records");for(var a=0;a<c.length;a++){this.childNodesDelete(c[a]);Mac.Store.removeRecord(c[a])}}},managedViewSelectionDidChange:function(){var a=this.managedView;if(!a){return}this.set("selection",a.get("selection"))},createArchive:function(){console.log("column controller-> create Archive");var e=this.get("selection");if(e.length>1){var f=0;var c=0;var b="Archive";var a=b+".zip";var h=this.get("content").childRecords().get("records").get("name");if(h.indexOf(b+".zip")>=0){c=2;while(f!=1){a=b+" "+c+".zip";if(h.indexOf(a)==-1){f=1}c++}}var i=e[0].get("guid").split("/");var d="";for(var g=1;g<i.length-1;g++){d=d+i[g];if(g!=i.length-2){d=d+"/"}}}this.get("content").createArchive(this.get("selection"),a,d,this)},explodeArchive:function(){this.get("content").explodeArchive(this.get("selection"),this);console.log("column controller-> explode Archive");this.previousColumnController.managedView.becomeFirstResponder()}});require("core");Mac.Adaptor=Mac.Object.extend({tokens:{},base:"",namespaces:["Mac"],requests:{},_requestHistory:{},requestQueue:[],defaultOptions:{method:"get",useSpinner:false,asynchronous:true,sanitizeJSON:true},showSpinner:false,emptyRecordSet:false,_useEtag:false,start:0,end:0,server:null,_prepareRequest:function(a){var c,b;if(a){c=$H(a)}if(this.tokens){b=$H(this.tokens)}if(a&&this.tokens){c=c.merge(b)}else{if(b){c=b}}if(c){return c.toQueryString()}},_updateRecords:function(l){if(l.data&&(l.data.reset==1)){window.location.reload()}var b=l.records||[];var j=l.additions||[];var h=l.modifications||[];var k=l.deletions||[];if(b.length>0){Mac.Store.updateRecords(this.mapRecordsToNamespaces(b,l.isSummary),this,Mac.Record,true)}if(j.length>0){Mac.Store.updateRecords(this.mapRecordsToNamespaces(j,false),this,Mac.Record,true)}if(h.length>0){Mac.Store.updateRecords(this.mapRecordsToNamespaces(h,false),this,Mac.Record,true)}if(k.length>0){k=this.mapRecordsToNamespaces(k,false);for(var f=0,a=k.length;f<a;f++){var d=k[f];var c=d.recordType;var g=c.find(d.guid);if(!g){continue}g.set("isDeleted",true);Mac.Store.removeRecord(g)}}var e=b.length+j.length+h.length+k.length;this.set("emptyRecordSet",(e>0))},_insertHTMLContent:function(a){var d,b;if(a.htmlcontent){for(var c in a.htmlcontent){b=Mac.View.viewFor($(c));b.set("innerHTML",a.htmlcontent[c])}}if(Event.compactCache){Event.compactCache()}},_updateTokens:function(a){for(var b in a.tokens){Mac.Application.tokens.set(b,a.tokens[b])}},request:function(requestName,parameters,onSuccess,onError,onFailure){var url;var options=Object.clone(this.defaultOptions);var base=this.requests[requestName].base||this.base;if(typeof this.requests[requestName].action=="function"){url=base+this.requests[requestName].action()}else{url=base+this.requests[requestName].action}if(onSuccess!==null&&onSuccess!==undefined){this._onSuccess=onSuccess}else{var onSuccess=this.requests[requestName].onSuccess;if(typeof onSuccess=="string"){onSuccess=eval(onSuccess)}this._onSuccess=onSuccess}if(onError!==null&&onError!==undefined){this._onError=onError}else{var onError=this.requests[requestName].onError;if(typeof onError=="string"){onError=eval(onError)}this._onError=onError}if(onFailure!==null&&onFailure!==undefined){this._onFailure=onFailure}else{var onFailure=this.requests[requestName].onFailure;if(typeof onFailure=="string"){onFailure=eval(onFailure)}this._onFailure=onFailure}if(typeof(this.requests[requestName].asynchronous)!=="undefined"){options.asynchronous=this.requests[requestName].asynchronous}if(typeof(this.requests[requestName].method)!=="undefined"){options.method=this.requests[requestName].method}if(typeof(this.requests[requestName].contentType)!=="undefined"){options.contentType=this.requests[requestName].contentType}if(typeof(this.requests[requestName].useEtag)!=="undefined"){this._useEtag=this.requests[requestName].useEtag}else{this._useEtag=true}var params=null;if($type(parameters)=="string"){params=this._prepareRequest();if(options.method=="post"){options.postBody=parameters}else{if(params||parameters){params=[params,parameters].compact().join("&")}}}else{params=this._prepareRequest(parameters);if(options.method=="post"){options.postBody=params;params=null}}if(params){url=url+"?"+params}delete options.parameters;if(this._requestHistory[url]&&this._useEtag){if(!(SC.isSafari())||SC.isSafari3()){options.requestHeaders={"If-None-Match":this._requestHistory[url]}}}if(typeof(this.requests[requestName].requestHeaders)!=="undefined"){options.requestHeaders=this.requests[requestName].requestHeaders}if(this.requests[requestName].useSpinner){this.set("showSpinner",true)}if(Mac.Adaptor.requestId===undefined){Mac.Adaptor.requestId=0}options.requestId=Mac.Adaptor.requestId++;this.requestQueue[options.requestId]={onSuccess:onSuccess||this._onSuccess||Prototype.emptyFunction,onError:onError||this._onError||Prototype.emptyFunction,onFailure:onFailure||this._onFailure||Prototype.emptyFunction};var that=this;that.set("start",new Date().getTime());this.server.request(url,options,that)},handleResponse:function(b,a,c,f){var d=b.getResponseHeader("Etag");if(d&&this._useEtag){var e=this._requestHistory[c];this._requestHistory[c]=d;if(d==e){return}}this._useEtag=true;this._updateRecords(a);this._insertHTMLContent(a);this._updateTokens(a);switch(a.status){case -1:break;case 0:this.requestQueue[f].onError(b,a);break;case 1:case 3:case 4:this.requestQueue[f].onSuccess(b,a);break}},handleXMLResponse:function(a,b,c){this.requestQueue[c].onSuccess(a)},handleTextResponse:function(a,b,c){this.requestQueue[c].onSuccess(a)},mapRecordsToNamespaces:function(records,isSummary){var type,ns,adaptor=this;var colorIndex=0;records.each(function(record,index){if(record.type){type=record.type;if(type=="VCalendar"){record.show=true;if(!record.color){record.color=(["#92278f","#ed1c24","#2e3192","#0054a6","#2e3192","#005e20","#ed145b"])[colorIndex++%7]}}else{if(type=="Contact"){record.isSummary=isSummary||false}}ns=adaptor.namespaces.detect(function(namespace){if(eval(namespace+"."+type)){return true}else{return false}});if(ns){record.recordType=eval(ns+"."+type)}}});return records}});require("core");require("adaptor");Mac.APP_ROOT="%@://%@/%@%@/";Mac.SECURE_APPS=["account"];Mac.PRODUCTION_DOMAINS=[(/me.com$/),(/mac.com$/)];Mac.ANIMATE_APPLICATION_TRANSITIONS=(window.location.search.match("transition=yes")||window.location.search.match("transition=true"))?YES:NO;Mac.ENABLE_BADGING=YES;Mac.dockController=SC.Object.create({activeApplicationName:"",selectedApplicationName:"",username:null,enabledApplications:[],run:function(appName,namespace){if(window._loadStartTime){console.log("bench!");SC.Benchmark.start("isLoaded",false,window._loadStartTime);SC.Benchmark.end("isLoaded")}SC.Benchmark.start("isReady");this._processLoginStatus();var handleRedirect=(window.sso&&window.sso.authenticationDisabled)?NO:YES;if(handleRedirect&&!this.enabledApplications.include(appName)){this.set("selectedApplicationName",this.enabledApplications.first());return}if(!namespace){namespace=eval(appName.capitalize())}if(!namespace){throw"Mac.dockController could not find a namespace for '%@'".fmt(appName)}this.set("activeApplicationName",appName);this.set("selectedApplicationName",appName);this.set("isSearchEnabled",(namespace.searchFieldValue!==undefined));this.set("applicationNamespace",namespace);namespace.main();var body=SC.window;body.addClassName(appName);body.addClassName(SC.Platform.Browser.toLowerCase());if(SC.Platform.isWindows){body.addClassName("windows")}else{if(SC.Platform.isMac){body.addClassName("mac")}}if(Prototype.Browser.MobileSafari){body.addClassName("mobile")}document.title=[appName.capitalize(),this.get("username")].compact().join(" - ");SC.page.get("wrapper");this.adaptor.updateBadgingInfo()},performSearch:function(){var a=this.get("applicationNamespace");if(a&&$type(a.performSearch)==T_FUNCTION){a.performSearch(this.get("searchFieldValue"))}},focusApplication:function(e,c){if($type(e)==T_STRING){e=SC.page.get(e)}if($type(c)==T_STRING){c=SC.page.get(c)}var d=SC.page.get("wrapper");var a=d.mainContainer;var b=d.toolbarContainer;if(a){a.set("resizeOptions",{width:SC.FLEXIBLE,height:SC.FLEXIBLE})}if(a.loading){a.loading.removeFromParent()}a.set("content",e);if(e){if(Mac.ANIMATE_APPLICATION_TRANSITIONS){e.setStyle({opacity:"0"});this.mainTransition=e.transitionTo(1,"opacity: 1.0",{duration:350,onComplete:this._animationDidComplete.bind(this)})}this.mainView=e;e.set("frame",{x:0,y:0});e.resizeChildrenWithOldSize(e.get("frame"))}if(c){if(Mac.ANIMATE_APPLICATION_TRANSITIONS){c.setStyle({opacity:"0"});this.toolbarTransition=c.transitionTo(1,"opacity: 1.0",{duration:175})}this.toolbarView=c;if(!c){c=d.main.get("toolbarView")}b.set("content",c)}},logout:function(){this.removeCookie();var a=window.sso.logoutUrl;var b=window.location.href.toLowerCase();if(b.indexOf("/calendar")!=-1){a="/wo/WebObjects/Calendar.woa/wa/logout"}else{if(b.indexOf("/contacts")!=-1){a="/wo/WebObjects/Contacts.woa/wa/logout"}}window.location=a},removeCookie:function(){var b=new Date();var a=new Date(b.getTime()-(24*60*60*1000));var c=window.location.hostname;var d="selectedDate=;";if(c.indexOf(".")!=-1){d+=" domain="+c+";"}d+=" expires="+a.toUTCString()+";";document.cookie=d},updateBadgingFor:function(a,d,e,c){var b=this._badges[a];var f=SC.page.getPath("wrapper.dock");var g=f.get("%@Button".fmt(a));if(!g||((d+e+c)==0&&!b)){return}if(!b){b=Mac.DockBadgeView.viewFor(null,{anchorView:g});g.get("parentNode").appendChild(b);this._badges[a]=b}b.beginPropertyChanges();b.set("unreadCount",(d===undefined)?0:d);b.set("warningCount",(e===undefined)?0:e);b.set("infoCount",(c===undefined)?0:c);b.endPropertyChanges()},_badges:{},_selectedApplicationObserver:function(){var a=this.get("selectedApplicationName");var c=this.get("activeApplicationName");if(a&&a=="files"&&c&&c!="files"){this._comingSoonFiles();this.set("selectedApplicationName",c);return}if(a!==c){if((a==null)||(a.length<=0)){return}var b=(this._isProduction()&&(Mac.SECURE_APPS.indexOf(a)>=0))?"https":"http";this._newWindowLocation=Mac.APP_ROOT.fmt(b,window.location.host,a,window.location.search);console.log("switching to: %@".fmt(this._newWindowLocation));if(this.mainView&&this.mainTransition){this.mainView.transitionTo(0,this.mainTransition)}else{this._animationDidComplete()}if(this.toolbarView&&this.toolbarTransition){this.toolbarView.transitionTo(0,this.toolbarTransition)}}}.observes("selectedApplicationName"),_comingSoonPhotos:function(){var a={msgType:"comingSoonPhotos",imagePath:"/sw/shared/de/d3bced03efd15736141cf474823b5e450f783489/images/coming_soon/coming_soon_photos.png",msgTitle:"Coming Soon",msgLine1:"Photos will be included in an upcoming release."};Mac.comingSoonController.showPanel(a)},_comingSoonFiles:function(){var a={msgType:"comingSoonFiles",imagePath:"/sw/shared/de/d3bced03efd15736141cf474823b5e450f783489/images/coming_soon/coming_soon_files.png",msgTitle:"Coming Soon",msgLine1:"iDisk will be included in an upcoming release."};Mac.comingSoonController.showPanel(a)},_isProduction:function(){for(var a=0;a<Mac.PRODUCTION_DOMAINS.length;a++){if(window.location.host.match(Mac.PRODUCTION_DOMAINS[a])){return true}}return false},_animationDidComplete:function(){if(this._newWindowLocation){window.location=this._newWindowLocation}},_processLoginStatus:function(){var d=window.loginStatus;if($type(d)!=T_HASH){return}var e=SC.page.getPath("wrapper.dock");this.enabledApplications=["account"];for(var b in d){if(!d.hasOwnProperty(b)){continue}if(b=="username"){this.set("username",d[b])}else{if(e){var c=d[b];if(c){this.enabledApplications.push(b)}var a=e.get("%@Button".fmt(b));if(a){a.set("isEnabled",c)}}}}},showSearchClearButton:false,_searchFieldValueObserver:function(){this.set("showSearchClearButton",(this.get("searchFieldValue")&&this.get("searchFieldValue").length>0))}.observes("searchFieldValue"),clearSearchField:function(){if(this.get("searchFieldValue")&&this.get("searchFieldValue").length>0){this.set("searchFieldValue","")}},_newWindowLocation:null,adaptor:Mac.Adaptor.create({base:"/wo/WebObjects/Notification.woa/da/",requests:{getBadgingInfo:{base:"/wo/WebObjects/Notification.woa/da/",action:"getBadgingInfo",method:"post",useEtag:false,onSuccess:"Mac.dockController.adaptor.handleBadgingInfo",onError:"Mac.dockController.adaptor.handleError",onFailure:"Mac.dockController.adaptor.handleFailure"}},updateBadgingInfo:function(){if(Mac.ENABLE_BADGING==NO){return}if(!this.server){this.server=Mac.ServerClass.create()}this.request("getBadgingInfo")},handleBadgingInfo:function(e,p){var h=5000;var o=36000000;var d=p.badging||{};var a={};var f={};var g={};var b=[];var n=Mac.dockController.get("activeApplicationName");var j=["mail"];for(var m in d){if(!d.hasOwnProperty(m)){continue}var l=parseInt(d[m],0);switch(m){case"pollMin":h=l;break;case"pollMax":o=l;break;default:if(m.match(/Unread$/)){var i=m.slice(0,-6);a[i]=(i!==n||!j.include(n))?l:0;b.push(i)}else{if(m.match(/Warning$/)){var i=m.slice(0,-7);f[i]=1;b.push(i)}else{if(m.match(/Info$/)){var i=m.slice(0,-4);g[i]=1;b.push(i)}}}}}b=b.uniq();var k=b.length;while(--k>=0){var i=b[k];Mac.dockController.updateBadgingFor(i,a[i],f[i],g[i])}if(Mac.BADGING_POLL_MIN&&(h<Mac.BADGING_POLL_MIN)){h=Mac.BADGING_POLL_MIN}var c=Mac.dockController.adaptor;c.updateBadgingInfo.bind(c).delay(h/1000)},handleError:function(b,a){console.log("Mac.dockController.adaptor#handleError")},handleFailure:function(b,a){console.log("Mac.dockController.adaptor#handleFailure")}})});SC.ListCollectionView=SC.CollectionView.extend({delegate:null,deleteSelection:function(){var a=this.get("delegate");if(!a){return false}if(a.canRemoveSelection&&!a.canRemoveSelection()){return false}if(a.confirmRemoveSelection){a.confirmRemoveSelection()}},emailSelection:function(){var a=this.get("delegate");if(!a){return false}if(a.canEmailSelection&&!a.canEmailSelection()){return false}if(a.emailSelection){a.emailSelection()}},printSelection:function(){var a=this.get("delegate");if(!a){return false}if(a.canPrintSelection&&!a.canPrintSelection()){return false}if(a.printSelection){a.printSelection()}},addFolderToSelection:function(){var a=this.get("delegate");if(!a){return false}if(this.hasClassName("sourcelist_container")){a=this}a.addNewFolder()},downloadSelection:function(){var a=this.get("delegate");if(!a){return false}if(this.get("selection").get("children")!=""){CoreFiles.adaptor.downloadIndex=1;a.createArchive()}else{a.downloadSelection()}},addSelectionToSidebar:function(){var a=this.get("delegate");if(!a){return false}a.addToSidebar()},duplicateSelection:function(){var a=this.get("delegate");if(!a){return false}a.duplicateSelection()},renameSelection:function(){var c=this.childNodes.length;var b=0;for(var a=0;a<c;a++){if(this.childNodes[a].get("isSelected")==true){b++}}if(b==1){a=this.childNodes.get("isSelected").indexOf(true);this.childNodes[a].labelView.beginInlineEdit()}},validateMenuItem:function(b){var a=this.get("delegate");if(!a){return false}switch(b.get("action")){case"deleteSelection":return !!(a.canRemoveSelection&&a.canRemoveSelection());case"selectAll":return !!this.get("isEnabled");case"emailSelection":return !!(a.canEmailSelection&&a.canEmailSelection());case"printSelection":return !!(a.canPrintSelection&&a.canPrintSelection());case"addSelectionToSidebar":if(!(this.hasClassName("sourcelist_container focus"))){if(this.get("selection").get("fileType")!="folder"){return false}}else{return !(this.hasClassName("sourcelist_container focus"))}case"duplicateSelection":return !(this.hasClassName("sourcelist_container focus"));case"renameSelection":return !(this.hasClassName("sourcelist_container focus"));default:return true}},createArchive:function(){var a=this.get("delegate");if(!a){return false}a.createArchive()},explodeArchive:function(){var a=this.get("delegate");if(!a){return false}a.explodeArchive()},acceptsFirstResponder:true,mouseDown:function(a){this.becomeFirstResponder();return arguments.callee.base.apply(this,arguments)},keyDown:function(a){return this.interpretKeyEvents(a)},moveUp:function(){this.selectPreviousItem()},moveUpAndModifySelection:function(){this.selectPreviousItem(true)},moveDown:function(){this.selectNextItem()},moveDownAndModifySelection:function(){this.selectNextItem(true)},selectAll:function(){this.selectItems(this.get("content")||[])},selectNone:function(){this.selectItems([])}});SC.ListSourceListView=SC.SourceListView.extend({delegate:null,deleteSelection:function(){var a=this.get("delegate");if(!a){return false}if(a.canRemoveSelection&&!a.canRemoveSelection()){return false}if(a.confirmRemoveSelection){a.confirmRemoveSelection()}},emailSelection:function(){var a=this.get("delegate");if(!a){return false}if(a.canEmailSelection&&!a.canEmailSelection()){return false}if(a.emailSelection){a.emailSelection()}},printSelection:function(){var a=this.get("delegate");if(!a){return false}if(a.canPrintSelection&&!a.canPrintSelection()){return false}if(a.printSelection){a.printSelection()}},addFolderToSelection:function(){var a=this.get("delegate");if(!a){return false}if(this.hasClassName("sourcelist_container")){a=this}a.addNewFolder()},downloadSelection:function(){var a=this.get("delegate");if(!a){return false}if(this.get("selection").get("children")!=""){CoreFiles.adaptor.downloadIndex=1;a.createArchive()}else{a.downloadSelection()}},addSelectionToSidebar:function(){var a=this.get("delegate");if(!a){return false}a.addToSidebar()},duplicateSelection:function(){var a=this.get("delegate");if(!a){return false}a.duplicateSelection()},renameSelection:function(){var c=this.childNodes.length;var b=0;for(var a=0;a<c;a++){if(this.childNodes[a].get("isSelected")==true){b++}}if(b==1){a=this.childNodes.get("isSelected").indexOf(true);this.childNodes[a].labelView.beginInlineEdit()}},validateMenuItem:function(b){var a=this.get("delegate");if(!a){return false}switch(b.get("action")){case"deleteSelection":return !!(a.canRemoveSelection&&a.canRemoveSelection());case"selectAll":return !!this.get("isEnabled");case"emailSelection":return !!(a.canEmailSelection&&a.canEmailSelection());case"printSelection":return !!(a.canPrintSelection&&a.canPrintSelection());case"addSelectionToSidebar":if(!(this.hasClassName("sourcelist_container focus"))){if(this.get("selection").get("fileType")!="folder"){return false}}else{return !(this.hasClassName("sourcelist_container focus"))}case"duplicateSelection":return !(this.hasClassName("sourcelist_container focus"));case"renameSelection":return !(this.hasClassName("sourcelist_container focus"));default:return true}},createArchive:function(){var a=this.get("delegate");if(!a){return false}a.createArchive()},explodeArchive:function(){var a=this.get("delegate");if(!a){return false}a.explodeArchive()},acceptsFirstResponder:true,mouseDown:function(a){this.becomeFirstResponder();return arguments.callee.base.apply(this,arguments)},keyDown:function(a){return this.interpretKeyEvents(a)},moveUp:function(){this.selectPreviousItem()},moveUpAndModifySelection:function(){this.selectPreviousItem(true)},moveDown:function(){this.selectNextItem()},moveDownAndModifySelection:function(){this.selectNextItem(true)},selectAll:function(){this.selectItems(this.get("content")||[])},selectNone:function(){this.selectItems([])}});require("core");Mac.ThinClientController=SC.Object.extend({onFocusAction:null,focusApplication:function(a){this.rootUrl=a;var c=document.$tag("body");this.element=document.createElement("div");this.element.setStyle({display:"none"});c.appendChild(this.element);var b={onSuccess:this._rootUrlDidLoad.bind(this),method:"get"};b.onFailure=this._rootUrlDidFail.bind(this,a,b);new Ajax.Request(a,b)},_rootUrlDidLoad:function(b){var a=$(this.element);a.innerHTML=b.responseText;this.toolbarView=Element.$view(a,".thin_client_toolbar:1:1",SC.View);this.mainView=Element.$view(a,".thin_client_main:1:1",SC.View);Mac.dockController.focusApplication(this.mainView,this.toolbarView);this.mainView.get("innerHTML").evalScripts();if(!Mac.ANIMATE_APPLICATION_TRANSITIONS){if(this.toolbarView){this.toolbarView.setStyle({opacity:"0"});this.toolbarView.transitionTo(1,"opacity: 1.0",{duration:Mac.INITIAL_FADE_IN_DURATION})}if(this.mainView){this.mainView.setStyle({opacity:"0"});this.mainView.transitionTo(1,"opacity: 1.0",{duration:Mac.INITIAL_FADE_IN_DURATION})}}if(this.onFocusAction){this.onFocusAction()}},_rootUrlDidFail:function(b,a,c){if(c.status==401){Mac.Server.authUnity(b,a,c)}else{console.log("URL failed to load!")}}});Mac.FlashView=Mac.View.extend({resourceURL:null,width:null,height:null,version:"0",loadParameters:{},loadVariables:{},loadAttributes:{},quality:"high",locked:false,hasValidVersion:function(){var d=this.get("version").split(".");var b=Mac.FlashView.playerVersion();if(b==null){return false}for(var e=0;e<d.length;e++){var c=d[e];var a=b[e];if(a>c){return true}if(a<c){return false}}return true}.property("version"),movie:function(){return $(this.get("flashId"))}.property(),flashId:null,flashProperties:[],flashNotAvailable:function(){console.log("required version of flash is not available.")},flashPropertyDidChange:function(a,b){this.set(a,b)},_flashPropertyObserver:function(d,b,c){var a=this.get("movie");if(a&&this.flashProperties&&this.flashProperties.include(b)){a.externalPropertyDidChange(b,c)}}.observes("*"),_lockedObserver:function(){if(this.didChangeFor("locked","locked")){this.render()}}.observes("locked"),render:function(){if(this.didChangeFor("render","resourceURL","version","height","width","quality","loadVariables","loadParameters","loadAttributes")){if(this.get("hasValidVersion")==false){return this.flashNotAvailable()}var i="";var m=this.get("loadVariables")||{};var e=this.get("loadParameters")||{};var l=this.get("loadAttributes")||{};var a=this.get("resourceURL");l.id=this.get("flashId");e.quality=this.get("quality")||"high";var n=this.get("height");if(n){l.height=n}var b=this.get("width");if(b){l.width=b}if(!l.wmode){l.wmode="opaque"}if(!l.scale){l.scale="noborder"}if(!l.menu){l.menu="false"}m.callMethod="Mac.FlashView._flashCallMethod";m.ownerView=this._guid;var j=[];for(var k in l){j.push('%@="%@"'.format(k,l[k]))}var d=[];for(var k in m){d.push("%@=%@".format(k,m[k]))}var g=this.flashProperties.length;while(--g>=0){var k=this.flashProperties[g];var c=this.get(k);if(c){d.push("%@=%@".format(k,c))}}var h=d.join("&");if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){for(var k in e){j.push('%@="%@"'.format(k,e[k]))}if(h.length>0){j.push('flashvars="%@"'.format(h))}i='<embed type="application/x-shockwave-flash" src="%@" %@ />'.format(a,j.join(" "))}else{var f=[];f.push('<param name="movie" value="%@" />'.format(a));for(var k in e){f.push('<param name="%@" value="%@" />'.format(k,e[k]))}if(h.length>0){f.push('<param name="flashvars" value="%@" />'.format(h))}i='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" %@ >%@</object>'.format(j.join(" "),f.join("\n"))}this.set("innerHTML",i)}}.observes("*"),init:function(){arguments.callee.base.call(this);_flashViews[this._guid]=this;this.flashId="flashview%@".format(this._guid);this.render()}});Mac.FlashView.mixin({playerVersion:function(){var g=[0,0,0];var d=false;if(navigator.plugins&&navigator.mimeTypes.length){var a=navigator.plugins["Shockwave Flash"];if(a&&a.description){d=true;g=a.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".")}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var c=1;var b=3;while(c){try{b++;c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+b);d=true;g=[b,0,0]}catch(f){c=null}}}else{try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(f){try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");g=[6,0,21];d=true;c.AllowScriptAccess="always"}catch(f){if(g[0]==6){d=true}}if(!d){try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(f){}}}if((!d)&&(c!=null)){d=true;g=c.GetVariable("$version").split(" ")[1].split(",")}}}if(d){return g.map(function(e){return parseInt(e,10)})}else{return null}},_flashCallMethod:function(c,b){console.log("_flashCallMethod(%@)".format($A(arguments)));args=$A(arguments);args.shift();args.shift();var a=_flashViews[c];if(a){var d=a[b];d.apply(a,args)}}});_flashViews={};Mac.PANEL_ALERT_PANE="panelalert";SC.PanelalertPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane panel-pane panelalert-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div></div>',layer:100});Mac.MonthCalendarView=SC.View.extend({currentDate:null,selectedDate:null,viewingMonth:null,startingWeekday:null,showNextPrevButtons:false,showMonthLabel:true,collapseRows:true,showingCanvas:"month",showCanvas:"month",visibleDays:7,highlightNowShowing:false,selectedDateIndex:0,useLongMonth:true,useLongDay:true,numRows:6,clickOffMonth:true,changePeriodChangesSelectedDate:false,enableTimeZone:false,displayPeriod:true,dimensions:[],locMonthsLong:["January","February","March","April","May","June","July","August","September","October","November","December"],locMonthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],locDaysLong:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],locDaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],prevMonthLabel:"<",prevMonthTooltip:"Go back one month",nextMonthLabel:">",nextMonthTooltip:"Go forward one month",outlets:["days","monthGrid","monthLabel","nextButton","prevButton","dayLabels"],monthGrid:".month-grid?",dayLabels:Mac.LabelView.extend({}).outletFor(".label"),monthLabel:SC.LabelView.extend({valueBinding:"*owner.monthGridHeading",isVisibleBinding:"*owner.showMonthLabel"}).outletFor(".month?"),nextButton:SC.ButtonView.extend({action:function(){this.owner.changePeriod(true)},localize:true,labelSelector:null,isVisibleBinding:"*owner.showNextPrevButtons",labelTextBinding:"*owner.nextButtonLabel",toolTipBinding:"*owner.nextButtonTooltip"}).outletFor(".next-button?"),prevButton:SC.ButtonView.extend({action:function(){this.owner.changePeriod(false)},localize:true,labelSelector:null,isVisibleBinding:"*owner.showNextPrevButtons",labelTextBinding:"*owner.prevButtonLabel",toolTipBinding:"*owner.prevButtonTooltip"}).outletFor(".prev-button?"),didAddToParent:function(){this.resizeWithOldParentSize()},resizeWithOldParentSize:function(a){},monthGridHeading:function(){var b=this.get("viewingMonth");if(b){var a=(this.get("useLongMonth"))?this.locMonthsLong:locMonthsShort;return a[b.getMonth()].loc()+" "+b.getFullYear()}}.property("viewingMonth"),calendarStart:function(){var a=this.get("startingWeekday");var b=this.get("viewingMonth");if(b){var c=a-b.getDay();if(c>0){c=a-b.getDay()-7}this.calendarHeadings();return new Date(b.getFullYear(),b.getMonth(),c+1,0,0,0,0)}}.property("viewingMonth","startingWeekday"),init:function(){arguments.callee.base.call(this);this.days=this.$$sel(".month-grid td");for(var a=0;a<42;a++){this.days[a].thisIndex=a}for(var a=0;a<6;a++){Element.addClassName(this.days[a*7+6],"month-right-edge");Element.addClassName(this.days[a*7],"month-left-edge")}if(!this.collapseRows){for(var a=0;a<7;a++){Element.addClassName(this.days[35+a],"")}Element.addClassName(this.monthGrid,"six-rows")}},mouseDown:function(c){var b=null;if(Element.hasClassName(c.target,"day")){b=c.target.parentNode.date}else{if(c.target.date){b=c.target.date}}if(b!=null){var a=new Date(b);if(!this.get("clickOffMonth")){this.blockViewingMonthChange=true}this.set("selectedDate",new Date(a));Calendar.eventsController.set("selection",[]);if(this.get("visibleDays")==5&&(a.getDay()==0||a.getDay()==6)){this.set("visibleDays",7)}}},blockViewingMonthChange:false,selectedDateObserver:function(){if(this.get("selectedDate")!=null){var g=this.get("selectedDate");var b=g.getMonth();var e=g.getFullYear();if(this.get("viewingMonth")==null||((e!=this.get("viewingMonth").getYear()||b!=this.get("viewingMonth").getMonth())&&!this.blockViewingMonthChange)){this.set("viewingMonth",new Date(e,b,1,0,0,0,0));this.setDisplayPeriod()}else{var d=this.get("calendarStart");var a=this.get("currentDate");for(var f=0;f<42;f++){var c=false;if(this.dateEquals(g,d)&&this.get("viewingMonth")!=d.getMonth()){this.selectedDateIndex=f;c=true}Element.setClassName(this.days[f],"selected-date",c);Element.setClassName(this.days[f].childNodes[0],"sel",c);Element.removeClassName(this.days[f],"highlight-period");d.setDate(d.getDate()+1)}this.setHighlight()}}this.blockViewingMonthChange=false}.observes("selectedDate"),renderObserver:function(){this.numRows=6;var h=this.get("selectedDate");var b=this.get("currentDate");var n=this.get("viewingMonth");if(h===null||b===null||n===null){return}var n=this.get("viewingMonth").getMonth();var o=this.get("calendarStart");var m=parseInt(this.get("startingWeekday"));var p=0;for(var f=0;f<6;f++){var g=[true,true,true,true,true,true,true];for(var e=0;e<7;e++){var r=7*f+e;if(this.days[r]){var q=(n!=o.getMonth());var l=(this.dateEquals(o,b)&&n==o.getMonth());var c=o.getDate().toString();var a=false;if(this.dateEquals(h,o)&&!q){this.selectedDateIndex=r;a=true}g[e]=(n!=o.getMonth());this.days[r].firstChild.innerHTML=c;this.days[r].style.display="";Element.setClassName(this.days[r],"today-date",l);Element.setClassName(this.days[r].childNodes[0],"today",l);Element.setClassName(this.days[r],"off-month",q);Element.setClassName(this.days[r].childNodes[0],"outofrange",q);Element.setClassName(this.days[r],"selected-date",a);Element.setClassName(this.days[r].childNodes[0],"sel",a);Element.removeClassName(this.days[r],"highlight-period");Element.removeClassName(this.days[r],"no-leftborder");Element.removeClassName(this.days[r],"no-rightborder");Element.removeClassName(this.days[r],"no-topborder");Element.removeClassName(this.days[r],"no-bottomborder");this.days[r].weekDay=(e+m)%7;this.days[r].isSelected=a;this.days[r].isOffMonth=q;this.days[r].isToday=l;this.days[r].date=o.getTime();this.days[r].month=o.getMonth();o.setDate(o.getDate()+1)}}if(g[0]&&g[1]&&g[2]&&g[3]&&g[4]&&g[5]&&g[6]&&this.collapseRows){this.numRows--;for(var d=0;d<7;d++){this.days[7*f+d].style.display="none"}}else{p++}}if(this.collapseRows){for(var d=0;d<7;d++){Element.setClassName(this.days[21+d],"month-bottom-edge",p==4);Element.setClassName(this.days[28+d],"month-bottom-edge",p==5);Element.setClassName(this.days[35+d],"month-bottom-edge",p==6)}Element.setClassName(this.monthGrid,"four-rows",p==4);Element.setClassName(this.monthGrid,"five-rows",p==5)}this.setHighlight();this.resizeWithOldParentSize()}.observes("currentDate","viewingMonth","startingWeekday","visibleDays","showingCanvas","showCanvas"),setHighlight:function(){if(this.get("highlightNowShowing")&&(this.get("selectedDate").getMonth()==this.get("viewingMonth").getMonth())&&(this.get("selectedDate").getYear()==this.get("viewingMonth").getYear())&&this.get("showCanvas")!="day"){var e=0;var b=42;var a=this.selectedDateIndex;if(this.get("showingCanvas")=="week"){if(this.get("visibleDays")==5){e=a-(this.days[a].weekDay-1);b=a-(this.days[a].weekDay-1)+5}else{var d=Math.floor((a/7));e=d*7;b=d*7+7}}if(e<0){e=0}if(b>42){b=42}for(var c=e;c<b;c++){if(this.get("visibleDays")==7||this.get("showingCanvas")=="month"||(this.get("visibleDays")==5&&(this.days[c].weekDay!=0&&this.days[c].weekDay!=6))){Element.setClassName(this.days[c],"highlight-period",!Element.hasClassName(this.days[c],"off-month"))}}}},calendarHeadings:function(){var c=(this.get("useLongDay"))?this.locDaysLong:this.locDaysShort;var b=parseInt(this.get("startingWeekday"),0);for(var a=0;a<7;a++){this.dayLabels[a].set("value",c[(a+b)%7])}},dateEquals:function(b,a){return(b.getYear()==a.getYear()&&b.getMonth()==a.getMonth()&&b.getDate()==a.getDate())},shouldCalculatePeriod:function(){return true},setDisplayPeriod:function(){if(!this.shouldCalculatePeriod()){return}var c=parseInt(this.get("startingWeekday"),0);var d=this.get("viewingMonth");if(c==NaN){return}if(!d){return}var a=new Date(d.getTime());var e=c-d.getDay();if(e>0){e=c-d.getDay()-7}a.setDate(a.getDate()+e);var b=new Date(a.getTime());if(this.collapseRows){b.setDate(b.getDate()+28);if(b.getMonth()==d.getMonth()){b.setDate(b.getDate()+7)}if(b.getMonth()==d.getMonth()){b.setDate(b.getDate()+7)}}else{b.setDate(b.getDate()+42)}if(this.enableTimeZone){Calendar.toUTCDate(a);Calendar.toUTCDate(b)}this.set("displayPeriod",[a,b])},changePeriod:function(c){var e=(c)?1:-1;var d=this.get("viewingMonth");var b=parseInt(this.get("startingWeekday"),0);d.setMonth(d.getMonth()+e);this.set("viewingMonth",d);if(!this.changePeriodChangesSelectedDate&&this.clickOffMonth){return}this.setDisplayPeriod();var a=new Date(this.get("selectedDate"));if(this.changePeriodChangesSelectedDate&&this.clickOffMonth){a.setMonth(a.getMonth()+e)}else{a.setMonth(d.getMonth());if(d.getMonth()<a.getMonth()&&d.getFullYear()==a.getFullYear()){while(d.getMonth()!=a.getMonth()){a.setDate(a.getDate()-1)}}else{if(d.getFullYear()!=a.getFullYear()){a.setFullYear(d.getFullYear())}}}this.set("selectedDate",new Date(a))}});require("views/month_calendar");Mac.DatePickerCalendarView=Mac.MonthCalendarView.extend({locDaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],mouseDown:function(c){var b=null;if(Element.hasClassName(c.target,"day")){b=c.target.parentNode.date}else{if(c.target.date){b=c.target.date}}if(b!=null){var a=new Date(b);this.set("selectedDate",new Date(a));if(this.get("visibleDays")==5&&(a.getDay()==0||a.getDay()==6)){this.set("visibleDays",7)}}},mouseUp:function(a){this.owner.set("isVisible",false)},selectedDateObserver:function(){if(this.get("selectedDate")!=null){var g=this.get("selectedDate");var b=g.getMonth();var e=g.getFullYear();if(this.get("viewingMonth")==null||b!=this.get("viewingMonth").getMonth()){this.set("viewingMonth",new Date(e,b,1,0,0,0,0))}else{var d=this.get("calendarStart");var a=this.get("currentDate");for(var f=0;f<42;f++){var c=false;if(this.dateEquals(g,d)&&this.get("viewingMonth")!=d.getMonth()){this.selectedDateIndex=f;c=true}Element.setClassName(this.days[f],"selected-date",c);d.setDate(d.getDate()+1)}}}}.observes("selectedDate")});require("core");Mac.AjaxUploader=SC.Object.extend({init:function(){arguments.callee.base.apply(this,arguments);var a="background_uploader"+Math.floor(Math.random()*100000);this.iframe=Element("iframe",{border:0,width:1,height:1,name:a,id:a,src:"about:blank"});this.iframe.observe("load",this._onFrameLoaded.bind(this));document.body.appendChild(this.iframe)},_onFrameLoaded:function(){var a=this.iframe;var b=(a.contentDocument)?a.contentDocument:a.contentWindow.document;if(b.location.href!="about:blank"){this.onUploadResponse(b)}},onUploadRequest:function(a){},onUploadResponse:function(a){},submit:function(a){a.target=this.iframe.name;this.onUploadRequest(a);a.submit()}});Mac.ServerJSVersion="$Revision: 1.3 $";require("core");Mac.ServerClass=Mac.Object.extend({_pollingTimer:null,_observers:{html:{},tokens:{}},_lastRequest:null,_requestName:null,adaptor:null,prefix:["Calendar","Contacts","Sidewinder","Shared","Photos","CoreFiles","PublicFiles"],preload:function(a){if((!a)||(a.size==0)){return}this.refreshRecordsWithData(a,SC.Record,null,false)},refreshRecordsWithData:function(d,e,a,b){var c=this;d=d.map(function(h){h=c._camelizeData(h);if(h.id){h.guid=h.id;delete h.id}if(h.type){var i=h.type.capitalize();if(c.prefix){for(var f=0;f<c.prefix.length;f++){var g=window[c.prefix[f]];if(g){h.recordType=g[i]}if(h.recordType){break}}}else{h.recordType=window[i]}if(!h.recordType){console.log("skipping undefined recordType:"+i)}}else{h.recordType=e}if(!h.recordType){return null}return h}).compact();SC.Store.updateRecords(d,c,e,b)},_camelizeData:function(e){if(e==null){return e}var c=this;if(e instanceof Array){return e.map(function(f){return c._camelizeData(f)})}if(typeof(e)=="object"){var a={};for(var b in e){var d=c._camelizeData(e[b]);if(b=="id"){b="guid"}a[b.replace(/_/g,"-").camelize()]=d}return a}return e},_decamelizeData:function(e){if(e==null){return e}var c=this;if(e instanceof Array){return e.map(function(f){return c._decamelizeData(f)})}if(typeof(e)=="object"){var a={};for(var b in e){var d=c._decamelizeData(e[b]);if(b=="guid"){b="id"}a[b.decamelize()]=d}return a}return e},_clearPollingTimer:function(){if(this._pollingTimer){clearInterval(pollingTimer);this._pollingTimer=null}},_threadResponse:function(e,c,b,d){var a=this._parseJsonResponse(e,b,d);if(a){c(a)}},_reportError:function(a){this._clearPollingTimer();if(!a){a="Request failed."}},_evaluateXMLResponse:function(c,a,b){this.adaptor.handleXMLResponse(c,a,b)},_evaluateTextResponse:function(c,a,b){this.adaptor.handleTextResponse(c,a,b)},_parseJsonResponse:function(originalResponse,url,requestId){var result;var errorMessage;var statusMessage;try{var txt=originalResponse.responseText;if(txt.substr(0,2)=="/*"){txt=txt.substring(2,txt.length-2)}var start=new Date().getTime();var result="";try{result=eval("("+txt+")")}catch(e){window.console.log("XHR unable to parse response: "+e.toString());window.console.log(e);window.console.log(txt);window.console.info("This above exception is thrown by eval function that failed because the response was not in JSON format. Ideally server should have returned JSON. For time being response text is ignored and is replaced by an empty JSON record.");txt='{ "status" : 1, "statusString" : "Success"}';result=eval("("+txt+")")}var end=new Date().getTime();switch(result.status){case -1:case 0:case 1:case 3:case 4:this._clearPollingTimer();this.adaptor.handleResponse(originalResponse,result,url,requestId);break;case 2:this._checkThreadedResponse(result,successFunc,url,requestId);break;default:this._clearPollingTimer()}}catch(e){this._clearPollingTimer();window.console.log("XHR unable to parse response: "+e.toString())}result=null;return result},_checkThreadedResponse:function(a,e,c,f){var c=urlBase()+"wa/ScriptAction/checkThreadStatus";var d="threadName="+encodeURIComponent(a.threadName);var b=a.pollInterval?a.pollInterval*1000:3000;this._clearPollingTimer();that=this;pollingTimer=setTimeout(function(){new Ajax.Request(c,{method:"post",postBody:d,onFailure:that._reportError,onSuccess:function(g){that._threadResponse(g,e,c,f)}})},b)},_domainForUrl:function(b){var a=b.slice(0,3);if(a=="/wo"){a=b.match(/\/wo\/WebObjects\/[^\/]+/)[0]}return a},_authenticationDomainFor:function(c){var d=this._domainForUrl(c);var a=this._domains=this._domains||{};var b=a[d];if(!b){b={domain:d,isReady:NO,requestPending:NO,queue:[]};a[d]=b}return b},request:function(b,a,e){var d=this._authenticationDomainFor(b);if(!d.isReady){if(d.requestPending){d.queue.push([b,a,e]);return}else{d.requestPending=NO}}this.adaptor=e;a.retryDelay=50;a.onFailure=function(f,h,g){c.adaptor.requestQueue[h].onFailure(g)}.bind(this,b,a.requestId);var c=this;a.onComplete=function(f,h,g){c.adaptor.set("showSpinner",false)}.bind(this,b,a.requestId);a.onSuccess=function(g,j,h){if(c._lastRequest==null){setTimeout(arguments.callee.bind(this,g,j,h),1);return}if(!d.isReady){d.isReady=YES;var i;while(i=d.queue.shift()){this.request(i[0],i[1],i[2]);i=i[0]=i[1]=i[2]=null}}var f,k=h.getResponseHeader("Content-Type");if(k===null||k===undefined){console.log("Server has not returned any content type. Defaulting to text/plain");k="text/plain"}c.adaptor.set("end",new Date().getTime());c.adaptor.set("start",0);c.adaptor.set("end",0);if(k){k=k.split(";")[0];switch(k){case"application/x-javascript":case"text/javascript":case"text/json":case"application/json":f=c._parseJsonResponse(h,g,j);break;case"text/xml":case"application/xml":case"application/rss+xml":case"application/atom+xml":f=c._evaluateXMLResponse(h,g,j);break;default:f=c._parseJsonResponse(h,g,j)}}else{f=c._evaluateTextResponse(h,g,j)}c._lastRequest==null}.bind(this,b,a.requestId);this._lastRequest=new Ajax.Request(b,a)},_authQueue:[],_authOutstanding:NO,authUnity:function(e,d,h){if(this._authOutstanding){this._authQueue.push([e,d,h])}else{this._authOutstanding=YES}var a=h.getHeader("X-Auth-Apple-Service");window.appleAuth=null;var c="%@1%@2&r=%@3".fmt(window.sso.quietAuthUrl,a,Math.round(Math.random()*100000));console.log("#authUrl: %@".fmt(c));var b=$(d.authNodeId);var g=document.createElement("script");g.src=c;g.id="dma"+Math.round(Math.random()*100000);d.authNodeId=g.id;var f=$tag("head");f.appendChild(g);setTimeout(this._checkAuth.bind(this,e,d,Date.now()),50)},_checkAuth:function(c,b,f){var d=false;var a=null;if(a=window.sso.getArtifactQueryString()){c+=(c.indexOf("?")<0)?"?":"&";c+=a;if(!b.retryDelay){b.retryDelay=100}b.retryDelay*=2;console.log("#checkAuth: %@1  [delay %@2ms]  ".fmt(c,b.retryDelay));setTimeout(function(){this._lastRequest=new Ajax.Request(c,b)}.bind(this),b.retryDelay);this._doNextAuth();d=true}else{if(window.appleAuth){var e=window.location.toString();window.sso.redirectToLoginFor("client",e)}}if(!d){if((Date.now()-f)>5000){this._doNextAuth();b.onFailure(c,{status:500})}else{setTimeout(this._checkAuth.bind(this,c,b,f),50)}}},_doNextAuth:function(){this._authOutstanding=NO;var a=this._authQueue.pop();if(a){this.authUnity(a[0],a[1],a[2]);a=a[0]=a[1]=a[2]=null}}});Mac.Server=Mac.ServerClass.create();SC.Validator.IsDate=SC.Validator.Date.extend({validate:function(b,d){var c=d.get("fieldValue");var a=!!c;if(a&&c.length){a=Date.isDate(c)}return a},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return $error("Invalid.Date(%@)".loc(),c.get("errorLabel"))}});require("core");Mac.SearchFieldView=SC.TextFieldView.extend({insertNewline:function(){Mac.dockController.performSearch()}});require("core");Mac.BranchItemView=SC.ListItemView.extend({emptyElement:['<div class="sc-list-item-view branch-item file"></div>'].join(""),acceptsFirstResponder:true,PIXELSINACHAR:8,DOTSPIXELSPACE:11,labelRefer:null,labelIndex:null,previousSelected:null,mouseMoveFirst:null,DESTINATIONRECORD:null,Updated:0,SOURCECONTENT:null,AVGWIDTHOFICONANDARROW:70,contentPropertyDidChange:function(){arguments.callee.base.apply(this);if(this.get("content").get("isDirectory").toString().toLowerCase()=="false"){this.rootElement.setStyle({backgroundImage:"none"})}},editIfSelected:function(a){if(!this.get("isSelected")){return}setTimeout(function(){if(this.canEditTitle()){this.beginEditing()}}.bind(this),Mac.CLICK_TO_EDIT_TITLE_DELAY)},canEditTitle:function(){return true},render:function(){arguments.callee.base.apply(this,arguments);this.rootElement.childNodes[1].onmousedown=this.editIfSelected.bind(this)},renderLabelHtml:function(g){var g=this.get("content").get("name");if(g.length>this.owner.maxCharsInItem){this.owner.maxCharsInItem=g.length}var i=parseInt((this.owner.columnWidth-this.AVGWIDTHOFICONANDARROW-this.DOTSPIXELSPACE),10);var h="...";var a=g;var e=g.length/2;var c=g.length*this.PIXELSINACHAR;console.warn("labelSize!!!!!!!!!!!!!!!!!!!!!!!!!!"+c);if(c>i){while((a.length*this.PIXELSINACHAR)>i){var b=g.substr(0,e);var f=g.substr(g.length-e);h=b+"..."+f;a=h;e=e-1}}var d=[];d.push('<span class="sc-label branch-item-label title">');d.push(a||"");d.push("</span>");return d.join("")},renderIconHtml:function(c){var a=[];var b=null;var d=null;if(this.get("content").get("isDirectory")){b="image_folder"}else{b="image_file";c="image_"+this.get("content").get("extension")}d=c;a.push('<span class="sc-icon branch-icon '+b+" "+d+'">');a.push("&nbsp");a.push("</span>");a=a.join("");return a},selectionDidChange:function(){if(this.get("isSelected")){this.owner.set("selectedBranchItemView",this)}}.observes("isSelected")});require("core");require("views/branch_item");Mac.BranchView=SC.CollectionView.extend({emptyElement:['<div class="col"></div>'].join(""),rowHeight:23,hasContentIcon:YES,contentIconKey:"keyImage",contentValueKey:"name",columnWidth:266,maxCharsInItem:0,acceptsFirstResponder:true,selectedBranchItemView:null,exampleView:Mac.BranchItemView,mouseDown:function(){arguments.callee.base.apply(this,arguments);this.becomeFirstResponder()},columnView:null,columnController:null,moveLeft:function(){var a=this.get("previousSibling");var b=this.get("nextSibling");if(a){a.becomeFirstResponder();a.selectItems(a.get("selection"),false)}else{this.selectPreviousItem()}},moveRight:function(){var a=this.get("nextSibling");if(a){if(this.get("selection").get("isDirectory")=="true"){if(a.get("selection")==""&&a.get("content")!=""){a.becomeFirstResponder();a.selectNextItem()}}else{this.selectNextItem()}}else{this.becomeFirstResponder();this.selectItems(this.get("content")[0],false)}},insertNewline:function(){if(!this.selectedBranchItemView.labelView.get("isEditing")){this.selectedBranchItemView.labelView.oldName=this.selectedBranchItemView.labelView.get("content");this.selectedBranchItemView.labelView.beginInlineEdit()}},cancel:function(){var a=this.get("previousSibling");var b=this.get("nextSibling");if(a){a.becomeFirstResponder();b.set("content",null);this.set("selection",null)}else{this.selectedBranchItemView.set("isSelected",null);this.set("selection",null)}},computeFrame:function(){var b=265;var d=this.get("content");var g=(d)?d.get("length"):0;if(!this.previousSibling){b=0}if(g>0){var h;h=this.get("content").get("guid")[0].split("/").length-4;b=b*h}if(g==0&&this.previousSibling){b=this.previousSibling.get("size").x+265}var c=this.get("rowHeight")||23;var a=this.get("parentNode");var e=(a)?a.get("innerFrame"):{width:100,height:100};e.width=265;e.x=b;e.y=0;e.height=Math.max(e.height,g*c);return e},layoutItemView:function(a,g,e){SC.Benchmark.start("SC.ListView.layoutItemViewsFor");var c=this.get("rowHeight")||0;var b=a.get("parentView");var d={x:0,y:g*c,height:c,width:(b||this).get("innerFrame").width};if(e||!SC.rectsEqual(a.get("frame"),d)){a.set("frame",d);a.setStyle({zIndex:g.toString()})}SC.Benchmark.end("SC.ListView.layoutItemViewsFor")},selectionDidChange:function(){console.log("BranchView->selectionDidChange");var b=0;if(this.get("selection").get("isDirectory").toString()=="true"){b=this.columnWidth}else{if(this.get("selection").get("isDirectory").toString()=="false"){b=this.fileWidth}}var a=parseFloat(Element.getStyle(this.rootElement,"left"))+parseFloat(Element.getStyle(this.rootElement,"width"))+this.SOURCELISTWIDTH+b;scrollFlag=a-window.document.width;if((scrollFlag>0)&&(this.hasClassName("dragger"))){branchView=this;while(branchView!=null){branchView.setClassName("scroll_dragger",true);branchView.removeClassName("dragger",true);branchView=branchView.get("previousSibling")}}else{if(!this.hasClassName("dragger")&&(scrollFlag<0)){branchView=this;if(this.nextSibling){this.nextSibling.setClassName("dragger",true);this.nextSibling.removeClassName("scroll_dragger",true)}while(branchView!=null){branchView.setClassName("dragger",true);branchView.removeClassName("scroll_dragger",true);branchView=branchView.get("previousSibling")}}}}.observes("selection")});require("core");Mac.ColumnView=SC.View.extend({content:null,selectionContent:null,parentProperty:"parent",iconProperty:"iconClass",labelProperty:"",leafSelection:function(){var a=this.get("selection")||[];return a.reject(Mac.ColumnView.modelObjectIsBranch)}.property("selection"),delegate:null,branchViewClass:Mac.BranchView,leafViewClass:null,rootColumnController:null,listHeading:"",insertBranchColumnAfter:function(c){var b=this.get("branchViewClass");if(b==null){return null}var d=b.viewFor(null);var a=(c)?c.get("nextSibling"):this.get("firstChild");this.insertBefore(d,a);return d},insertLeafColumnAfter:function(c){var b=this.get("leafViewClass");if(this.listHeading=="Sites"){b=this.get("leafViewClassSites")}if(b==null){return null}var d=b.viewFor(null);var a=(c)?c.get("nextSibling"):this.get("firstChild");this.insertBefore(d,a);return d},scrollToColumn:function(a){},didCurrentSelectionChanged:function(){console.log("Mac.ColumnView -> didCurrentSelectionChanged");console.log(this.selectionContent);this.setupDeatiledController(this.get("selectionContent"))}.observes("selectionContent"),setupDeatiledController:function(a){console.log("Mac.ColumnView -> setupDeatiledController");if(a.length<1){CoreFiles.detailController.set("content",this.get("content"))}else{if(a.get("isDirectory")==true){CoreFiles.detailController.set("content",a)}else{CoreFiles.detailController.set("content",CoreFiles.File.find({guid:a.get("parent")}))}}console.log(CoreFiles.detailController.get("content"))},selectionDidChange:function(){console.log("Mac.ColumnView -> selectionDidChange");console.log(this.get("selection"));this.setupDeatiledController(this.get("selection"));this.listHeading=CoreFiles.canvasController.selectedSourceListItem.get("listHeading");if(this.selectionContent){console.log("column view -> Route set location");console.log(this.selectionContent.get("url"));console.log(this.selection.get("url"));SC.Routes.set("location",this.selectionContent.get("url"))}}.observes("selection"),handleRoute:function(b){console.log("column view -> handleRoute");console.log(b);console.log(SC.page.get("main").get("canvasContainer")._tabs.columnView.get("columnList"));if(b.url){var a=b.url.split("/");SC.page.get("main").get("canvasContainer")._tabs.columnView.get("columnList").repaint(a)}},repaint:function(c){console.log("Inside repaint method ...");console.log(c);console.log(c.length);var e=2;var b=c.length;var d="/"+c[1];if(this.rootColumnController.nextColumnController){this.rootColumnController.clearNextColumnController()}var a=this.rootColumnController;while(e<b){var f=CoreFiles.File.findOrCreate({guid:d});a.set("content",f);d=d+"/"+c[e];e++;a.createNextColumnController();a=a.nextColumnController}},getValues:function(){var a=this.rootColumnController;var b=this.childNodes.length-1;var c=null;while(b>=0){if(this.childNodes[b].get("isFirstResponder")){c=this.childNodes[b].get("selection");break}else{b-=1}}return c},layoutColumns:function(){var child=this.get("firstChild");var position=0;while(child){var colWidth=child.get("columnWidth");child.setClassName("branch_width",true);var newStyle={};newStyle.width=eval(colWidth-1)+"px";child.setStyle(newStyle);child.set("origin",{x:position});position+=colWidth;child=child.get("nextSibling")}},init:function(){arguments.callee.base.apply(this,arguments);this.setClassName("files",true);this.rootColumnController=Mac.ColumnController.create({columnView:this,contentBinding:"*columnView.content",selectionBinding:"*managedView.selection"})},contentDidChange:function(){var b=CoreFiles.canvasController.selectedSourceListItem;$view(".folder_name").setStyle("display:none");this.removeClassName("column_list_MaiTai");if(b.get("listHeading")=="Sites"){$view(".folder_name").setStyle("display:inline");this.addClassName("column_list_MaiTai");this.owner.folderName.folderLabelWeb.setStyle("display:none");this.owner.folderName.folderLabelHomeSites.setStyle("display:none");this.owner.folderName.folderLabelGroups.setStyle("display:none");this.owner.folderName.folderLinkGroups.setStyle("display: none");this.owner.folderName.folderLinkWeb.setStyle("display: none");this.owner.folderName.folderLinkHomePage.setStyle("display: none");var a=b.get("name");switch(a){case"iWeb":this.owner.folderName.folderLabelWeb.setStyle("display:inline");this.owner.folderName.folderLinkWeb.setStyle("display: inline");break;case"Homepage":this.owner.folderName.folderLabelHomeSites.setStyle("display:inline");this.owner.folderName.folderLinkHomePage.setStyle("display: inline");break;case"Groups":this.owner.folderName.folderLabelGroups.setStyle("display:inline");this.owner.folderName.folderLinkGroups.setStyle("display: inline");break}}}.observes("content")});Mac.ColumnView.mixin({modelObjectIsLeaf:function(a){if(!a||!a.get){return true}if((a.get("length")||0)>0){return false}if(a.get("isLeaf")==true){return true}},modelObjectIsBranch:function(a){return !Mac.ColumnView.modelObjectIsLeaf(a)}});require("core");Mac.DockBadgeView=SC.View.extend({emptyElement:'<div class="dock-badge"></div>',anchorView:null,unreadCount:0,warningCount:0,infoCount:0,_updateDisplayState:function(){if(!this.didChangeFor("counts","anchorView","unreadCount","warningCount","infoCount")){return}var b=this.get("unreadCount");var c=this.get("warningCount");var a=this.get("infoCount");var h=this.get("anchorView");var d={width:14,height:15};if((b+c+a)==0){this.set("isVisible",false)}else{this.set("isVisible",true);if(c>0){a=0;b=0}if(b>0){a=0}this.setClassName("warning-badge",c>0);this.setClassName("info-badge",a>0);this.setClassName("single-unread-badge",(b>0)&&(b<10));this.setClassName("double-unread-badge",(b>9)&&(b<100));this.setClassName("triple-unread-badge",b>99);if(this.asHTML===undefined){this.set("innerHTML",(b>0)?((b>999)?"999+":b.toString()):"")}else{this.set("asHTML",(b>0)?((b>999)?"999+":b.toString()):"")}if(c>0){d.width=16}else{if(b>9){d.width=(b<100)?19:25}}}if(h){var e=h.convertFrameToView(h.get("frame"),this);var g={x:(SC.maxX(e)-d.width)+4,y:SC.minY(e)-10};this.set("frame",g)}}.observes("anchorView","unreadCount","warningCount","infoCount"),didAddToParent:function(){this._updateDisplayState()}});require("core");Mac.BranchDragIconView=SC.View.extend({count:null,emptyElement:['<div class="branch-drag-icon">','<div class="branch-badge"></div>',"</div>"].join(""),outlets:["countLabel"],countLabel:SC.LabelView.extend({contentBinding:"*owner.count"}).outletFor(".branch-badge")});require("core");SC.SplitPaneView=SC.View.extend({emptyElement:'<div class="split_pane"></div>',isPositioned:true});SC.SplitPaneDividerView=SC.View.extend(SC.DragSource,{emptyElement:'<div class="split_pane_divider"></div>',isPositioned:true,mouseDown:function(a){return true},mouseDragged:function(a){SC.Drag.start({event:a,source:this,anchorView:this.get("parentNode"),dragView:SC.View.viewFor(null)})},dragDidBegin:function(b,a){this._xNew=null;this._xOffset=null;this._xCurrent=a.x;this._prevView=this.get("previousSibling");this._nextView=this.get("nextSibling");this._isLastPane=this.get("parentNode").get("lastChild")==this._nextView;this._prevViewWidth=this._prevView.get("size").width;this._nextViewWidth=this._nextView.get("size").width;this._nextViewX=this._nextView.get("origin").x;this._thisViewx=this.get("origin").x;this._minPaneWidth=120;this._maxPaneWidth=400},dragDidMove:function(d,a){this._xNew=a.x;this._xOffset=this._xNew-this._xCurrent;var f=this._prevViewWidth+this._xOffset;var b=this._nextViewWidth-this._xOffset;var h=this._nextViewX+this._xOffset;var e=this._thisViewx+this._xOffset;var g=(this._xOffset>0&&!this._isLastPane)?b:f;var c=(this._xOffset<0&&!this._isLastPane)?b:f;if(g>=this._minPaneWidth&&c<=this._maxPaneWidth){this._prevViewWidth=f;this._nextViewWidth=b;this._nextViewX=h;this._thisViewx=e;this._xCurrent=this._xNew;this._resizeAndPositionViews()}},dragDidEnd:function(c,b,a){},_resizeAndPositionViews:function(){this.set("origin",{x:this._thisViewx});this._prevView.set("size",{width:this._prevViewWidth});this._nextView.set("origin",{x:this._nextViewX});if(!this._isLastPane){this._nextView.set("size",{width:this._nextViewWidth})}else{this._nextView.rootElement.style.right="0px"}}});Mac.PICKER_RIGHT_PANE="pickerright";SC.PickerrightPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane pickerright-pane picker-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div><div class="pointer"></div></div></div>',layer:300,isModal:false,positionPane:function(){var d=this.anchorView;var c=this.containerView;var a;if(d){a=c.convertFrameFromView(d.get("frame"),d);a=this.fitPositionToScreen(c,d)}else{var b=SC.window.get("size");var e=c.get("size");a.x=(b.width-e.width)/2;a.y=(b.height-e.height)/2}c.set("origin",a)},fitPositionToScreen:function(g,d){if(g){g._frame=null}var e=g.convertFrameToView(g.get("frame"),null);var l=d.convertFrameToView(d.get("frame"),null);var h=SC.window.get("frame");e.x=l.x>0?l.x+15:0;e.y=l.y+parseInt(l.height/3,0)-35;this.get("pickerPointer").setPointerType("perfectRight");var b=[[l.x+l.width-15,l.y+parseInt(l.height/3,0)-35],[l.x-e.width+15,l.y+parseInt(l.height/3,0)-35],[l.x+parseInt(l.width/2,0)-parseInt(e.width/2,0),l.y-e.height-5],[l.x+parseInt(l.width/2,0)-parseInt(e.width/2,0),l.y+l.height+5],];var a=[[l.x+l.width+e.width-15,l.y+parseInt(l.height/3,0)+e.height-35],[l.x+15,l.y+parseInt(l.height/3,0)+e.height-35],[l.x+parseInt(l.width/2,0)-parseInt(e.width/2,0)+e.width,l.y-5],[l.x+parseInt(l.width/2,0)-parseInt(e.width/2,0)+e.width,l.y+l.height+e.height+5],];var c=[[b[0][1]>0?0:0-b[0][1],a[0][0]<h.width?0:a[0][0]-h.width,a[0][1]<h.height?0:a[0][1]-h.height,b[0][0]>0?0:0-b[0][0]],[b[1][1]>0?0:0-b[1][1],a[1][0]<h.width?0:a[1][0]-h.width,a[1][1]<h.height?0:a[1][1]-h.height,b[1][0]>0?0:0-b[1][0]],[b[2][1]>0?0:0-b[2][1],a[2][0]<h.width?0:a[2][0]-h.width,a[2][1]<h.height?0:a[2][1]-h.height,b[2][0]>0?0:0-b[2][0]],[b[3][1]>0?0:0-b[3][1],a[3][0]<h.width?0:a[3][0]-h.width,a[3][1]<h.height?0:a[3][1]-h.height,b[3][0]>0?0:0-b[3][0]]];if(c[0][0]==0&&c[0][1]==0&&c[0][2]==0&&c[0][3]==0){e.x=b[0][0];e.y=b[0][1];this.get("pickerPointer").setPointerType("perfectRight")}else{if(c[1][0]==0&&c[1][1]==0&&c[1][2]==0&&c[1][3]==0){e.x=b[1][0];e.y=b[1][1];this.get("pickerPointer").setPointerType("perfectLeft")}else{if(c[2][0]==0&&c[2][1]==0&&c[2][2]==0&&c[2][3]==0){e.x=b[2][0];e.y=b[2][1];this.get("pickerPointer").setPointerType("perfectTop")}else{if(c[3][0]==0&&c[3][1]==0&&c[3][2]==0&&c[3][3]==0){e.x=b[3][0];e.y=b[3][1];this.get("pickerPointer").setPointerType("perfectBottom")}else{var j=[[[l.x+l.width-15,l.y-e.height+(20+15)],[l.x+l.width-15,l.y+l.height-(20+15)]],[[l.x-e.width+15,l.y-e.height+(20+15)],[l.x-e.width+15,l.y+l.height-(20+15)]],[[l.x-e.width+(30+15),l.y-e.height-5],[l.x+l.width-(30+15),l.y-e.height-5]],[[l.x-e.width+(30+15),l.y+l.height+5],[l.x+l.width-(30+15),l.y+l.height+5]]];var i=[[[l.x+l.width+e.width-15,l.y+(20+15)],[l.x+l.width+e.width-15,l.y+l.height+e.height-(20+15)]],[[l.x+15,l.y+(20+15)],[l.x+15,l.y+l.height+e.height-(20+15)]],[[l.x+(30+15),l.y-5],[l.x+l.width+e.width-(30+15),l.y-5]],[[l.x+(30+15),l.y+l.height+e.height+5],[l.x+l.width+e.width-(30+15),l.y+l.height+e.height+5]]];var k=[[[j[0][0][1]>0?0:0-j[0][0][1],i[0][0][0]<h.width?0:i[0][0][0]-h.width,i[0][0][1]<h.height?0:i[0][0][1]-h.height,j[0][0][0]>0?0:0-j[0][0][0]],[j[0][1][1]>0?0:0-j[0][1][1],i[0][1][0]<h.width?0:i[0][1][0]-h.width,i[0][1][1]<h.height?0:i[0][1][1]-h.height,j[0][1][0]>0?0:0-j[0][1][0]]],[[j[1][0][1]>0?0:0-j[1][0][1],i[1][0][0]<h.width?0:i[1][0][0]-h.width,i[1][0][1]<h.height?0:i[1][0][1]-h.height,j[1][0][0]>0?0:0-j[1][0][0]],[j[1][1][1]>0?0:0-j[1][1][1],i[1][1][0]<h.width?0:i[1][1][0]-h.width,i[1][1][1]<h.height?0:i[1][1][1]-h.height,j[1][1][0]>0?0:0-j[1][1][0]]],[[j[2][0][1]>0?0:0-j[2][0][1],i[2][0][0]<h.width?0:i[2][0][0]-h.width,i[2][0][1]<h.height?0:i[2][0][1]-h.height,j[2][0][0]>0?0:0-j[2][0][0]],[j[2][1][1]>0?0:0-j[2][1][1],i[2][1][0]<h.width?0:i[2][1][0]-h.width,i[2][1][1]<h.height?0:i[2][1][1]-h.height,j[2][1][0]>0?0:0-j[2][1][0]]],[[j[3][0][1]>0?0:0-j[3][0][1],i[3][0][0]<h.width?0:i[3][0][0]-h.width,i[3][0][1]<h.height?0:i[3][0][1]-h.height,j[3][0][0]>0?0:0-j[3][0][0]],[j[3][1][1]>0?0:0-j[3][1][1],i[3][1][0]<h.width?0:i[3][1][0]-h.width,i[3][1][1]<h.height?0:i[3][1][1]-h.height,j[3][1][0]>0?0:0-j[3][1][0]]]]}}}}return e},outlets:["pickerPointer"],pickerPointer:SC.View.extend({setPointerType:function(b){var c=["perfectRight","perfectLeft","perfectTop","perfectBottom"];for(var a=0;a<c.length;a++){if(this.hasClassName(c[a])){this.removeClassName(c[a])}}this.addClassName(b||"")}}).outletFor(".pointer?")});Mac.MENU_POPUP_PANE="menupopup";SC.MenupopupPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane menupopup-pane menu-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div></div>',layer:400,isModal:false,positionPane:function(){var d=this.anchorView;var c=this.containerView;var a;var f=c.get("rootView").get("firstChild").get("firstChild");if(f&&(c.get("size").width-f.get("size").width==40)){c.set("size",{width:f.get("size").width})}if(d){a=c.convertFrameFromView(d.get("frame"),d);a.x+=1;a.y+=a.height+4;a=this.fitPositionToScreen(a,c,d)}else{var b=SC.window.get("size");var e=c.get("size");a.x=(b.width-e.width)/2;a.y=(b.height-e.height)/2}c.set("origin",a)}});require("core");Mac.BackgroundFormView=SC.View.extend({emptyElement:'<form action="" target="background_uploader" enctype="multipart/form-data" method="post" class="background_form"></form>',submit:function(){console.log("Mac.BackgroundFormView#onFormSubmit");Mac.AjaxUploader.create({onUploadRequest:function(a){console.log("--- uploading form to: "+a.target)},onUploadResponse:function(a){console.log("--- uploaded form... tracking id: "+a.body.innerHTML)}}).submit(this.rootElement)}});Mac.SHEET_PANE="sheet";SC.SheetPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane sheet-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div></div>',layer:100,init:function(){arguments.callee.base.apply(this,arguments);this.visibleAnimation={visible:"top: 0px",hidden:"top: -500px",duration:500};$("panes").observe("selectstart",function(a){if(!a.findElement("input")){a.stop()}})}});Mac.PICKER_TOP_PANE="pickertop";SC.PickertopPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane pickertop-pane pickerright-pane picker-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div><div class="pointer"></div></div></div>',layer:300,isModal:false,positionPane:function(){var d=this.anchorView;var c=this.containerView;var a;if(d){a=c.convertFrameFromView(d.get("frame"),d);a=this.fitPositionToScreen(c,d)}else{var b=SC.window.get("size");var e=c.get("size");a.x=(b.width-e.width)/2;a.y=(b.height-e.height)/2}c.set("origin",a)},fitPositionToScreen:function(c,d){if(c){c._frame=null}var h=c.convertFrameToView(c.get("frame"),null);var b=d.convertFrameToView(d.get("frame"),null);var a=SC.window.get("frame");var g=[[b.x+parseInt(b.width/2),b.y+parseInt(b.height/3,0)-35],[b.x-h.width-15,b.y+parseInt(b.height/3,0)-35],[b.x+parseInt(b.width/4,0)-parseInt(h.width/2,0),b.y-h.height-15],[b.x+parseInt(b.width/4,0)-parseInt(h.width/2,0),b.y+b.height+5],];var e=[[b.x+parseInt(b.width/2)+h.width,b.y+parseInt(b.height/3,0)+h.height-35],[b.x-15,b.y+parseInt(b.height/3,0)+h.height-35],[b.x+parseInt(b.width/4,0)-parseInt(h.width/2,0)+h.width,b.y-15],[b.x+parseInt(b.width/4,0)-parseInt(h.width/2,0)+h.width,b.y+b.height+h.height+5],];var i=[[g[0][1]>0?0:0-g[0][1],e[0][0]<a.width?0:e[0][0]-a.width,e[0][1]<a.height?0:e[0][1]-a.height,g[0][0]>0?0:0-g[0][0]],[g[1][1]>0?0:0-g[1][1],e[1][0]<a.width?0:e[1][0]-a.width,e[1][1]<a.height?0:e[1][1]-a.height,g[1][0]>0?0:0-g[1][0]],[g[2][1]>0?0:0-g[2][1],e[2][0]<a.width?0:e[2][0]-a.width,e[2][1]<a.height?0:e[2][1]-a.height,g[2][0]>0?0:0-g[2][0]],[g[3][1]>0?0:0-g[3][1],e[3][0]<a.width?0:e[3][0]-a.width,e[3][1]<a.height?0:e[3][1]-a.height,g[3][0]>0?0:0-g[3][0]]];h.x=g[2][0];h.y=g[2][1];this.get("pickerPointer").setPointerType("perfectTop");if(i[0][0]==0&&i[0][1]==0&&i[0][2]==0&&i[0][3]==0){h.x=g[0][0];h.y=g[0][1];this.get("pickerPointer").setPointerType("perfectRight")}else{if(i[1][0]==0&&i[1][1]==0&&i[1][2]==0&&i[1][3]==0){h.x=g[1][0];h.y=g[1][1];this.get("pickerPointer").setPointerType("perfectLeft")}else{if(i[2][0]==0&&i[2][1]==0&&i[2][2]==0&&i[2][3]==0){}else{if(i[3][0]==0&&i[3][1]==0&&i[3][2]==0&&i[3][3]==0){h.x=g[3][0];h.y=g[3][1];this.get("pickerPointer").setPointerType("perfectBottom")}}}}return h},isVisibleObserver:function(){if(!this.get("isVisible")&&this.anchorView.hasClassName("pickertop")){this.anchorView.removeClassName("pickertop")}else{if(this.get("isVisible")&&!this.anchorView.hasClassName("pickertop")){this.anchorView.addClassName("pickertop")}}}.observes("isVisible"),outlets:["pickerPointer"],pickerPointer:SC.View.extend({setPointerType:function(b){var c=["perfectRight","perfectLeft","perfectTop","perfectBottom"];for(var a=0;a<c.length;a++){if(this.hasClassName(c[a])){this.removeClassName(c[a])}}this.addClassName(b||"")}}).outletFor(".pointer?")});require("core");Mac.comingSoonController=SC.Object.create({showPanel:function(a){this.set("msgType",a.msgType||"");this.set("imagePath",a.imagePath||"");this.set("msgTitle",a.msgTitle||"");this.set("msgLine1",a.msgLine1||"");this.set("msgLine2",a.msgLine2||"");this.set("action",a.action||Prototype.emptyFunction);this.set("DEFAULT_PANEL_GRAD_BG_PATH","/sw/shared/de/d3bced03efd15736141cf474823b5e450f783489/images/panels/panel_grad_bg.png");var b=Mac.dockController.get("activeApplicationName");if(b&&b=="mail"&&$("reveal")&&Element.visible("reveal")){Element.hide("reveal")}SC.page.get("comingSoonPanel").set("isVisible",true);setTimeout(function(){var f=window.innerHeight;var d=parseInt($view(".coming_soon_panel").parentNode.parentNode.getStyle("height"),0);var c=Math.round((f/2)-(d/2));var e=c+"px";$view(".coming_soon_panel").parentNode.parentNode.setStyle({top:e})},1)},hidePanel:function(){SC.page.get("comingSoonPanel").set("isVisible",false);var a=Mac.dockController.get("activeApplicationName");if(a&&a=="mail"&&$("reveal")&&!Element.visible("reveal")){Element.show("reveal")}},onCommandExecute:function(){this.get("action")();this.hidePanel()}});require("views/flash");Mac.Uploader=Mac.FlashView.extend({uploadDescription:"",allowedFileTypes:"",allowedFileSize:10000,retryCount:0,chooseFiles:function(){var a=this.get("movie");if(a){if(!a.chooseFiles&&++this.retryCount<3){setTimeout(function(){this.owner.chooseFiles()}.bind(this),500)}else{a.chooseFiles()}}},uploadFile:function(c,b){var a=this.get("movie");if(a){a.uploadFile(c,b)}},cancelFile:function(b){console.log("CANCELFILE");var a=this.get("movie");if(a){a.cancelUpload(b)}},flashInfo:function(){var b;var a=this.get("movie");if(a&&a.getFlashInfo){b=a.getFlashInfo();return b}else{return null}}.property(),didChooseFile:function(b){var a=this.delegate||this.owner;if(a&&a.uploaderDidChooseFile){a.uploaderDidChooseFile(this,b)}},uploadDidCancel:function(b){var a=this.delegate||this.owner;if(a&&a.uploaderDidCancelUpload){a.uploaderDidCancelUpload(this,b)}},uploadDidComplete:function(b){var a=this.delegate||this.owner;if(a&&a.uploaderDidCompleteUpload){a.uploaderDidCompleteUpload(this,b)}},uploadProgress:function(b,d,c){var a=this.delegate||this.owner;if(a&&a.uploaderUploadProgress){a.uploaderUploadProgress(this,b,d,c)}},uploadError:function(d,c,b){var a=this.delegate||this.owner;if(a&&a.uploaderUploadError){a.uploaderUploadError(this,d,c,b)}},version:"8.0.0",resourceURL:"/sw/shared/de/d3bced03efd15736141cf474823b5e450f783489/flash/uploader.swf",width:"1px",height:"1px",emptyElement:'<div style="visibility: hidden;"></div>',flashProperties:$w("uploadDescription allowedFileTypes allowedFileSize uploadURL"),init:function(){arguments.callee.base.call(this);if(!this.parentNode){SC.window.appendChild(this)}}});require("core");Mac.DragIconView=SC.View.extend({count:null,countObserver:function(){this.setClassName("two-digits",(this.get("count")>9)&&(this.get("count")<100));this.setClassName("three-digits",(this.get("count")>99)&&(this.get("count")<1000));this.setClassName("four-digits",this.get("count")>999)}.observes("count"),emptyElement:['<div class="drag-icon">','<div class="badge"></div>',"</div>"].join(""),outlets:["countLabel"],countLabel:SC.LabelView.extend({contentBinding:"*owner.count"}).outletFor(".badge")});
