var Traction={};function _get_url_param(a,b){return(document.fm)?document.fm[a].value:b}Traction.DigestState=Class.create();Traction.DigestState.prototype={hour:-1,minute:-1,frequencyCode:-1,enabled:true,initialize:function(b,d,a,c){this.hour=b;this.minute=d;this.frequencyCode=a;this.enabled=c},getHour:function(){if(this.hour==0){return 12}if(this.hour>12){return(this.hour-12)}return this.hour},getAMPM:function(){if(this.hour>=12){return"PM"}return"AM"},serialize:function(a){var c=(typeof(a)=="number")?(a+"_"):"";var b=c+"hours="+this.hour+","+c+"minutes="+this.minute+","+c+"enabled="+(this.enabled?"true":"false")+","+c+"digestFreq="+this.frequencyCode;return b}};Traction.UserDigestState=Class.create();Traction.UserDigestState.prototype=Object.extend(new Traction.DigestState(),{initialize:function(b,f,a,d,c,e){this.hour=b;this.minute=f;this.frequencyCode=a;this.enabled=d;this.email=c;this.styleCode=e},serialize:function(a){var c=(typeof(a)=="number")?(a+"_"):"";var b=c+"hours="+this.hour+","+c+"minutes="+this.minute+","+c+"enabled="+(this.enabled?"true":"false")+","+c+"digestFreq="+this.frequencyCode+","+c+"digestEmails="+this.email+","+c+"digestHtmls="+this.styleCode;return b}});Traction.InternetAddress=Class.create();Traction.InternetAddress.prototype={ip:null,notes:null,valid:true,removed:false,initialize:function(c,a,b){this.ip=c;this.notes=a;this.valid=b},serialize:function(a){var c=(typeof(a)=="number")?(a+"_"):"";var b=c+"addr="+this.ip+","+c+"notes="+this.notes+",";return b}};Traction.MailAliasRule=Class.create();Traction.MailAliasRule.prototype={recipient:null,labelProjectName:null,labelName:null,removed:false,initialize:function(c,b,a){this.recipient=c;this.labelProjectName=b;this.labelName=a},serialize:function(a){var c=(typeof(a)=="number")?(a+"_"):"";var b=c+"project="+this.labelProjectName+","+c+"type=topic,"+c+"value="+this.labelName+",";return b}};Traction.MailHeaderMatcher=Class.create();Traction.MailHeaderMatcher.prototype={header:null,match:null,labelProjectName:null,labelName:null,removed:false,initialize:function(d,b,c,a){this.header=d;this.match=b;this.labelProjectName=c;this.labelName=a},serialize:function(a){var c=(typeof(a)=="number")?(a+"_"):"";var b=c+"header="+this.header+","+c+"match="+this.match+","+c+"label.project="+this.labelProjectName+","+c+"label.type=topic,"+c+"label.value="+this.labelName+",";return b}};Traction.Permission={RECLASSIFY:"R",COMMENT:"C",EDIT:"c",DELETE:"X",RENAME:"n",LOCK:"k",VERSION:"V",CANCEL_CHECKOUT:"y",CANCEL_LOCK:"Y",STEAL_LOCK:"Z"};Traction.PermissionSet=Class.create();Traction.PermissionSet.prototype={initialize:function(a){this.permstr=a},has:function(a){return(this.permstr!=null&&this.permstr.indexOf(a)!=-1)}};Traction.Permissions={initialize:function(){},map:new Array(),store:function(b,a){var c=a;if(typeof c=="string"){c=new Traction.PermissionSet(c)}this.map[b]=c},get:function(a){return this.map[a]},has:function(b,c){var a=this.get(b);return(a&&a!=null&&a.has(c))}};Traction.ProjectTemplateInfo=Class.create();Traction.ProjectTemplateInfo.prototype={name:null,displayName:null,description:null,hasSettings:false,editable:false,initialize:function(c,a,e,b,d){this.name=c;this.displayName=a;this.description=e;this.hasSettings=b;this.editable=d}};Traction.StandardMailEntryRoutingRule=Class.create();Traction.StandardMailEntryRoutingRule.prototype={header:null,regex:null,project:null,removed:false,initialize:function(c,a,b){this.header=c;this.regex=a;this.project=b},serialize:function(a){var c=(typeof(a)=="number")?(a+"_"):"";var b=c+"header="+this.header+","+c+"regex="+this.regex+","+c+"project="+this.project;return b}};Traction.ID=Class.create();Traction.ID.parse=function(c){if(c==null){c=""}else{c=c.trim()}c=decode_url_parameter(c);Debug.println("Traction.ID.parse( ",c," )");var d=new RegExp("^([^\\s\\\"_\\?,\\.!#;:@\\$%\\^&\\*=~/\\\\\\|\\(\\)\\[\\]\\{\\}\\'`<>\\+\\-]*[^\\s\\\"_\\?,\\.!#;:@\\$%\\^&\\*=~/\\\\\\|\\(\\)\\[\\]\\{\\}\\'`<>\\+\\-0-9])(\\d+)((\\.|@)(\\d+)|(\\$)(.+))?$");var b=new RegExp("^(@(\\d+)|\\$(.+))$");var a=b.exec(c);if(a!=null){if(typeof(a[2])!="undefined"){return new Traction.ID("",Traction.ID.CURRENT_ENTRY,"@",a[2])}else{return new Traction.ID("",Traction.ID.CURRENT_ENTRY,"$",a[3])}}else{a=d.exec(c);if(a!=null){if(typeof(a[3])!="undefined"){if(typeof(a[4])!="undefined"){return new Traction.ID(a[1],a[2],a[4],a[5])}else{return new Traction.ID(a[1],a[2],a[6],a[7])}}else{return new Traction.ID(a[1],a[2])}}else{return null}}};Traction.ID.prototype={initialize:function(c,a,b,d){this.project=c;this.entry=a;this.id=(typeof(d)=="undefined")?Traction.ID.NO_ITEM:d;this.separator=(typeof(b)=="undefined")?((this.id==Traction.ID.NO_ITEM)?"":"."):b},debug:function(){Debug.println("project="+this.project+" entry="+this.entry+" id="+this.id+" sep="+this.separator+" str="+this.toString())},toString:function(){return this.project+((this.entry!=Traction.ID.CURRENT_ENTRY)?this.entry:"")+this.separator+((this.id!=Traction.ID.NO_ITEM)?this.id:"")},removeItem:function(){return new Traction.ID(this.project,this.entry)}};Traction.ID.CURRENT_ENTRY=-1;Traction.ID.NO_ITEM=-1;Traction.ID.test=function(){Traction.ID.parse("Woohoo43").debug();Traction.ID.parse("Woohoo43.00").debug();Traction.ID.parse("Woohoo43.03").debug();Traction.ID.parse("Woohoo43$important").debug();Traction.ID.parse("Woohoo43$7").debug();Traction.ID.parse("Woohoo43@2").debug();Traction.ID.parse("notatractionid").debug()};if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.length>=a.length&&this.substring(this.length-a.length)==a}}if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.length>=a.length&&this.substring(0,a.length)==a}}if(!String.prototype.trim){String.prototype.trim=function(){return new String(this).replace(/^\s+/,"").replace(/\s+$/,"")}}if(!String.prototype.ltrim){String.prototype.ltrim=function(){return new String(this).replace(/^\s+/,"")}}if(!String.prototype.rtrim){String.prototype.rtrim=function(){return new String(this).replace(/\s+$/,"")}}if(!String.prototype.caseInsensitiveCompare){String.prototype.caseInsensitiveCompare=function(d){var e=this.toLowerCase();var c=(d!=null)?d.toLowerCase():null;return(al==bl)?0:(al");return c}}if(!String.prototype.escape_commas){String.prototype.escape_commas=function(){var b=new RegExp("\\\\","g");var c=this.replace(b,"\\\\");var a=new RegExp(",","g");c=c.replace(a,"\\,");return c}}if(!String.prototype.escape_forattribute){String.prototype.escape_forattribute=function(){var d=new RegExp('"',"g");var c=this.replace(d,""");var a=new RegExp("<","g");c=c.replace(a,"<");var b=new RegExp(">","g");c=c.replace(b,">");return c}}if(!String.prototype.escape_char){String.prototype.escape_char=function(e){var b=new RegExp("\\\\","g");var d=this.replace(b,"\\\\");var a=new RegExp(e,"g");d=d.replace(a,"\\"+e);return d}}if(!String.prototype.unescape_char){String.prototype.unescape_char=function(e){var a=new RegExp("\\\\"+e,"g");var d=this.replace(a,e);var b=new RegExp("\\\\\\\\","g");d=d.replace(b,"\\");return d}}if(!String.prototype.escape_singlequotes){String.prototype.escape_singlequotes=function(){return this.escape_char("'")}}if(!String.prototype.unescape_singlequotes){String.prototype.unescape_singlequotes=function(){return this.unescape_char("'")}}if(!String.prototype.encode_url){String.prototype.encode_url=function(){try{return encodeURI(this)}catch(a){return escape(this)}}}if(!String.prototype.decode_url){String.prototype.decode_url=function(){try{return decodeURI(this)}catch(a){return unescape(this)}}}if(!String.prototype.encode_url_parameter){String.prototype.encode_url_parameter=function(){try{return encodeURIComponent(this)}catch(a){return escape(this)}}}if(!String.prototype.decode_url_parameter){String.prototype.decode_url_parameter=function(){try{return decodeURIComponent(this)}catch(a){return unescape(this)}}}Traction.StringUtil={replaceClassName:function(c,f,b){var e=(c!=null)?c.className:null;if(e==null){return}var d=" "+e+" ";var a=new RegExp("\\s+"+f+"\\s+","g");d=d.replace(a," "+b+" ").trim();c.className=d},nopx:function(a){return parseInt(a.replace("px",""))},px:function(a){return a+"px"}};var Rect=Class.create();Rect.copy=function(a){return new Rect(a.x,a.y,a.w,a.h)};Rect.prototype={initialize:function(a,d,b,c){this.x=a;this.y=d;this.w=b;this.h=c},isPointInside:function(a,b){return(this.x<=a&&a<=this.x+this.w&&this.y<=b&&b<=this.y+this.h)},isMouseInside:function(a){var b=Util.getMousePosition(a);return this.isPointInside(b.x,b.y)},equals:function(a){return(this.x==a.x&&this.y==a.y&&this.w==a.w&&this.h==a.h)},x2:function(){return this.x+this.w},y2:function(){return this.y+this.h},print:function(){return"("+this.x+","+this.y+")["+this.w+","+this.h+"]"}};var Util={};Util.getMousePosition=function(a){if(a==null){return{x:-1,y:-1}}if(a.pageX||a.pageY){return{x:a.pageX,y:a.pageY}}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){return{x:a.clientX+document.documentElement.scrollLeft,y:a.clientY+document.documentElement.scrollTop}}else{return{x:a.clientX+document.body.scrollLeft,y:a.clientY+document.body.scrollTop}}}};Util.getElementBounds=function(b){var a=b;if(b!=null&&b.tagName=="TR"){a=b.firstChild;while(a.tagName!="TD"){a=a.nextSibling}}return new Rect(getleft(b),gettop(a),outer_width(b),outer_height(a))};Util.getViewportBounds=function(){if(window.innerWidth){var a=window.innerWidth;var b=window.innerHeight;if(window.scrollMaxX){b-=20}if(window.scrollMaxY){a-=20}return new Rect(window.pageXOffset,window.pageYOffset,a,b)}else{if(document.documentElement&&document.documentElement.clientWidth){return new Rect(document.documentElement.scrollLeft,document.documentElement.scrollTop,document.documentElement.clientWidth,document.documentElement.clientHeight)}else{return new Rect(document.body.scrollLeft,document.body.scrollTop,document.body.clientWidth,document.body.clientHeight)}}};Util.getDocumentBounds=function(){if(document.documentElement&&document.documentElement.clientWidth){return new Rect(0,0,document.documentElement.scrollWidth,document.documentElement.scrollHeight)}else{return new Rect(0,0,document.body.scrollWidth,document.body.scrollHeight)}};Util.cvtToRelativeCoords=function(e,d){var a=Util.getElementBounds(e);var c=nopx(e.style.left);var b=nopx(e.style.top);return{x:d.x+(c-a.x),y:d.y+(b-a.y)}};Util.keepInBounds=function(c,b){var a=Rect.copy(c);if(c.x2()>b.x2()){a.x-=(c.x2()-b.x2())}if(c.y2()>b.y2()){a.y-=(c.y2()-b.y2())}return a};Util.getServerRelativeURL=function(b){var a=b;var d=b.indexOf("//");if(d!=-1){var c=b.indexOf("/",d+2);if(c!=-1){a=b.substring(c)}}return a};Util.hasStylesheet=function(b){b=Util.getServerRelativeURL(b);var c=document.styleSheets;for(var a=0;a255)?255:this.r);this.g=(this.g<0||isNaN(this.g))?0:((this.g>255)?255:this.g);this.b=(this.b<0||isNaN(this.b))?0:((this.b>255)?255:this.b);this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var k=this.r.toString(16);var j=this.g.toString(16);var i=this.b.toString(16);if(k.length==1){k="0"+k}if(j.length==1){j="0"+j}if(i.length==1){i="0"+i}return"#"+k+j+i};this.getHelpXML=function(){var m=new Array();for(var o=0;o "+s.toRGB()+" -> "+s.toHex());q.appendChild(u);q.appendChild(k);p.appendChild(q)}catch(r){}}return p}};Util.getRGBFromString=function(b){var a=new Util.ColorParser(b);if(a.ok){return[a.r,a.g,a.b]}else{return null}};Util.EditApps={Word:{name:"Word.Application",failKey:"cfi_direct_open_failure_message_msword",failText:"Could not open Microsoft Word. Microsoft Word may not be installed on your system, or you may need to change your Internet Explorer security settings to allow execution of ActiveX controls.",open:function(b,a){b.Visible=true;b.Documents.Open(a)}},Excel:{name:"Excel.Application",failKey:"cfi_direct_open_failure_message_msexcel",failText:"Could not open Microsoft Excel. Microsoft Excel may not be installed on your system, or you may need to change your Internet Explorer security settings to allow execution of ActiveX controls.",open:function(b,a){b.Visible=true;b.Workbooks.Open(a)}},Powerpoint:{name:"PowerPoint.Application",failKey:"cfi_direct_open_failure_message_mspowerpoint",failText:"Could not open Microsoft PowerPoint. Microsoft PowerPoint may not be installed on your system, or you may need to change your Internet Explorer security settings to allow execution of ActiveX controls.",open:function(b,a){b.Visible=true;b.Presentations.Open(a)}}};Util.editDocument=function(f,b){var d,a=false;try{d=new ActiveXObject(f.name);if(d!=null){f.open(d,b)}else{a=true}}catch(c){a=true}if(a){if(confirm(i18n(f.failKey,f.failText))){showClientSecuritySettingsHelp()}}};Util.getEditApp=function(a){switch(a){case"Word":return Util.EditApps.Word;case"Excel":return Util.EditApps.Excel;case"Powerpoint":return Util.EditApps.Powerpoint}return null};Util.getEditAppAndOpen=function(a,b){var c=Util.getEditApp(a);if(c==null){return false}Util.editDocument(c,b);return true};Util.requestFailedServerUnreachable=function(a){var b=(ua("xmlhttp_unreachable_unauthorized_reversed","false")=="true");if(b){return(a==null)}return(a=="")};Util.requestFailedUnauthorized=function(a){var b=(ua("xmlhttp_unreachable_unauthorized_reversed","false")=="true");if(b){return(a=="")}if(a==null){return(a==null)}return(a!=null&&a.indexOf("");return}var a=FORM_ACTION_READ_ONLY+"?type=atomsnippet_";Debug.println("Retrieving atomsnippet_ for named page ",document.fm.name.value.trim()," in scope ",document.fm.proj.options[document.fm.proj.selectedIndex].text,"...");a+="&name="+encode_url_parameter(document.fm.name.value.trim())+"&proj="+encode_url_parameter(document.fm.proj.value.substring(2));xmlget_async(a,null,true,Traction.Edit.Dialogs.ChooseName.getTractionAtomPreview_wakeup.bind(this))},getTractionAtomPreview_wakeup:function(c){var b;var a=c.indexOf("