var UiSkin = {"ALOHA":{"apiValue":"Theme3","dbValue":"4"},"WEBSTORE":{"apiValue":"Webstore","dbValue":"3"},"CLASSIC":{"apiValue":"Theme1","dbValue":"0"},"SALESFORCE":{"apiValue":"Theme2","dbValue":"1"},"PORTAL_DEFAULT":{"apiValue":"PortalDefault","dbValue":"2"}};
var LayoutItemTypeEnum = {"CUSTOM_LINK":{"apiValue":"K","dbValue":"K"},"STANDARD_RELATED_LIST":{"apiValue":"R","dbValue":"R"},"PAGE":{"apiValue":"P","dbValue":"P"},"EMPTY_SPACE":{"apiValue":"E","dbValue":"E"},"CONTROL":{"apiValue":"O","dbValue":"O"},"TAGGING":{"apiValue":"T","dbValue":"T"},"STANDARD_FIELD":{"apiValue":"F","dbValue":"F"},"DETAIL_BUTTON_BAR":{"apiValue":"B","dbValue":"B"},"CUSTOM_S_CONTROL":{"apiValue":"S","dbValue":"S"},"CUSTOM_RELATED_LIST":{"apiValue":"L","dbValue":"L"},"CUSTOM_FIELD":{"apiValue":"C","dbValue":"C"}};
var InlineEditState = {"EDIT":{"display":true,"cssClass":"inlineEditWrite"},"READONLY":{"display":true,"cssClass":"inlineEditLock"},"POSTONLY":{"display":false,"cssClass":""},"NONE":{"display":false,"cssClass":""}};
var ColumnType = {"DUEDATE":{"inlineEditFieldObject":"DateField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return DateField;},"inlineEditExtraData":["hasTime"],"datatypeLetter":"F","isDate":true,"isNumber":false,"inlineEditable":true,"isCompond":false},"INTEGER":{"inlineEditFieldObject":"NumberField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return NumberField;},"datatypeLetter":"N","isDate":false,"isNumber":true,"inlineEditable":true,"isCompond":false},"PERSONNAME":{"inlineEditFieldObject":"PersonNameField","needsLookup":false,"inlineEditFieldConstructor":function(){return PersonNameField;},"inlineEditExtraData":["hasSalutation","reverse","picklistId","labels"],"datatypeLetter":"M","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":true},"DYNAMICENUM":{"inlineEditFieldObject":"DynamicEnumField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":true,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return DynamicEnumField;},"inlineEditExtraData":["picklistId","controller","controllerLabel"],"datatypeLetter":"L","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"BLOB":{"needsLookup":false,"datatypeLetter":"X","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"MULTIENUM":{"inlineEditFieldObject":"MultiEnumField","queryOperators":["e","n","u","x"],"needsLookup":true,"filterQueryOperators":["e","n"],"inlineEditFieldConstructor":function(){return MultiEnumField;},"inlineEditExtraData":["picklistId","controller","controllerLabel","height"],"datatypeLetter":"Q","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"PERCENT":{"inlineEditFieldObject":"NumberField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return NumberField;},"datatypeLetter":"P","isDate":false,"isNumber":true,"inlineEditable":true,"isCompond":false},"STRINGPLUSCLOB":{"inlineEditFieldObject":"MultiLineTextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return MultiLineTextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"J","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"ADDRESSSTATE":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"S","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"DATETIME":{"inlineEditFieldObject":"DateField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return DateField;},"inlineEditExtraData":["hasTime"],"datatypeLetter":"F","isDate":true,"isNumber":false,"inlineEditable":true,"isCompond":false},"DATACATEGORYGROUPREFERENCE":{"queryOperators":["e","n"],"needsLookup":false,"filterQueryOperators":["e","n"],"datatypeLetter":"d","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"ADDRESSCOUNTRY":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"S","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"PHONE":{"inlineEditFieldObject":"PhoneField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return PhoneField;},"inlineEditExtraData":["maxLength","formatPhone"],"datatypeLetter":"H","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"SWITCHABLE_PERSONNAME":{"needsLookup":false,"inlineEditFieldConstructor":function(){return null;},"datatypeLetter":"m","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":true},"TIMEONLY":{"queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"datatypeLetter":"f","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"CONTENT":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"9","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"DATEONLY":{"inlineEditFieldObject":"DateField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return DateField;},"inlineEditExtraData":["hasTime"],"datatypeLetter":"D","isDate":true,"isNumber":false,"inlineEditable":true,"isCompond":false},"TEXT":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"S","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"FILE":{"needsLookup":false,"datatypeLetter":"l","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":true},"YEARQUARTER":{"needsLookup":false,"datatypeLetter":"O","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":true},"EMAIL":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"E","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"URL":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"U","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"FAX":{"inlineEditFieldObject":"PhoneField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return PhoneField;},"inlineEditExtraData":["maxLength","formatPhone"],"datatypeLetter":"G","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"ENCRYPTEDTEXT":{"inlineEditFieldObject":"EncryptedTextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return EncryptedTextField;},"inlineEditExtraData":["maxLength","masked"],"datatypeLetter":"6","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"HTMLMULTILINETEXT":{"inlineEditFieldObject":"HtmlMultiLineTextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return HtmlMultiLineTextField;},"inlineEditExtraData":["maxLength","isHtml"],"datatypeLetter":"5","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"BIRTHDAY":{"inlineEditFieldObject":"DateField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return DateField;},"inlineEditExtraData":["hasTime"],"datatypeLetter":"D","isDate":true,"isNumber":false,"inlineEditable":true,"isCompond":false},"ANYTYPE":{"needsLookup":false,"datatypeLetter":"K","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"RECORDTYPE":{"queryOperators":["e","n"],"needsLookup":true,"filterQueryOperators":["e","n"],"datatypeLetter":"7","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"BOOLEAN":{"inlineEditFieldObject":"BooleanField","queryOperators":["e","n"],"needsLookup":true,"filterQueryOperators":["e","n"],"inlineEditFieldConstructor":function(){return BooleanField;},"datatypeLetter":"B","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"MULTILINETEXT":{"inlineEditFieldObject":"MultiLineTextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return MultiLineTextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"X","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"ADDRESS":{"inlineEditFieldObject":"AddressField","needsLookup":false,"inlineEditFieldConstructor":function(){return AddressField;},"inlineEditExtraData":["showState","labels"],"datatypeLetter":"A","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":true},"INETADDRESS":{"queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"datatypeLetter":"W","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"ENUMORID":{"queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":true,"filterQueryOperators":["e","n","c","k","s"],"datatypeLetter":"L","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"BITVECTOR":{"queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"datatypeLetter":"8","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"DIVISION":{"inlineEditFieldObject":"StaticEnumField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":true,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return StaticEnumField;},"inlineEditExtraData":["picklistData"],"datatypeLetter":"I","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"ENTITYID":{"inlineEditFieldObject":"ForeignKeyField","queryOperators":["e","n","s"],"needsLookup":false,"filterQueryOperators":["e","n","s"],"inlineEditFieldConstructor":function(){return ForeignKeyField;},"inlineEditExtraData":["domain","useNewLookups","lookupEntityPrefix","lookupFieldEnumOrId","mruServletUri","mruAutoComplete","controllerIds","validationServletURI","matchBlanks"],"datatypeLetter":"Y","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"AUTONUMBER":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"datatypeLetter":"V","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"DOUBLE":{"inlineEditFieldObject":"NumberField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return NumberField;},"datatypeLetter":"N","isDate":false,"isNumber":true,"inlineEditable":true,"isCompond":false},"TEXTENUM":{"inlineEditFieldObject":"TextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return TextField;},"inlineEditExtraData":["maxLength"],"datatypeLetter":"L","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"CURRENCY":{"inlineEditFieldObject":"NumberField","queryOperators":["e","n","l","g","m","h"],"needsLookup":false,"filterQueryOperators":["e","n","l","g","m","h"],"inlineEditFieldConstructor":function(){return NumberField;},"datatypeLetter":"C","isDate":false,"isNumber":true,"inlineEditable":true,"isCompond":false},"FFX_BLOB":{"needsLookup":false,"datatypeLetter":"X","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false},"HTMLSTRINGPLUSCLOB":{"inlineEditFieldObject":"MultiLineTextField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return MultiLineTextField;},"inlineEditExtraData":["maxLength","numCols","numRows","isHtml"],"datatypeLetter":"z","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"STATICENUM":{"inlineEditFieldObject":"StaticEnumField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":true,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return StaticEnumField;},"inlineEditExtraData":["picklistData"],"datatypeLetter":"L","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"CURRENCYCODE":{"inlineEditFieldObject":"StaticEnumField","queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"inlineEditFieldConstructor":function(){return StaticEnumField;},"inlineEditExtraData":["picklistData"],"datatypeLetter":"L","isDate":false,"isNumber":false,"inlineEditable":true,"isCompond":false},"SFDCENCRYPTEDTEXT":{"queryOperators":["e","n","l","g","m","h","c","k","s","i"],"needsLookup":false,"filterQueryOperators":["e","n","c","k","s"],"datatypeLetter":"T","isDate":false,"isNumber":false,"inlineEditable":false,"isCompond":false}};
var QueryOperator = {"INCLUDES":{"value":"u"},"STARTS_WITH":{"value":"s"},"EXACT_EQUALS":{"value":"a"},"GREATER_THAN":{"value":"g"},"RANGE_INCLUSIVE":{"value":"I"},"NOT_START_WITH":{"value":"t"},"NOT_EQUAL":{"value":"n"},"EXCLUDES":{"value":"x"},"LESS_OR_EQUAL":{"value":"m"},"GREATER_OR_EQUAL":{"value":"h"},"CONTAINS":{"value":"c"},"LESS_THAN":{"value":"l"},"NOT_LIKE":{"value":"j"},"NOT_EXACT_EQUALS":{"value":"o"},"EQUALS":{"value":"e"},"RANGE_EXCLUSIVE":{"value":"E"},"RANGE_INCL_RIGHT":{"value":"R"},"NOT_CONTAIN":{"value":"k"},"RANGE_INCL_LEFT":{"value":"L"},"LIKE":{"value":"i"}};
var ScheduleElement={pFreq:"freq",pStartDate:"start",pMonthlyOnDayN:"mdom",pEndDate:"end",pDailyEveryNDays:"dn",pMonthlyRec:"mr",pMonthlyOnNDayOfWeek:"mdn",pMonthlyOnNthDay:"mond",pPrefTimeLoadingDiv:"prefTimeLoad",pPrefTimeLabelDiv:"prefTimeLabel",pOuterBox:"outerBox",pDailyRec:"dr",pOtherPrefTimeLabelDiv:"otherPrefTimeLabel",pDayOfWeek:"ww",pPrefTime:"pst",pPrefTimeDiv:"prefTime"};var ReportChartMetadataServlet={SERVLETURL:"analytics.reporting.chart.ReportChartMetadataServlet",REPORT_CHART_AGGS:"chartAggs",SUCCESS:"success",HAS_CHART:"hasChart",TOPN:"topN",REPORT_CHART_DIMS:"chartDims",REPORT_ID:"reportId"};var BlowoutServlet={SERVLETURL:"/_ui/system/scheduler/cron/ScheduleBlowoutServlet",SUCCESS:"success",BLOWOUT:"blowout",SUFFIX:"suf"};var RuleFilterPageConstants={NO_REASSIGN_SUFFIX:"_noReassign"};var SoftphoneLayoutEditorConstants={XSLT_INFO_FIELDS_CSS:"infoFields",FLIPPY_PREFIX:"flippy_",LISTING_PREFIX:"listing_",FLIPPY_CONTROL_PREFIX:"control_",RESULT_FIELDS_KEY:"resultFields",HIDDEN_IFRAME_ID:"previewIframe",CALL_TYPE_PREVIEW_PREFIX:"callTypePreview_",XSLT_RELATED_OBJS_CSS:"relatedObjects",FIRST_FLIPPY_CSS:"firstFlippy",CALL_TYPE_PREFIX:"callType_"};var RtaImageServlet={RTA_IMAGE_SERVLET_URL:"/servlet/rtaImage?"};var ActivityReminderRefreshPage={pCLASS_NAME:"ui.core.activity.ActivityReminderRefreshPage"};var BrowserSettingsWarningElement={MORE_INFO_ID:"browserSettingsWarningMoreInfo",BROWSER_SETTINGS_WARNING_ID:"browserSettingsWarning",cBrowserSettings:"numReqs",NEVER_SHOW_AGAIN_ID:"browserSettingsWarningGoAway"};var EmailAttachmentManagementConstants={START_DATE_ID:"start_date",FILE_NAME_ID:"file_name",SEARCH_BY_DATA:"data",END_DATE_ID:"end_date",SENDER_LOOKUP_ID:"sender",SEARCH_BY_URL:"url",LOOKUP_URL_ID:"lookup_url"};var CaptchaVerifierServlet={CLIENT_ERROR_PARAM:"error",CHALLENGE_PARAM:"chal",SERVLET_NAME:"common.html.captcha.CaptchaVerifierServlet",RESPONSE_PARAM:"resp",VALID_KEY:"valid"};var MenuButtonElement={BUTTON:"Button",MENU:"Menu",SELECT:"Select",GO_BUTTON:"Go"};var FindSimilarOppsFilter={MAX_DISPLAY_ROWS:300};var AjaxLoadPLAServlet={PAGE_SIZE:"pageSize",TYPE:"type"};var ActivityReminderPage={pCLASS_NAME:"ui.core.activity.ActivityReminderPage"};var EmailAddrEditConstants={pPASS_IN_EMAIL_ADDRESS:"pass_in_email_address",pSAVE_CANCEL:"saveCancel"};var SummaryLayoutEditor={SUMMARY_LAYOUT_MIN_COL:1,SUMMARY_LAYOUT_MAX_COL:4};var MultiSelectList={deselectLabelId:"deselectLabel",availableRowPrefix:"row_",selectLabelId:"selectLabel",pTOTAL_ROW_COUNT:"msl_totalRowCount",allOrNoneCheckbox:"allOrNone",pUNSAVED_IDS:"unsavedIds",selectedFrameId:"selected",pIDS:"selectedIds",pTOTAL_ROW_COUNT_FILTER:"msl_totalRowCountFilter",availableTableId:"availableTable",availableFrameId:"available",listEmptyLabelId:"listEmptyLabel",nameCellPrefix:"name_",availableCheckboxPrefix:"chk_",selectionsTableId:"selections",selectedRowPrefix:"sel_",pFILTER_TYPE:"filterType",selectedCheckboxPrefix:"uch_"};var EmailTemplatePreviewConstants={REQUIRED_BLOCK_CLASS:"requiredBlock",ID_REQUIRED_BLOCK_ID:"_id_required_block",LOOKUP_REQUIRED_BLOCK_ID:"_lookup_required_block"};var SlaProcessUi={TIMELINE_DIV:"entitlement_timeline",ENTRY_DATE_FIELD_DIV:"edfield",EXIT_CRITERIA_DIV:"exitcrt"};var ProfileListInlineEditConstants={DISABLE_PERMISSION:"disabledPermissionHtml",ENABLE_PERMISSION:"enabledPermissionHtml"};var DashboardConstants={CHART_RANGE_MIN_ELEMENT_NAME:"p19",DASHBOARD_COMPONENT_TYPE_ELEMENT_NAME:"p3",CHART_RADIO_BUTTON_VALUE:"0",TABLE_COLUMN2_ELEMENT_NAME:"pCol2",LEGEND_POSITION_ELEMENT_NAME:"p17",DRILLTYPE_REPORT_VALUE:"Report",TABLE_COLUMN_SORT_DESCENDING_VALUE:"DSC",USE_MULTI_COLUMN:"useMultiColumnTable",SORT_BY_ELEMENT_NAME:"p8",TABLE_COLUMN3_LABEL_NAME:"pCol3Lbl",TABLE_COLUMN_GROUP_NAME:"tcColGrp",CHART_RANGE_MAX_ELEMENT_NAME:"p20",TABLE_COLUMN1_LABEL_NAME:"pCol1Lbl",TABLE_COLUMN4_ELEMENT_NAME:"pCol4",USE_MULTI_COLUMN_LABEL_NAME:"umcLbl",TABLE_COLUMN_SORT_LBL_ID:"tcSortByLbl",DRILL_TYPE:"p25",CUSTOM_REPORT_ELEMENT_NAME:"p2",NUMBER_ROWS_ELEMENT_NAME:"p9",TABLE_SORT_BY_PICKLIST:"tcSbp",TABLE_COLUMN2_LABEL_NAME:"pCol2Lbl",TABLE_COLUMN1_ELEMENT_NAME:"pCol1",TABLE_COLUMN4_LABEL_NAME:"pCol4Lbl",CHART_RANGE_MANUAL_ELEMENT_NAME:"p21",NUMBER_OF_TABLE_COLUMNS:"4",TABLE_SORT_RADIO_ELEMENT_NAME:"tcSbr",TABLE_COLUMN3_ELEMENT_NAME:"pCol3",TABLE_COLUMN_SORT_ASCENDING_VALUE:"ASC",TABLE_SORT_COLUMN_ELEMENT_NAME:"pSortCol",DRILLTYPE_FILTER_VALUE:"FilterReport",DRILLTYPE_URL_VALUE:"URL"};var EmailSyncConfigConstants={ALLOW_USER_MODIFY:"_usrMod",OVERRIDE_MAPPINGS_SUFFIX:"ofm",OVERRIDE_ENT_SUFFIX:"oes",OVERRIDE_SYNCDIR_SUFFIX:"osd",CONFLICT_RES_STATIC_SUFFIX:"_conf_res_static",FM_HIDE_SUFFIX:"_fmHideLink",FM_ROW_SUFFIX:"_fmRow",CONFLICT_RES_SUFFIX:"_conf_res",ADVANCED_SETTINGS_PARAM:"advanced_settings",ADVANCED_SETTINGS_ROW_PREFIX:"adv_row_",OWNERSHIP_ALL:"ownership_all",FM_SHOW_SUFFIX:"_fmShowLink",OVERRIDE_CONFLICT_SUFFIX:"ocr",OWNERSHIP_SELECTED:"ownership_selected",SYNC_DIR_SUFFIX:"_sync_dir",ADVANCED_SETTINGS_TABLE_ID:"advSettingsTable"};var OrganizerPage={PROPOSE_TIME_MODE_MANUAL:"MANUAL",PROPOSE_TIME_MODE_AUTO:"AUTO",MAX_TOTAL_ATTENDEES:50};var AbstractAutoCompleteServlet={AUTOCOMPLETE_USED_SUFFIX:"_acused",SUGGESTIONS:"suggestions",pINPUT:"inputString"};var ForecastSharingPrefPopup={DISABLE_CHECKBOX:"disableCheckbox",pIS_FCT_SHARE_ENABLED:"isFctShareEnabled",CAN_SHARE_RADIO:"enableRadio"};var CrtLookupConstants={LOOKUP_DEPTH_LIMIT:4,LOOKUP_ELEM:"lookupBox",PATH_ELEM:"pathBox",CONTROL_ELEM_1:"controlLinks1",LOOKUP_HEADER:"lookupInnerHeader"};var UiData={pRET_URL:"retURL",pID:"id",pCANCEL_URL:"cancelURL",pSAVE_URL:"saveURL"};var DynamicContent={pERROR_DESC:"errorDesc",pERROR_TITLE:"errorTitle",pTYME:"tyme",pCOOKIE_PARAM:"cookieParam"};var NonUddKeyConstants={SUBKEY_SEPARATOR:"___"};var LookupsUi={FIELD:"field",PATH:"path",LOOKUPS:"lookups"};var Activity={pATT_WARNING:"attWarning",DAY_OF_WEEK_TUESDAY:"4",MAX_RECURRENCE_SPAN_ID:"maxRecurrence",WHO_BUTTON_ID:"whobtn",DAY_OF_WEEK_MONDAY:"2",REMINDER_LEAD_DAYS_TIME_ID:"reminder_ldt",DAY_OF_WEEK_FRIDAY:"32",MAX_RECURRENCE_END_DATE:"maxRecurrenceEndDate",pYEARLY_MONTHOFYEAR:"ymoy",DAY_OF_WEEK_SATURDAY:"64",DAY_OF_WEEK_SUNDAY:"1",REMINDER_DATE_TIME_ID:"reminder_dt",MAX_RECURRENCE_ERRORS:"maxRecurrenceErrors",REMINDER_SET_ID:"reminder_select_check",REMINDER_SELECT_ID:"reminder_lt",DAY_OF_WEEK_WEDNESDAY:"8",DAY_OF_WEEK_THURSDAY:"16",pYEARLY_DAYOFMONTH:"ydom",pNEW_ATTACHMENTS:"newatt",ACTIVITY_TYPE:"activityType"};var SetupSearchElement={SETUP_SEARCH_PARAM:"setupSearch",ATT_SEARCH_TEXT:"searchText"};var HoverTooltipElement={DEFAULT_CLASS_TEXT:"mouseOverText"};var TagConstants={TAG_SEARCH_FIELD:"tagsSearch",EDIT_TAGS_PAGE:"/ui/tag/TagsEditPage",PUBLIC_TAG_NAMES_ELEM:"pTagNames",TAG_HEADER:"tag_header",TAG_SUMMARY_ID:"tagSummary",HIDDEN_TAG_ID_LIST:"hidden_tag_id_list",ERROR_DIV_ID:"tagHomeErrorDiv",BROWSER_TAG_TABLE_ID:"browseTagsTable",LOOKUP_TAGS_PAGE:"/ui/tag/LookupTagsPage",ROLODEX_SEARCH_VALUE:"-10",HIDING_SECTION_ID:"layoutEditSection",TAG_EDIT_ID:"tag_edit",TAG_RESULTS_BODY_ID:"tagListBody",BROWSER_SEARCH_HEADER_CLASS:"pbTagBrowserSearch",TAG_RESULTS_ID:"tagResults",TAG_IDS_ELEM:"tagIds",CHANGE_TAGS_IDS:"changeTagsIds",NOTIFY_MSG_ID:"successNotifyId",TAG_EDIT_LIST:"tag_edit_list",TAG_ROLODEX_ID:"tagRolodexId",SAVE_TAGS_PAGE:"/ui/tag/SaveTagsPage",EDIT_AREA_ID:"tag_edit_area",TAG_ID_LIST:"tIdList",TAG_NAMES_ELEM:"tagNames",IS_DELETE:"isDelete",TAG_UPDATE_STRING:"tagUpdate",SAVED_TAG_SEARCH:"savedTagSearch",TAG_DISPLAY_CONTAINER:"tag_display_container",pTAG_SCOPE_MODE:"scopeMode",EDIT_SECTION_ID:"editSectionId",TAG_DISPLAY_LIST:"tag_display_list",TAG_EDIT_ERROR_ID:"tag_edit_error",TAG_MERGE_CHECK:"/ui/tag/TagMergeCheckServlet",TAG_VALUE_FOR_UPDATE:"tValForUpdate",TAG_SAVE_ID:"tag_save",TAG_EDIT_TEXT_ID:"tag_edit_text",BROWSER_LIST_ID:"browseTags",HIDING_PUBLIC_SECTION_ID:"layoutPublicEditSection",PUBLIC_TAG_IDS_ELEM:"pTagIds",CHANGE_TAGS_NAMES:"changeTagsNames",TAG_CANCEL_ID:"tag_cancel",TAG_DROP_DOWN_CONTENTS_ID:"tag_drop_down_contents",TAG_SEARCH_RESULTS_URL:"/search/TagSearchResults",TAG_SET_HAS_RECORDS:"tagSetHasRecords",TAG_DROP_DOWN_ID:"tag_drop_down",HIDDEN_TAG_LIST:"hidden_tag_list"};var NewLayoutEditor={STD_BTN_PREFIX:"BTN__",BLANK_ID:"__BLANK"};var InviterLookup={EMAIL_ADDRESS_REQUIRED:"emailreq",RETURN_INVITEE_DATA:"returnmore",HIDE_SEARCH_TYPES:"hidetype",MAX_TOTAL_ATTENDEES:"maxtotalattendees"};var HTPortal={pSECTION:"section",pCLASS_DAY:"R_DAY",pBODY:"body",pID:"id",pLOCATION:"loc",pFEATURE:"feature",pORG_ID:"orgId",pSELECT_LOCATION:"sel_loc",pCLASS_NAME:"cname",pTRACK:"track",pTARGET:"target"};var JiffyConstants={JIFFY_PAYLOAD_PARAM:"bulkJiffy",COOKIE_UNLOAD_NAME:"prevUnloadTime",COOKIE_NAME:"enableJiffy",JIFFY_URL:"/_ui/common/request/servlet/JiffyServlet"};var ChangePasswordConstants={pNEW_PASSWORD_STRENGTH_PROMPT:"passStrengthPrompt",pNEW_PASSWORD_CONFIRMATION_ICON_ELEM:"passVerify",pNEW_PASSWORD_STRENGTH_ELEM:"passStrength",pANSWER_ERROR_ELEM:"answerContainsPassword",pNEW_PASSWORD_STRENGTH_INFO_ELEM:"passStrengthInfo",pANSWER_ELEM:"p3",pOLD_PASSWORD_ELEM:"p4",pANSWER_ICON_ELEM:"answerVerify",pNEW_PASSWORD_ELEM:"p5",pNEW_PASSWORD_ICON_ELEM:"strengthImage",pNEW_PASSWORD_CONFIRMATION_ELEM:"p6",pQUESTION_ELEM:"p2"};var vaSelectElementConst={DOWN_CLASS:"down",UP_CLASS:"up"};var SoftphoneScreenPopTypeEnum={POP_TO_SEARCH:"PopToSearch",POP_TO_VISUALFORCE:"PopToVisualforce",POP_TO_ENTITY:"PopToEntity",DO_NOT_POP:"DoNotPop"};var UserDeactivate={pREMOVE_FROM_CLOSED_OPP_TEAMS:2,pREMOVE_FROM_ACCOUNT_TEAMS:1,pREMOVE_FROM_ADHOC_CASE_TEAMS:6,pREMOVE_FROM_OPEN_OPP_TEAMS:3,pREMOVE_FROM_PREDEFINED_CASE_TEAMS:5,pSPLITS_REMOVAL_NOTE:4};var AjaxLoadPLAForPageServlet={PAGE_NUM:"pageNum"};var CrtConstants={MAX_OBJECTS:4,OBJECT_PREFIX:"o",PICKLIST_VALUE_ID_SEPARATOR:"|",PICKLIST_VALUE_TABLE_FIELD_SEPARATOR:"."};var CustomObjectTeamMemberUiConstants={pMEMBER_PREFIX:"tm_",REMOVED_TEAMS_CONTAINER:"rtc",pCSP_PORTAL_PREFIX:"csp_",pTEAM_RECORD_PREFIX:"tt_",pREMOVED_TEAMS_PREFIX:"rt_",TEAMS_TABLE_ROW_PREFIX:"tt_t_r_",MEMBERS_TABLE_ROW_PREFIX:"tm_t_r_",pREMOVED_MEMBERS_PREFIX:"rm_",pTEAM_RECORDS_COUNT:"ttc",pMEMBERS_COUNT:"tmc",pSHARE_ACCESS_PREFIX:"sa_",REMOVED_MEMBERS_CONTAINER:"rmc",pROLE_PREFIX:"tmr_",MEMBERS_TABLE:"tm_t",TEAMS_TABLE:"tt_t"};var ColorInputConstants={ERROR_COLOR_BOX_CSS:"errorColorBox",COLOR_BOX_CSS:"colorBox"};var SidetabConstants={SIDETAB_ID_PREFIX:"st:",DEALVIEW_FEED_PANEL_DIV_ID:"dvFeedPanelDiv",ITEM_FLYOUT_ID:"RLPanelShadow",SIDE_TABS_ID:"st:SideTabs",HIDDEN_LIST_SHOW_LINK_ID:"st:HiddenListShowLink",DETAIL_SIDETAB_NAME:"DetailTab",GENIUS_SIDETAB_NAME:"GeniusTab",DEALVIEW_LOADING_IMG_ID:"dvLoadingImg",DETAIL_SIDETAB_ID:"st:DetailTab",DEALVIEW_DETAIL_PANEL_DIV_ID:"dvDetailsPanelDiv",DEALVIEW_SIDETABS_DIV_ID:"dvSidetabsDiv",HIDE_BUCKET_ID:"st:HideBucket",FEED_SIDETAB_NAME:"FeedTab",SIDETAB_ITEM_ID_SUFFIX:":item",DEALVIEW_GENIUS_PANEL_DIV_ID:"dvGeniusPanelDiv",HIDDEN_LIST_ID:"st:HiddenList",FEED_SIDETAB_ID:"st:FeedTab",DEALVIEW_MAIN_CELL_ID:"sales-main-content-cell",HIDDEN_LIST_PANEL_DROP_COVER_ID:"st:HiddenListPanelDropCover",DEALVIEW_SIDETABS_CELL_CLASS:"sales-sidetabs-cell",HIDDEN_LIST_PANE_ID:"st:HiddenListPane",HIDDEN_LIST_TOGGLE_LINK_ID:"st:HiddenListToggleLink",HIDDEN_LIST_PANEL_ID:"st:HiddenListPanel",CANVAS_BODY_PANEL_ID:"st:CanvasBodyPanel",BACK_TO_TOP_BTN_ID:"st:BackToTopBtn",ITEM_PROXY_ID:"st:ItemProxy",DEALVIEW_LOADING_MESSAGE_PANE_ID:"dvLoadingMessagePane",GENIUS_SIDETAB_ID:"st:GeniusTab"};var ChartConstants={pCHART_SUMMARY:"cs",pCHART_SHOW_AS:"chsa",pCHART_USE_MULTI:"chum",pCHART_SHOW_VALUES:"chsv",MORE_BARS:"mbars",pCHART_SHOW_PERCENTAGE:"chsp",pCOMBINE_OTHERS:"chco",pCHART_SHOW_TOTAL:"chst",ONLY_LINE:"ol",pCHART_DIFF_AXIS:"chda",pCHART_SUMMARY_3:"cs3",pCHART_SUMMARY_2:"cs2",pCHART_SUMMARY_4:"cs4"};var ActivityUi={RECURRENCE_PATTERN_DIV:"recpat",ALL_SUBGROUP_DIVS:"dwmy"};var FilterSelectionElement={pFILTER_VALUE:"fval",pOPERATOR:"oper",ON_LOAD_CRITERIA:"onLoadCriteria",pCOLUMN:"col"};var SoftphoneMatchTypeEnum={SINGLE_MATCH:"SingleMatch",MULTIPLE_MATCHES:"MultipleMatches",NO_MATCH:"NoMatch"};var InviterLookupMatch={NAME:"name",ID:"id",TYPE_USER:"user",EMAIL:"email",TYPE_LEAD:"lead",TYPE_CONTACT:"contact",TYPE:"type"};var RelatedListServlet={pParentId:"parentId",pRlId:"rlId"};var SummaryFieldConstants={OPERATION_CONTAINER_ID:"operationCtr"};var CustomObjectTeamTemplateUiConstants={pMEMBER_PREFIX:"tm_",REMOVED_CONTAINER:"rmc",pMEMBERS_COUNT:"tmc",pCSP_PORTAL_PREFIX:"csp_",pSHARE_ACCESS_PREFIX:"sa_",pROLE_PREFIX:"tmr_",pREMOVED_PREFIX:"rm_"};var CustomMotifDefinitionPageConst={COLOR_ELEMENT:"ce",MOTIF_ICON_PARAM:"file_id"};var CrtLayoutElement={cFIELD_UNUSED:"#CCCCAA",CSS_CLASS_LAYOUT_ITEM_SEPARATOR:"sepCell",cFIELD_USED_FONT:"#B0B0B0",ITEM_SHOWLABEL:"showLabel",NUM_LAYOUT_COLS:4,SECTION_AVAIL_WRAPPER_ID:"availableSectionWrapper",ACTIONREF_ORDER:"order",COLUMN_ID:"columnId",SECTION_EDIT_HEADING:"editHeading",ACTIONREF_NAME:"name",FIELD_TYPE_SELECT_NAME:"availableDropDown",cSEPARATOR_ON:"#000000",ITEM_POS_X:"xPos",ITEM_DEFAULT_CHECKED:"defaultChecked",SECTION_TABLE_ID_PREFIX:"table",SECTION_DETAIL_HEADING:"detailHeading",ROOT_CONTAINER:"root",ITEM_BEHAVIOR:"behavior",LEFT_SECTION_ID:"layoutdndLeft",AVAIL_CELL:"availCell",COLUMN:"column",ITEM_LAYOUT_IDS:"lIds",SECTION_DIV_SUFFIX:"availSectionDiv",ITEM_NAME:"name",LAYOUT_NAME:"name",LAST_SEC_SEP_DIV:"LAST_SEC_SEP_DIV",SCROLL_BUFFER_ID:"scrollBuffer",ITEM_HEIGHT:"height",cFIELD_EMPTY:"#FFFFFF",cFIELD_IN_SECTION:"#CCCCCC",pVALUE:"val",ITEM:"item",SECTION:"section",XML_FORM_NAME:"submitForm",cFIELD_SELECTED:"#6699CC",ITEM_TYPE:"itemType",ITEM_ID:"itemId",cAVAILABLE_HIGHLIGHT:"#000000",SECTION_ID:"sectionId",CSS_CLASS_LAYOUT_ITEM:"itemCell",ITEM_CUSTOMLABEL:"customLabel",SECTION_CAN_EDIT_LABEL:"canEditLabel",pSAVE_AND_CLOSE:"saveAndClose",cFIELD_USED:"#EEEEEE",SEPARATOR_PREFIX:"rp_",SECTION_NUM_COLUMNS:"numColumns",SECTION_HEADER_ID_PREFIX:"sec_",SECTION_SEP_DIV_PREFIX:"LayoutSectionSeparator_",DEFAULT_NUM_COLS:"defaultNumCols",HOVER_DIV:"MOUSE_HOVER_DIV",MAX_DISPLAY_FIELD_LENGTH:15,SECTION_SORT_ORDER:"sortOrder",CSS_CLASS_LAYOUT_CELL:"layoutCell",SECTION_SORT_ORDER_HORIZONTAL:"h",ITEM_SHOWSCROLLBARS:"showScrollbars",SECTION_NAME:"name",COLUMN_NAME:"columnName",SECTION_MASTER_LABEL:"masterLabel",MAIN_TABLE_DIV_ID:"mainTableDiv",LAYOUT_FIELDS_LIMIT:1000,ACTIONREF:"actionRef",ITEM_WIDTH:"width"};var AdvancedCurrencyEnable={enableButton:"enableButton",pENABLE:"enable"};var MCXHRParams={pQSTestResults:"qsTestResults",pLoadObjId:"LOI",pFilterItemCount:"itemCount",pSaveObjRelField:"SORF",pCollisionParam:"LMT",pSaveObjType:"SOT",pIsSuccess:"isSuccess",pTestResultRecordCount:"recordCount",pTotalsElement:"totalsElement",pData:"data",pScope:"scope",pTestResultDataSize:"dataSize",pLoadObjType:"LOT",pSaveObjId:"SOI",pTestResultQSID:"id",pLoadObjRelField:"LORF",pTestResultConfigError:"configError",pAction:"ACT",pSaveObjParentId:"SPI"};var DurationInputElement={pMINUTES_NAME:"mi",pHOURS_NAME:"hh"};var RoleTreeCookieConstants={COOKIE_KEY:"roleopen"};var CriteriaInputConstants={pVAL:"pVAL",HAS_ERROR_OR_WARNING:"HasErrorOrWarning",pCOL:"critfld",INVALID_PREFIX:"fk__",INVALID_FIELD_VALUE:"invalid__",pLOOKUP:"pLOOKUP",INFO_MESSAGE:"InfoMessage",LOOKUP_FILTER_SECTION_ID:"lookupFilterSection",IS_OPTIONAL:"IsOptional",INSERT_DEP_BUTTON_ID:"insertDepButton",CLEAR_FILTERS_LINK:"clrFiltersLnk",ERROR_CLS:"FAErrorCell",MAX_ROWS_ID:"maxRowsReached",pFLD:"pFLD",BOOL_FILTER_NAME:"bool_filter",IS_DEFAULT_MESSAGE:"isDefaultMsg",INSERT_DEP_ID_PREFIX:"dep_",pFIELD_VAL:"critfld_val",ERROR_MESSAGE:"ErrorMessage",IS_ACTIVE:"Active",SHOW_SUMMARY_FILTER:"filterControl",pOP:"critop",RESET_ERROR_MESSAGE_LINK:"rstErrMsgLnk",RESET_ERROR_MESSAGE:"rstErrMsg",pIS_FLD:"pIS_FLD",FILTER_SECTION_ID:"filterSection",LABEL_PREFIX:"labelFor",F_ROW:"frow"};var GoogleDocCreator={DOC_NAME:"docName",CREATE:0,FORM_NAME:"googleDocForm",DOC_UPLOAD:"docUpload",DIALOG_ID:"DocNameInputId",DOC_TYPE:"docType",METHOD:"method",DOC_UPLOAD_NAME:"docUploadName",PARENT_ID:"parentId",UPLOAD:1};var HolidayUi={START_TIME_PARAM:"sttime",END_TIME_PARAM:"endtime"};var EmailRelayConstants={RESTRICT_TO_DOMAINS_ID:"restrict_to_domains",EMAIL_HOST_ID:"email_host",EMAIL_HOST_PORT_ID:"email_host_port",ACTIVATE_RESTRICT_TO_DOMAINS_ID:"activate_restrict_to_domains",ACTIVATE_EMAIL_RELAY_ID:"activate_email_relay",RESTRICT_TO_DOMAINS_HIDDEN_ID:"restrict_to_domains_hidden",EMAIL_RELAY_TLS_SETTING_ID:"email_relay_tls_setting"};var MRUAutoCompleteServlet={DEPDATA_PARAM:"aclkdata"};var TaskMassAction={ROW_LIMIT:200};var RequestInfo={pSID:"sid"};var InlineHelp={ORB:"helpOrb",DISPLAY_DIV_CLASS:"helpText",CLASS_NAME_HOVER:"helpButtonOn",CLASS_NAME:"helpButton",ID_SUFFIX:"-_help",SUFFIX_DELIMITER:"-_"};var findSimilarQueryPage={SEARCH_QUERY_STRING:"srch",FIND_PROVIDER:"findSimilarProvider"};var FieldTreeConstants={SELECT_ID:"FieldTreeSelect",DB_NAME:"dbName",TYPE:"type",COLUMN_TYPE:"columnType"};var FilterEditConstants={pDEV_NAME:"devname",pSCOPE:"fscope",pNAME:"fname"};var AjaxLoadFieldsForEntity={pPARENT_ENTITY_NAME:"parentEntity",pENTITY_NAME:"entity",pFIELD_LIST:"fieldList"};var AjaxGetUsersInGroups={pNUM_USERS:"numUsers",pOWNER_NAME_LIST:"ownerNameList",pINVALID_GROUPS_MESSAGE:"invalidGroups",pOWNER_ID_LIST:"ownerIdList",pCLASS_NAME:"common.ownership.group.AjaxGetUsersInGroups"};var DesktopSidebarComponents={GOOGLETALK_CONTAINER_ID:"googleTalk",SOFTPHONE_CONTAINER_ID:"softphoneContainer",MRU_LIST_CONTAINER_ID:"mruList"};var EmailAuthorConstants={EMAIL_ADDR_DELIM:"; "};var AjaxServlet={ERROR_MSG_KEY:"errMsg",CSRF_PROTECT:"while(1);\n"};var IFrameElement={EmptyRelatedListDoc:"emptyHtmlDoc.html",BLANK_SRC:"javascript: ''"};var SynonymConstants={SYNONYM_NAME_FILTER_PARAM_VALUE:"synonymFilterValue",SORT_DIRECTION_PARAM_NAME:"sortDirection",SYNONYM_PAGE_PARAM:"page",SORT_COLUMN_PARAM_NAME:"sortColumn",SYNONYM_GROUP_DISPLAY_STRING_PARAM:"synGroupDispStr"};var EmailCCBccLookupConstants={BCC_ADDR_ID:"bcc_addr",ADDITIONAL_TO_ID:"additional_to",CC_NAME_ID:"cc_name",BCC_NAME_ID:"bcc_name",ADDITIONAL_TO_ADDR_ID:"additional_to_addr",BCC_ID:"bcc",CC_ID:"cc",CC_ADDR_ID:"cc_addr",ADDITIONAL_TO_NAME_ID:"additional_to_name",REF_ID:"ref"};var SuggestedTimeProvider={TARGET_SUGGESTION_NUMBER:5};var AccountAssociationSuggestionsServlet={pASSOCIATION_DATA_PARAM:"adp",SEARCH:"SEARCH",DEFAULT:"DEFAULT",ACTION_COUNT:3};var ProfileEditConstants={CRUD_READ:"crudRead",CRUD_VIEW_ALL:"crudViewAll",CRUD_UPDATE:"crudUpdate",CRUD_MODIFY_ALL:"crudModifyAll",CRUD_CREATE:"crudCreate",CRUD_DELETE:"crudDelete"};var CampaignManageMembers={MEMBERS_UPDATED:"membersUpdated",NOTICE_DIV_ID:"notice",ERROR_TEXT_ID:"save_error_text",pLOOKUP_ID:"lookup",pCOLUMN:"col",ERROR_DIV_ID:"save_error",ACCOUNT:"a",CONTACT:"c",FILTER_ID_PREFIX:"mm_filters_",MEMBERS_TOTAL:"membersTotal",EXISTING_TAB:1,pFILTER_VALUE:"fval",DEFAULT_FILTER_ROW_COUNT:5,pOPERATOR:"oper",ERROR_MSG:"membersError",LEAD:"l",ADD_TAB:0,CAMPAIGN_MEMBER:"CampaignMember",MEMBERS_REMOVED:"membersRemoved",MEMBERS_ADDED:"membersAdded"};var EventPage={CALENDAR_IFRAME_ID:"calendarIFrame",MINI_EDIT_PAGE_LINK_ID:"miniEditPageLink",MINI_CANCEL_SAVE_ID:"miniSave",MINI_CANCEL_BUTTON_ID:"miniCancel"};var BusinessHoursPageConstants={p24X7_CHECKBOX:"has24x7"};var DatePickerIds={DOM_ID:"datePicker",TABLE_ID:"datePickerCalendar",YEAR_PICKER:"calYearPicker",MONTH_PICKER:"calMonthPicker"};var JSPDispatcher={NONSTANDARD_PACKAGE_PREFIX:"_ui/",PACKAGE_MARKER:"p/",STANDARD_PACKAGE:"ui"};var AutoCompleteComboElement={LIST_CLASS:"acList",JS_COMBO_CONTAINER_ID_VAR:"acComboContainer",ITEM_CLASS:"acItem",JS_COMBO_VAR_PREFIX:"acCombo",ITEM_SELECTOR_CLASS:"acItemSelector",JS_ON_SELECT_VAR:"acOnSelect",TOOLBAR_PAGE_SIZE:"acPagingToolbarPageSize",JS_ERROR_NOT_FOUND_VAR:"acErrorNotFound",FOLDER_CLASS:"acFolder",JS_PAGING_TOOLBAR_ID:"accomboPgToolbar",JS_INITIAL_TEXT_VAR:"acInitialText",JS_DATA_VAR:"acData",JS_PAGING_TOOLBAR_NEXT_TEXT_VAR:"acPagingToolbarNext",CONTAINER_CLASS:"acContainer",JS_WIDTH_VAR:"acWidth",JS_PAGING_TOOLBAR_MESSAGE_VAR:"acPagingToolbarText",JS_PAGING_TOOLBAR_PREVIOUS_TEXT_VAR:"acPagingToolbarPrevious",EDIT_FIELD_CLASS:"acCombo",JS_COMBO_TEMPLATE_VAR:"acComboTemplate",EMPTY_TEXT_CLASS:"acEmptyText",JS_APPLY_TO_VAR:"acApplyTo",TRIGGER_CLASS:"acTrigger",JS_STORE_VAR_PREFIX:"acStore",JS_DROPDOWN_CONTAINER_ID:"accomboDropdownContainer"};var FilterEditPageConstants={pSEARCH_ANCHOR:"searchAnchor"};var ForecastRoleUser={FORECAST_SHARE_RADIO:"forecastSharingRadios",pCAN_SHARE:"allowMgrFctSharing",pUSER:"user"};var InlineScontrolElement={DEFAULT_HEIGHT:200,DEFAULT_WIDTH:-100};var Desktop={BROWSER_MAX_URL:"2048",AgentConsoleFE:"AgentConsoleFE",AgentConsoleX:"AgentConsoleX",RESIZE_WIDTH:"resizeWidth",AgentConsoleY:"AgentConsoleY",pGOTO_ID:"goToId",pGOTO_URL:"goToUrl",SIDEBAR_NORMAL_WIDTH_STYLE_PX:"200",IS_DESKTOP:"isdtp",AgentConsoleS:"AgentConsoleS"};var TabSetPageConstants={WORKSPACE_MAPPING_ROW_CLASS:"workspaceMappingRow",WORKSPACE_MAPPING_TABLE_ID:"workspaceMappingTable",ROW_PREFIX:"row"};var TagMode={PUBLIC:"public",PERSONAL:"personal"};var SearchRelatedList={ERROR_DIV_ID_PREFIX:"srchErrorDiv_",ShouldNotLookUp:"noLookUp",COLUMN_PARAMETER:"columns",FILTER_FIELDS_SAVE_PREFIX:"save_filter_",FILTER_FIELD_FORM_PREFIX:"field_name_form_",pSEARCH:"search",COLUMN_SELECTOR_PREFIX:"selector_",SearchUserLayoutServletName:"UserSearchListLayout",SEARCH_IDENTIFIER_PARAM:"searchId",ENTITY_PARAMETER:"entity",pENTITY_ALL:"0",COMBO_BUTTON_ID:"comboButton",SEARCH_ACTION_IDENTIFIER_PARAM:"aId",ALL_STATES_PREFIX:"allStates_",LIST_LAYOUT_TYPE_PARAMETER:"layoutType",FILTER_FIELDS_PARAM:"sFltrFields",SearchFilterInfoServletName:"SearchFilterInfo",FILTER_FIELDS_PREFIX:"field_name_",PER_ENTITY_VALUE:"perEntityValue",pSEARCH_STR:"str"};var CaseUi={TIMELINE_DIV:"entitlement_timeline"};var AjaxGetFieldTreeChildren={NODE_LIST:"nodeList",FORMULA_TYPE:"formulaType",NODE_KEY:"nodeKey"};var TaskOwnerLookup={pTABBED_TMU_LOOKUP:"tabbedTmuLookup",pLOOKUP_UROG_SUFFIX:"_lkurogid",DONE_BUTTON_ID:"doneButton"};var MailmergeTemplateSelectElementConst={TEMPLATE_DESCRIPTION:"mmtse_description",TEMPLATE_TITLE:"mmtse_title",TEMPLATE_VIEW_BUTTON:"mmtse_preview",TEMPLATE_ID:"mmtse_id"};var RelatedListPrioritizationServlet={pPOSITION:"position",pRELATIVE:"relative",pMOVED:"moved",pCONFIG_KEY:"configKey"};var MotifInputElementConst={MOTIF_ELEMENT_SUFFIX:"motifElement",FIELD_NAME_MOTIF:"motifName",FIELD_NAME_ICON:"motifIcon",FIELD_NAME_DESCRIPTION:"motifClass"};var EditPageConstants={pQUICK_SAVE:"quick_save",pSAVE_NEW:"save_new",pCANCEL:"cancel",NOSAVE:"nosave",pSAVE_NEW_URL:"save_new_url",pSAVE:"save",pSAVE_CLOSE:"save_close",pSAVE_ATTACH:"save_attach",pEDIT_PAGE:"editPage"};var BusyTimesAjaxServlet={SERVLET_NAME:"core.activity.scheduling.BusyTimesAjaxServlet",TIME_ZONE_PARAM:"timezone",USER_ID_PARAM:"userid",DATE_OF_THE_WEEK_PARAM:"date"};var EventUi={START_TIME_PARAM_NAME:"startTimeId",WHO_NAME_PARAM_NAME:"whoNameId",ALL_DAY_PARAM_NAME:"allDayId",LEAD_PREFIX_PARAM_NAME:"leadPrefix",REMINDER_DATE_TIME_PARAM_NAME:"reminderDateTimeTimeId",WHAT_ID_PARAM_NAME:"whatIdId",WHO_ID_PARAM_NAME:"whoId",RECURRING_EVENT_PARAM_NAME:"isRecurringId",PRIVATE_CHECKBOX_PARAM_NAME:"privateCheckboxId",WHO_LINK_PARAM_NAME:"whoLinkId",VISIBLE_IN_SS_PARAM_NAME:"isVisibleInSelfServiceId",EVENT_CONVERT:"convert",START_DATE_PARAM_NAME:"startDateId",pISPERSONACCOUNT:"pip",WHAT_LINK_PARAM_NAME:"whatLinkId",WHAT_NAME_PARAM_NAME:"whatNameId",pADD_INVITEE_ID:"addInvId",WHAT_TYPE_PARAM_NAME:"whatTypeId",END_TIME_PARAM_NAME:"endTimeId",WHO_TYPE_PARAM_NAME:"whoTypeId",END_DATE_PARAM_NAME:"endDateId"};var SideTabPreferenceServlet={pTAB_NAME_PARAM:"tabName",pIS_COLLAPSED_PARAM:"isCollapsed",pSAVE:"save",pCONFIG_LIST:"configList",pCONFIG_KEY:"configKey",pQUERY_ORDER_PARAM:"tabIndex"};var Udd={EMPTY_KEY:"000000000000000"};var UserInterfaceUI={pALOHA_CHATTER_MSG:"alohaChatterMsg",pINLINE_SCHEDULING_NAME:"inlineScheduling",pALOHA_SKIN:"alohaSkin",pSPELL_CHECKER_ACTIVITIES_NAME:"spellcheckerActivities",pCLICK_AND_CREATE_ON_CALENDAR_NAME:"clickAndCreateOnCalendar",pSPELL_CHECKER_ENABLED_NAME:"spellchecker",pINLINE_SCHEDULING_NAME_MESSAGE:"inlineSchedulingMessage",pDRAG_AND_DROP_ON_CALENDAR_NAME:"dragAndDropOnCalendar",pNEW_LIST_VIEW_NAME:"newListView"};var CreateNewElement={DOM_ID:"createNew"};var LookupInputElement={pLOOKUP_WIDGET:"_lkwgt",DIALOG_ID:"LookupOverlayDialog",LOOKUP_IFRAME:"lookupIFrame"};var OppSalesTeamRowEdit={SPLIT_AMOUNT_LABEL:"splitAmount_row",SPLIT_PERCENTAGE_LABEL:"splitPercentage_row",SUMMARY_ROW_ID:"stt_summaryRow",ROW_TYPE_LABEL:"rowType_row",ROW_ID_LABEL:"salesTeam_row",IS_SPLIT_LABEL:"isSplit_row",SPLIT_NOTE_LABEL:"splitNote_row",USER_LOOKUP_ID_LABEL:"userLookup_row"};var BodyLayout={BODY_CELL_ID:"bodyCell",BODY_TABLE_ID:"bodyTable",NO_TABLE_BODY_ID:"noTableContainer",PAGE_HEADER_ID:"AppBodyHeader",FOOTER_DIV_ID:"bodyFooter"};var CSRFConstants={CSRF_TOKEN:"_CONFIRMATIONTOKEN"};var PortalStyleConfigEditorConstants={PARAM_PREFIX:"p_"};var SearchSettingsConstants={OPTIMIZE_SEARCH_FOR_CJK_WARNING:"optimizeSearchForCJKWarning",OPTIMIZE_SEARCH_FOR_CJK_NAME:"optimizeSearchForCJK",SIDEBAR_SEARCH_ENTITY_PICKER_ID:"enableSidebarSearchEntityPicker",DEFAULT_SEARCH_ENTITY_CHECKBOX_ID:"defaultSearchEntityCheckbox",DEFAULT_SEARCH_ENTITY_PICKLIST_ID:"defaultSearchEntityPicklist"};var SalesTeamRowTypeEnum={NEW:"New",EXISTING_DELETED:"Existing_Deleted",NEW_DELETED:"New_Deleted",EXISTING_INACTIVE:"Existing_Inactive",EXISTING:"Existing"};var OpportunitySalesTeamEdit={SALES_TEAM_MEMBER_TABLE_ID:"stt",SPLIT_TOTAL_PER_ID:"splitTotPer",SPLIT_TOTAL_ID:"splitTotal",SPLIT_AMOUNT_TOTAL_ID:"splitAmtPer"};var DetailElement={DEFAULT_ERROR_DIV_ID:"errorDiv_ep",TOP_BUTTON_ROW:"topButtonRow",DEFAULT_DETAIL_ELEMENT_ID:"ep",BOTTOM_BUTTON_ROW:"bottomButtonRow"};var MouseOverElement={DEFAULT_CLASS:"mouseOverInfoOuter",DEFAULT_CLASS_INNER:"mouseOverInfo"};var AjaxValidateFormula={VALID_KEY:"valid",RANGE_KEY:"range"};var AssociationSelectElement={ASSOCIATION_DATA_PREFIX:"aasead_",SERVLET_NAME:"sync.association.actions.AccountAssociationSuggestionsServlet",SELECT_NAME_PREFIX:"aasesel_",LOOKUP_NAME_PREFIX:"aaselkup_"};var GoogleTalkConstants={COLLAPSED_HEIGHT:0,MIN_EXPANDED_HEIGHT:22,HEIGHT_COOKIE:"gTalkHeight",COLLAPSED_COOKIE:"gTalkCollapsed",EXPANDED_HEIGHT:400};var LookupUi={pSEARCH_VALUE:"lksrch"};var SetupTreeNodeConstants={COOKIE_KEY:"setupopen"};var ForecastSettings={pALLOW_FM_SHARING:"allowFMSharing",pFORECAST_SHARING:"forecastSharing"};var ListView={ACTION_COLUMN:"ACTION_COLUMN",CHECKBOX_ID:"ids",SELECT_ALL_BOX_ID:"allBox",ID_COLUMN:"LIST_RECORD_ID",DEFAULT_ROWS_PER_PAGE:25};var ColumnTypeConstants={FILE_CONTENTTYPE_LENGTH:120,ADDRESS_POSTAL_CODE_OFFSET:3,DEFAULT_TEXTNAME_LENGTH:255,DEFAULT_LASTNAME_LENGTH:80,FILE_LENGTH_OFFSET:3,PERSONNAME_SALUTATION_OFFSET:0,PERSONNAME_LASTNAME_OFFSET:2,DEFAULT_FIRSTNAME_LENGTH:40,DEFAULT_COUNTRY_LENGTH:40,ADDRESS_CITY_OFFSET:1,ADDRESS_COUNTRY_OFFSET:4,DEFAULT_STREET_LENGTH:255,PERSONNAME_FIRSTNAME_OFFSET:1,FILE_NAME_LENGTH:40,ADDRESS_STATE_OFFSET:2,DEFAULT_ZIP_LENGTH:20,ADDRESS_STREET_OFFSET:0,FILE_BODY_OFFSET:4,FILE_NAME_OFFSET:1,FILE_CONTENTTYPE_OFFSET:2,DEFAULT_STATE_LENGTH:20,FILE_FIELDDATA_OFFSET:0,DEFAULT_SALUTATION_LENGTH:40,DEFAULT_CITY_LENGTH:40};var MCFilterPaneParams={pNO_LIMIT:"noLimit",pSCOPE:"ofscope",pORDER_BY_DIV:"orderBySection",pSET_LIMIT:"setLimit",NONE_SCOPE_VALUE:"-1",pMAX_RECORD_RADIO:"maxRecordRadio"};var SoftphoneConstants={MODULE_CLASS:"softphoneModule",SOFTPHONE_ID:"softphone",SIDEBAR_SOFTPHONE_WIDTH_STYLE_PX:"220"};var CSNWelcomeMessage={DOM_ID:"CSNWelcomeMessage"};var ReportConstants={pDELREP:"delrep",pDRILLDOWN_VAL:"drillval",pDRILLDOWN:"drilldown",pDRILLDOWN_BREAK:"drillbreak",pSubTotalBy0:"subtotalBy0",pDRILLDOWN_COL:"drillcol"};var MultiLookupInputElement={MULTI_LOOKUP_SELECT_SUFFIX:"_mlktp"};var CompactLayoutUiConst={hideItemsRight:"hideItemsRight",saveButtonId:"saveButton",switchColumnToRight:"switchColumnRight",hideItemsLeft:"hideItemsLeft",showItemsLeft:"showItemsLeft",switchColumnToLeft:"switchColumnLeft",showItemsRight:"showItemsRight"};var TaskUi={pNOTIFY_PREFERENCE_GROUP_ELEMENT:"prefEl",pSHOW_PREFERENCE:"show_pref",pMAX_ASSIGNEE_TEXT_LENGTH:200,pLOOKUP_SUMMARY_SUFFIX:"_sum",pLOOKUP_BUTTON_MULTI_OWNER_SUFFIX:"m",ASSIGNEE_SEPARATOR:",",pLOOKUP_DISPLAY_SUFFIX:"_dsp",MAX_TMU_ASSIGNEES:100};var AjaxLoadRelatedListItem={pRELATED_LIST_ID:"RelatedListId"};var SchedulingUtils={SCHEDULING_URL_KEY:"sched",OVERLAY_DIALOG_WIDTH:"877"};var ActivityReminderConstants={DUE_TIME_ATTR:"due_time",DUE_MINUTES_ID:"minutes",SNOOZE_TIME_ID:"snooze_time",pAT:"at",pSNOOZED_AT:"snoozed_at",SNOOZE_ID:"snooze",REMINDERS_OK:"reminders_ready",REMINDERS_NONE:"reminders_none_active",REMINDER_ID:"reminder",DISMISS_ID:"dismiss",pTEST:"test",DISMISS_ALL_ID:"dismiss_all",SUMMARY_ID:"summary",ALL_DAY_ATTR:"all_day"};var AjaxLoadPLAForRecordTypeServlet={RECORD_TYPE_ID:"rtId"};var ActivityPage={DISABLED_RECURRENCE_MSG_DIV:"DisabledRecurrenceMsgDiv"};var EventObject={ONE_DAY_IN_MINUTES:1440};var BounceEmailConstants={HIDDEN_BOUNCE_REASON:"hidden_bounce_reason",HIDDEN_EMAIL_ADDRESS:"hidden_email_address",HIDDEN_BOUNCE_DATE:"hidden_bounce_date"};var ReportsFch={FLOATING_HEADER:"floatingHeader",FCH_AREA:"fchArea",HEADER_ROW:"headerRow"};var RelatedListSuppressionServlet={pSUPPRESS:"suppress",pCONFIG_KEY:"configKey"};var SidebarConstants={pSEARCH_SIDEBAR_STR:"sbstr",SIDEBAR_DIV_ID:"sidebarDiv",HANDLE_ID:"handle",PIN_INDICATOR_ID:"pinIndicator",SIDEBAR_PINNED_COOKIE:"sidebarPinned",PIN2_INDICATOR_ID:"pinIndicator2"};var LookupValidationServlet={pENTITY_NAME:"acent",pFILTER_RESULTS:"filterresults",pLKFIELD_NAME:"aclkfield",pDEPDATA_NAME:"aclkdata",pLKID_NAME:"aclkid",pLKENTITY_NAME:"aclkent"};var TimePickerInputElementConstants={EMPTY_TIME_STANDIN:"HH:MM"};var HighlightsPanelConstants={HOVER_VALUE_CLASS:"hp_hover_value",HOVER_CLASS:"hp_hover",ICON_CONTAINER_CLASS:"hp_icons",HOVER_LABEL_CLASS:"hp_hover_label",HIGHLIGHTS_PANEL_ID:"highlights_panel",VALUE_CLASS:"hp_value",ROW_PREFIX_CLASS:"hp_row",DRAWER_ID:"highlights_panel_drawer",SINGLE_ITEM_COLUMN_CLASS:"hp_single_item_col",CELL_DIV_CLASS:"hp_cell",LABEL_CLASS:"hp_label",LABEL_ELLIPSIS_CLASS:"hp_label_ellipsis",VALUE_ELLIPSIS_CLASS:"hp_value_ellipsis"};var ColorPickerConstants={DOM_ID:"colorPicker",COLOR_VIEW_ID:"colorPickerColorView",HEX_VIEW_ID:"colorPickerHexView"};var CrtObjectElement={JOIN_RADIO:"radio",MAX_OBJECTS_WARNING:"warning",LEVEL:"level",INNER_JOIN_SELECT:"inner_select",ELBOW_OUTER:"elbow_outer",INNER_JOIN_OPTION:"inner_join_option",OUTER_JOIN_SELECT:"outer_select",REMOVE_OBJECT_LINK:"remove",GHOST_ELBOW:"ghost_elbow",EST_OBJECT_LABEL:"estObjLabel",ELBOW_INNER:"elbow_inner",GHOST0:"ghost0",TERMINAL_OBJECT_WARNING:"endWarning",GHOST1:"ghost1"};var EditEventMultiUserCalendarElementConstants={EDIT_PAGE_CALENDAR:"editEventCalendar"};var DeveloperSettings={LICENSE_MGR_CHOICE_STR:"licenseMgr"};var SectionElement={LEFT_TABLE_CLASS:"detailList"};var EditElement={FIELD_NAME_CITY:"city",pID_SUFFIX:"_lkid",FIELD_NAME_STATE:"state",FIELD_NAME_FIRST:"name_first",FIELD_NAME_COUNTRY:"country",FIELD_NAME_ZIP:"zip",FIELD_NAME_STREET:"street",ERROR_CLASS:"error",pTYPE_SUFFIX:"_lktp",FIELD_NAME_LAST:"name_last",pMOD_SUFFIX:"_mod",SELECTED_ID_SUFFIX:"_selected",FIELD_NAME_SALUTATION:"name_salutation",pBASE_NAME:"lknm",STREET_NUM_ROWS:2,pOLD_NAME_SUFFIX:"_lkold",UNSELECTED_ID_SUFFIX:"_unselected",STREET_NUM_COLS:27,CHECKBOX_SUFFIX:"_chkbox"};var ForecastSummaryPage={pLOOKUP_INPUT_ENTERED:"lookupEntered"};var StageManager={pWIZARD_RET_URL:"wizardRetUrl"};var SchedulePage={pDuelOuter:"duelOuter",pIsOffPeak:"isoffpeak",pNotifyMe:"nm",pNotifyOthers:"no",pBlowout:"bout",pJobType:"jt",pEmailUrog:"eurog"};var InlineEditConstants={SAVED:"saved",LAST_MOD:"sysMod",FIELD_DATA:"fields",COLUMN_ID:"columnId",FIELD_VALUE:"initialValue",SAVE_BUTTON:"inlineEditSave",FIELD_TYPE:"fieldType",VALIDATION_ERRORS:"validationErrors",IDS:"recordIds",FIELD_REQUIRED:"required",MAX_SAVE:200,FIELD_STATE:"state",COLUMN_LABEL:"label",INIT_HOOK:"initHook",DYNAMIC_DATA:"dynamicData",SAVE_URL:"saveUrl",OVERRIDE_TYPE:"overrideType",IS_PERSON:"isPerson",NON_SPECIFIC_ERRORS:"nonSpecificErrors",SUCCESS:"success",EDITABLE:"editable",FIELD_ID:"fieldId",NULLABLE:"nullable",AFTER_SAVE_REDIRECT_URL:"afterSaveUrl",ENTITY_ID:"entityId",SORTABLE:"isSortable",ENTITY_TYPE:"entityType",CELL_ID:"_ilecell",COLUMN_NAME:"columnName",LAYOUT_INFO:"layoutInfo",ROLODEXABLE:"useRolodex",MASS_EDITABLE:"massEditable",CANCEL_BUTTON:"inlineEditCancel",IS_TASK:"isTask",INNER_ID:"_ileinner",NAME_LABEL:"nameLabel"};var ManageableInfo={MORE_INFO_CLASS:"manageableMoreInfo",DHTML_ID:"manageableInfo"};var CreateNewList={DHTML_ID:"newEntityList"};
function GenericSfdcPage(){this.init();this.inlineHelpMap={};this.helpFader=null;this.helpParentElement=null;var self=this;this.handleHelpHover=function(e){var target=getEventTarget(getEvent(e));if(!target||UserContext.isAccessibleMode){return;}if(target.className==InlineHelp.CLASS_NAME){target.className=InlineHelp.CLASS_NAME_HOVER;}else{if(target.nodeName=="LABEL"&&target.parentNode&&target.parentNode.className==InlineHelp.CLASS_NAME){target.parentNode.className=InlineHelp.CLASS_NAME_HOVER;}else{if(target.className==InlineHelp.ORB){helpSpan=target.parentNode;while(!(helpSpan.className==InlineHelp.CLASS_NAME||helpSpan.className==InlineHelp.CLASS_NAME_HOVER)){helpSpan=helpSpan.parentNode;}var helpId=helpSpan.id;helpSpan.className=InlineHelp.CLASS_NAME_HOVER;if(helpId&&helpId.length>InlineHelp.SUFFIX_DELIMITER.length){var helpKey=helpId.substring(0,helpId.lastIndexOf(InlineHelp.SUFFIX_DELIMITER));self.showHelp(helpKey,helpSpan);}}}}};this.handleHelpUnhover=function(e){var target=getEventTarget(getEvent(e));if(!target||UserContext.isAccessibleMode){return;}if((target.className==InlineHelp.CLASS_NAME_HOVER)&&mouseExited(e,target)){target.className=InlineHelp.CLASS_NAME;}else{if((target.nodeName=="LABEL"&&target.parentNode.className==InlineHelp.CLASS_NAME_HOVER)&&mouseExited(e,target.parentNode)){target.parentNode.className=InlineHelp.CLASS_NAME;}else{if(target.className==InlineHelp.DISPLAY_DIV_CLASS&&mouseExited(e,target)){var toElement=getEventToElement(getEvent(e));if(toElement&&toElement.className!=InlineHelp.ORB&&self.helpFader){self.helpFader.fadeOut();}}else{if(target.className==InlineHelp.ORB&&mouseExited(e,target)){var toElement=getEventToElement(getEvent(e));var parent=target.parentNode;if(UserContext.isAccessibleMode){parent=parent.parentNode;}if(toElement.className==InlineHelp.DISPLAY_DIV_CLASS){return;}if(toElement!=parent){parent.className=InlineHelp.CLASS_NAME;}if(self.helpFader){self.helpFader.fadeOut();}}}}}};this.prependToOnloadQueue(function(){if(UserContext&&UserContext.uiSkin==UiSkin.ALOHA.apiValue){AlohaSkin.init();}});this.appendToOnloadQueue(function(){addEvent(window,"resize",function(){self.executeOnResizeQueue();});addEvent(document,"mouseover",self.handleHelpHover,false);addEvent(document,"mouseout",self.handleHelpUnhover,false);if(XBrowser.userAgent.isIE){addEvent(document.body,"click",self.handleLabelClickIEOnly);}});this.appendToOnloadQueue(GenericSfdcPage.displayAlohaWarning);}GenericSfdcPage.prototype.init=function(){this.onLoadQueue=[];this.onBeforeUnloadQueue=[];this.onResizeQueue=[];this.hasRun=false;this.relatedLists=[];this.relatedListsById={};this.dialogs={};this.messages={};this.appendToOnloadQueue(function(){XBrowser.turnOnBackgroundImageCache();},"Turn on CSS background image cache (IE6 only)");};GenericSfdcPage.prototype.handleLabelClickIEOnly=function(e){var event=getEvent(e);var target=getEventTarget(event);if(!target){return;}if(target.tagName=="LABEL"&&target.htmlFor){var input=getElementByIdCS(target.htmlFor);if(input){if(input.type&&input.type.toLowerCase()=="checkbox"){input.click();}if(input.focus){input.focus();e.returnValue=false;}}}};GenericSfdcPage.prototype.prependToOnloadQueue=function(fn,description){if(description){fn.desc=description;}if(this.hasRun){this.execFunctionNoThrow(fn);}else{this.onLoadQueue.unshift(fn);}};GenericSfdcPage.prototype.appendToOnloadQueue=function(fn,description){if(description){fn.desc=description;}if(this.hasRun){this.execFunctionNoThrow(fn);}else{this.onLoadQueue.push(fn);}};GenericSfdcPage.prototype.executeOnloadQueue=function(){for(var i=0;(this.onLoadQueue&&(i<this.onLoadQueue.length));i++){this.execFunctionNoThrow(this.onLoadQueue[i]);}this.hasRun=true;this.onLoadQueue=[];if(window.Jiffy&&Jiffy.onLoad){Jiffy.onLoad();}};GenericSfdcPage.prototype.prependToOnBeforeUnloadQueue=function(fn,description){if(description){fn.desc=description;}this.onBeforeUnloadQueue.unshift(fn);};GenericSfdcPage.prototype.appendToOnBeforeUnloadQueue=function(fn,description){if(description){fn.desc=description;}this.onBeforeUnloadQueue.push(fn);};GenericSfdcPage.prototype.executeOnBeforeUnloadQueue=function(){for(var i=0;(this.onBeforeUnloadQueue&&(i<this.onBeforeUnloadQueue.length));i++){this.execFunctionNoThrow(this.onBeforeUnloadQueue[i]);}if(window.Jiffy&&Jiffy.onUnload){Jiffy.onUnload();}};GenericSfdcPage.prototype.prependToOnResizeQueue=function(fn,description){if(description){fn.desc=description;}this.onResizeQueue.unshift(fn);};GenericSfdcPage.prototype.appendToOnResizeQueue=function(fn,description){if(description){fn.desc=description;}this.onResizeQueue.push(fn);};GenericSfdcPage.prototype.executeOnResizeQueue=function(){for(var i=0;(this.onResizeQueue&&(i<this.onResizeQueue.length));i++){this.execFunctionNoThrow(this.onResizeQueue[i]);}};GenericSfdcPage.prototype.execFunctionNoThrow=function(fn){try{fn();}catch(ex){if(fn.desc){ex.sfdcDesc=fn.desc;}Gack.handleException(ex);}};GenericSfdcPage.prototype.setPrefAndHideBanner=function(prefName,prefValue,bannerId){UserContext.userPreferences.setBoolean(prefName,prefValue);this.hideMessage(bannerId);};GenericSfdcPage.prototype.registerRelatedList=function(listId,visibleRowCount,title,hasMore,refURL,refQS,onlySkipLink,shouldLoad,registerWithRelatedListPanel,listCommonId){var firstList=(this.relatedLists.length==0);if(!this.relatedListsById[listId]){this.relatedListsById[listId]=new RelatedList(listId,visibleRowCount,title,hasMore,refURL,refQS,onlySkipLink,shouldLoad,listCommonId);this.relatedLists.push(this.relatedListsById[listId]);}if(this.relatedListPanel&&registerWithRelatedListPanel){this.relatedListPanel.registerList(this.relatedListsById[listId]);}var self=this;if(firstList){this.prependToOnloadQueue(function(){if((self.relatedListPanel)&&(self.relatedListPanel.addListsToPanel)){self.relatedListPanel.addListsToPanel();}},"rlHovers: Initializing panel");}};GenericSfdcPage.prototype.registerDialog=function(dialog){this.appendToOnloadQueue(function(){dialog.createDialog();},"Create a dialog");this.dialogs[dialog.id]=dialog;};GenericSfdcPage.prototype.unRegisterDialog=function(dialog){this.dialogs[dialog.id]=null;};GenericSfdcPage.prototype.getDialogById=function(dialogId){return this.dialogs[dialogId];};GenericSfdcPage.prototype.getRelatedListById=function(listId){return this.relatedListsById[listId];};GenericSfdcPage.prototype.getHrefAsRetURL=function(){var href=window.location.href;var retUrlArr=href.split("/");retUrlArr.splice(0,3);return encodeURIComponent("/"+retUrlArr.join("/"));};GenericSfdcPage.prototype.includeJavascriptTag=function(scriptUri){return this.embedJSTag(scriptUri,document);};GenericSfdcPage.prototype.embedJSTag=function(scriptUri,doc){var html_doc=doc.getElementsByTagName("head").item(0);var js=doc.createElement("script");js.setAttribute("language","javascript");js.setAttribute("type","text/javascript");js.setAttribute("src",scriptUri);html_doc.appendChild(js);return false;};GenericSfdcPage.prototype.embedExternalStyleSheet=function(sheetUrl,doc){var styleNode=doc.createElement("link");styleNode.setAttribute("href",sheetUrl);styleNode.setAttribute("type","text/css");styleNode.setAttribute("rel","stylesheet");var targetHead=doc.body.parentNode.firstChild;targetHead.appendChild(styleNode);};GenericSfdcPage.prototype.hideEmbeddingIframe=function(iframeWin){if(iframeWin.name&&document.getElementById(iframeWin.name)){document.getElementById(iframeWin.name).style.display="none";document.getElementById(iframeWin.name).parentNode.style.border="none";}};GenericSfdcPage.prototype.setHelp=function(key,text){this.inlineHelpMap[key]=text;};GenericSfdcPage.prototype.getHelp=function(key){return this.inlineHelpMap[key];};GenericSfdcPage.prototype.setHelpParent=function(parentElement){this.helpParentElement=parentElement;};GenericSfdcPage.prototype.showHelp=function(id,element){var help=this.getHelp(id);if(help){if(!this.displayDiv){this.displayDiv=document.createElement("DIV");this.displayDiv.className=InlineHelp.DISPLAY_DIV_CLASS;}var parentElement=this.helpParentElement;if(!parentElement){var parentElement=document.getElementById("bodyDiv_setup");if(!parentElement){var parentElement=document.getElementById(BodyLayout.BODY_CELL_ID);if(!parentElement){parentElement=document.body;}}}parentElement.appendChild(this.displayDiv);this.displayDiv.style.top=(getObjY(element)+element.offsetHeight+8-getObjY(parentElement))+"px";if(!this.helpFader){this.helpFader=new MouseOverFadeHandler(null,this.displayDiv,false);}this.displayDiv.innerHTML=help;this.helpFader.setPosition();var sidebar=document.getElementById(SidebarConstants.SIDEBAR_DIV_ID);if(LC.isRtlPage()){var right=getObjX(parentElement)+parentElement.offsetWidth-getObjX(element)-this.displayDiv.offsetWidth;if(sidebar){var sidebarLeft=getObjX(parentElement)+parentElement.offsetWidth-getObjX(sidebar);if(right<sidebarLeft){right=sidebarLeft;}}if(right>=0){this.displayDiv.style.right=right+"px";}}else{var left=(getObjX(element)-getObjX(parentElement)+element.offsetWidth-this.displayDiv.offsetWidth);if(sidebar){var sidebarRight=getObjX(sidebar)+sidebar.offsetWidth;if(left<sidebarRight){left=sidebarRight;}}if(left>=0){this.displayDiv.style.left=left+"px";}}this.helpFader.fadeIn();}};GenericSfdcPage.prototype.registerMessage=function(id){var message=document.getElementById(id);if(message&&!this.messages[id]){this.messages[id]=message;}};GenericSfdcPage.prototype.hideMessage=function(id){var message=this.messages[id];if(message){message.style.display="none";}};GenericSfdcPage.prototype.showMessage=function(id){var message=this.messages[id];if(message){message.style.display="block";}};GenericSfdcPage.prototype.findSimilarNavigate=function(tagName1,titleId,descriptionId,custFieldId){var tagTypeElements=document.getElementsByTagName(tagName1);var custInputs=document.getElementById(custFieldId);var descriptionElement=document.getElementById(descriptionId);var titleElement=document.getElementById(titleId);var qs=new QueryString("");var searchCommand="common.search.similar.IdeaFindSimilarProvider";var url=UserContext.getUrl("/_ui/common/search/similar/FindSimilarQueryPage/d");qs.append(findSimilarQueryPage.SEARCH_QUERY_STRING,titleElement.innerHTML," ");qs.append(findSimilarQueryPage.SEARCH_QUERY_STRING,descriptionElement.innerHTML," ");function appendSearchStringComponents(tagTypeElements,customFieldContainerId){for(var i=0;i<tagTypeElements.length;i++){var node=tagTypeElements[i];var shouldConitnue=false;for(var j=0;j<6;j++){node=node.parentNode;if(!node){shouldConitnue=true;break;}}if(shouldConitnue||!node.id){continue;}var id=node.id;if(id==customFieldContainerId){qs.append(findSimilarQueryPage.SEARCH_QUERY_STRING,tagTypeElements[i].innerHTML," ");}}}if(custInputs!=undefined){appendSearchStringComponents(tagTypeElements,custInputs.id);}qs.add(findSimilarQueryPage.FIND_PROVIDER,searchCommand);return url+qs.toString();};GenericSfdcPage.prototype.handleDivisionOnChange=function(servletUrl,divisionSelect){var url=UserContext.getUrl(servletUrl);var bodyString=divisionSelect.name+"="+divisionSelect.value;XBrowser.postHttpResponse(url,function(){if(document.filter_element){document.filter_element.submit();}if(ListViewport.instances){for(var id in ListViewport.instances){var list=ListViewport.instances[id];if(list.refreshList){list.refreshList();}}}},bodyString);};GenericSfdcPage.displayAlohaWarning=function(){var content=document.getElementById("browserWarningContent");if(content&&!UserContext.userPreferences.getBoolean("HideBrowserWarning")){var type=Dialogs.types.INFO;var warnDialog=Dialogs.createDialog({id:"browserWarningDialog",title:LC.getLabel("BrowserWarnings","DialogTitle"),message:content.innerHTML,backgroundClass:type.backgroundClass,contentClass:type.contentClass,iconClass:type.iconClass,iconAlt:type.getIconAlt(),actions:[function(){UserContext.userPreferences.setBoolean("HideBrowserWarning",true);}],actionLabels:[LC.getLabel("Buttons","ok")]},false);sfdcPage.dialogs[warnDialog.id]=warnDialog;warnDialog.createDialog();warnDialog.setWidth(560);warnDialog.show();}};
var UserContext={initialized:false,locale:"",language:"",startOfWeek:0,dateFormat:"",dateTimeFormat:"",timeFormat:"",ampm:null,today:"",isAccessibleMode:false,userPreferences:null,siteUrlPrefix:"",userId:"",uiSkin:"",initialize:function(values){if(!values){UserContext.initializeFromServlet();return;}UserContext.processValues(values);},initializeFromServlet:function(){var url=UserContext.getUrl("/_ui/system/context/UserContextServlet");XBrowser.getHttpResponse(url,function(request){var values=Util.evalAjaxServletOutput(request.responseText);UserContext.processValues(values);});},processValues:function(values){for(var key in values){if(typeof UserContext[key]!="undefined"){if(key=="userPreferences"||key=="orgPreferences"){UserContext[key]=new PreferenceBits(values[key]);}else{UserContext[key]=values[key];}}}UserContext.initialized=true;},getUrl:function(url){if(typeof url=="undefined"||typeof UserContext.siteUrlPrefix=="undefined"||!UserContext.siteUrlPrefix){return url;}if(url.indexOf("/")!=0){return url;}if(url.indexOf(UserContext.siteUrlPrefix)==0){return url;}return UserContext.siteUrlPrefix+url;}};
var DesktopContext={pageTitle:"",pageTitleIcon:"",pageTitleIconAlt:"",interactionLog:{}};DesktopContext.setCurrentDesktopParam=function(obj){var qs=new QueryString(null);var param=qs.get(Desktop.IS_DESKTOP);if(param){obj[Desktop.IS_DESKTOP]=param;}return obj;};DesktopContext.preserveDesktopPageUrl=function(url,value,noOverwrite){if(typeof value==="undefined"){return url;}var uri=QueryString.getURI(url);var qs=QueryString.createQueryString(url);if(!noOverwrite||qs.get(Desktop.IS_DESKTOP)===null){qs.add(Desktop.IS_DESKTOP,value);}return uri+qs.toString();};DesktopContext.fireSaveEvent=function(cmpId,saveType,targetUrl,newURL){if(isServiceDeskPage&&cmpId){var frameContainer=Ext.getCmp(cmpId);if(frameContainer){frameContainer.fireEvent("PageSavedEvent",{saveType:saveType,href:newURL,targetUrl:targetUrl});}}};DesktopContext.fireCloseTabEvent=function(cmp,refreshParent,srcEntityId){if(typeof cmp==="string"){cmp=Ext.getCmp(cmp);}if(cmp){cmp.fireEvent("CloseTabEvent",{refreshParent:refreshParent,srcEntityId:srcEntityId});}};
var Util={makeOptionString:function(labelText,value,array){if(!array){return"<option value='"+value+"'>"+labelText+"</option>";}else{array.push('<option value="');array.push(value);array.push('">');array.push(labelText);array.push("</option>");}},scriptCache:{},evalScriptsUnderElement:function(element){var scriptTags=element.getElementsByTagName("script");var srcScripts=[];for(var i=0;i<scriptTags.length;i++){var src=scriptTags[i].src;if(src){if(!Util.scriptCache[src]){XBrowser.createDynamicScript(src);Util.scriptCache[src]=true;}srcScripts.push(scriptTags[i]);}else{eval(scriptTags[i].innerHTML);}}for(var i=0;i<srcScripts.length;i++){srcScripts[i].parentNode.removeChild(srcScripts[i]);}},evalScriptsUnderElementWithSrc:function(element){var _parseScripts=function(){var scriptTags=element.getElementsByTagName("script");var docHead=document.getElementsByTagName("head")[0];for(var scriptIndex=0;scriptIndex<scriptTags.length;scriptIndex++){var newScript=document.createElement("script");newScript.type=scriptTags[scriptIndex].type;if(scriptTags[scriptIndex].src){var src=scriptTags[scriptIndex].src;var index=src.indexOf("://");if(index!=-1){src=src.substring(src.indexOf("/",index+3));}var xmlHttp=XBrowser.createHttpRequest();xmlHttp.open("GET",src,false);xmlHttp.send(null);eval(xmlHttp.responseText);newScript.src=src;docHead.appendChild(newScript);}else{if(scriptTags[scriptIndex].text){eval(scriptTags[scriptIndex].text);newScript.text=scriptTags[scriptIndex].text;docHead.appendChild(newScript);}else{}}}};setTimeout(_parseScripts,0);},evalAjaxServletOutput:function(jsonStr){if(!jsonStr){return null;}else{if(jsonStr.substring(0,AjaxServlet.CSRF_PROTECT.length)!==AjaxServlet.CSRF_PROTECT){throw"CSRF protect string not added to servlet response.";}else{return eval("("+Util.stripCSRFProtect(jsonStr)+")");}}},stripCSRFProtect:function(jsonStr){if(jsonStr.indexOf(AjaxServlet.CSRF_PROTECT)===0){return jsonStr.substring(AjaxServlet.CSRF_PROTECT.length,jsonStr.length);}return jsonStr;},refreshDynamicSelect:function(selectElement,options,showNone,valToMatch){var selectedIndex=0;var optionsArr=["<select name='",selectElement.name,"' id='",selectElement.id,"' class='",selectElement.className,"' title='",selectElement.title,"'"];var otherAttributes=["size","multiple","tabindex"];for(var i=0;i<otherAttributes.length;i++){var param=otherAttributes[i];if(selectElement[param]){optionsArr.push(" ");optionsArr.push(param);optionsArr.push("='");optionsArr.push(selectElement[param]);optionsArr.push("'");}}if(selectElement.attributes["tabindex"]){optionsArr.push(" ");optionsArr.push("tabindex");optionsArr.push("='");optionsArr.push(selectElement.attributes["tabindex"].nodeValue);optionsArr.push("'");}optionsArr.push(">");var indexNum=0;if(showNone){Util.makeOptionString(LC.getLabel("SelectElement","Required"),"",optionsArr);indexNum++;}for(var i=0;i<options.length;i++){var newVal=options[i][1];Util.makeOptionString(options[i][0],newVal,optionsArr);if(valToMatch&&(newVal===valToMatch)){selectedIndex=indexNum;}indexNum++;}optionsArr.push("</select>");var selParent=selectElement.parentNode;if(!selParent.isDynamicSelect){var wrapperSpan=document.createElement("SPAN");wrapperSpan.isDynamicSelect=true;selParent.insertBefore(wrapperSpan,selectElement);selParent.removeChild(selectElement);selParent=wrapperSpan;}selParent.innerHTML=optionsArr.join("");var newSel=selParent.firstChild;if(valToMatch){newSel.selectedIndex=selectedIndex;}return newSel;},createDynamicSelect:function(attributeMap,options,showNone){var optionsArr=["<select"];for(var key in attributeMap){optionsArr.push(" ");optionsArr.push(key);optionsArr.push("='");optionsArr.push(attributeMap[key]);optionsArr.push("'");}optionsArr.push(">");if(showNone){Util.makeOptionString(LC.getLabel("SelectElement","Required"),"",optionsArr);}for(var i=0;i<options.length;i++){var newVal=options[i][1];Util.makeOptionString(options[i][0],newVal,optionsArr);}optionsArr.push("</select>");return optionsArr.join("");},insertOption:function(selectElement,optionElement,index){if(selectElement.currentStyle){selectElement.add(optionElement,index);}else{selectElement.add(optionElement,selectElement.options[index]);}},convertOptionsForPicklistData:function(options){var ret=[];for(var i=0;i<options.length;i++){ret.push(escapeHTML(options[i][1]));ret.push(escapeHTML(options[i][0]));}return ret;},animate:function(args){var obj=args.obj;var prop=args.prop;var value=parseInt(args.start);var target=args.target;var f=args.f||function(n){return n;};var inc=args.inc||1;var maxinc=args.maxinc||Infinity;var after=args.after;var aftereach=args.aftereach;if(target<value){var dest=value-f(inc);value=(dest<target)?target:dest;}else{if(target>value){var dest=value+f(inc);value=(dest>target)?target:dest;}}if(prop=="opacity"){obj.style[prop]=value/100;obj.style["filter"]="alpha(opacity="+value+")";}else{obj.style[prop]=value+"px";}if(!(inc>=maxinc)){inc++;}if(value!=target){if(aftereach){aftereach();}setTimeout(function(){Util.animate({obj:obj,prop:prop,start:value,target:target,f:f,aftereach:aftereach,after:after,inc:inc});},20);}else{if(aftereach){aftereach();}if(after){setTimeout(after,50);}}},apply:function(target,source){if(target&&source&&typeof source=="object"){for(var A in source){target[A]=source[A];}}return target;},applyIf:function(target,source){if(target&&source){for(var A in source){if(typeof target[A]=="undefined"){target[A]=source[A];}}}return target;},hasStyleEndsWith:function(elem,clazzName){var re=new RegExp(" (\\S*"+clazzName+") ");var n=" "+elem.className+" ";var match=re.exec(n);if(!match){return false;}else{return match[1];}},convertPathToTitle:function(path){if(navigator.platform&&navigator.platform.indexOf("Win")>=0){var pathDelimiter="\\";if(path.lastIndexOf(pathDelimiter)>=0){path=path.substring(path.lastIndexOf(pathDelimiter)+1);}pathDelimiter="/";if(path.lastIndexOf(pathDelimiter)>=0){path=path.substring(path.lastIndexOf(pathDelimiter)+1);}}else{var pathDelimiter2="/";if(path.lastIndexOf(pathDelimiter2)>=0){path=path.substring(path.lastIndexOf(pathDelimiter2)+1);}}var dotIndex=path.lastIndexOf(".");if(dotIndex<1){return{name:path};}return{name:path.substring(0,dotIndex),extension:path.substring(dotIndex+1,path.length)};},extend:function(constructor,superConstructor){var surrogateConstructor=function(){};surrogateConstructor.prototype=superConstructor.prototype;var prototypeObject=new surrogateConstructor();prototypeObject.constructor=constructor;constructor.prototype=prototypeObject;}};
function ApiUtils(){}ApiUtils.getApiURL=function(isPartner,version){var url=window.location.href;var idx=url.indexOf("/",10);var base=url.substring(0,idx)+UserContext.getUrl("/services/Soap/")+(isPartner?"u":"c")+"/"+version;return base;};ApiUtils.getSessionId=function(){var sessionId=getCookie(RequestInfo.pSID);return sessionId;};ApiUtils.to18CharId=function(id){if(id==null||(id.length==18)){return id;}id=id.replace(/\"/g,"");if(id.length!=15){return null;}var suffix="";for(var i=0;i<3;i++){var flags=0;for(var j=0;j<5;j++){var c=id.charAt(i*5+j);if(c>="A"&&c<="Z"){flags+=1<<j;}}if(flags<=25){suffix+="ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(flags);}else{suffix+="012345".charAt(flags-26);}}return id+suffix;};ApiUtils.to15CharId=function(id){if(!id){return null;}return id.substring(0,15);};ApiUtils.getId=function(record){if(!record){return null;}var id=record.get("Id");if(id.splice&&id.length&&id.length>0){id=id[0];}if(id){id=ApiUtils.to15CharId(id);}return id;};ApiUtils.soqlEncode=function(str){var newStr=str;newStr=newStr.replace("\\","\\\\");newStr=newStr.replace("'","\\'");return newStr;};
function CustomEntityDefinition(selectElemPrefix,radioName,standardHelpId){if(!document.getElementsByName(radioName)){return;}CustomEntityDefinition.prototype.pickerPrefix=selectElemPrefix;CustomEntityDefinition.prototype.standardHelpId=standardHelpId;CustomEntityDefinition.prototype.currentSelect=null;CustomEntityDefinition.prototype.enableScontrolPicker=function(e){var radio=getEventTarget(getEvent(e));if(CustomEntityDefinition.prototype.currentSelect!=null){CustomEntityDefinition.prototype.currentSelect.value="";if(radio.id==standardHelpId){CustomEntityDefinition.prototype.currentSelect.disabled=true;}else{CustomEntityDefinition.prototype.currentSelect.className="hidden";}}var newSelect=document.getElementById(CustomEntityDefinition.prototype.pickerPrefix+radio.value);if(newSelect!=null){newSelect.className="";newSelect.disabled=false;CustomEntityDefinition.prototype.currentSelect=newSelect;}};var radios=document.getElementsByName(radioName);for(var i=0;i<radios.length;i++){var radio=radios[i];addEvent(radio,"click",CustomEntityDefinition.prototype.enableScontrolPicker,false);var sel=document.getElementById(CustomEntityDefinition.prototype.pickerPrefix+radio.value);if(sel!=null&&sel.className!="hidden"){CustomEntityDefinition.prototype.currentSelect=sel;}}}CustomEntityDefinition.handleAutoNumberSel=function(s,e1,e2){var b=s.selectedIndex==0;toggleRow(e1,!b);if(e2){toggleRow(e2,!b);}};CustomEntityDefinition.hasAlerted=false;CustomEntityDefinition.displayFormatChangeWarning=function(){if(!CustomEntityDefinition.hasAlerted){alert(LC.getLabel("Page_CustomEntityDefinition_Edit","DisplayFormatChangeWarning"));CustomEntityDefinition.hasAlerted=true;}};CustomEntityDefinition.setNameLabel=function(masterLabel,nameElem){if(nameElem.value.length==0&&masterLabel.value.length!=0){var max=nameElem.maxLength;var targetVal=LC.getLabel("Page_CustomEntityDefinition_Edit","DefaultNameLabel",masterLabel.value);if(targetVal.length>max){targetVal=targetVal.substring(0,max);}nameElem.value=targetVal;}};
function CustomSummaryFieldAttributes(servletUrl,parentEntityEnumOrId,entityId,fieldTargetId,radioName,oppLabels,numFilters,initialMap){this.radios=document.getElementsByName(radioName);this.parentEntityEnumOrId=parentEntityEnumOrId;this.servletUrl=servletUrl;this.entityElement=document.getElementById(entityId);this.fieldTarget=document.getElementById(fieldTargetId);if(this.entityElement){this.currentEntity=this.getEntityValue(this.entityElement.options[this.entityElement.selectedIndex].value);}else{for(var entityName in initialMap){this.currentEntity=entityName;break;}}this.oldOpVal=null;for(var i=0;i<this.radios.length;i++){if(this.radios[i].checked){this.oldOpVal=this.radios[i].value;break;}}if(initialMap){this.cache=initialMap;}else{this.cache={};}this.criteriaCache={};var self=this;this.handleRadioClick=function(e){var newOpVal;for(var i=0;i<self.radios.length;i++){if(self.radios[i].checked){newOpVal=self.radios[i].value;break;}}if(CustomSummaryFieldAttributes.getShownFields(newOpVal)!=CustomSummaryFieldAttributes.getShownFields(self.oldOpVal)){self.setCurrentEntity();}self.oldOpVal=newOpVal;};this.handleEntityChange=function(e){var entityElementValue=self.getEntityValue(self.entityElement.options[self.entityElement.selectedIndex].value);self.setCurrentEntity(entityElementValue);};this.handleFilterViewClick=function(e){var radio=getEventTarget(getEvent(e));document.getElementById(CriteriaInputConstants.FILTER_SECTION_ID).style.display=(radio.value=="1"?"block":"none");};this.cacheFieldsFromResponse=function(request){var response=Util.evalAjaxServletOutput(request.responseText);var fields=response[AjaxLoadFieldsForEntity.pFIELD_LIST];self.cache[response[AjaxLoadFieldsForEntity.pENTITY_NAME]]=fields;self.fillFieldsFromCache();};this.setCurrentEntity=function(value){if(typeof(value)!="undefined"){self.currentEntity=value;}if(self.currentEntity){self.setOpsEnabled(true);var fields=self.cache[self.currentEntity];if(fields){self.fillFieldsFromCache();}else{var postMap={};postMap[self.entityElement.name]=self.currentEntity;postMap[AjaxLoadFieldsForEntity.pPARENT_ENTITY_NAME]=self.parentEntityEnumOrId;XBrowser.postHttpResponse(self.servletUrl,self.cacheFieldsFromResponse,XBrowser.buildPost(postMap));}}else{self.setOpsEnabled(false);}};this.setOpsEnabled=function(enabled){if(self.radios&&self.radios.length>0){for(var i=0;i<self.radios.length;i++){self.radios[i].disabled=!enabled;if(!enabled){self.radios[i].checked=false;}}}if(self.fieldTarget){self.fieldTarget.disabled=!enabled;if(!enabled){self.fieldTarget=Util.refreshDynamicSelect(self.fieldTarget,[],true);self.fieldTarget.disabled=true;}}};var prevCriteriaData;if(this.currentEntity){prevCriteriaData=new CriteriaEntityData(this.currentEntity,this.cache[this.currentEntity]);this.criteriaCache[this.currentEntity]=prevCriteriaData;}this.criteriaInput=new CriteriaInput(oppLabels,numFilters,prevCriteriaData);if(this.currentEntity){this.setCurrentEntity();}else{this.setOpsEnabled(false);}this.initEvents();}CustomSummaryFieldAttributes.prototype.getEntityValue=function(picklistVal){if(!picklistVal){return null;}return picklistVal.substring(0,picklistVal.indexOf("."));};CustomSummaryFieldAttributes.prototype.showOptions=function(shown){document.getElementById(SummaryFieldConstants.OPTIONS_ID).style.display=shown?"block":"none";};CustomSummaryFieldAttributes.prototype.initEvents=function(){for(var i=0;i<this.radios.length;i++){addEvent(this.radios[i],"click",this.handleRadioClick,false);}var filterViewRadios=document.getElementsByName(CriteriaInputConstants.SHOW_SUMMARY_FILTER);for(var i=0;i<filterViewRadios.length;i++){addEvent(filterViewRadios[i],"click",this.handleFilterViewClick,false);if(filterViewRadios[i].value=="1"&&filterViewRadios[i].checked){document.getElementById(CriteriaInputConstants.FILTER_SECTION_ID).style.display="block";}}if(this.entityElement){addEvent(this.entityElement,"change",this.handleEntityChange,false);}};CustomSummaryFieldAttributes.prototype.setCurrentCriteria=function(entity){var fields=this.cache[entity];if(!fields){Gack.sendGack("criteriadata set before fields loaded.  Entity: "+entity);}var criteriaEntity=this.criteriaCache[entity];if(!criteriaEntity){criteriaEntity=new CriteriaEntityData(entity,fields);this.criteriaCache[entity]=criteriaEntity;}this.criteriaInput.setEntity(criteriaEntity);};CustomSummaryFieldAttributes.prototype.fillFieldsFromCache=function(){var shownFields;for(var i=0;i<this.radios.length;i++){if(this.radios[i].checked){shownFields=CustomSummaryFieldAttributes.getShownFields(this.radios[i].value);break;}}this.setCurrentCriteria(this.currentEntity);var anyOptions=false;var prevOptionIndex=0;if(this.fieldTarget){if(!shownFields){this.fieldTarget=Util.refreshDynamicSelect(this.fieldTarget,[],true,"");}else{var prevOption;if(this.fieldTarget.options&&this.fieldTarget.selectedIndex>=0){prevOption=this.fieldTarget.options[this.fieldTarget.selectedIndex].value;}var options=[];var fields=this.cache[this.currentEntity];var numShownOptions=1;for(var i=0;i<fields.length;i++){if(fields[i].columnType in shownFields){anyOptions=true;options.push([fields[i].label,fields[i].name]);numShownOptions++;}}this.fieldTarget=Util.refreshDynamicSelect(this.fieldTarget,options,true,prevOption);}if(!anyOptions){this.fieldTarget.disabled=true;}else{this.fieldTarget.disabled=false;}}};CustomSummaryFieldAttributes.getShownFields=function(enumVal){switch(enumVal){case"0":return null;case"1":var ar={};for(var type in ColumnType){if(ColumnType[type].isNumber){ar[type]=true;}}return ar;case"2":case"3":var ar={};for(var type in ColumnType){if(ColumnType[type].isNumber||ColumnType[type].isDate){ar[type]=true;}}return ar;}};
function MaskTypeSelector(targetDivId,typeSelectId,charSelectId,maskData){this.targetDiv=document.getElementById(targetDivId);this.typeSelect=document.getElementById(typeSelectId);this.charSelect=document.getElementById(charSelectId);this.maskData=maskData;var self=this;this.handleSelectChange=function(e){var typeValue=self.typeSelect.options[self.typeSelect.selectedIndex].value;var charValue=self.charSelect.options[self.charSelect.selectedIndex].value;if(!(typeValue&&charValue)){self.targetDiv.innerHTML="";return;}var example=self.maskData[typeValue];example=example.replace(/X/g,charValue);self.targetDiv.innerHTML=example;};addEvent(this.typeSelect,"change",this.handleSelectChange,false);addEvent(this.charSelect,"change",this.handleSelectChange,false);this.handleSelectChange();}
function CompactLayoutUi(_unusedItems,_leftColItems,_rightColItems){var clUi=this;this.appendToOnloadQueue(function(){clUi.attachEvents();});}CompactLayoutUi.prototype=new GenericSfdcPage();CompactLayoutUi.prototype.initialize=function(_unusedItems,_leftColItems,_rightColItems){this.unusedItems=_unusedItems;this.leftColItems=_leftColItems;this.rightColItems=_rightColItems;};CompactLayoutUi.prototype.attachEvents=function(){var unusedSelectBox=document.getElementById(this.unusedItems);var leftColBox=document.getElementById(this.leftColItems);var rightColBox=document.getElementById(this.rightColItems);var clUi=this;CompactLayoutUi.addClick(document.getElementById(CompactLayoutUiConst.switchColumnToRight),function(){moveOption(leftColBox,rightColBox,LC.getLabel("SelectElement","Required"),[],null,LC.getLabel("SelectElement","Required"));});CompactLayoutUi.addClick(document.getElementById(CompactLayoutUiConst.switchColumnToLeft),function(){moveOption(rightColBox,leftColBox,LC.getLabel("SelectElement","Required"),[],null,LC.getLabel("SelectElement","Required"));});CompactLayoutUi.addClick(document.getElementById(CompactLayoutUiConst.hideItemsLeft),function(){moveOption(leftColBox,unusedSelectBox,LC.getLabel("SelectElement","Required"),[],null,LC.getLabel("SelectElement","Required"));});CompactLayoutUi.addClick(document.getElementById(CompactLayoutUiConst.showItemsLeft),function(){moveOption(unusedSelectBox,leftColBox,LC.getLabel("SelectElement","Required"),[],null,LC.getLabel("SelectElement","Required"));});CompactLayoutUi.addClick(document.getElementById(CompactLayoutUiConst.hideItemsRight),function(){moveOption(rightColBox,unusedSelectBox,LC.getLabel("SelectElement","Required"),[],null,LC.getLabel("SelectElement","Required"));});CompactLayoutUi.addClick(document.getElementById(CompactLayoutUiConst.showItemsRight),function(){moveOption(unusedSelectBox,rightColBox,LC.getLabel("SelectElement","Required"),[],null,LC.getLabel("SelectElement","Required"));});CompactLayoutUi.addClick(document.getElementById(CompactLayoutUiConst.saveButtonId),function(){clUi.selectAll();return true;});};CompactLayoutUi.prototype.selectAll=function(){var leftColBox=document.getElementById(this.leftColItems);var rightColBox=document.getElementById(this.rightColItems);for(var i=0;i<leftColBox.length;i++){leftColBox.options[i].selected=true;}for(var i=0;i<rightColBox.length;i++){rightColBox.options[i].selected=true;}};CompactLayoutUi.addClick=function(elem,fn){addEvent(elem,"click",fn,false);};
var CustomFieldRelatedList={_mapCDTToComponents:{},_setupPlusGif:"",_setupMinusGif:"",registerCDT:function(cdtId,componentIds,setupPlusGif,setupMinusGif){this._mapCDTToComponents[cdtId]=componentIds;this._setupPlusGif=setupPlusGif;this._setupMinusGif=setupMinusGif;var twisty=document.getElementById(cdtId+"_twisty");if(twisty){addEvent(twisty,"click",this.onClickCDTTwisty,false);}},onClickCDTTwisty:function(e){var twisty=getEventTarget(e);if(twisty==null){return;}var expanding=false;if(twisty.src.indexOf(CustomFieldRelatedList._setupPlusGif)!=-1){twisty.src=CustomFieldRelatedList._setupMinusGif;expanding=true;}else{twisty.src=CustomFieldRelatedList._setupPlusGif;}var cdtId=twisty.id.split("_")[0];var arrCompRowIds=CustomFieldRelatedList._mapCDTToComponents[cdtId];for(compRow=0;compRow<arrCompRowIds.length;compRow++){if(document.getElementById(arrCompRowIds[compRow])){toggleDisplay(document.getElementById(arrCompRowIds[compRow]),expanding);}}}};
function ActionOverrideUi(){}ActionOverrideUi.prototype.visiblePicklist=null;ActionOverrideUi.prototype.setVisiblePicklist=function(toDisplay){if(ActionOverrideUi.prototype.visiblePicklist!=null){document.getElementById(ActionOverrideUi.prototype.visiblePicklist).className="hidden";}document.getElementById(toDisplay).className=null;ActionOverrideUi.prototype.visiblePicklist=toDisplay;};
function Scontrol(){}Scontrol.prototype.getSelectedRecordIdsFromForm=function(form,keyPrefix){var selected=[];if(form){for(i=0;i<form.elements.length;i++){var element=form.elements[i];if((element.name=="ids")&&element.checked){var value=element.value;if(value.substr(0,3)==keyPrefix){selected.push(value);}}}}else{alert("Unable to find a form for this button");}return selected;};
function ValidateFormula(servletUrl,buttonId,validTextId,bodyId,fieldArray){this.bodyId=bodyId;this.validTextId=validTextId;this.fieldArray=fieldArray;this.servletUrl=servletUrl;this.isLoading=false;this.loading=new LoadingScreen(document.getElementById(bodyId).parentNode,LC.getLabel("Scontrol","CheckingSyntax"));var self=this;this.handleCheckSyntaxResponse=function(request){response=Util.evalAjaxServletOutput(request.responseText);document.getElementById(self.validTextId).innerHTML=response[AjaxServlet.ERROR_MSG_KEY];if(!response[AjaxValidateFormula.VALID_KEY]){var range=response[AjaxValidateFormula.RANGE_KEY];if(range){setContentWindow(window);setSelectionInEditor(self.bodyId,range[0],range[1]);}}self.setLoading(false);};this.handleCheckSyntaxError=function(request){document.getElementById(self.validTextId).innerHTML=LC.getLabel("Scontrol","AjaxError");self.setLoading(false);};this.handleCheckSyntaxClick=function(e){self.setLoading(true);var postMap={};for(var i=0;i<self.fieldArray.length;i++){postMap[self.fieldArray[i]]=document.getElementById(self.fieldArray[i]).value;}postMap[self.bodyId]=document.getElementById(self.bodyId).value;XBrowser.postHttpResponse(self.servletUrl,self.handleCheckSyntaxResponse,XBrowser.buildPost(postMap),self.handleCheckSyntaxError);};addEvent(document.getElementById(buttonId),"click",this.handleCheckSyntaxClick,true);}ValidateFormula.prototype.setLoading=function(val){if(val!=this.isLoading){if(val){this.loading.show();this.isLoading=true;}else{this.loading.hide();this.isLoading=false;}}};
function WebLinkUi(){}WebLinkUi.prototype.updateOpenType=function(openType,newWinVal,allow){var typeSelect=document.getElementById(openType);var opts=typeSelect.options;if(typeSelect._saveOpts==null){typeSelect._saveOpts=new Array(opts.length);for(var i=0;i<opts.length;++i){typeSelect._saveOpts[i]=opts[i];}}var selectedVal=opts[typeSelect.selectedIndex].value;if(selectedVal==newWinVal&&!allow){selectedVal=opts[0].value;}opts.length=0;for(var i=0;i<typeSelect._saveOpts.length;++i){var opt=typeSelect._saveOpts[i];opt.selected=(opt.value==selectedVal);if(allow||opt.value!=newWinVal){opts[opts.length]=opt;}}WebLinkUi.prototype.updateContentValues();};WebLinkUi.prototype.updateRequireRowSelectionVisibility=function(rowSectionId,show){this.setDisplay(rowSectionId,show);};WebLinkUi.prototype.setContentType=function(id,isJs,jsValue,defValue){var elem=document.getElementById(id);if(elem==null){return;}if(isJs){elem.value=jsValue;}else{if(elem.value==jsValue){var opts=elem.options;if(opts!=null){for(var i=0;i<opts.length;++i){if(opts[i].value==defValue){opts[i].selected=true;return;}}opts[0].selected=true;}}}};WebLinkUi.prototype.currentDisplayedDiv=null;WebLinkUi.prototype.displayDiv=function(div){if(WebLinkUi.prototype.currentDisplayedDiv){WebLinkUi.prototype.currentDisplayedDiv.style.display="none";}var d=document.getElementById(div);d.style.display="block";d.style.zIndex=0;WebLinkUi.prototype.currentDisplayedDiv=d;};WebLinkUi.prototype.setDisplay=function(id,vis){var d=document.getElementById(id);if(d){if(vis){d.style.display="block";}else{d.style.display="none";}}};WebLinkUi.prototype.updateContentValues=function(){var linkType=document.getElementById("LinkType").value;var displayTypeElement=document.getElementById("WebLinkFields_DisplayTypeM");var listButton=displayTypeElement!=null?displayTypeElement.checked:false;var scontrolElement=document.getElementById("Scontrol");if(WebLinkUi.scontrolOptions==null){WebLinkUi.scontrolOptions=[];for(n=0;n<scontrolElement.options.length;n++){WebLinkUi.scontrolOptions.push(scontrolElement.options[n]);}}var options;var prefix;if(linkType=="V"){options=listButton?vfSetOrientedOptions:vfOptions;prefix="066";}else{options=WebLinkUi.scontrolOptions;prefix="01N";}var value=scontrolElement.value;if(value!=null){if(value.substring(0,3)!=prefix){value=null;}}var finalOptions=[];for(n=0;n<options.length;n++){var option=options[n];if(option.value.substring(0,3)==prefix){finalOptions.push([option.text,option.value]);}}Util.refreshDynamicSelect(scontrolElement,finalOptions,false,value);};
function CustomMotifDefinition(parentMotifId){this.parentMotifInputObject=window.opener.document.getElementById(parentMotifId).motifInputElement;this.motifObject=document.getElementById(CustomMotifDefinitionPageConst.COLOR_ELEMENT).motifInputElement;this.iconObject=document.getElementById(CustomMotifDefinitionPageConst.MOTIF_ICON_PARAM).imageSelectElement;}CustomMotifDefinition.prototype.returnSelections=function(){if(this.motifObject.isNull()){alert(noMotifErrorMsg);return false;}else{if(this.iconObject.isNull()){alert(noIconErrorMsg);return false;}else{this.parentMotifInputObject.motifElement.className=this.motifObject.motifElement.className.replace("motifColorElement","customDefinedMotif");this.parentMotifInputObject.setMotifKey(this.motifObject.motifKeyInput.value);this.parentMotifInputObject.setDescription(userDefinedDescription);this.parentMotifInputObject.setIconSrc(this.iconObject.image.src);this.parentMotifInputObject.setIconValue(this.iconObject.inputElement.value);window.blur();window.close();return true;}}};CustomMotifDefinition.prototype.copyInputVal=function(fromID,toID){window.opener.document.getElementById(toID).value=document.getElementById(fromID).value;};CustomMotifDefinition.prototype.copyInput=function(fromInput,toInput){toInput.value=fromInput.value;};
function DefaultTabWarning(selectedTabsId){this.selectedTabsId=selectedTabsId;}DefaultTabWarning.prototype.defaultIsSelectedToMove=function(){var selectedTabs=document.getElementById(this.selectedTabsId);var options=selectedTabs.options;for(var i=0;i<options.length;i++){if(options[i].selected&&this.isDefault(options[i].text)){return true;}}return false;};DefaultTabWarning.prototype.isDefault=function(value){var defaultString=LC.getLabel("Page_My_Tabs","DefaultTabMarkerOnly");if(value.indexOf(defaultString)>=0){return true;}return false;};
function TabSetPage(selectToUpdateId,workspaceMappingServletUrl){this.selectToUpdateId=selectToUpdateId;this.workspaceMappingServletUrl=workspaceMappingServletUrl;}TabSetPage.prototype.update=function(availableSelectId){var selectedTabs=document.getElementById(availableSelectId);var selectToUpdate=document.getElementById(this.selectToUpdateId);var selectedDefault=selectToUpdate.options[selectToUpdate.selectedIndex].value;var options=selectedTabs.options;var optionsArr=[];var isSelectedInOptions=false;for(var i=0;i<options.length;i++){var option=options[i];optionsArr[i]=[option.text,option.value];if(option.value==selectedDefault){isSelectedInOptions=true;}}if(!isSelectedInOptions){selectedDefault=optionsArr[0].value;}Util.refreshDynamicSelect(selectToUpdate,optionsArr,false,selectedDefault);};TabSetPage.prototype.updateWorkspaceMapping=function(availableSelectId){var options=Ext.getDom(availableSelectId).options;var newOptions=new Array();var seenOptions=new Array();for(var i=0;i<options.length;i++){var option=options[i].value;var row=Ext.get(TabSetPageConstants.ROW_PREFIX+option);if(row===null){newOptions.push(option);}else{row.enableDisplayMode().show();seenOptions[option]=1;}}if(newOptions.length>0){Ext.Ajax.request({url:UserContext.getUrl(this.workspaceMappingServletUrl),params:{tabNames:newOptions},method:"POST",success:this.updateWorkspaceMappingRows,scope:this});}else{var rows=Ext.select("#"+TabSetPageConstants.WORKSPACE_MAPPING_TABLE_ID+" .dataRow");for(var i=0;i<rows.getCount();i++){var row=rows.item(i);var tabName=row.dom.id.substr(TabSetPageConstants.ROW_PREFIX.length);if(seenOptions[tabName]==undefined){row.enableDisplayMode().hide();}}}};TabSetPage.prototype.updateWorkspaceMappingRows=function(response){var output=Util.evalAjaxServletOutput(response.responseText).html;Ext.select("#"+TabSetPageConstants.WORKSPACE_MAPPING_TABLE_ID+" .last").removeClass("last");Ext.fly(TabSetPageConstants.WORKSPACE_MAPPING_TABLE_ID).insertHtml("beforeEnd",output);};var TabSetPageUtil={enableField:function(selectBoxId){var elt=document.getElementById(selectBoxId);elt.disabled=false;elt.parentNode.className="";},disableField:function(selectBoxId){var elt=document.getElementById(selectBoxId);elt.disabled=true;elt.parentNode.className="disabledText";}};
function SchedulePageUtil(){}SchedulePageUtil.clickExpand=function(){Animation.rollIn(document.getElementById(SchedulePage.pDuelOuter),function(){});};SchedulePageUtil.clickCollapse=function(){Animation.rollOut(document.getElementById(SchedulePage.pDuelOuter),function(){});};SchedulePageUtil.disableTime=function(suffix){document.getElementById(ScheduleElement.pPrefTime+suffix).value="";document.getElementById(ScheduleElement.pPrefTime+suffix).style.display="none";document.getElementById(ScheduleElement.pPrefTime+suffix).disabled=true;document.getElementById(ScheduleElement.pOtherPrefTimeLabelDiv+suffix).style.display="none";document.getElementById(ScheduleElement.pPrefTimeLabelDiv+suffix).style.display="block";};SchedulePageUtil.enableTime=function(suffix){document.getElementById(ScheduleElement.pPrefTimeLabelDiv+suffix).style.display="none";document.getElementById(ScheduleElement.pOtherPrefTimeLabelDiv+suffix).style.display="none";document.getElementById(ScheduleElement.pPrefTimeLoadingDiv+suffix).style.display="block";document.getElementById(ScheduleElement.pPrefTimeLoadingDiv+suffix).focus();var saveData=SchedulePageUtil.buildPost(suffix);XBrowser.postHttpResponse(UserContext.getUrl(BlowoutServlet.SERVLETURL),function(response){SchedulePageUtil.handleResponse(suffix,response.responseText);},XBrowser.buildPost(saveData),null);return false;};SchedulePageUtil.buildPost=function(suffix){var saveData={};saveData[BlowoutServlet.SUFFIX]=suffix;saveData[SchedulePage.pBlowout]=document.getElementById(SchedulePage.pBlowout).value;saveData[SchedulePage.pIsOffPeak]=document.getElementById(SchedulePage.pIsOffPeak).value;saveData[ScheduleElement.pFreq+suffix]=SchedulePageUtil.getCheckedValue(ScheduleElement.pFreq+suffix);saveData[ScheduleElement.pStartDate+suffix]=document.getElementById(ScheduleElement.pStartDate+suffix).value;saveData[ScheduleElement.pEndDate+suffix]=document.getElementById(ScheduleElement.pEndDate+suffix).value;saveData[ScheduleElement.pDailyRec+suffix]=SchedulePageUtil.getCheckedValue(ScheduleElement.pDailyRec+suffix);for(var i=0;i<7;i++){saveData[ScheduleElement.pDayOfWeek+i+suffix]=document.getElementById(ScheduleElement.pDayOfWeek+i+suffix).checked?"1":"0";}saveData[ScheduleElement.pMonthlyRec+suffix]=SchedulePageUtil.getCheckedValue(ScheduleElement.pMonthlyRec+suffix);saveData[ScheduleElement.pMonthlyOnDayN+suffix]=document.getElementById(ScheduleElement.pMonthlyOnDayN+suffix).value;saveData[ScheduleElement.pMonthlyOnNthDay+suffix]=document.getElementById(ScheduleElement.pMonthlyOnNthDay+suffix).value;saveData[ScheduleElement.pMonthlyOnNDayOfWeek+suffix]=document.getElementById(ScheduleElement.pMonthlyOnNDayOfWeek+suffix).value;saveData[SchedulePage.pJobType]=document.getElementById(SchedulePage.pJobType).value;return saveData;};SchedulePageUtil.getCheckedValue=function(paramName){var params=document.getElementsByName(paramName);if(params.length==null){if(params.checked){return params.value;}}else{for(var i=0;i<params.length;i++){if(params[i].checked){return params[i].value;}}}return"";};SchedulePageUtil.handleResponse=function(suffix,responseText){var response=null;try{response=Util.evalAjaxServletOutput(responseText);}catch(err){if(window.location.replace){window.location.replace(window.location);}else{window.location.href=window.location.href;}return;}document.getElementById(ScheduleElement.pPrefTimeLoadingDiv+suffix).style.display="none";if(response[BlowoutServlet.SUCCESS]){SchedulePageUtil.setTimePicklist(suffix,response[BlowoutServlet.BLOWOUT]);document.getElementById(ScheduleElement.pPrefTime+suffix).disabled=false;document.getElementById(ScheduleElement.pPrefTime+suffix).style.display="block";document.getElementById(ScheduleElement.pPrefTime+suffix).focus();}else{document.getElementById(ScheduleElement.pPrefTimeLabelDiv+suffix).style.display="block";}SchedulePageUtil.handleErrors(response);};SchedulePageUtil.setTimePicklist=function(suffix,values){var options=document.getElementById(ScheduleElement.pPrefTime+suffix).options;options.length=0;if(values.length==0){options[0]=new Option(LC.getLabel("SelectElement","Required"),"");}else{for(var i=0;i<values.length;i++){options[i]=new Option(values[i],values[i]);}}};SchedulePageUtil.handleErrors=function(response){var specific=response[AjaxServlet.ERROR_MSG_KEY];if(specific instanceof Array){if(specific.length>3){document.getElementById(DetailElement.DEFAULT_ERROR_DIV_ID).style.display="block";}else{document.getElementById(DetailElement.DEFAULT_ERROR_DIV_ID).style.display="none";}for(var i=0;i<specific.length;i++){var idAndVal=SchedulePageUtil.getIdAndVal(specific[i]);SchedulePageUtil.setError(idAndVal[0],idAndVal[1]);}}else{}};SchedulePageUtil.getIdAndVal=function(idVal){return idVal.split(",");};SchedulePageUtil.setError=function(id,message){var elem=null;if(document.getElementById(id).nodeName=="DIV"){elem=document.getElementById(id).parentNode;}else{elem=document.getElementById(id).parentNode.parentNode;}var isErrorPresent=false;var errorLoc;for(var i=0;i<elem.childNodes.length;i++){if(elem.childNodes[i].className!=null&&elem.childNodes[i].className=="errorMsg"){isErrorPresent=true;errorLoc=i;}}if(!isErrorPresent){if(message!=""){var errorDiv=document.createElement("div");errorDiv.className="errorMsg";errorDiv.innerHTML=message;elem.appendChild(errorDiv);}}else{if(message!=null){elem.childNodes[errorLoc].innerHTML=message;elem.childNodes[errorLoc].style.display="block";}else{elem.childNodes[errorLoc].style.display="none";}}};SchedulePageUtil.toggleMonthlyActive=function(isFirstSet,suffix){if(isFirstSet){document.getElementById(ScheduleElement.pMonthlyOnDayN+suffix).disabled=false;document.getElementById(ScheduleElement.pMonthlyOnNDayOfWeek+suffix).disabled=true;document.getElementById(ScheduleElement.pMonthlyOnNthDay+suffix).disabled=true;}else{document.getElementById(ScheduleElement.pMonthlyOnDayN+suffix).disabled=true;document.getElementById(ScheduleElement.pMonthlyOnNDayOfWeek+suffix).disabled=false;document.getElementById(ScheduleElement.pMonthlyOnNthDay+suffix).disabled=false;}};
function AjaxRequestGate(){this.ajaxIdle=true;}AjaxRequestGate.prototype.okToPostAjaxReq=function(){if(this.ajaxIdle){this.ajaxIdle=false;return true;}return false;};AjaxRequestGate.prototype.ajaxReqIsDone=function(){this.ajaxIdle=true;};
AutoComplete=function(el){this.baseName=this.getBaseName(el);this.type=this.getLookupType(el);this.lookupInput=this.getLookupInput(el);this.lookupInput.onkeyup=AutoComplete.prototype.onKeyUp;this.lookupInput.onfocus=AutoComplete.prototype.onFocus;this.lookupInput.onblur=AutoComplete.prototype.onBlur;this.hasFocus=false;this.valQueried=null;this.records;this.selected=-1;this.entityName;this.entityNameFields;if(this.type=="001"){this.entityName="Account";this.entityNameFields=["Name"];}else{if(this.type=="003"){this.entityName="Contact";this.entityNameFields=["FirstName","LastName"];}else{if(this.type=="005"){this.entityName="User";this.entityNameFields=["FirstName","LastName","Alias"];}}}};AutoComplete.prototype.RECORD_HEIGHT=17;AutoComplete.prototype.MIN_LENGTH_THRESHOLD=3;AutoComplete.prototype.TYPING_THRESHOLD_MILLIS=200;AutoComplete.prototype.HIGHLIGHT_COLOR="#AACCFF";AutoComplete.prototype.IS_IE=document.all;AutoComplete.prototype.AUTOCOMPLETE_MAP=[];AutoComplete.prototype.IS_PROCESSING=false;AutoComplete.prototype.FORM_NAME="editPage";AutoComplete.prototype.getBaseName=function(el){if(!el){return this.baseName;}var name=el.name;var idx=name.indexOf("_");if(idx>-1){return name.substring(0,idx);}else{return name;}};AutoComplete.prototype.isLookup=function(el){return el.name.indexOf("_lkid")>0;};AutoComplete.prototype.getLookupInput=function(el){if(!el){return this.lookupInput;}var base=this.getBaseName(el);return document.getElementById(base);};AutoComplete.prototype.getLookupType=function(el){if(!el){return this.type;}var type;var base=this.getBaseName(el);var name=base+"_lktp";var el=document.getElementById(name);if(el){type=el.value;}return type;};AutoComplete.prototype.doLookup=function(val){if(!this.hasFocus||AutoComplete.prototype.IS_PROCESSING){return;}var nameParts=this.parseName(val);if(!nameParts||nameParts.length==0){return;}AutoComplete.prototype.IS_PROCESSING=true;this.valQueried=val;var soql="SELECT Id";for(var i=0;i<this.entityNameFields.length;i++){soql+=", "+this.entityNameFields[i];}soql+=" FROM "+this.entityName+" WHERE ";if(this.entityNameFields.length==1){soql+=this.entityNameFields[0]+" like '"+val+"%' ";}else{for(var i=0;i<this.entityNameFields.length;i++){for(var j=0;j<nameParts.length;j++){var part=nameParts[j];if(part){soql+=this.entityNameFields[i]+" like '"+part+"%' ";if(i!=this.entityNameFields.length-1||j!=nameParts.length-1){soql+=" OR ";}}}}}this.records=AutoComplete.prototype.query(soql).records;this.displayResults(this.records,val);AutoComplete.prototype.IS_PROCESSING=false;};AutoComplete.prototype.parseName=function(val){var partsTemp;if(val){partsTemp=val.split(" ");}else{partsTemp=[];}var parts=[];for(var i=0;i<partsTemp.length;i++){var part=partsTemp[i];part=part.replace(" ","");if(part){parts.push(part);}}return parts;};AutoComplete.prototype.displayResults=function(records,value){if(records&&records.length>0){var baseName=this.getBaseName();var html=[];html.push("<table width='100%' cellpadding='0' cellspacing='0' border='0'>");for(var i=0;i<records.length;i++){var record=records[i];var id=ApiUtils.getId(record);html.push("<tr><td style='cursor: pointer;' onmouseover='AutoComplete.prototype.setSelected(\""+baseName+'", '+i+');this.style.backgroundColor="'+AutoComplete.prototype.HIGHLIGHT_COLOR+"\";' onmouseout='this.style.backgroundColor=\"\";'>");html.push("<div style='height:"+AutoComplete.prototype.RECORD_HEIGHT+"px;' id='"+id+"'>");var name=this.getName(record);html.push(this.highlightMatch(name,value));html.push("</div>");html.push("</td></tr>");}html.push("</table>");var boxName=this.getBaseName();var box=AutoComplete.prototype.getBox(boxName);if(!box){box=AutoComplete.prototype.makeBox(boxName,records.length*AutoComplete.prototype.RECORD_HEIGHT,200);var inputEl=this.getLookupInput();var top=getObjY(inputEl)+20;var left=getObjX(inputEl);AutoComplete.prototype.moveBox(boxName,top,left);}else{AutoComplete.prototype.resizeBox(baseName,records.length*AutoComplete.prototype.RECORD_HEIGHT,200);}box.innerHTML=html.join("");this.displaySuggestions(true);}};AutoComplete.prototype.getName=function(record){var name="";for(var i=0;i<this.entityNameFields.length;i++){var value=record.get(this.entityNameFields[i]);if(value){name+=value+" ";}}return name;};AutoComplete.prototype.highlightMatch=function(name,value){if(!name||!value){return"";}var nameLower=name.toLowerCase();var valueLower=value.toLowerCase();var idx=nameLower.indexOf(valueLower);if(idx==-1){return name;}else{var before=name.substring(0,idx);var middle=name.substring(idx,idx+value.length);var after=name.substring(idx+value.length);var match=before+"<b>"+middle+"</b>"+after;return match;}};AutoComplete.prototype.doFilter=function(val){var filteredRecords=[];for(var i=0;i<this.records.length;i++){var record=this.records[i];if(this.isMatch(record,val)){filteredRecords.push(record);}}if(filteredRecords&&filteredRecords.length>0){this.displayResults(filteredRecords,val);}else{this.doClear();}};AutoComplete.prototype.isMatch=function(record,val){var value=null;if(this.entityNameFields.length==1){value=record.get(this.entityNameFields[0]);}else{value=this.getName(record);}return(value&&value.toLowerCase().indexOf(val.toLowerCase())>-1);};AutoComplete.prototype.doClear=function(){this.displaySuggestions(false);this.selected=-1;};AutoComplete.prototype.displaySuggestions=function(isVisible){AutoComplete.prototype.showBox(this.getBaseName(),isVisible);};AutoComplete.prototype.selectItem=function(selectedIndex){var baseName=this.getBaseName();var id=null;var name=null;var box=AutoComplete.prototype.getBox(baseName);if(box&&selectedIndex>=0){var content=box.childNodes[0].childNodes[0];if(content&&content.rows&&selectedIndex<content.rows.length){var row=content.rows[selectedIndex];if(row){var cell=row.cells[0];var div=cell.getElementsByTagName("div")[0];if(div){id=div.id;}}}}if(id){for(var i=0;i<this.records.length;i++){var rec=this.records[i];if(id==ApiUtils.getId(rec)){name=this.getName(rec);break;}}}if(id&&name){lookupPick(AutoComplete.prototype.FORM_NAME,baseName+"_lkid",baseName,"",id,name,"","");}var autoComplete=AutoComplete.prototype.AUTOCOMPLETE_MAP[baseName];if(autoComplete){autoComplete.doClear();}};AutoComplete.prototype.onKeyUp=function(event){if(!event){event=window.event;}var autoComplete=AutoComplete.prototype.AUTOCOMPLETE_MAP[this.name];if(!autoComplete){return;}var val=this.value;var isKeyPress=(event&&event.keyCode);if(AutoComplete.prototype.IS_PROCESSING){return;}else{if(isKeyPress&&AutoComplete.prototype.isEnter(event)){return;}else{if(isKeyPress&&AutoComplete.prototype.isNavigation(event)){AutoComplete.prototype.handleNav(this.name,event);return;}else{if(isKeyPress&&AutoComplete.prototype.isTypingFast(this.name,event)){return;}else{if(isKeyPress&&AutoComplete.prototype.isIgnore(event)){return;}else{if(isKeyPress&&AutoComplete.prototype.isEscape(event)){autoComplete.doClear();return;}}}}}}if(val!=null&&val.length>=AutoComplete.prototype.MIN_LENGTH_THRESHOLD){if(autoComplete.valQueried==null||val.toLowerCase().indexOf(autoComplete.valQueried.toLowerCase())==-1){autoComplete.doLookup(val);}else{autoComplete.doFilter(val);}}else{if(val==null||val.length<=AutoComplete.prototype.MIN_LENGTH_THRESHOLD){autoComplete.valQueried=null;autoComplete.doClear();}}};AutoComplete.prototype.onFocus=function(event){var autoComplete=AutoComplete.prototype.AUTOCOMPLETE_MAP[this.name];if(!autoComplete){return;}autoComplete.hasFocus=true;};AutoComplete.prototype.onBlur=function(event){if(!event){event=window.event;}var autoComplete=AutoComplete.prototype.AUTOCOMPLETE_MAP[this.name];if(!autoComplete){return;}autoComplete.hasFocus=false;if(AutoComplete.prototype.TIMEOUT_ID){clearTimeout(AutoComplete.prototype.TIMEOUT_ID);}if(event&&!AutoComplete.prototype.isIgnore(event)&&!AutoComplete.prototype.isEscape(event)&&autoComplete.selected>=0){autoComplete.selectItem(autoComplete.selected);}else{setTimeout("AutoComplete.prototype.AUTOCOMPLETE_MAP['"+this.name+"'].doClear()",200);}};AutoComplete.prototype.setSelected=function(baseName,idx){var autoComplete=AutoComplete.prototype.AUTOCOMPLETE_MAP[baseName];if(!autoComplete){return;}else{autoComplete.selected=idx;}};AutoComplete.prototype.handleNav=function(name,event){var autoComplete=AutoComplete.prototype.AUTOCOMPLETE_MAP[name];if(!autoComplete){return;}var code=event.keyCode;var isDown=(code==40);var newSelected=autoComplete.selected;var box=AutoComplete.prototype.getBox(autoComplete.getBaseName());if(box){var content=box.childNodes[0].childNodes[0];if(content&&content.rows){if(isDown){if(autoComplete.selected<content.rows.length-1){newSelected++;}}else{if(autoComplete.selected>0){newSelected--;}}if(autoComplete.selected>=0){var oldRow=content.rows[autoComplete.selected];if(oldRow&&oldRow.childNodes[0]){oldRow.childNodes[0].onmouseout();}}if(newSelected>=0){var newRow=content.rows[newSelected];if(newRow&&newRow.childNodes[0]){newRow.childNodes[0].onmouseover();}autoComplete.selected=newSelected;}}}};AutoComplete.prototype.LAST_DATE=null;AutoComplete.prototype.TIMEOUT_ID=null;AutoComplete.prototype.isTypingFast=function(name,event){if(AutoComplete.prototype.TIMEOUT_ID){clearTimeout(AutoComplete.prototype.TIMEOUT_ID);}var d=new Date();if(AutoComplete.prototype.LAST_DATE==null){AutoComplete.prototype.LAST_DATE=d;return true;}else{var diff=d.getTime()-AutoComplete.prototype.LAST_DATE.getTime();AutoComplete.prototype.LAST_DATE=d;if(diff<AutoComplete.prototype.TYPING_THRESHOLD_MILLIS){var delayedExec="document.getElementById('"+name+"').onkeyup();";AutoComplete.prototype.TIMEOUT_ID=setTimeout(delayedExec,AutoComplete.prototype.TYPING_THRESHOLD_MILLIS);return true;}else{return false;}}};AutoComplete.prototype.isNavigation=function(event){var code=event.keyCode;return(code==38||code==40);};AutoComplete.prototype.isIgnore=function(event){var code=event.keyCode;return(code==9||code==16||(code>=33&&code<=46)||(code>=112&&code<=123));};AutoComplete.prototype.isEscape=function(event){var code=event.keyCode;return code==27;};AutoComplete.prototype.isEnter=function(event){var code=event.keyCode;return code==13;};AutoComplete.prototype.query=function(soql){try{var qr=sforce.connection.query(soql);var results=new Object();results.size=qr.size;results.records=qr.getArray("records");return results;}catch(fault){alert("error: "+fault);}};AutoComplete.prototype.makeBox=function(name,height,width){if(AutoComplete.prototype.IS_IE){var iframe=document.createElement("iframe");iframe.id=name+"I";iframe.style.display="block";iframe.style.position="absolute";iframe.style.padding="3px";iframe.style.height=height+"px";iframe.style.width=width+"px";iframe.style.backgroundColor="#ffffCC";document.body.appendChild(iframe);}var div=document.createElement("div");div.id=name+"D";div.style.border="1px solid #666";div.style.display="block";div.style.position="absolute";div.style.padding="2px";div.style.height=height+"px";div.style.width=width+"px";div.style.backgroundColor="#ffffCC";document.body.appendChild(div);return div;};AutoComplete.prototype.getBox=function(name){return document.getElementById(name+"D");};AutoComplete.prototype.resizeBox=function(name,height,width){var iframe=document.getElementById(name+"I");if(iframe){iframe.style.height=height+"px";iframe.style.width=width+"px";}var box=document.getElementById(name+"D");if(box){box.style.height=height+"px";box.style.width=width+"px";}};AutoComplete.prototype.moveBox=function(name,top,left){var iframe=document.getElementById(name+"I");if(iframe){iframe.style.top=top+"px";iframe.style.left=left+"px";iframe.style.zIndex=10;}var box=document.getElementById(name+"D");if(box){box.style.top=top+"px";box.style.left=left+"px";box.style.zIndex=20;}};AutoComplete.prototype.showBox=function(name,isVisible){var disp=isVisible?"block":"none";var iframe=document.getElementById(name+"I");if(iframe){iframe.style.display=disp;}var box=document.getElementById(name+"D");if(box){box.style.display=disp;}};AutoComplete.prototype.loadAutoComplete=function(formName){if(!formName){AutoComplete.prototype.FORM_NAME="editPage";}var apiSession=getCookie("sid");var apiURL=ApiUtils.getApiURL(true,"7.0");sforce.connection.init(apiSession,apiURL,true);var els=document.getElementsByTagName("input");for(var i=0;i<els.length;i++){var el=els[i];if(AutoComplete.prototype.isLookup(el)){var autoComplete=new AutoComplete(el);AutoComplete.prototype.AUTOCOMPLETE_MAP[autoComplete.getBaseName()]=autoComplete;}}};
function Banner(id){this.bannerDiv=document.getElementById(id);this.bannerY=Banner.BANNER_END;this.fadingIn=null;this.fadingOut=null;this.clicked=false;var self=this;if(getCookie("sawBanner")!=id){this.shim=new iframeShim(this.bannerDiv);addEvent(this.bannerDiv,"click",function(){self.click();},false);this.shim.setStyle("display","block");this.fadeIn();}}Banner.BANNER_END=-50;Banner.BANNER_START=0;Banner.BANNER_STEP=-5;Banner.BANNER_STEP_DELAY=40;Banner.BANNER_DELAY=4000;Banner.COOKIE_LIFE=90;Banner.prototype.click=function(){if(this.fadingIn){clearTimeout(this.fadingIn);this.fadingIn=null;}this.clicked=true;var expires=new Date();expires.setDate(expires.getDate()+Banner.COOKIE_LIFE);setCookie("sawBanner",this.bannerDiv.id,expires);this.fadeOut();};Banner.prototype.goAway=function(){if(!this.clicked){var self=this;this.fadingOut=setTimeout(function(){self.fadeOut();},Banner.BANNER_DELAY);}};Banner.prototype.interrupt=function(){if(!this.clicked&&this.fadingOut){var self=this;clearTimeout(this.fadingOut);this.fadingOut=null;this.fadingIn=setTimeout(function(){self.fadeIn();},0);}};Banner.prototype.fadeOut=function(){if(this.fadingOut){clearTimeout(this.fadingOut);this.fadingOut=null;}if(this.bannerY>Banner.BANNER_END){var self=this;this.bannerY+=Banner.BANNER_STEP;this.shim.setStyle("top",this.bannerY+"px");this.fadingOut=setTimeout(function(){self.fadeOut();},Banner.BANNER_STEP_DELAY);}};Banner.prototype.fadeIn=function(){if(this.fadingIn){clearTimeout(this.fadingIn);this.fadingIn=null;}if(this.bannerY<Banner.BANNER_START){var self=this;this.bannerY-=Banner.BANNER_STEP;this.shim.setStyle("top",this.bannerY+"px");this.fadingIn=setTimeout(function(){self.fadeIn();},Banner.BANNER_STEP_DELAY);}};
function toggleDependentCheckboxes(controllerId,checkboxes){var controller=document.getElementById(controllerId);var len=checkboxes.length;for(var i=0;i<len;i++){var checkbox=document.getElementById(checkboxes[i]);if(checkbox.disabled==""){checkbox.checked=controller.checked;}}}
function BrowserSettingsWarning(){var warning=this;if(window.sfdcPage){window.sfdcPage.appendToOnloadQueue(function(){warning.init();});}}BrowserSettingsWarning.DO_NOT_ASK_AGAIN_EXPIRY=60;BrowserSettingsWarning.prototype.init=function(){var browserSettingsWarning=this;var neverAgain=document.getElementById(BrowserSettingsWarningElement.NEVER_SHOW_AGAIN_ID);addEvent(neverAgain,"click",function(e){browserSettingsWarning.neverShowAgain();return false;},false);var moreInfo=document.getElementById(BrowserSettingsWarningElement.MORE_INFO_ID);addEvent(moreInfo,"click",function(e){Cookies.prototype.SetCookie(BrowserSettingsWarningElement.cBrowserSettings,"0",new Date(),"/");browserSettingsWarning.hideElement();},false);};BrowserSettingsWarning.prototype.neverShowAgain=function(){var expiryDate=new Date();expiryDate.setDate(expiryDate.getDate()+BrowserSettingsWarning.DO_NOT_ASK_AGAIN_EXPIRY);Cookies.prototype.DeleteCookie(BrowserSettingsWarningElement.cBrowserSettings);Cookies.prototype.SetCookie(BrowserSettingsWarningElement.cBrowserSettings,"-1",expiryDate,"/");this.hideElement();};BrowserSettingsWarning.prototype.hideElement=function(){document.getElementById(BrowserSettingsWarningElement.BROWSER_SETTINGS_WARNING_ID).style.display="none";};
function ButtonInputElement(){}ButtonInputElement.prototype.enableButton=function(name,enable){var buttons=document.getElementsByName(name);if(buttons){for(var i=0;i<buttons.length;i++){var button=buttons[i];button.disabled=!enable;button.className=enable?"btn":"btnDisabled";}}};
ColorInput=function(id){this.id=id;this.box=document.createElement("div");this.box.innerHTML="<span></span>";this.input=document.getElementById(id);var self=this;this.handleChange=function(e){self.formatInput();self.updateColor();};this.init();};ColorInput.prototype.updateColor=function(){var color=this.input.value;if(color.match(/^(#[0-9a-f]{6})$/i)){delStyleClass(this.box,ColorInputConstants.ERROR_COLOR_BOX_CSS);this.box.style.backgroundColor=color;}else{this.box.style.backgroundColor="#FFFFFF";addStyleClass(this.box,ColorInputConstants.ERROR_COLOR_BOX_CSS);}};ColorInput.prototype.formatInput=function(){var color=this.input.value;if("#"!=color.charAt(0)&&6==color.length){color="#"+color;}color=color.toUpperCase();if(color.match(/^#[0-9a-f]{3}$/i)){var r=color.charAt(1);var g=color.charAt(2);var b=color.charAt(3);color="#"+r+r+g+g+b+b;}this.input.value=color;};ColorInput.prototype.init=function(){addStyleClass(this.box,ColorInputConstants.COLOR_BOX_CSS);this.updateColor();this.input.parentNode.insertBefore(this.box,this.input);var self=this;addEvent(this.input,"change",this.handleChange,false);var handlePick=function(e){ColorPicker.pick(self.id,e);};addEvent(this.box,"click",handlePick,false);addEvent(this.input,"focus",handlePick,false);addEvent(this.input,"click",ColorPicker.cancelHide,false);this.input.updateColor=function(){self.updateColor();};};
function ColorPicker(){this.pickerDiv=document.getElementById(ColorPickerConstants.DOM_ID);this.colorView=document.getElementById(ColorPickerConstants.COLOR_VIEW_ID);this.hexView=document.getElementById(ColorPickerConstants.HEX_VIEW_ID);this.shim=new iframeShim(this.pickerDiv);this.field=null;this.addedFields={};var self=this;addEvent(document,"click",function(){self.hide();},false);addEvent(this.pickerDiv,"click",function(e){ColorPicker.cancelHide(e);},false);}ColorPicker.prototype.position=function(){var x=0;var y=0;var elem=this.field;while(elem!=null&&elem!=this.pickerDiv.offsetParent){x+=elem.offsetLeft;y+=elem.offsetTop;elem=elem.offsetParent;}var pickerHeight=this.pickerDiv.offsetHeight;var pickerWidth=this.pickerDiv.offsetWidth;if(getObjX(this.field)+pickerWidth>getScrollX()+getWindowWidth()){x-=pickerWidth-this.field.offsetWidth;}if(getObjY(this.field)+pickerHeight>getScrollY()+getWindowHeight()){y-=pickerHeight;}else{y+=this.field.offsetHeight;}this.shim.setStyle("left",x+"px");this.shim.setStyle("top",y+"px");};ColorPicker.prototype.hide=function(){this.shim.setStyle("display","none");};ColorPicker.prototype.show=function(fieldId){this.field=document.getElementById(fieldId);this.updateView(this.field.value);this.shim.setStyle("display","block");if(!this.addedFields[fieldId]){this.addedFields[fieldId]=true;var self=this;addEvent(this.field,"keydown",function(e){self.handleKeyPress(e);},false);}this.position();};ColorPicker.prototype.handleKeyPress=function(e){var key=getEvent(e).keyCode;if(key==KEY_ESC){this.hide();}};ColorPicker.prototype.selectBasic=function(value){if(!this.field.disabled&&this.field.value!=value){this.field.value=ColorPicker.formatHex(value);if(this.field.fireEvent){this.field.fireEvent("onchange");}else{if(this.field.dispatchEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",true,true);this.field.dispatchEvent(e);}}}this.hide();};ColorPicker.prototype.updateView=function(hex){var fHex=ColorPicker.formatHex(hex);this.colorView.style.backgroundColor=fHex;this.hexView.value=fHex;};ColorPicker.singleton=null;ColorPicker.cancelHide=function(e){eventCancelBubble(e);return false;};ColorPicker.pick=function(fieldId,event){if(!ColorPicker.singleton){ColorPicker.singleton=new ColorPicker();}ColorPicker.singleton.show(fieldId);if(event){ColorPicker.cancelHide(event);}};ColorPicker.formatHex=function(hex){var newHex=("#"==hex.charAt(0))?hex:"#"+hex;if(newHex.match(/^#[0-9a-f]{3}$/i)){var r=newHex.charAt(1);var g=newHex.charAt(2);var b=newHex.charAt(3);newHex="#"+r+r+g+g+b+b;}else{if(!newHex.match(/^#[0-9a-f]{6}$/i)){newHex="#FFFFFF";}}return newHex;};ColorPicker.hiOn=function(elem,boxColor){hiOn(elem);elem.style.backgroundColor="#000000";ColorPicker.singleton.updateView(boxColor);};ColorPicker.hiOff=function(elem,boxColor){hiOff(elem);elem.style.backgroundColor=ColorPicker.formatHex(boxColor);};
function CriteriaInput(oppLabels,numFilters,prevEntityData){if(oppLabels){this.oppLabels=oppLabels;this.numFilters=numFilters;this.hook_isPopulated=false;this.currentEntityData=prevEntityData;this.entityCache={};if(prevEntityData){this.entityCache[prevEntityData.entityName]=prevEntityData;}var self=this;this.handleFieldChange=function(e){var field=getEventTarget(getEvent(e));self.updateOperator(field,self.getOp(field));};this.handleClearFiltersClick=function(e){if(!document.getElementById(CriteriaInputConstants.pCOL+"1").disabled){self.clearFilters();}};this.handleClearFilterRowClick=function(row){if(!document.getElementById(CriteriaInputConstants.pCOL+"1").disabled){self.clearFilterRow(row);}};this.revealHiddenRow=function(e){var fieldId=e.hiddenId;if(fieldId===undefined){fieldId=getEventTarget(getEvent(e)).id;}for(var i=0;i<fieldId.length;i++){var rowNum=parseInt(fieldId.substr(i),10);if(rowNum){if(self.isRowPopulated(rowNum)){var row=document.getElementById(CriteriaInputConstants.F_ROW+(rowNum+1));if(row){row.style.display="";}if(rowNum>=numFilters){var maxRowsEle=document.getElementById(CriteriaInputConstants.MAX_ROWS_ID);if(maxRowsEle){maxRowsEle.style.display="";}}break;}}}self.hook_revealHiddenRow();};this.init();}}CriteriaInput.prototype.init=function(){var self=this;var clearRowI=function(i){return function(){self.handleClearFilterRowClick(i);};};for(var i=1;i<=this.numFilters;i++){var field=document.getElementById(CriteriaInputConstants.pCOL+i);if((typeof field.selectedIndex=="number"&&field.selectedIndex>0)||(typeof field.selectedIndex!="number"&&field.value.length>0)){this.updateOperator(field,this.getOp(field));}addEvent(field,"change",this.handleFieldChange,false);addEvent(field,"blur",this.revealHiddenRow,false);addEvent(document.getElementById(CriteriaInputConstants.pVAL+i),"blur",this.revealHiddenRow,false);addEvent(document.getElementById(CriteriaInputConstants.pOP+i),"blur",this.revealHiddenRow,false);var clearLnk=document.getElementById(CriteriaInputConstants.CLEAR_FILTERS_LINK+i);if(clearLnk){addEvent(clearLnk,"click",clearRowI(i),false);}}var clearFiltersLink=document.getElementById(CriteriaInputConstants.CLEAR_FILTERS_LINK);if(clearFiltersLink){addEvent(clearFiltersLink,"click",this.handleClearFiltersClick);}};CriteriaInput.prototype.setEntity=function(entityData,checkPrevVals){if(entityData!==this.currentEntityData){this.currentEntityData=entityData;this.refreshElementsFromData(checkPrevVals);}};CriteriaInput.prototype.setIsPopulatedHook=function(func){this.hook_isPopulated=func;};CriteriaInput.prototype.isPopulated=function(){for(var i=1;i<=this.numFilters;i++){if(this.isRowPopulated(i)){return true;}}return false;};CriteriaInput.prototype.isAllPopulated=function(){for(var i=1;i<=this.numFilters;i++){if(!this.isRowPopulated(i)){return false;}}return true;};CriteriaInput.prototype.isRowPopulated=function(rowNum){return document.getElementById(CriteriaInputConstants.pCOL+rowNum).value.length>0||document.getElementById(CriteriaInputConstants.pVAL+rowNum).value.length>0||document.getElementById(CriteriaInputConstants.pOP+rowNum).value.length>0;};CriteriaInput.prototype.refreshElementsFromData=function(checkPrevVals){for(var i=1;i<=this.numFilters;i++){var newSel=Util.refreshDynamicSelect(document.getElementById(CriteriaInputConstants.pCOL+i),this.currentEntityData.getFieldOptions(),true);addEvent(newSel,"change",this.handleFieldChange,false);document.getElementById(CriteriaInputConstants.pOP+i).selectedIndex=0;document.getElementById(CriteriaInputConstants.pVAL+i).value="";document.getElementById(CriteriaInputConstants.pLOOKUP+i).style.display="none";}};CriteriaInput.prototype.updateOperator=function(fieldSel,opSel){var oldWidth;if(opSel.offsetWidth>0){oldWidth=opSel.offsetWidth+"px";}var opList=null;var fieldVal=(typeof fieldSel.selectedIndex=="number")?fieldSel.options[fieldSel.selectedIndex].value:fieldSel.value;if(fieldVal){opList=this.currentEntityData.getOperators(fieldVal);}else{opList=null;}var prevSelectedVal=opSel.options[opSel.selectedIndex].value;var optionsList=[];if(opList){for(var i=0;i<opList.length;i++){optionsList.push([this.oppLabels[opList[i]],opList[i]]);}}opSel=Util.refreshDynamicSelect(opSel,optionsList,true,prevSelectedVal);if(oldWidth){opSel.style.width=oldWidth;}else{opSel.style.width="98%";}var lookupEl=this.getLookup(fieldSel);if(this.currentEntityData.needsLookup(fieldVal)){lookupEl.style.display="block";}else{lookupEl.style.display="none";}};CriteriaInput.prototype.getLookup=function(fieldEl){var num=fieldEl.id.substring(CriteriaInputConstants.pCOL.length,fieldEl.id.length);return document.getElementById(CriteriaInputConstants.pLOOKUP+num);};CriteriaInput.prototype.getOp=function(fieldEl){var num=fieldEl.id.substring(CriteriaInputConstants.pLOOKUP.length,fieldEl.id.length);return document.getElementById(CriteriaInputConstants.pOP+num);};CriteriaInput.prototype.clearFilters=function(){for(var i=1;i<=this.numFilters;i++){this.clearFilterRow(i,true);}var boolFilter=document.getElementById(CriteriaInputConstants.BOOL_FILTER_NAME);if(boolFilter){boolFilter.value="";}if(this.hook_isPopulated){this.hook_isPopulated(this.isPopulated());}};CriteriaInput.prototype.clearFilterRow=function(i,skipCheck){var pColEle=document.getElementById(CriteriaInputConstants.pCOL+i);if(typeof pColEle.selectedIndex=="number"){pColEle.selectedIndex=0;}else{pColEle.value="";}document.getElementById(CriteriaInputConstants.pOP+i).selectedIndex=0;var valEle=document.getElementById(CriteriaInputConstants.pVAL+i);valEle.value="";document.getElementById(CriteriaInputConstants.pLOOKUP+i).style.display="none";document.getElementById(CriteriaInputConstants.ERROR_CLS+i).innerHTML="";var valErrorDiv=document.getElementById(CriteriaInputConstants.pVAL+i+"_error");if(valEle.nextSibling&&hasStyleClass(valEle.nextSibling,"errorMsg")){valEle.nextSibling.innerHTML="";}if(!skipCheck&&this.hook_isPopulated){this.hook_isPopulated(this.isPopulated());}};CriteriaInput.prototype.hook_revealHiddenRow=function(){if(this.hook_isPopulated){this.hook_isPopulated(this.isPopulated());}};function CriteriaEntityData(entityName,fields){this.entityName=entityName;this.fields=fields;}CriteriaEntityData.prototype.getFieldOptions=function(){if(this.fieldOptions){return this.fieldOptions;}this.fieldOptions=[];for(var i=0;i<this.fields.length;i++){this.fieldOptions.push([this.fields[i].label,this.entityName+"."+this.fields[i].name]);}return this.fieldOptions;};CriteriaEntityData.prototype.getColunmTypeByName=function(fieldName){return ColumnType[this.getFieldByName(fieldName).columnType];};CriteriaEntityData.prototype.getOperators=function(fieldName){var colType=this.getColunmTypeByName(fieldName);if(colType.filterQueryOperators){return colType.filterQueryOperators;}else{return colType.queryOperators;}};CriteriaEntityData.prototype.getFieldByName=function(entityFieldName){var field;var fieldName=entityFieldName.split(".")[1];for(var i=0;i<this.fields.length;i++){if(this.fields[i].name===fieldName){field=this.fields[i];break;}}return field;};CriteriaEntityData.prototype.needsLookup=function(fieldName){if(!fieldName){return false;}if(fieldName=="MEMBER_STATUS"||fieldName=="CAMPAGN_MEMBER.STATUS"||fieldName=="Lead.CampaignMemberStatus"){return false;}if(fieldName.indexOf("$Profile.Name")>=0){return true;}return this.getColunmTypeByName(fieldName).needsLookup;};function FormulaFilterCriteriaEntityData(entityName){CriteriaEntityData.call(this,entityName);}FormulaFilterCriteriaEntityData.prototype=new CriteriaEntityData();FormulaFilterCriteriaEntityData.prototype.getColunmTypeByName=function(fullFieldName){var type=sfdcPage.getDialogById("FieldTreeDialogId").controller.getNodeByDbName(fullFieldName);if(type){if(type.attributes[FieldTreeConstants.COLUMN_TYPE]=="DYNAMICENUM"||type.attributes[FieldTreeConstants.COLUMN_TYPE]=="TEXTENUM"||type.attributes[FieldTreeConstants.COLUMN_TYPE]=="STATICENUM"||type.attributes[FieldTreeConstants.COLUMN_TYPE]=="CURRENCYCODE"||type.attributes[FieldTreeConstants.COLUMN_TYPE]=="DIVISION"){return{needsLookup:ColumnType[type.attributes[FieldTreeConstants.COLUMN_TYPE]].needsLookup,filterQueryOperators:["e","n","c","k","s"]};}return ColumnType[type.attributes[FieldTreeConstants.COLUMN_TYPE]];}return{needsLookup:false,queryOperators:["e","n","s","c","k","l","g","m","h","u","x"]};};
function DatePicker(){this.today=DateUtil.getDateTimeFromUserLocale(UserContext.today);this.calendarDiv=document.getElementById(DatePickerIds.DOM_ID);this.shim=new iframeShim(this.calendarDiv);this.table=document.getElementById(DatePickerIds.TABLE_ID);this.monthPicker=document.getElementById(DatePickerIds.MONTH_PICKER);this.yearPicker=document.getElementById(DatePickerIds.YEAR_PICKER);this.callOnChange=false;this.myField=null;this.myElement=null;this.currentDate=null;this.hasTime=false;this.addedFields={};var self=this;this.closeHandler=function(e){self.hide(e);};addEvent(document,"click",this.closeHandler,false);addEvent(this.calendarDiv,"click",function(e){self.cancelHide(e);},false);addEvent(this.monthPicker,"change",function(){self.generateMonth();},false);addEvent(this.yearPicker,"change",function(){self.generateMonth();},false);}DatePicker.prototype.setMyDate=function(date){var found=false;var dateYearValue=date.getFullYear();var dateYearDisplay=dateYearValue;if(LC.isThaiTHLocale()){dateYearDisplay=dateYearDisplay+LC.BUDDHIST_CAL_OFFSET;}for(var i=0;i<this.yearPicker.options.length;i++){var year=parseInt(this.yearPicker[i].value);if(year>date.getFullYear()){Util.insertOption(this.yearPicker,new Option(dateYearDisplay,dateYearValue,false,true),i);found=true;break;}else{if(parseInt(this.yearPicker[i].value)==dateYearValue){this.yearPicker.selectedIndex=i;found=true;break;}}}if(!found){this.yearPicker.options[this.yearPicker.options.length]=new Option(dateYearDisplay,dateYearValue,false,true);}this.monthPicker.selectedIndex=date.getMonth();};DatePicker.prototype.prevMonth=function(){if(this.monthPicker.selectedIndex==0){var prevYear=parseInt(this.yearPicker[this.yearPicker.selectedIndex].value)-1;if(this.yearPicker.selectedIndex==0||prevYear!=this.yearPicker[this.yearPicker.selectedIndex-1].value){var d=new Date();d.setFullYear(prevYear);d.setMonth(11);this.setMyDate(d);}else{this.yearPicker.selectedIndex--;this.monthPicker.selectedIndex=11;}}else{this.monthPicker.selectedIndex--;}this.generateMonth();};DatePicker.prototype.nextMonth=function(){if(this.monthPicker.selectedIndex==11){var nextYear=parseInt(this.yearPicker[this.yearPicker.selectedIndex].value)+1;if(this.yearPicker.selectedIndex==this.yearPicker.length-1||nextYear!=this.yearPicker[this.yearPicker.selectedIndex+1].value){var d=new Date();d.setFullYear(nextYear);d.setMonth(0);this.setMyDate(d);}else{this.yearPicker.selectedIndex++;this.monthPicker.selectedIndex=0;}}else{this.monthPicker.selectedIndex++;}this.generateMonth();};DatePicker.prototype.generateMonth=function(){var month=parseInt(this.monthPicker[this.monthPicker.selectedIndex].value);var year=parseInt(this.yearPicker[this.yearPicker.selectedIndex].value);var d=new Date();d.setDate(1);d.setFullYear(year);d.setMonth(month);var startPoint=UserContext.startOfWeek-d.getDay();if(startPoint>1){startPoint-=7;}d.setDate(startPoint);document.getElementById("calRow5").style.display="";document.getElementById("calRow6").style.display="";var dayCells=this.table.getElementsByTagName("td");for(var i=0;i<dayCells.length;i++){var dayOfWeek=d.getDay();var clazz;if(dayOfWeek==0||dayOfWeek==6){clazz="weekend";}else{clazz="weekday";}if(d.getMonth()==month-1||d.getFullYear()==year-1){clazz+=" prevMonth";}else{if(d.getMonth()==month+1||d.getFullYear()==year+1){if(i%7==0){document.getElementById("calRow6").style.display="none";if(i/7==4){document.getElementById("calRow5").style.display="none";}break;}clazz+=" nextMonth";}}if(DateUtil.equals(d,this.today)){clazz+=" todayDate";}if(DateUtil.equals(d,this.currentDate)){clazz+=" selectedDate";}dayCells[i].className=clazz;dayCells[i].innerHTML=d.getDate();d.setDate(d.getDate()+1);}};DatePicker.prototype.selectDate=function(value){var selectedDate;if("today"==value){this.currentDate=this.today;selectedDate=this.hasTime?DateUtil.getDateTimeStringFromUserLocale(this.today):DateUtil.getDateStringFromUserLocale(this.today);this.setMyDate(this.today);this.generateMonth();}else{var d=new Date(this.today.getTime());d.setDate(1);d.setFullYear(parseInt(this.yearPicker[this.yearPicker.selectedIndex].value));var month=parseInt(this.monthPicker[this.monthPicker.selectedIndex].value);if(value.className.indexOf("nextMonth")!=-1){month++;}else{if(value.className.indexOf("prevMonth")!=-1){month--;}}d.setMonth(month);d.setDate(value.innerHTML);selectedDate=this.hasTime?DateUtil.getDateTimeStringFromUserLocale(d):DateUtil.getDateStringFromUserLocale(d);this.hide();}DatePicker.insertDate(selectedDate,this.myField.id,this.callOnChange);};DatePicker.prototype.position=function(){var x=0;var y=0;var element=this.myElement;while(element!=null&&element!=this.calendarDiv.offsetParent){x+=element.offsetLeft;y+=element.offsetTop;element=element.offsetParent;}if(getObjY(this.myElement)+this.calendarDiv.offsetHeight>getScrollY()+getWindowHeight()){y-=this.calendarDiv.offsetHeight;}else{y+=this.myElement.offsetHeight;}var alignSide="left";if(LC.isRtlPage()){alignSide="right";var pageWidth=this.calendarDiv.offsetParent.offsetWidth;var inputFieldLength=this.myElement.offsetWidth;x=pageWidth-x-inputFieldLength;}this.shim.setStyle(alignSide,x+"px");this.shim.setStyle("top",y+"px");};DatePicker.prototype.show=function(callOnChange,myField,hasTime,myElement){this.callOnChange=callOnChange;this.hasTime=hasTime;this.myField=getElementByIdCS(myField);if(myElement){this.myElement=myElement;}else{this.myElement=getElementByIdCS(myField);}var self=this;if(this.myField.type!="hidden"){if(this.addedFields[myField]!==this.myField){this.addedFields[myField]=null;}if(!this.addedFields[myField]){this.addedFields[myField]=this.myField;addEvent(this.myField,"keydown",function(e){self.handleKeyPress(e);},false);if(!hasTime&&LC.isEnglishLanguage()){var blurHandler;if(LC.isEnglishUS()){blurHandler=function(){DateUtil.checkYear(self.myField,self.callOnChange);};}else{blurHandler=function(){DateUtil.evaluateShortcut(self.myField,self.callOnChange);};}addEvent(this.myField,"blur",blurHandler,false);}}}var time=hasTime?DateUtil.getDateFromFormat(this.myField.value,UserContext.dateTimeFormat):DateUtil.getDateFromFormat(this.myField.value,UserContext.dateFormat);if(time!=0){this.currentDate=new Date(time);this.setMyDate(this.currentDate);}else{this.setMyDate(this.today);}this.generateMonth();this.shim.setStyle("display","block");this.position();};DatePicker.prototype.cancelHide=function(e){eventCancelBubble(e);return false;};DatePicker.prototype.handleKeyPress=function(e){var key=getEvent(e).keyCode;if(key==KEY_ESC||key==KEY_TAB){this.hide();}else{if(key==KEY_ENTER&&!this.hasTime){if(LC.isEnglishUS()){DateUtil.checkYear(this.myField);}else{if(LC.isEnglishLanguage()){DateUtil.evaluateShortcut(this.myField);}}}}};DatePicker.prototype.hide=function(e){if(e&&getEventTarget(e)===this.myField){return;}this.shim.setStyle("display","none");};DatePicker.datePicker=null;DatePicker.pickDate=function(callOnChange,field,hasTime,element){if(!DatePicker.datePicker){DatePicker.datePicker=new DatePicker();}DatePicker.datePicker.show(callOnChange,field,hasTime,element);};DatePicker.insertDate=function(value,field,callOnChange){var element=getElementByIdCS(field);if(!element.disabled&&element.value!=value){element.value=value;if(window.sfdcPage&&window.sfdcPage.getLookupFieldsControlledBy){var controlledFieldsId=sfdcPage.getLookupFieldsControlledBy(field);var length=controlledFieldsId?controlledFieldsId.length:0;for(var i=0;i<length;i++){ForeignKeyInputElement.allElements[controlledFieldsId[i]].validate();}}if(callOnChange&&element.onchange){element.onchange();}}};DatePicker.datePickEventRemove=function(){if(DatePicker.datePicker){removeEvent(document,"click",DatePicker.datePicker.closeHandler,false);}};
function confirmDelete(msg){if(!msg){msg=LC.getLabel("Global","are_you_sure");}return Modal.confirm(msg);}
function DeveloperNameInputElement(){}DeveloperNameInputElement.setName=function(labelElement,developerNameElement,defaultName){var ov=labelElement.value;var v="";var hasFirstChar=false;var lastCharIsUnderscore=false;if(developerNameElement!==null&&developerNameElement.value.length==0&&ov.length>0){for(i=0;i<ov.length;i++){var ch=ov.charAt(i);if((ch>="a"&&ch<="z")||(ch>="A"&&ch<="Z")||(ch>="0"&&ch<="9")){if(!hasFirstChar&&(ch>="0"&&ch<="9")){v+="X";}v+=ch;hasFirstChar=true;lastCharIsUnderscore=false;}else{if(hasFirstChar&&!lastCharIsUnderscore){v+="_";lastCharIsUnderscore=true;}}}if(!hasFirstChar){developerNameElement.value=defaultName;}else{if(lastCharIsUnderscore){developerNameElement.value=v.substring(0,v.length-1);}else{developerNameElement.value=v;}}}return true;};
DhtmlHistory.POLLING_FREQUENCY=300;DhtmlHistory.WAIT_FREQUENCY=500;function DhtmlHistory(storageMap,listenerFunction,parentObject){this.locationOfBlankPage=UserContext.getUrl("/back_blank.html?");this.currentLocation=null;this.listener=listenerFunction;this.iframe=null;this.ignoreLocationChange=false;this.currentWaitTime=0;this.historyStorage=storageMap;this.parentObject=parentObject;this.create();}DhtmlHistory.prototype.add=function(newLocation,historyData){var self=this;var addImpl=function(){if(self.currentWaitTime>0){self.currentWaitTime=self.currentWaitTime-DhtmlHistory.WAIT_FREQUENCY;}newLocation=self.removeHash(newLocation);var idCheck=document.getElementById(newLocation);if(idCheck){Gack.sendGack("History locations can not have the same value as any id's that might be in the document");return;}self.historyStorage[newLocation]=historyData;self.ignoreLocationChange=true;self.currentLocation=newLocation;window.location.hash=newLocation;if(XBrowser.userAgent.isIE){if(!self.iframe){var b=document.getElementsByTagName("body")[0];if(!b){return;}var divElem=document.createElement("div");b.appendChild(divElem);divElem.style.display="none";divElem.innerHTML="<iframe class='dhtmlHistoryFrame' name='DhtmlHistoryFrame' id='DhtmlHistoryFrame' src='"+self.locationOfBlankPage+newLocation+"'></iframe>";self.iframe=document.getElementById("DhtmlHistoryFrame");}else{self.iframe.src=self.locationOfBlankPage+newLocation;}}};window.setTimeout(addImpl,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+DhtmlHistory.WAIT_FREQUENCY;};DhtmlHistory.prototype.getCurrentLocation=function(){return this.removeHash(window.location.hash);};DhtmlHistory.prototype.create=function(){var initialHash=this.getCurrentLocation();this.currentLocation=initialHash;this.ignoreLocationChange=true;if(!XBrowser.userAgent.isIE){var self=this;var locationHandler=function(){self.checkLocation();};setInterval(locationHandler,DhtmlHistory.POLLING_FREQUENCY);}};DhtmlHistory.prototype.fireHistoryEvent=function(oldHash,newHash){this.listener.call(this.parentObject,oldHash,newHash);};DhtmlHistory.prototype.shouldProceedWithHistoryEvent=function(){if(this.ignoreLocationChange){this.ignoreLocationChange=false;return false;}else{return true;}};DhtmlHistory.prototype.checkLocation=function(){if(XBrowser.userAgent.isIE||!this.shouldProceedWithHistoryEvent()){return;}var hash=this.getCurrentLocation();if(hash==this.currentLocation){return;}var oldHash=this.currentLocation;this.currentLocation=hash;this.fireHistoryEvent(oldHash,hash);};DhtmlHistory.prototype.removeHash=function(hashValue){if(!hashValue){return null;}else{if(hashValue==""||(hashValue.length==1&&hashValue.charAt(0)=="#")){return"";}else{if(hashValue.length>1&&hashValue.charAt(0)=="#"){return hashValue.substring(1);}else{return hashValue;}}}};DhtmlHistory.prototype.iframeLoaded=function(newLocation){if(!XBrowser.userAgent.isIE||!this.shouldProceedWithHistoryEvent()){return;}var hash=new String(newLocation.search);if(!hash||(hash.length==1&&hash.charAt(0)=="?")){hash="";}else{if(hash.length>=2&&hash.charAt(0)=="?"){hash=hash.substring(1);}}var oldHash=this.removeHash(window.location.hash);window.location.hash=hash;this.fireHistoryEvent(oldHash,hash);};
function DuelingListBoxesElement(selectionIds,warnId,removeWarnIf,removeWarningText){this.sListIds=selectionIds;this.warnDiv=warnId;this.removeWarnIf=removeWarnIf;this.removeWarningText=removeWarningText;}DuelingListBoxesElement.prototype.storeStateOnce=function(){if(this.isStored){return;}this.isStored=true;this.storeState();};DuelingListBoxesElement.prototype.storeState=function(){this.selectContents=new Array();for(var i=0;i<this.sListIds.length;i++){var curSelect=document.getElementById(this.sListIds[i]);if(!curSelect){continue;}this.selectContents[i]=new Array();for(var j=0;j<curSelect.options.length;j++){this.selectContents[i][j]=[curSelect.options[j].text,curSelect.options[j].value];}}};DuelingListBoxesElement.prototype.resetSelection=function(){if(!this.isStored){return;}for(var i=0;i<this.sListIds.length;i++){var curSelect=document.getElementById(this.sListIds[i]);if(!curSelect){continue;}Util.refreshDynamicSelect(curSelect,this.selectContents[i]);}};DuelingListBoxesElement.prototype.quickWarn=function(message){DuelingListBoxesElement.warning(this.warnDiv,message);};DuelingListBoxesElement.prototype.quickUnwarn=function(){DuelingListBoxesElement.removeWarning(this.warnDiv);};DuelingListBoxesElement.prototype.instMoveDown=function(sourceSelect,topSourceValue,radicalValue,unmovableAlertMessage,warnDivId){this.storeStateOnce();DuelingListBoxesElement.moveDown(sourceSelect,topSourceValue,radicalValue,unmovableAlertMessage,warnDivId);};DuelingListBoxesElement.prototype.instMoveUp=function(sourceSelect,topSourceValue,radicalValue,unmovableAlertMessage,warnDivId){this.storeStateOnce();DuelingListBoxesElement.moveUp(sourceSelect,topSourceValue,radicalValue,unmovableAlertMessage,warnDivId);};DuelingListBoxesElement.prototype.instMoveBottom=function(sourceSelect,warnDivId){this.storeStateOnce();DuelingListBoxesElement.moveBottom(sourceSelect,warnDivId);};DuelingListBoxesElement.prototype.instMoveTop=function(sourceSelect,warnDivId){this.storeStateOnce();DuelingListBoxesElement.moveTop(sourceSelect,warnDivId);};DuelingListBoxesElement.prototype.instMoveOption=function(sourceSelect,targetSelect,keepSourceLabel,unmovableSourceValues,unmovableAlertMessages,keepTargetLabel,cannotBeEmpty,cannotBeEmptyMessage,warnDivId){this.storeStateOnce();DuelingListBoxesElement.moveOption(sourceSelect,targetSelect,keepSourceLabel,unmovableSourceValues,unmovableAlertMessages,keepTargetLabel,cannotBeEmpty,cannotBeEmptyMessage,warnDivId,this.removeWarnIf,this.removeWarningText);};DuelingListBoxesElement.prototype.instSaveAllSelected=function(fromSelectArray,toArray,delim,escape,emptyLabel){DuelingListBoxesElement.saveAllSelected(fromSelectArray,toArray,delim,escape,emptyLabel);};DuelingListBoxesElement.warning=function(warnId,message){if(!warnId){return;}var warnDiv=document.getElementById(warnId);if(warnDiv){warnDiv.innerHTML=LC.getLabel("Global","colonSeparatedWords",LC.getLabel("Global","error"),message);warnDiv.style.display="block";}};DuelingListBoxesElement.removeWarning=function(warnId){if(!warnId){return;}var warnDiv=document.getElementById(warnId);if(warnDiv){warnDiv.innerHTML="";warnDiv.style.display="none";}};DuelingListBoxesElement.moveTop=function(sourceSelect,warnDivId){if(sourceSelect.length>1){var options=sourceSelect.options;var selectedIds=new Array();var index=0;for(var i=0;i<sourceSelect.length;i++){if(options[i].selected){selectedIds[index]=i;index++;}}var selId;for(var i=0;i<selectedIds.length;i++){selId=selectedIds[i];delta=selId-i;for(var j=0;j<delta;j++){DuelingListBoxesElement.privateMoveUp(options,selId-j);options[selId-j].selected=false;options[(selId-j)-1].selected=true;}}sourceSelect.focus();if(sourceSelect.onLocalMoveTop){sourceSelect.onLocalMoveTop();}}DuelingListBoxesElement.removeWarning(warnDivId);};DuelingListBoxesElement.moveBottom=function(sourceSelect,warnDivId){if(sourceSelect.length>1){var options=sourceSelect.options;var selectedIds=new Array();var index=0;for(var i=0;i<sourceSelect.length;i++){if(options[i].selected){selectedIds[index]=i;index++;}}var targetPos=sourceSelect.length-1;var selId;for(var i=selectedIds.length-1;i>=0;i--){selId=selectedIds[i];var delta=targetPos-selId;for(var j=0;j<delta;j++){DuelingListBoxesElement.privateMoveDown(options,selId+j);options[selId+j].selected=false;options[(selId+j)+1].selected=true;}targetPos--;}sourceSelect.focus();if(sourceSelect.onLocalMoveBottom){sourceSelect.onLocalMoveBottom();}}DuelingListBoxesElement.removeWarning(warnDivId);};DuelingListBoxesElement.privateMoveUp=function(options,index){var newOption=new Option(options[index-1].text,options[index-1].value);options[index-1].text=options[index].text;options[index-1].value=options[index].value;options[index].text=newOption.text;options[index].value=newOption.value;};DuelingListBoxesElement.privateMoveDown=function(options,index){var newOption=new Option(options[index+1].text,options[index+1].value);options[index+1].text=options[index].text;options[index+1].value=options[index].value;options[index].text=newOption.text;options[index].value=newOption.value;};DuelingListBoxesElement.moveDown=function(sourceSelect,topSourceValue,radicalValue,unmovableAlertMessage,warnDivId){var seenWarn=false;if(sourceSelect.length>1){var options=sourceSelect.options;var selectedIds=new Array();var index=0;if(topSourceValue!=null){if(topSourceValue==options[0].value&&options[0].selected&&(options[1].value!=radicalValue||options[1].selected)){options[0].selected=false;if(unmovableAlertMessage!=null){DuelingListBoxesElement.warning(warnDivId,unmovableAlertMessage);seenWarn=true;}}if(radicalValue&&options[1].value==topSourceValue&&options[1].selected){options[1].selected=false;if(unmovableAlertMessage!=null){DuelingListBoxesElement.warning(warnDivId,nmovableAlertMessage);seenWarn=true;}}}for(var i=sourceSelect.length-2;i>=0;i--){if(sourceSelect.options[i].selected){selectedIds[index]=i;index++;}}var selId;for(var i=0;i<selectedIds.length;i++){selId=selectedIds[i];DuelingListBoxesElement.privateMoveDown(options,selId);options[selId].selected=false;options[selId+1].selected=true;}sourceSelect.focus();if(sourceSelect.onLocalMoveDown){sourceSelect.onLocalMoveDown();}}if(!seenWarn){DuelingListBoxesElement.removeWarning(warnDivId);}};DuelingListBoxesElement.moveUp=function(sourceSelect,topSourceValue,radicalValue,unmovableAlertMessage,warnDivId){if(sourceSelect.length>1){var options=sourceSelect.options;var selectedIds=new Array();var index=0;if(topSourceValue!=null){if(options[0].value==topSourceValue&&options[1].selected&&options[1].value!=radicalValue){options[1].selected=false;if(unmovableAlertMessage!=null){DuelingListBoxesElement.warning(warnDivId,unmovableAlertMessage);return;}}if(radicalValue&&options[2].selected&&(options[1].value==topSourceValue||options[1].selected)){options[2].selected=false;if(unmovableAlertMessage!=null){DuelingListBoxesElement.warning(warnDivId,unmovableAlertMessage);return;}}}for(var i=1;i<sourceSelect.length;i++){if(options[i].selected){selectedIds[index]=i;index++;}}var selId;for(var i=0;i<selectedIds.length;i++){selId=selectedIds[i];DuelingListBoxesElement.privateMoveUp(options,selId);options[selId].selected=false;options[selId-1].selected=true;}sourceSelect.focus();if(sourceSelect.onLocalMoveUp){sourceSelect.onLocalMoveUp();}}DuelingListBoxesElement.removeWarning(warnDivId);};DuelingListBoxesElement.moveOption=function(sourceSelect,targetSelect,keepSourceLabel,unmovableSourceValues,unmovableAlertMessages,keepTargetLabel,cannotBeEmpty,cannotBeEmptyMessage,warnDivId,removeWarnIf,removeWarningText){if(removeWarnIf&&removeWarnIf()){if(!((Modal.confirm&&Modal.confirm(removeWarningText))||(!Modal.confirm&&window.confirm(removeWarningText)))){return;}}var seenWarn=false;var sourceOptions=sourceSelect.options;var canMove;var option;var selectedIds=new Array();var index=0;if(sourceSelect.cannotBeEmpty||cannotBeEmpty){var numSelected=0;for(var i=0;i<sourceSelect.length;i++){if(sourceSelect.options[i].selected){numSelected++;}}if(numSelected==sourceSelect.options.length){if(sourceSelect.handleEmptyList){sourceSelect.handleEmptyList();}if(cannotBeEmptyMessage){DuelingListBoxesElement.warning(warnDivId,cannotBeEmptyMessage);}return;}}for(var i=0;i<sourceSelect.length;i++){option=sourceOptions[i];if(option.selected){canMove=(option.text!=keepSourceLabel);if(canMove&&unmovableSourceValues!=null){for(var j=0;j<unmovableSourceValues.length;j++){if(unmovableSourceValues[j]==option.value){canMove=false;if(unmovableAlertMessages[j]!=null){DuelingListBoxesElement.warning(warnDivId,unmovableAlertMessages[j]);seenWarn=true;}break;}}}if(canMove){selectedIds[index]=i;index++;}else{option.selected=false;}}}var targetOptions=targetSelect.options;if(selectedIds.length>0){targetSelect.selectedIndex=-1;for(var i=0;i<selectedIds.length;i++){option=new Option(sourceOptions[selectedIds[i]].text,sourceOptions[selectedIds[i]].value);option.title=sourceOptions[selectedIds[i]].title;if(targetOptions.length==1&&targetOptions[0].text==keepTargetLabel){targetOptions[0]=option;targetOptions[0].selected=true;}else{targetOptions[targetOptions.length]=option;targetOptions[targetOptions.length-1].selected=true;}}}if(targetSelect.onchange){targetSelect.onchange();}if(sourceSelect.onchange){sourceSelect.onchange();}for(var i=selectedIds.length-1;i>-1;i--){sourceSelect.remove(selectedIds[i]);}sourceSelect.disabled=true;sourceSelect.disabled=false;if(sourceOptions.length==0){sourceOptions[0]=new Option(keepSourceLabel,keepSourceLabel);}if(selectedIds.length>0){targetSelect.focus();}if(targetSelect.onLocalMoveOptions){targetSelect.onLocalMoveOptions();}if(sourceSelect.onLocalMoveOptions){sourceSelect.onLocalMoveOptions();}if(!seenWarn){DuelingListBoxesElement.removeWarning(warnDivId);}};DuelingListBoxesElement.saveAllSelected=function(fromSelectArray,toArray,delim,escape,emptyLabel){var i,j,escapedValue;for(i=0;i<fromSelectArray.length;i++){toArray[i].value="";for(j=0;j<fromSelectArray[i].length;j++){if(!(fromSelectArray[i].length==1&&fromSelectArray[i].options[0].value==emptyLabel)){var val=fromSelectArray[i].options[j].value.replace(new RegExp(escape+escape,"g"),escape+escape);toArray[i].value+=val.replace(new RegExp(delim,"g"),escape+delim);}if(j+1<fromSelectArray[i].length){toArray[i].value+=delim;}}}};
function EncryptedTextInputElement(id,maxLength,isMasked){if(!isMasked){return;}this.maxLength=maxLength;this.element=getElementByIdCS(id);if(!this.element){return;}this.wasCleared=false;this.origValue=this.element.value;var self=this;this.handleOnFocus=function(e){if(self.wasCleared){return;}self.element.select();};this.handleKey=function(e){if(!self.wasCleared){var code=getEvent(e).keyCode;if(!(code===KEY_ENTER||code===KEY_TAB||code===KEY_PAGEUP||code===KEY_PAGEDOWN)){self.element.value="";self.element.maxLength=self.maxLength;self.wasCleared=true;}}};this.handleBlur=function(e){if(self.element.value===self.origValue){self.wasCleared=false;}};addEvent(this.element,"focus",this.handleOnFocus,true);addEvent(this.element,"blur",this.handleBlur,true);addEvent(this.element,"keypress",this.handleKey,true);}
function FileFieldInputElement(elementId){this.elementId=elementId;this.ffDiv=document.getElementById(elementId);this.ffUploadingDiv=document.getElementById(elementId+"_uploading");this.backupOfDiv=this.ffDiv.innerHTML;this.isTimeout=false;}FileFieldInputElement.prototype.completeUpload=function(sourceDiv,deleteSourceDiv){this.isTimeout=false;document.getElementById(this.elementId+"_timeout").style.display="none";if(this.isCancelled){this.isCancelled=false;return;}this.ffDiv.innerHTML=sourceDiv.innerHTML;if(deleteSourceDiv){sourceDiv.parentNode.removeChild(sourceDiv);}this.ffDiv.style.display="block";this.ffUploadingDiv.style.display="none";if(FileFieldInputElement.stopUpload){FileFieldInputElement.stopUpload();}};FileFieldInputElement.prototype.removeUpload=function(){this.ffDiv.innerHTML=this.backupOfDiv;};FileFieldInputElement.prototype.createHiddenInput=function(name,value){var hidden=document.createElement("input");hidden.setAttribute("type","hidden");hidden.setAttribute("name",name);hidden.setAttribute("value",value);return hidden;};FileFieldInputElement.prototype.restoreFormTarget=function(){var form=this.ffDiv.getElementsByTagName("input")[0].form;if(form.targetBak){form.target=form.targetBak;}else{form.removeAttribute("target");}};FileFieldInputElement.prototype.upload=function(button){var fileInput=button.form.elements[this.elementId+":file"];if(!fileInput.value||(fileInput.files&&fileInput.files.length==1&&fileInput.files[0].fileSize==0)){alert(LC.getLabel("FileFieldType","InvalidFile"));return false;}this.isCancelled=false;this.isTimeout=true;if(FileFieldInputElement.startUpload){FileFieldInputElement.startUpload();}button.form.targetBak=button.form.target;button.form.target=this.elementId+"_upload_iframe";this.ffDiv.style.display="none";this.ffUploadingDiv.style.display="block";return true;};FileFieldInputElement.prototype.timeout=function(){if(this.isTimeout){document.getElementById(this.elementId+"_timeout").style.display="block";this.cancelUpload(null);}};FileFieldInputElement.prototype.cancelUpload=function(button){this.isCancelled=true;this.restoreFormTarget();this.ffDiv.style.display="block";this.ffUploadingDiv.style.display="none";if(FileFieldInputElement.stopUpload){FileFieldInputElement.stopUpload();}};
ForeignKeyInputElement=function(elementId,validationServletURI,mruServletURI,matchBlanks,requestParams){this.id=elementId;this.validationServletURI=validationServletURI;this.mruServletURI=mruServletURI;this.requestParams=requestParams;this.element=getElementByIdCS(this.id);this.idElement=getElementByIdCS(this.id+EditElement.pID_SUFFIX);this.matchBlanks=matchBlanks;this.onChangeListeners=[];ForeignKeyInputElement.allElements[elementId]=this;};ForeignKeyInputElement.allElements={};ForeignKeyInputElement.dispatchLookupChange=function(domId){var lookup=ForeignKeyInputElement.allElements[domId];if(lookup){lookup.applyValidationChanges({});lookup.validateDependents();ForeignKeyInputElement.showHideLookup(lookup,true);if(lookup.clearButton){lookup.clearButton.style.display="inline-block";}}};ForeignKeyInputElement.showHideLookup=function(lookup,show){if(lookup.ghostTextInput){if(show){lookup.element.style.display="";lookup.ghostTextInput.style.display="none";}else{lookup.element.style.display="none";lookup.ghostTextInput.style.display="";}}};ForeignKeyInputElement.disableAndAddClearButton=function(lookup){if(lookup&&!lookup.isDisabled){lookup.element.readOnly=true;var ghostTextInput=document.createElement("INPUT");ghostTextInput.className="emptyDependentLookup";ghostTextInput.style.display="none";ghostTextInput.readOnly=true;ghostTextInput.value=LC.getLabel("Global","click_lookup_icon");ghostTextInput.tabIndex=lookup.element.tabIndex;lookup.element.parentNode.insertBefore(ghostTextInput,lookup.element.nextSibling);lookup.ghostTextInput=ghostTextInput;var xButton=document.createElement("IMG");xButton.className="closeIcon";xButton.alt=LC.getLabel("Global","clear");xButton.src="/s.gif";addEvent(xButton,"mouseover",function(){this.className="closeIconOn";},true);addEvent(xButton,"mouseout",function(){this.className="closeIcon";},true);addEvent(xButton,"focus",function(){this.className="closeIconOn";},true);addEvent(xButton,"blur",function(){this.className="closeIcon";},true);lookup.element.parentNode.insertBefore(xButton,lookup.element.nextSibling);lookup.clearButton=xButton;if(lookup.idElement.value==""||lookup.element.value==""){xButton.style.display="none";ForeignKeyInputElement.showHideLookup(lookup,false);}addEvent(xButton,"click",function(){xButton.style.display="none";lookup.element.value="";lookup.idElement.value="";ForeignKeyInputElement.showHideLookup(lookup,false);lookup.validateDependents();},true);lookup.isDisabled=true;lookup.element.blur();lookup.blurred=true;}};ForeignKeyInputElement.prototype.validate=function(){if(this.element.value){this.performValidation();}if(this.lookupAutoCompleteElement&&this.lookupAutoCompleteElement.clearCache){this.lookupAutoCompleteElement.clearCache();}};ForeignKeyInputElement.prototype.validateDependents=function(){for(var i=0;(i<this.onChangeListeners.length);i++){this.onChangeListeners[i].validate();}};ForeignKeyInputElement.prototype.afterLoad=function(){var blurred=false;if(this.referredDomIds){var self=this;for(var i=0;i<this.referredDomIds.length;i++){var lookup=ForeignKeyInputElement.allElements[this.referredDomIds[i]];if(lookup){lookup.onChangeListeners.push(this);ForeignKeyInputElement.disableAndAddClearButton(lookup);blurred=blurred||lookup.blurred;}else{var el=getElementByIdCS(this.referredDomIds[i]);if(el){addEvent(el,"change",function(){self.validate();});}}}}this.initAutoComplete();if(blurred){setFocus();}};ForeignKeyInputElement.prototype.initAutoComplete=function(){if(this.mruServletURI){this.lookupAutoCompleteElement=new LookupAutoCompleteInputElement(this.id,this.mruServletURI,1,this.requestParams,this.matchBlanks,this.referredDomIds?this.id:null);}};ForeignKeyInputElement.prototype.validateAfterLoadIfNecessary=function(){var modElement=getElementByIdCS(this.id+EditElement.pMOD_SUFFIX);if(modElement&&modElement.value=="1"){this.validateDependents();}};ForeignKeyInputElement.prototype.performValidation=function(){var qs=new QueryString();if(this.requestParams){for(var i in this.requestParams){qs.add(i,this.requestParams[i]);}}qs.add(LookupUi.pSEARCH_VALUE,this.element.value);qs.add(LookupValidationServlet.pLKID_NAME,this.idElement.value);if(sfdcPage.getReferredDomIds){var referredDomIds=sfdcPage.getReferredDomIds(this.id);if(referredDomIds){qs.add(LookupValidationServlet.pDEPDATA_NAME,dpdLkUtil.serialize(referredDomIds));}}qs.add(EditElement.pBASE_NAME,this.id);var self=this;var url=this.validationServletURI+qs.toString();XBrowser.getHttpResponse(url,function(request){var resp=request.responseText;if(resp){var tmpResp=Util.evalAjaxServletOutput(resp);if(tmpResp&&tmpResp[LookupValidationServlet.pFILTER_RESULTS]){self.applyValidationChanges(tmpResp[LookupValidationServlet.pFILTER_RESULTS]);}}});return true;};ForeignKeyInputElement.ARIA_ERROR_SUFFIX="_pcm";ForeignKeyInputElement.prototype.applyValidationChanges=function(obj){var span=this.element.parentNode;var errEl=span.nextSibling;if(errEl&&errEl.className!="errorMsg"){errEl=null;}if(obj.error){var div=errEl;if(!div){var aria=this.element.getAttribute("aria-labelledby");div=document.createElement("div");if(aria){div.id=this.id+ForeignKeyInputElement.ARIA_ERROR_SUFFIX;this.element.setAttribute("aria-labelledby",aria+" "+div.id);}div.className="errorMsg";span.parentNode.appendChild(div);}div.innerHTML=obj.error;}else{if(errEl){delStyleClass(this.element,"error");var aria=this.element.getAttribute("aria-labelledby");if(aria){this.element.setAttribute("aria-labelledby",aria.replace(" "+this.id+ForeignKeyInputElement.ARIA_ERROR_SUFFIX,""));}span.parentNode.removeChild(errEl);}}};ForeignKeyInputElementSelectProxy=function(elementId){ForeignKeyInputElement.call(this,elementId);};Util.extend(ForeignKeyInputElementSelectProxy,ForeignKeyInputElement);ForeignKeyInputElementSelectProxy.prototype.performValidation=function(){};ForeignKeyInputElementSelectProxy.prototype.validateAfterLoadIfNecessary=function(){};ForeignKeyInputElementSelectProxy.prototype.showHideLookup=function(){};ForeignKeyInputElementSelectProxy.prototype.disableAndAddClearButton=function(){};
function FunctionalDialog(id,isModal,title,isMovable){this.id=id;this.isModal=isModal;this.isMovable=isMovable;this.extraClass="functionalDialog";this.width=OverlayDialog.MAX_WIDTH;this.maxHeight=OverlayDialog.MAX_HEIGHT;this.setupDefaultButtons();this.title=title;this.hasSummaryElement=true;this.addEvents();}FunctionalDialog.prototype=new OverlayDialog();FunctionalDialog.MAX_HEIGHT=600;FunctionalDialog.MIN_HEIGHT=120;FunctionalDialog.prototype.setMaxHeight=function(maxHeight){this.maxHeight=maxHeight>FunctionalDialog.MAX_HEIGHT?FunctionalDialog.MAX_HEIGHT:maxHeight;};FunctionalDialog.prototype.setInnerHeight=function(){var inner=this.getContentElement();var height=inner.offsetHeight+(Math.min(this.maxHeight,getWindowHeight()-40)-this.dialog.offsetHeight);inner.style.height=Math.max(FunctionalDialog.MIN_HEIGHT,height)+"px";};FunctionalDialog.prototype.createContent=function(){var content=document.getElementById(this.id+"Content");var html=[];html.push("<h2 id='");html.push(this.id);html.push("Header'>");html.push(this.header);html.push("</h2>");if(this.info){html.push("<p id='");html.push(this.id);html.push("Info'>");html.push(this.info);html.push("</p>");}html.push("<div class='");if(this.hasSummaryElement){html.push("scrollableArea");}else{html.push("scrollableAreaBottomBorder");}html.push("' id='");html.push(this.id);html.push("Inner'></div>");if(this.hasSummaryElement){html.push("<div id='");html.push(this.id);html.push("Split' class='split'><img src='"+UserContext.getUrl("/img/overlaypointer.gif")+"' class='pointer'></div><div class='summaryArea' id='");html.push(this.id);html.push("Summary'></div>");}this.createButtons(html);content.innerHTML=html.join("");};FunctionalDialog.prototype.setContentInnerHTML=function(html){this.getContentElement().innerHTML=html;};FunctionalDialog.prototype.importContentNode=function(element){this.setContentInnerHTML("");this.getContentElement().appendChild(element);};FunctionalDialog.prototype.getContentElement=function(){return document.getElementById(this.id+"Inner");};FunctionalDialog.prototype.setSummaryInnerHTML=function(html){this.getSummaryElement().innerHTML=html;};FunctionalDialog.prototype.importSummaryNode=function(element){this.setSummaryInnerHTML("");this.getSummaryElement().appendChild(element);};FunctionalDialog.prototype.getSummaryElement=function(){return document.getElementById(this.id+"Summary");};FunctionalDialog.prototype.hideSummaryElement=function(){if(!this.hasSummaryElement){return;}this.hasSummaryElement=false;var summary=this.getSummaryElement();var split=document.getElementById(this.id+"Split");var inner=this.getContentElement();if(summary&&split&&inner){summary.style.display="none";split.style.display="none";inner.className="scrollableAreaBottomBorder";}};
HtmlDetailElement={};HtmlDetailElement.populateIframeFromDiv=function(iFrameId,divId){var fElem=document.getElementById(iFrameId);if(fElem!=null){var fDoc=fElem.contentWindow.document;if(fDoc!=null){var fDiv=document.getElementById(divId);if(fDiv!=null){fDoc.body.innerHTML=fDiv.innerHTML;}}}};HtmlDetailElement.adjustSfdcSpaceSize=function(clientSpaceId){var iFrame=document.getElementById(clientSpaceId+"_frame");HtmlDetailElement.adjustFrameSize(iFrame);};HtmlDetailElement.registerRta=function(domId){if(typeof(window.twistSection)=="function"){if(!HtmlDetailElement.rtaIds){HtmlDetailElement.rtaIds=[];var oldTwistSection=window.twistSection;window.twistSection=function(twisty,sectionId){if(oldTwistSection(twisty,sectionId)){HtmlDetailElement.adjustSfdcAllFrames();return true;}return false;};}HtmlDetailElement.rtaIds.push(domId);}};HtmlDetailElement.adjustSfdcAllFrames=function(){for(var i=0;i<HtmlDetailElement.rtaIds.length;i++){HtmlDetailElement.adjustSfdcSpaceSize(HtmlDetailElement.rtaIds[i]);}};HtmlDetailElement.adjustFrameSize=function(iFrame){if(iFrame){var iFrameDom;if(iFrame.Document){iFrameDom=iFrame.Document.body;}else{iFrameDom=iFrame.contentWindow.document.documentElement;}if(!document.getElementById("knowledgeTOCRenderer")){var newWidth=600;var scrollWidth=iFrameDom.scrollWidth+20;if(scrollWidth>newWidth){newWidth=scrollWidth;}iFrame.width=newWidth;}var iFrameBody=iFrameDom.getElementsByTagName("body")[0];var scrollbarHeight=0;var additionalHeight=0;ua=navigator.userAgent.toLowerCase();if(/msie 8/.test(ua)){additionalHeight=40;}else{if(/msie/.test(ua)||(/gecko/.test(ua)&&/rv:1/.test(ua))){additionalHeight=20;}}if(iFrameBody){if(iFrameBody.scrollHeight!=iFrameBody.clientHeight){scrollbarHeight=iFrameBody.scrollHeight-iFrameBody.clientHeight;}var newHeight=iFrameBody.clientHeight+scrollbarHeight+HtmlDetailElement.adjustFrameSizeForListOnly(iFrameBody)+additionalHeight;if(iFrameBody.firstChild&&iFrameBody.firstChild.offsetTop){newHeight=newHeight+iFrameBody.firstChild.offsetTop;}iFrame.height=newHeight;}else{if(iFrameDom.scrollHeight!=iFrameDom.clientHeight){scrollbarHeight=iFrameDom.scrollHeight-iFrameDom.clientHeight;}iFrame.height=iFrameDom.scrollHeight+scrollbarHeight+HtmlDetailElement.adjustFrameSizeForListOnly(iFrameDom)+additionalHeight;}}};HtmlDetailElement.adjustFrameSizeForListOnly=function(iFrameBody){if(iFrameBody&&iFrameBody.childNodes&&iFrameBody.childNodes.length==1&&iFrameBody.firstChild.nodeName.toLowerCase()=="ul"){var ulNode=iFrameBody.firstChild;if(ulNode.childNodes&&ulNode.childNodes.length>=1){return ulNode.getElementsByTagName("li")[0].clientHeight;}}return 0;};
function ImageSelectElement(hiddenElementId,imageId,partialImgURL){var self=this;this.inputElement=document.getElementById(hiddenElementId);this.image=document.getElementById(imageId);this.partialImageURL=partialImgURL;this.inputElement.imageSelectElement=this;this.inputElement.onchange=function(){self.image.src=self.partialImageURL+self.inputElement.value;};}ImageSelectElement.prototype.isNull=function(){return(!((this.inputElement)&&(this.inputElement.value)&&(this.inputElement.value.length>0)));};
function ListElement(formName){this.formName=formName;}ListElement.prototype.cbWarn=function(){var form=document.getElementById(this.formName);for(i=0;i<form.elements.length;i++){if((form.elements[i].name==ListView.CHECKBOX_ID)&&form.elements[i].checked){if(window.confirm(LC.getLabel("List","checkboxWarning"))){for(j=i;j<form.elements.length;j++){if(form.elements[j].name==ListView.CHECKBOX_ID){form.elements[j].checked=false;}}return true;}else{return false;}}}return true;};ListElement.getList=function(formName){return instances[formName];};ListElement.instances={};ListElement.createListElement=function(formName){ListElement.instances[formName]=new ListElement(formName);};
function ListPaginator(args){this.init(args);}ListPaginator.prototype=new Paginator();ListPaginator.opts=[10,25,50,100,200];ListPaginator.rppId="_rpp";ListPaginator.selectionId="_selection";ListPaginator.target="_target";ListPaginator.prototype.init=function(args){this.listDomId=args.listDomId;this.id=this.listDomId+"_paginator";Paginator.addPaginator(this);this.containerIds=args.containerIds;this.handler=args.handler;this.ref="Paginator.instances['"+this.id+"']";this.listRef="ListViewport.instances['"+this.listDomId+"']";var self=this;var f=function(e){var target=getEventTarget(e);if(target.id!=self.id+ListPaginator.rppId+ListPaginator.target&&target.parentNode.id!=self.id+ListPaginator.rppId+ListPaginator.target){ListPaginator.hideSelector(self.id+ListPaginator.rppId+ListPaginator.target);}if(target.id!=self.id+ListPaginator.selectionId+ListPaginator.target&&target.parentNode.id!=self.id+ListPaginator.selectionId+ListPaginator.target){ListPaginator.hideSelector(self.id+ListPaginator.selectionId+ListPaginator.target);}};addEvent(document.body,"mousedown",f,true);this.selectedOnThisPage=0;this.selectCount=0;this.setState(args);};ListPaginator.prototype.setSelectCount=function(num){this.selectCount=num;this.draw();};ListPaginator.prototype.setState=function(args){this.currentPage=parseInt(args.currentPage)||this.currentPage||1;this.recordsPerPage=parseInt(args.recordsPerPage)||this.recordsPerPage||50;this.totalRecords=parseInt(args.totalRecords);this.capped=args.capped;this.hasCheckbox=args.hasCheckbox;if(!this.capped){this.totalPages=Math.ceil(this.totalRecords/this.recordsPerPage);}else{this.totalPages=null;}this.startingRecord=(this.currentPage-1)*this.recordsPerPage+1;if(!args.nodraw){var self=this;if(this.totalRecords===0){window.sfdcPage.appendToOnloadQueue(function(){self.draw(true);});}else{window.sfdcPage.appendToOnloadQueue(function(){self.draw();});}}};ListPaginator.prototype.draw=function(empty){var html=[];html.push("<div class='paginator'>");html.push("<span class='left'>");if(empty){html.push("&nbsp;");}else{html.push(this.getRecordCounts());if(this.hasCheckbox){html.push(this.getSelectedCount());}}html.push("</span>");if(empty){html.push("&nbsp;");}else{html.push(this.getPrevNextLinks());}html.push("<span class='right'>");if(empty){html.push("&nbsp;");}else{html.push(this.getPageXofY());}html.push("</span>");html.push("</div>");html.push("<div class='clearingBox'/>");for(var i=0;i<this.containerIds.length;i++){document.getElementById(this.containerIds[i]).innerHTML=html.join("");}};ListPaginator.keyHandle=function(e){if(window.ActiveXObject&&e.keyCode==KEY_ENTER){getEventTarget(e).onchange();}};ListPaginator.prototype.getPageXofY=function(){var html=[];html.push(LC.getLabel("Paginator","page"));if(this.totalPages){html.push("<input class='pageInput' maxlength='4' onchange=\"");html.push(this.ref);html.push('.goToPage(this.value)"');html.push(' onkeydown="');html.push('ListPaginator.keyHandle(event)"');html.push(" value='");html.push(this.currentPage);html.push("'>");html.push(LC.getLabel("Paginator","of",this.totalPages));}else{html.push("&nbsp;");html.push(this.currentPage);}return html.join("");};ListPaginator.prototype.getRecordCounts=function(){if(this.totalRecords===0){return"0";}else{var html=[];html.push("<span class='selectorTarget'");html.push(" id='");html.push(this.id+ListPaginator.rppId+ListPaginator.target);html.push("'");html.push(' onmousedown="');html.push("ListPaginator.showSelector('");html.push(this.id+ListPaginator.rppId+ListPaginator.target);html.push("')\"");html.push(' onmouseover="');html.push("ListPaginator.hoverSelector(this)");html.push('"');html.push(' onmouseout="');html.push("ListPaginator.unhoverSelector(this)");html.push('"');html.push(">");html.push(this.startingRecord);html.push("-");this.lastRecord=0;if(!this.capped){this.lastRecord=Math.min((this.startingRecord+this.recordsPerPage-1),this.totalRecords);}else{this.lastRecord=this.startingRecord+this.recordsPerPage-1;}html.push(this.lastRecord);if(!this.capped){html.push(" ");html.push(LC.getLabel("Paginator","of",this.totalRecords));}else{html.push(" ");html.push(LC.getLabel("Paginator","of",this.totalRecords+"+"));}html.push(this.getRppSelector());html.push("</span>");return html.join("");}};ListPaginator.prototype.getPrevNextLinks=function(){var html=[];var jscall="";html.push("<span class='prevNextLinks'>");html.push("<span class='prevNext'>");if(this.currentPage!=1){jscall=this.ref+".goToPage(1)";html.push('<a href="javascript:');html.push(jscall);html.push('">');html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='first'>");html.push("</a>");}else{html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='firstoff'>");}html.push("</span>");html.push("<span class='prevNext'>");if(this.currentPage!=1){jscall=this.ref+".goToPage("+(this.currentPage-1)+")";html.push('<a href="javascript:');html.push(jscall);html.push('">');html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='prev'>");html.push(LC.getLabel("Paginator","previous"));html.push("</a>");}else{html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='prevoff'>");html.push(LC.getLabel("Paginator","previous"));}html.push("</span>");html.push("<span class='prevNext'>");if(this.capped||(this.totalPages&&this.currentPage!=this.totalPages)){jscall=this.ref+".goToPage("+(this.currentPage+1)+")";html.push('<a href="javascript:');html.push(jscall);html.push('">');html.push(LC.getLabel("Paginator","next"));html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='next'>");html.push("</a>");}else{html.push(LC.getLabel("Paginator","next"));html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='nextoff'>");}html.push("</span>");html.push("<span class='prevNext'>");if(this.totalPages&&this.currentPage!=this.totalPages){jscall=this.ref+".goToPage("+this.totalPages+")";html.push('<a href="javascript:');html.push(jscall);html.push('">');html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='last'>");html.push("</a>");}else{html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='lastoff'>");}html.push("</span>");html.push("</span>");return html.join("");};ListPaginator.prototype.getSelectedCount=function(){var html=[];html.push("<span class='selectorTarget selectCount");if(this.selectCount>0){html.push(" selectCountHi");}html.push("' id='");html.push(this.id+ListPaginator.selectionId+ListPaginator.target);html.push("'");html.push(' onmousedown="');html.push("ListPaginator.showSelector('");html.push(this.id+ListPaginator.selectionId+ListPaginator.target);html.push("')\"");html.push(' onmouseover="');html.push("ListPaginator.hoverSelector(this)");html.push('"');html.push(' onmouseout="');html.push("ListPaginator.unhoverSelector(this)");html.push('"');html.push(">");html.push(this.selectCount);html.push(" ");html.push(LC.getLabel("Paginator","selected"));html.push(this.getSelectionSelector());html.push("<img class='selectArrow' src='"+UserContext.getUrl("/s.gif")+"' />");html.push("</span>");return html.join("");};ListPaginator.prototype.goToPage=function(pageNum){if(isNaN(pageNum)||pageNum<1){pageNum=1;}else{if(this.totalPages&&pageNum>this.totalPages){pageNum=this.totalPages;}}if(this.handler){this.handler(pageNum);}};ListPaginator.prototype.getRppSelector=function(){var html=[];html.push("<table cellpadding='0' cellspacing='0' class='selector rpp' id='");html.push(this.id+ListPaginator.rppId+"'>");var opts=ListPaginator.opts;for(var i=0;i<opts.length;i++){var selected=opts[i]==this.recordsPerPage;var clazz=selected?"optSelected":"optUnselected";html.push("<tr");html.push(" class='opt ");html.push(clazz);html.push("'");html.push(' onmouseover="');html.push("if (this.className.indexOf('optHover') < 0) { this.className += ' optHover' }");html.push('"');html.push(' onmouseout="');html.push("this.className = this.className.replace('optHover', '')");html.push('"');html.push(' onmousedown="');html.push(this.listRef);html.push(".getListData({");html.push("rowsPerPage: ");html.push(opts[i]);html.push(", rolodexIndex: ");html.push(this.listRef);html.push(".rolodexIndex");html.push("})");html.push('">');html.push("<td class='optUnselected'>");html.push(LC.getLabel("Paginator","display"));html.push("</td>");html.push("<td class='rppOpt'>");html.push(opts[i]);html.push("</td>");html.push("<td class='optUnselected'>");html.push(LC.getLabel("Paginator","rpp"));html.push("</td>");html.push("</tr>");}html.push("</table>");html.push("<img class='selectArrow' src='"+UserContext.getUrl("/s.gif")+"' />");return html.join("");};ListPaginator.prototype.getSelectionSelector=function(){var html=[];var smRef=this.listRef+".grid.getSelectionModel()";var recordsOnPage=this.lastRecord-this.startingRecord+1;var notSelectedOnPage=recordsOnPage-this.selectedOnThisPage;var opts=[{label:LC.getLabel("Paginator","select_page","+"+notSelectedOnPage),handler:smRef+".selectAll()"},{label:LC.getLabel("Paginator","deselect_page","-"+this.selectedOnThisPage),handler:smRef+".clearSelections()"},{label:LC.getLabel("Paginator","clear_all_selections","-"+this.selectCount),handler:smRef+".clearAllSelections()"}];html.push("<div class='selector selection' id='");html.push(this.id+ListPaginator.selectionId+"'>");for(var i=0;i<opts.length;i++){html.push("<div");html.push(" class='opt'");html.push(' onmouseover="');html.push("if (this.className.indexOf('optHover') < 0) { this.className += ' optHover' }");html.push('"');html.push(' onmouseout="');html.push("this.className = this.className.replace('optHover', '')");html.push('"');html.push(' onmousedown="');html.push(opts[i].handler);html.push('">');html.push(opts[i].label);html.push("</div>");}html.push("</div>");return html.join("");};ListPaginator.showSelector=function(id){var el=document.getElementById(id);if(el&&el.className.indexOf(" selectorOpen")<0){el.className+=" selectorOpen";}};ListPaginator.hideSelector=function(id){var el=document.getElementById(id);if(el){el.className=el.className.replace(" selectorOpen","");}};ListPaginator.hoverSelector=function(el){if(el.className.indexOf(" selectorHover")<0){el.className+=" selectorHover";}};ListPaginator.unhoverSelector=function(el){el.className=el.className.replace(" selectorHover","");};
function LookupElement(){var self=this;this.lookupPick=function(formName,parentIdElementName,parentEditElementName,relatedFieldName,id,display,relatedFieldValue,extraNameElementName){setTimeout(function(){self.closeLookup();},1);lookupPick(formName,parentIdElementName,parentEditElementName,relatedFieldName,id,display,relatedFieldValue,extraNameElementName);};this.lookupPick2=function(formName,parentIdElementName,parentEditElementName,id,display,extraNameElementName,extraName,extraIdElementName,extraId,allowOverwrite){setTimeout(function(){self.closeLookup();},1);lookupPick2(formName,parentIdElementName,parentEditElementName,id,display,extraNameElementName,extraName,extraIdElementName,extraId,allowOverwrite);};this.lookupPhonePick=function(parentId,newValue){setTimeout(function(){self.closeLookup();},1);lookupPhonePick(parentId,newValue);};}LookupElement.prototype.openLookup=function(baseURL,width,modified,searchParam){if(modified=="1"){baseURL=baseURL+searchParam;}this.initOverlay(baseURL).show();};LookupElement.prototype.closeLookup=function(){this.getOverlay().hide();this.redirectIframe(IFrameElement.BLANK_SRC);};LookupElement.prototype.getOverlay=function(){return sfdcPage.getDialogById(LookupInputElement.DIALOG_ID);};LookupElement.prototype.redirectIframe=function(url){this.getOverlay().getContentElement().firstChild.src=url;};LookupElement.prototype.initOverlay=function(baseURL){var ret=this.getOverlay();if(ret){this.redirectIframe(baseURL);}else{var iframeHtml=[];iframeHtml.push("<iframe ");iframeHtml.push('src="');iframeHtml.push(baseURL);iframeHtml.push('" class="pageMaskIFrame" scrolling="no" ');iframeHtml.push('id="');iframeHtml.push(LookupInputElement.LOOKUP_IFRAME);iframeHtml.push('" name="');iframeHtml.push(LookupInputElement.LOOKUP_IFRAME);iframeHtml.push('"></iframe>');iframeHtml=iframeHtml.join("");ret=new FunctionalDialog(LookupInputElement.DIALOG_ID,true,LC.getLabel("Lookup","Title"));ret.setWidth(900);ret.setMaxHeight(700);ret.hideSummaryElement();ret.clearButtons();sfdcPage.registerDialog(ret);ret.setContentInnerHTML(iframeHtml);}return ret;};
function ManageableInfoElement(dhtml_id){if(!dhtml_id){return;}var outer=document.getElementById(dhtml_id);if(!outer){return;}var elements=getElementsByClassName(ManageableInfo.MORE_INFO_CLASS,outer,"div");if(!elements||elements.length<1){return;}var moreInfo=elements[0];var self=this;this.isHidden=true;this.onLinkClickHandler=function(){if(self.isHidden){moreInfo.style.display="block";self.link.innerHTML=LC.getLabel("ManageableInfo","LessInfo");self.isHidden=false;}else{moreInfo.style.display="none";self.link.innerHTML=LC.getLabel("ManageableInfo","MoreInfo");self.isHidden=true;}if(window.VFEditor){window.VFEditor.refreshTroughPosition();}};var linkArr=outer.getElementsByTagName("a");if(linkArr&&linkArr.length>0){this.link=linkArr[0];addEvent(this.link,"click",this.onLinkClickHandler,false);}}
function MenuButton(id,hasDefaultAction){this.id=id;this.hasDefaultAction=hasDefaultAction;if(this.id){if(this.hook_isAccessibleMode()){this.initAccessibilityMode(this.id);return;}this.parentDiv=document.getElementById(id);this.buttonDiv=document.getElementById(id+MenuButtonElement.BUTTON);this.menuDiv=document.getElementById(id+MenuButtonElement.MENU);this.buttonWidth=MenuButton.DEFAULT_ARROW;this.shim=new iframeShim(this.menuDiv);var self=this;addEvent(document,"click",function(e){self.hideOthers(e);},false);addEvent(document,"keydown",function(e){self.handleKeyPress(e);},false);addEvent(this.parentDiv,"click",function(e){self.handleDivClick(e);},false);addEvent(this.parentDiv,"mouseover",function(e){addStyleClass(self.parentDiv,"menuButtonOver");});addEvent(this.parentDiv,"mouseout",function(e){delStyleClass(self.parentDiv,"menuButtonOver");});addEvent(this.menuDiv,"click",function(e){return self.handleMenuClick(e);},false);}}MenuButton.DEFAULT_ARROW=17;MenuButton.prototype.handleDivClick=function(e){if(this.hasDefaultAction){var target=getEventTarget(e);target=target.parentNode;var x=getMouseX(e)-getObjX(target);if(this.defaultActionCondition(x,e)){this.defaultAction();return;}}if(XBrowser.getCurrentStyle(this.menuDiv,"display")=="none"){this.show();}else{this.hide();}};MenuButton.prototype.handleMenuClick=function(e){this.hide();eventCancelBubble(e);};MenuButton.prototype.defaultActionCondition=function(xLocation,event){return(xLocation<this.buttonDiv.offsetWidth-this.buttonWidth);};MenuButton.prototype.hook_isAccessibleMode=function(){return UserContext.isAccessibleMode;};MenuButton.prototype.defaultAction=function(){var link=this.menuDiv.childNodes[0];if(link.target){var targets=document.getElementsByName(link.target);if(targets&&targets[0].src){targets[0].src=link.href;}}else{navigateToUrl(link.href);}};MenuButton.prototype.show=function(){this.shim.setStyle("display","block");this.position();this.show_hook();};MenuButton.prototype.show_hook=function(){};MenuButton.prototype.getMenuWidth=function(){return this.buttonDiv.offsetWidth-2;};MenuButton.prototype.position=function(){this.menuDiv.style.width="";var width=this.getMenuWidth();for(var i=0;i<this.menuDiv.childNodes.length;i++){var node=this.menuDiv.childNodes[i];if(node.nodeType==Node.ELEMENT_NODE){if(node.offsetWidth>width){width=node.offsetWidth;}}}this.shim.setStyle("width",width+"px");var display=XBrowser.getCurrentStyle(this.parentDiv,"display");if(display=="inline"||display=="inline-block"){this.parentDiv.style.position="relative";var y=this.buttonDiv.offsetHeight;if(this.parentDiv.currentStyle){for(var i=0;i<this.menuDiv.childNodes.length;i++){var node=this.menuDiv.childNodes[i];if(node.nodeType==Node.ELEMENT_NODE){node.style.width=width+"px";}}}this.shim.setStyle("top",y+"px");}};MenuButton.prototype.hide=function(ignoreHideHook){if(XBrowser.getCurrentStyle(this.menuDiv,"display")!="none"){this.shim.setStyle("display","none");this.parentDiv.style.position="";if(!ignoreHideHook){this.hide_hook();}}};MenuButton.prototype.hide_hook=function(){};MenuButton.prototype.hideOthers=function(e){var target=getEventTarget(e);if(target!=this.buttonDiv&&target!=this.parentDiv){this.hide(true);}};MenuButton.prototype.handleKeyPress=function(e){var key=e.keyCode;if(key==KEY_ESC){this.hide();}};MenuButton.prototype.addOption=function(disp,href,css,target){if(!this.hook_isAccessibleMode()){var link=document.createElement("a");if(css){link.className=css;}if(target){link.target=target;}link.href=href;link.innerHTML=disp;this.menuDiv.appendChild(link);}};MenuButton.prototype.initAccessibilityMode=function(id){var go=document.getElementById(id+MenuButtonElement.GO_BUTTON);addEvent(go,"click",function(){var select=document.getElementById(id+MenuButtonElement.SELECT);var where=select.options[select.selectedIndex].value;if(where!=""){navigateToUrl(where);}},false);};
var MultiSelectPicklist={};MultiSelectPicklist.loadMSP=function(id){var sElem=getElementByIdCS(id+"_selected");var uElem=getElementByIdCS(id+"_unselected");if(isSafari){for(i=0;i<sElem.childNodes.length;i++){var ch=sElem.childNodes[i];if(ch.nodeName=="OPTGROUP"){ch.appendChild(document.createElement("p"));}}for(i=0;i<uElem.childNodes.length;i++){var ch=uElem.childNodes[i];if(ch.nodeName=="OPTGROUP"){ch.appendChild(document.createElement("p"));}}}MultiSelectPicklist.resizeMSP(sElem,uElem);};MultiSelectPicklist.resizeMSP=function(sElem,uElem){if(!sElem||!uElem){return;}if(!sElem.style.width){var selW=(sElem.scrollWidth>uElem.scrollWidth)?sElem.scrollWidth:uElem.scrollWidth;selW=selW+35;sElem.style.width=selW+"px";uElem.style.width=selW+"px";}};MultiSelectPicklist.handleMSPChange=function(sel){var sElem=getElementByIdCS(sel.id+"_selected");var uElem=getElementByIdCS(sel.id+"_unselected");if(isSafari){var sDepth;var uDepth;for(i=0;i<sElem.childNodes.length;i++){var ch=sElem.childNodes[i];if(ch.nodeName=="OPTGROUP"){sDepth=i;var chlen=ch.childNodes.length;for(j=0;j<chlen;j++){ch.removeChild(ch.childNodes[0]);}ch.appendChild(document.createElement("p"));}}for(i=0;i<uElem.childNodes.length;i++){var ch=uElem.childNodes[i];if(ch.nodeName=="OPTGROUP"){uDepth=i;var chlen=ch.childNodes.length;for(j=0;j<chlen;j++){ch.removeChild(ch.childNodes[0]);}ch.appendChild(document.createElement("p"));}}for(i=0;i<sel.options.length;i++){if(sel.options[i].value!=picklistNAMarker){var o=document.createElement("option");o.text=sel.options[i].text;o.value=i;if(sel.options[i].selected){sElem.childNodes[sDepth].appendChild(o);}else{uElem.childNodes[uDepth].appendChild(o);}}}}else{var sI=0;var uI=0;sElem.length=0;uElem.length=0;for(var i=0;i<sel.options.length;i++){if(sel.options[i].value!=picklistNAMarker){if(sel.options[i].selected){sElem.options[sI]=new Option(sel.options[i].text,i);sI++;}else{uElem.options[uI]=new Option(sel.options[i].text,i);uI++;}}}}MultiSelectPicklist.resizeMSP(sElem,uElem);if(sel.onchange){sel.onchange();}};MultiSelectPicklist.handleMSPSelect=function(selId){var mainElem=getElementByIdCS(selId);var uElem=getElementByIdCS(selId+"_unselected");for(var i=0;i<uElem.options.length;i++){if(uElem.options[i].selected){mainElem.options[parseInt(uElem.options[i].value)].selected=true;}}MultiSelectPicklist.handleMSPChange(mainElem);};MultiSelectPicklist.handleMSPUnSelect=function(selId){var mainElem=getElementByIdCS(selId);var sElem=getElementByIdCS(selId+"_selected");for(var i=0;i<sElem.options.length;i++){if(sElem.options[i].selected){mainElem.options[parseInt(sElem.options[i].value)].selected=false;}}MultiSelectPicklist.handleMSPChange(mainElem);};
function OverlayDialog(){this.id=null;this.dialog=null;this.isModal=true;this.extraClass="";this.background=null;this.width=OverlayDialog.MAX_WIDTH;this.minHeight=OverlayDialog.MIN_HEIGHT;this.minWidth=OverlayDialog.MIN_WIDTH;this.buttons=[];this.title=null;this.header=null;this.info=null;this.isOpen=false;this.created=false;this.displayX=true;this.isResizable=false;this.isMovable=false;this.positioned=false;this.moving=false;this.resizing=false;this.fixedX=0;this.fixedY=0;this.relativeX=0;this.relativeY=0;this.changeX=0;this.changeY=0;}OverlayDialog.prototype.addEvents=function(){if(this.id){var self=this;addEvent(document,"keydown",function(e){self.handleKeyPress(e);},false);addEvent(window,"resize",function(){self.resizeEvent();},false);if(XBrowser.userAgent.isIE6){addEvent(window,"scroll",function(){self.scrollEvent();},false);}}};OverlayDialog.prototype.setTitle=function(title){this.title=title;if(this.created){document.getElementById(this.id+"Title").innerHTML=this.title;}};OverlayDialog.prototype.setHeader=function(header){this.header=header;if(this.created){document.getElementById(this.id+"Header").innerHTML=this.header;}};OverlayDialog.prototype.setInfo=function(info){this.info=info;if(this.created){document.getElementById(this.id+"Info").innerHTML=this.info;}};OverlayDialog.prototype.setWidth=function(width){this.width=width;if(this.created){if(typeof width=="string"){this.dialog.style.width=width;}else{this.dialog.style.width=width+"px";}if(this.isOpen){this.position();}}};OverlayDialog.prototype.setMinHeight=function(minHeight){this.minHeight=minHeight;};OverlayDialog.prototype.setMinWidth=function(minWidth){this.minWidth=minWidth;};OverlayDialog.prototype.overrideButton=function(index,disp,fn){if(index>=OverlayDialog.MAX_BUTTONS){throw"Cannot have more than "+OverlayDialog.MAX_BUTTONS+" buttons.";}this.buttons[index]={display:disp,action:fn};};OverlayDialog.prototype.setupDefaultButtons=function(){this.buttons=[];this.buttons[0]={display:LC.getLabel("Buttons","ok"),action:null};this.buttons[1]={display:LC.getLabel("Buttons","cancel"),action:null};};OverlayDialog.prototype.clearButtons=function(){this.buttons=[];};OverlayDialog.MAX_BUTTONS=4;OverlayDialog.MAX_WIDTH=800;OverlayDialog.MIN_WIDTH=300;OverlayDialog.MIN_HEIGHT=200;OverlayDialog.EDGE_BUFFER=40;OverlayDialog.prototype.show=function(){this.dialog.style.display="block";this.position();if(this.isModal){if(!this.background){this.createBackground();}this.background.style.display="block";if(XBrowser.userAgent.isIE6){var allSelects=document.getElementsByTagName("select");var dialogSelects=this.dialog.getElementsByTagName("select");var allLength=allSelects.length;var dialogLength=dialogSelects.length;for(var i=0;i<allLength;i++){allSelects[i].style.visibility="hidden";}for(var i=0;i<dialogLength;i++){dialogSelects[i].style.visibility="visible";}}}this.dialog.style.visibility="visible";this.isOpen=true;};OverlayDialog.prototype.hide=function(){if(this.isMovable){this.stopDrag();}if(this.isModal){this.background.style.display="none";if(XBrowser.userAgent.isIE6){var allSelects=document.getElementsByTagName("select");var allLength=allSelects.length;for(var i=0;i<allLength;i++){allSelects[i].style.visibility="visible";}}}this.dialog.style.visibility="hidden";if(!XBrowser.userAgent.isFirefox){this.dialog.style.display="none";}this.isOpen=false;};OverlayDialog.prototype.cancel=function(){this.hide();};OverlayDialog.prototype.handleKeyPress=function(e){if(this.isOpen){e=getEvent(e);var key=e.keyCode;if(key==KEY_ESC){this.cancel();}else{if(key==KEY_ENTER&&this.captureEnter(getEventTarget(e))){this.enter();}}}};OverlayDialog.prototype.captureEnter=function(target){return target.nodeName!="A"&&target.nodeName!="TEXTAREA"&&target.type!="button";};OverlayDialog.prototype.enter=function(){};OverlayDialog.prototype.position=function(){if(this.resizing){var width=this.startWidth+this.changeX;var height=this.startHeight+this.changeY;if(width<this.minWidth){width=this.minWidth;}if(height<this.minHeight){height=this.minHeight;}this.dialog.style.width=width+"px";this.dialog.style.height=height+"px";var inner=document.getElementById(this.getContentId());inner.style.height=(height-46)+"px";}else{if(!this.positioned){this.setInnerHeight();var left=getWindowWidth()-this.dialog.offsetWidth;left=left<6?6:left/2;var top=getWindowHeight()-this.dialog.offsetHeight;top=top<6?6:top/2;this.fixedX=left;this.fixedY=top;}else{var maxX=getWindowWidth()-OverlayDialog.EDGE_BUFFER;var maxY=getWindowHeight()-OverlayDialog.EDGE_BUFFER;var minX=OverlayDialog.EDGE_BUFFER-this.dialog.offsetWidth;var minY=OverlayDialog.EDGE_BUFFER/2;if(this.fixedX<minX){this.fixedX=minX;}else{if(this.fixedX>maxX){this.fixedX=maxX;}}if(this.fixedY<minY){this.fixedY=OverlayDialog.EDGE_BUFFER;}else{if(this.fixedY>maxY){this.fixedY=maxY;}}}if(XBrowser.userAgent.isIE6){this.dialog.style.left=(this.fixedX+getScrollX())+"px";this.dialog.style.top=(this.fixedY+getScrollY())+"px";}else{this.dialog.style.left=this.fixedX+"px";this.dialog.style.top=this.fixedY+"px";}}};OverlayDialog.prototype.setInnerHeight=function(){};OverlayDialog.prototype.createBackground=function(){this.background=document.createElement("div");this.background.className="overlayBackground";if(this.dialog.currentStyle&&XBrowser.userAgent.isIE6){this.background.style.width=document.body.offsetWidth+"px";this.background.style.height=document.body.offsetHeight+"px";}else{this.background.style.width=document.documentElement.scrollWidth+"px";this.background.style.height=document.documentElement.scrollHeight+"px";}document.body.appendChild(this.background);var self=this;addEvent(this.background,"mousedown",function(e){self.smash(e);},false);addEvent(this.background,"click",function(e){self.smash(e);},false);};OverlayDialog.prototype.scrollEvent=function(){if(this.created){this.position();}};OverlayDialog.prototype.resizeEvent=function(){if(this.created){if(this.background){if(this.background.currentStyle&&XBrowser.userAgent.isIE6){this.background.style.width=document.body.offsetWidth+"px";this.background.style.height=document.body.offsetHeight+"px";}else{this.background.style.width=document.documentElement.scrollWidth+"px";this.background.style.height=document.documentElement.scrollHeight+"px";}}this.position();}};OverlayDialog.prototype.createDialog=function(){var div=document.createElement("div");div.id=this.id;div.className="overlayDialog "+this.extraClass;if(typeof this.width=="string"){div.style.width=this.width;}else{if(typeof this.width=="number"){div.style.width=this.width+"px";}}var html=[];html.push("<div class='topRight");if(this.isMovable){html.push(" movable");}html.push("'><div class='topLeft'>");if(this.displayX){html.push("<img id='");html.push(this.id);html.push("X' onmouseover=\"this.className = 'dialogCloseOn'\" onmouseout=\"this.className = 'dialogClose'\" onclick=\"sfdcPage.getDialogById('");html.push(this.id);html.push("').cancel()\" class='dialogClose' src='"+UserContext.getUrl("/s.gif")+"'>");}html.push("<h2 id='");html.push(this.id);html.push("Title'>");html.push(this.title);html.push("</h2></div></div><div class='middle'><div class='innerContent' id='");html.push(this.getContentId());html.push("'></div></div>");if(this.isResizable){html.push("<div id='");html.push(this.id);html.push("Resize' class='dialogResize'></div>");}html.push("<div class='bottomRight'><div class='bottomLeft'></div></div>");div.innerHTML=html.join("");document.body.appendChild(div);this.dialog=div;var self=this;if(this.isMovable||this.isResizable){addEvent(document,"mouseup",function(){self.stopDrag();},false);if(this.isMovable){var dragger=this.dialog.firstChild;addEvent(dragger,"mousedown",function(e){self.startMove(e);},false);addEvent(document,"mousemove",function(e){self.move(e);},false);}if(this.isResizable){var resizer=document.getElementById(this.id+"Resize");addEvent(resizer,"mousedown",function(e){self.startResize(e);},false);addEvent(document,"mousemove",function(e){self.resize(e);},false);}}this.createContent();this.created=true;};OverlayDialog.prototype.createContent=function(){};OverlayDialog.prototype.startMove=function(e){e=getEvent(e);var target=getEventTarget(e);if(target.nodeName!="IMG"){this.positioned=true;this.moving=true;this.relativeX=e.clientX-this.dialog.offsetLeft;this.relativeY=e.clientY-this.dialog.offsetTop;if(XBrowser.userAgent.isIE6){this.relativeX+=getScrollX();this.relativeY+=getScrollY();}this.fixedX=e.clientX-this.relativeX;this.fixedY=e.clientY-this.relativeY;this.smash(e);}};OverlayDialog.prototype.startResize=function(e){e=getEvent(e);this.positioned=true;this.resizing=true;this.relativeX=e.clientX;this.relativeY=e.clientY;this.startWidth=this.dialog.offsetWidth;this.startHeight=this.dialog.offsetHeight;this.smash(e);};OverlayDialog.prototype.stopDrag=function(){this.moving=false;this.resizing=false;};OverlayDialog.prototype.move=function(e){if(this.moving){e=getEvent(e);this.smash(e);this.fixedX=e.clientX-this.relativeX;this.fixedY=e.clientY-this.relativeY;this.position();}};OverlayDialog.prototype.resize=function(e){if(this.resizing){e=getEvent(e);this.smash(e);this.changeX=e.clientX-this.relativeX;this.changeY=e.clientY-this.relativeY;this.position();}};OverlayDialog.prototype.smash=function(e){if(e.stopPropagation){e.stopPropagation();}else{e.cancelBubble=true;}if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}};OverlayDialog.prototype.getContentId=function(){return this.id+"Content";};OverlayDialog.prototype.createButtons=function(html){html.push("<div id='"+this.id+"_buttons' class='buttons'>");for(var i=0;i<this.buttons.length;i++){var display=this.buttons[i].display;var action=this.buttons[i].action;var id=this.buttons[i].id;html.push("<input class='btn' type='button' value='");html.push(display);if(id){html.push("' id='");html.push(id);}html.push("' onclick=\"");if(typeof action=="string"){html.push("if(");html.push(action.replace(/"/,'\\"'));html.push(")");}else{if(typeof action=="function"){html.push("if(");html.push(action.name);html.push("())");}}html.push("sfdcPage.getDialogById('");html.push(this.id);html.push("').hide();\">");}html.push("</div>");};OverlayDialog.prototype.register=function(){sfdcPage.registerDialog(this);};
function Paginator(args){if(args){this.init(args);}}Paginator.prototype.init=function(args){if(args.listId){this.listId=args.listId;this.id=this.listId+"_paginator";}else{this.id=args.id;}Paginator.addPaginator(this);this.containerIds=args.containerIds;this.handler=args.handler;this.ref="Paginator.instances['"+this.id+"']";this.setState(args);};Paginator.prototype.setState=function(args){this.currentPage=parseInt(args.currentPage)||this.currentPage||1;this.recordsPerPage=parseInt(args.recordsPerPage)||this.recordsPerPage||50;this.totalRecords=parseInt(args.totalRecords)||this.totalRecords;this.recordsOnThisPage=parseInt(args.recordsOnThisPage);this.more=args.more;if(this.totalRecords){this.totalPages=Math.ceil(this.totalRecords/this.recordsPerPage);}this.startingRecord=(this.currentPage-1)*this.recordsPerPage+1;if(!args.nodraw){var self=this;window.sfdcPage.appendToOnloadQueue(function(){self.draw();});}};Paginator.prototype.draw=function(){var html=[];html.push("<div class='paginator'>");html.push("<span class='left'>");html.push(this.getRecordCounts());html.push("</span>");html.push(this.getPrevNextLinks());html.push("<span class='right'>");html.push(this.getPageXofY());html.push("</span>");html.push("</div>");html.push("<div class='clearingBox'/>");for(var i=0;i<this.containerIds.length;i++){document.getElementById(this.containerIds[i]).innerHTML=html.join("").replace(/__CID__/g,this.containerIds[i]);}};Paginator.keyHandle=function(e){if(window.ActiveXObject&&e.keyCode==KEY_ENTER){getEventTarget(e).onchange();}};Paginator.prototype.getTempId=function(idSuffix){return"__CID__"+idSuffix;};Paginator.prototype.getPageXofY=function(){var html=[];if(this.totalPages){var idSuffix="_getPageXofY";html.push("<label for='");html.push(this.getTempId(idSuffix));html.push("'>");html.push(LC.getLabel("Paginator","page"));html.push("</label>");html.push("<input class='pageInput' maxlength='4' onchange=\"");html.push(this.ref);html.push('.goToPage(this.value)"');html.push(' onkeydown="');html.push('Paginator.keyHandle(event)"');html.push(" value='");html.push(this.currentPage);html.push("' id='");html.push(this.getTempId(idSuffix));html.push("'/>");html.push(LC.getLabel("Paginator","of",this.totalPages));}else{html.push(LC.getLabel("Paginator","page"));html.push("&nbsp;");html.push(this.currentPage);}return html.join("");};Paginator.prototype.getRecordCounts=function(){if(!this.totalRecords&&this.recordsOnThisPage==0){return"0";}else{var html=[];html.push(this.startingRecord);html.push("-");var lastRecord=0;if(this.totalRecords){lastRecord=Math.min((this.startingRecord+this.recordsPerPage-1),this.totalRecords);}else{lastRecord=Math.min((this.startingRecord+this.recordsPerPage-1),(this.startingRecord+this.recordsOnThisPage-1));}html.push(lastRecord);if(this.totalRecords){html.push(" ");html.push(LC.getLabel("Paginator","of",this.totalRecords));}return html.join("");}};Paginator.prototype.getPrevNextLinks=function(){var html=[];var jscall="";html.push("<span class='prevNextLinks'>");if(this.currentPage!=1){jscall=this.ref+".goToPage(1)";html.push("<a title='");html.push(LC.getLabel("Paginator","first_page"));html.push("' class='prevNext' href=\"javascript:");html.push(jscall);html.push('">');}else{html.push("<span class='prevNext prevNextDisabled'>");}html.push("&lt;&lt;");if(this.currentPage!=1){html.push("</a>");}else{html.push("</span>");}if(this.currentPage!=1){jscall=this.ref+".goToPage("+(this.currentPage-1)+")";html.push("<a title='");html.push(LC.getLabel("Paginator","previous_page"));html.push("' class='prevNext' href=\"javascript:");html.push(jscall);html.push('">');}else{html.push("<span class='prevNext prevNextDisabled'>");}html.push("&lt; ");html.push(LC.getLabel("Paginator","previous"));if(this.currentPage!=1){html.push("</a>");}else{html.push("</span>");}if(this.more||(this.totalPages&&this.currentPage!=this.totalPages)){jscall=this.ref+".goToPage("+(this.currentPage+1)+")";html.push("<a title='");html.push(LC.getLabel("Paginator","next_page"));html.push("' class='prevNext' href=\"javascript:");html.push(jscall);html.push('">');}else{html.push("<span class='prevNext prevNextDisabled'>");}html.push(LC.getLabel("Paginator","next"));html.push(" &gt;");if(this.more||(this.totalPages&&this.currentPage!=this.totalPages)){html.push("</a>");}else{html.push("</span>");}if(this.totalPages&&this.currentPage!=this.totalPages){jscall=this.ref+".goToPage("+this.totalPages+")";html.push("<a title='");html.push(LC.getLabel("Paginator","last_page"));html.push("' class='prevNext' href=\"javascript:");html.push(jscall);html.push('">');}else{html.push("<span class='prevNext prevNextDisabled'>");}html.push("&gt;&gt;");if(this.totalPages&&this.currentPage!=this.totalPages){html.push("</a>");}else{html.push("</span>");}html.push("</span>");return html.join("");};Paginator.prototype.goToPage=function(pageNum){if(isNaN(pageNum)||pageNum<1){pageNum=1;}else{if(pageNum>this.totalPages){pageNum=this.totalPages;}}if(this.handler){this.handler(pageNum);}};Paginator.addPaginator=function(what){Paginator.instances[what.id]=what;};Paginator.instances={};
function RelatedListPanel(rlPanelId){this.panelId=rlPanelId;this.currentListId=null;this.delayingHide=null;this.delayingShow=null;this.numLists=0;this.linksHtml=[];this.isConsole=location.search.indexOf(Desktop.IS_DESKTOP)>-1;}RelatedListPanel.prototype.getPanelNode=function(){return document.getElementById(this.panelId);};RelatedListPanel.prototype.getPanelShadowNode=function(){return(this.getPanelNode())?this.getPanelNode().parentNode:null;};RelatedListPanel.prototype.getIFrameNode=function(){return DomUtil.findDescendantWithTag(this.getPanelNode(),"iframe");};RelatedListPanel.prototype.registerList=function(relatedList){this.linksHtml.push(this.getHoverableLinkHTML(relatedList));};RelatedListPanel.prototype.addListsToPanel=function(){var linksNode=this.getHoverableLinksNode();if(linksNode.innerHTML.indexOf("linklet")<0&&linksNode.nodeName!==("SCRIPT").toUpperCase()){linksNode.innerHTML=this.linksHtml.join('<span class="pipe"> | </span>');}linksNode.style.visibility="visible";};RelatedListPanel.prototype.getHoverableLinkHTML=function(relatedList){var buf=[];buf.push('<a class="linklet" href="#');buf.push(relatedList.getLinkTarget());buf.push('" id="');buf.push(this.getLinkId(relatedList.listId));buf.push('"');if(!relatedList.isOnlySkipLink){buf.push(" onmouseover=\"sfdcPage.relatedListPanel.showRLDelayed('");buf.push(relatedList.listId);buf.push("')\" onmouseout=\"sfdcPage.relatedListPanel.hideRLDelayed('");buf.push(relatedList.listId);buf.push("')\" onclick=\"sfdcPage.relatedListPanel.hideRL('");buf.push(relatedList.listId);}buf.push('\')"><span class="listTitle">');buf.push(relatedList.getTitle());buf.push(this.getCountIndicator(relatedList));buf.push("</span></a>");return buf.join("");};RelatedListPanel.prototype.getCountIndicator=function(relatedList){var html=[];if(!relatedList.shouldLoad){html.push('<span class="count">[');html.push(relatedList.getNumberVisibleRows());if(relatedList.hasMore()){html.push('<span class="plus">+</span>');}html.push("]</span>");}else{html.push('<span class="count">[...]</span>');}return html.join("");};RelatedListPanel.prototype.getHoverableLinksNode=function(){return this.getPanelShadowNode().nextSibling;};RelatedListPanel.prototype.showRLDelayed=function(rlId){this.clearhidemenu();if(this.currentListId&&(this.currentListId!=rlId)){this.hideRL(this.currentListId);this.populateRL(rlId);this.showRL(rlId);}else{var self=this;this.delayingShow=setTimeout(function(){self.showRL(rlId);},500);this.populateRL(rlId);}};RelatedListPanel.prototype.hideRLDelayed=function(rlId,delay){this.clearshowmenu();if(!delay){delay=50;}if(!rlId){rlId=this.currentListId;}var self=this;this.delayingHide=setTimeout(function(){self.hideRL(rlId);},delay);};RelatedListPanel.prototype.getStyleSheetHtml=function(){var sheetHtml=[];for(var i=0;i<document.styleSheets.length;i++){if(document.styleSheets[i].owningElement&&document.styleSheets[i].owningElement.outerHTML){sheetHtml.push(document.styleSheets[i].owningElement.outerHTML);}}return sheetHtml.join("");};RelatedListPanel.prototype.populateRL=function(rlId){if(!rlId){rlId=this.currentListId;}if(this.currentListId!=rlId){var panelFrameNode=this.getIFrameNode();if(!panelFrameNode){return;}var relatedListNode=getElementByIdCS(rlId);var iFrameDoc=panelFrameNode.contentWindow.document;if(!(relatedListNode&&iFrameDoc)){return;}this.currentListId=rlId;if(iFrameDoc.importNode){iFrameDoc.body.innerHTML="";iFrameDoc.body.appendChild(iFrameDoc.importNode(relatedListNode,false));iFrameDoc.body.firstChild.innerHTML=relatedListNode.innerHTML;}else{if(relatedListNode.outerHTML){iFrameDoc.body.innerHTML=relatedListNode.outerHTML;}else{return false;}}var self=this;setTimeout(function(){self.fixContent();},1);panelFrameNode.contentWindow.navigateToUrl=function(url){window.navigateToUrl(url);};}};RelatedListPanel.prototype.showRL=function(rlId,forceResize){this.clearhidemenu();if(rlId!=this.currentListId){return;}var panelShadowNode=this.getPanelShadowNode();if(!panelShadowNode){return;}var panelFrameNode=this.getIFrameNode();var linkletNode=getElementByIdCS(this.getLinkId(rlId));var relatedListNode=DomUtil.findDescendantWithClassName(getElementByIdCS(rlId),"bPageBlock");if(!(panelFrameNode&&linkletNode)){return;}if(linkletNode.className.indexOf("linkletOn")>0&&(!forceResize)){return;}panelShadowNode.style.top=(linkletNode.offsetTop+linkletNode.offsetHeight)+"px";if(this.isConsole){panelShadowNode.style.left=(getObjX(this.getHoverableLinksNode())-4)+"px";panelShadowNode.style.width=(relatedListNode.offsetWidth-3)+"px";}else{panelShadowNode.style.left=(getObjX(this.getHoverableLinksNode())-14)+"px";panelShadowNode.style.width=(relatedListNode.offsetWidth+13)+"px";}panelFrameNode.style.height=(relatedListNode.offsetHeight+5)+"px";panelShadowNode.style.display="block";linkletNode.className+=" linkletOn";};RelatedListPanel.prototype.hideRL=function(rlId){if(!(Modal.isBlocked())){this.clearshowmenu();if(!rlId){rlId=this.currentListId;}this.currentListId=null;var panelShadowNode=this.getPanelShadowNode();var linklet=getElementByIdCS(this.getLinkId(rlId));if(linklet){linklet.className="linklet";}if(panelShadowNode){panelShadowNode.style.display="none";}}};RelatedListPanel.prototype.clearhidemenu=function(){if(this.delayingHide){clearTimeout(this.delayingHide);}};RelatedListPanel.prototype.clearshowmenu=function(){if(this.delayingShow){clearTimeout(this.delayingShow);}};RelatedListPanel.prototype.getLinkId=function(relatedListId){return relatedListId+"_link";};RelatedListPanel.prototype.fixContent=function(){var targetableTags=["a","form"];var iframeWin=this.getIFrameNode().contentWindow;for(var i=0,tag;tag=targetableTags[i];i++){var tags=iframeWin.document.body.getElementsByTagName(tag);for(var k=0,node;node=tags[k];k++){if(!node.target){node.target="_parent";}}}var scripts=iframeWin.document.body.getElementsByTagName("script");for(var i=0;i<scripts.length;i++){iframeWin.eval(scripts[i].innerHTML);}};RelatedListPanel.prototype.refresh=function(relatedLists){for(var rl in relatedLists){var relatedList=relatedLists[rl];var buf=[];var panelList=this.getIFrameNode().contentWindow.document.getElementById(relatedList.listId);var newList=document.getElementById(relatedList.listId);var linkletNode=document.getElementById(this.getLinkId(relatedList.listId));if(panelList&&panelList.innerHTML){panelList.innerHTML=newList.innerHTML;this.fixContent(panelList);if(linkletNode&&linkletNode.className&&(linkletNode.className.indexOf("linkletOn")>-1)){this.showRL(relatedList.listId,true);}}if(linkletNode){buf.push('<span class="listTitle">');buf.push(relatedList.getTitle());buf.push(this.getCountIndicator(relatedList));buf.push("</span>");linkletNode.innerHTML=buf.join("");}}};
var RoleTreeNodeElement=function(){this.openRoleList=new Array();this.downloadedRoles=new Array();this.downloadedAll=false;this.treeFormName=null;};RoleTreeNodeElement.prototype.init=function(isDownloadedAll,openRoleNodes){this.downloadedAll=isDownloadedAll;if(openRoleNodes!=null){this.openRoleList=openRoleNodes.split(":");this.downloadedRoles=openRoleNodes.split(":");}};RoleTreeNodeElement.prototype.addToOpenRoles=function(item){for(var i=0;i<this.openRoleList.length;i++){if(this.openRoleList[i]==null||this.openRoleList[i]==""){this.openRoleList[i]=item;this.updateCookiesRole();return;}}this.openRoleList[this.openRoleList.length]=item;this.updateCookiesRole();};RoleTreeNodeElement.prototype.isInDownloadedRoles=function(item){if(item=="000000000000000"){return true;}for(var i=0;i<this.downloadedRoles.length;i++){if(this.downloadedRoles[i]==item){return true;}}return false;};RoleTreeNodeElement.prototype.removeFromOpenRoles=function(item){for(var i=0;i<this.openRoleList.length;i++){if(this.openRoleList[i]==item){this.openRoleList[i]=null;}}this.updateCookiesRole();};RoleTreeNodeElement.prototype.updateCookiesRole=function(){var stringlist="";for(var i=0;i<this.openRoleList.length;i++){if(this.openRoleList[i]!=null&&this.openRoleList[i]!=""){stringlist=stringlist+this.openRoleList[i]+":";}}Cookies.prototype.SetCookie(RoleTreeCookieConstants.COOKIE_KEY,stringlist,null,"/");};RoleTreeNodeElement.prototype.toggleRoles=function(img,blockNum,roleId){var obj=document.getElementById(blockNum);if(obj!=null){visible=(obj.style.display!="none");if(visible){obj.style.display="none";img.className=TreeNodeElement.prototype.getCollapsedWidgetState(img.className);this.removeFromOpenRoles(roleId);}else{this.addToOpenRoles(roleId);if(this.downloadedAll||this.isInDownloadedRoles(roleId)){obj.style.display="block";img.className=TreeNodeElement.prototype.getExpandedWidgetState(img.className);}else{this.refreshTree();}}}};RoleTreeNodeElement.prototype.collapseAllRoles=function(){Cookies.prototype.SetCookie(RoleTreeCookieConstants.COOKIE_KEY,"",null,"/");this.refreshTree();};RoleTreeNodeElement.prototype.expandAllRoles=function(){Cookies.prototype.SetCookie(RoleTreeCookieConstants.COOKIE_KEY,"EXPANDALL",null,"/");this.refreshTree();};RoleTreeNodeElement.prototype.setTreeFormName=function(name){this.treeFormName=name;};RoleTreeNodeElement.prototype.refreshTree=function(){if(this.treeFormName==null){window.location.replace(window.location.href);}else{window.document.forms[this.treeFormName].submit();}};
function ScheduleReportOverlayUtil(){}ScheduleReportOverlayUtil.displayScheduleReportDialogElement=function(id,csrf){var dialog=OverlayDialogElement.getDialog("deleteScheduleReportDialog_"+id);dialog.isModal=true;dialog.setWidth(480);var url="/"+id+"?"+ReportConstants.pDELREP+"=1";if(csrf){url+="&"+CSRFConstants.CSRF_TOKEN+"="+csrf;}dialog.buttonContents='<input value="'+LC.getLabel("Report","DeleteScheduleReportConfirm")+'" class="btn" id="deleteScheduleReportDialog_'+id+'_overlayConfirmButton" name="overlayConfirmButton" onclick="if(true) {sfdcPage.getDialogById(\'deleteScheduleReportDialog_'+id+"').hide();window.location.href='"+url+'\';}" title="'+LC.getLabel("Report","DeleteScheduleReportConfirm")+'" type="button" /><input value="'+LC.getLabel("Buttons","cancel")+'" class="btn" name="cancel" onclick="document.getElementById(\'del_'+id+"').focus();OverlayDialogElement.getDialog('deleteScheduleReportDialog_"+id+'\').cancel()" title="'+LC.getLabel("Buttons","cancel")+'" type="button" />';dialog.setTitle(LC.getLabel("Report","DeleteScheduleReportTitle"));var topContent=LC.getLabel("Report","DeleteScheduleReportContentTopHalf");var bottomContent=LC.getLabel("Report","DeleteScheduleReportContentBottom");dialog.contents='<div><table ><tr><td><img src="/s.gif" alt="Warning"  class="warningLarge" style=\'margin-right: 15px; margin-left: 8px\'="style=\'margin-right: 15px\'" title="Warning"/></td><td><br/>'+topContent+"<br/><br/>"+bottomContent+"</td></tr>\n</table></div>";dialog.createContent();dialog.show();document.getElementById("deleteScheduleReportDialog_"+id+"_overlayConfirmButton").focus();return false;};
function SelectElementDependency(selectElementId,divIds){this.divIds=divIds;this.selectElementId=selectElementId;var self=this;this.changeVisibleDiv=function(){var selectedIndex=document.getElementById(self.selectElementId).selectedIndex;for(var i=0;i<divIds.length;i++){var displayValue;if(i==selectedIndex){displayValue="block";}else{displayValue="none";}document.getElementById(self.divIds[i]).style.display=displayValue;}};this.changeVisibleDiv();addEvent(document.getElementById(this.selectElementId),"change",this.changeVisibleDiv,false);}
var SelectFilterElement=function(ctlName,ctlOption,target,targetOption,existing,max,useJs,ajaxFilterUrl){this.controllerName=ctlName;this.controllerOption=ctlOption;this.targetName=target;this.targetOption=targetOption;this.existingName=existing;this.selectedOptions=new Array();this.allOptions=new Array();this.maxValues=max;this.searchQueueCount=0;this.useJsSearch=useJs;this.searchStringChanged=false;this.itemAdded=false;this.ajaxFilterUrl=ajaxFilterUrl;};SelectFilterElement.prototype.getSearchElementId=function(){return"searchValue_"+this.controllerName;};SelectFilterElement.prototype.addOptions=function(array){for(var i=0;i<array.length;i++){this.addOption.apply(this,array[i]);}};SelectFilterElement.prototype.addOption=function(type,label,key,searchValue,existingValues){var opt=new Option(label,key);opt.searchValue=searchValue;var optionsArray=this.allOptions[type];if(!optionsArray){optionsArray=new Array();this.allOptions[type]=optionsArray;}optionsArray[optionsArray.length]=opt;if(existingValues&&this.selectedOptions!=null&&this.selectedOptions[key]){existingValues.options[existingValues.options.length]=new Option(label,key);}};SelectFilterElement.prototype.queueSearch=function(){this.searchQueueCount++;var callback=this.getJavascriptVarName()+".doSearch()";setTimeout(callback,300);};SelectFilterElement.prototype.doSearch=function(){this.searchQueueCount--;if(this.searchQueueCount>0){return;}this.searchQueueCount=0;if(this.useJsSearch){this.doSearchJS();}else{this.doSearchServer();}};SelectFilterElement.prototype.doSearchJS=function(){var controller=document.getElementById(this.controllerName);var targetField=document.getElementById(this.targetName);var existing=document.getElementById(this.existingName);var searchEl=document.getElementById(this.getSearchElementId());var searchValue=searchEl.value?searchEl.value.toLowerCase():"";if(searchValue.length==0){this.filter();return;}targetField.options.length=0;var numMatched=0;var numAdded=0;var optionsOfType=this.allOptions[controller.value];if(optionsOfType){for(var i=0;i<optionsOfType.length&&numAdded<this.maxValues+1;i++){var option=optionsOfType[i];if(existing&&this.selectedOptions[option.value]){numMatched++;continue;}var match=!option.searchValue||option.searchValue.length==0||option.searchValue.indexOf(searchValue)==0||option.searchValue.indexOf(" "+searchValue)>-1;if(match){if(numAdded<this.maxValues){targetField.options[numAdded]=option;}numMatched++;numAdded++;}}}var tooManyValues=numMatched>this.maxValues;this.showErrorMessage(tooManyValues);if(targetField.options.length==0){targetField.options[0]=new Option(LC.getLabel("SelectElement","Required"),"000000000000000");}};SelectFilterElement.prototype.onSearchComplete=function(response){var controller=document.getElementById(this.controllerName);var json=Util.evalAjaxServletOutput(response.responseText);var existing=document.getElementById(this.existingName);var targetField=document.getElementById(this.targetName);targetField.options.length=0;if(json.FilteredOptions&&json.FilteredOptions.length>0){var newOptions=new Array;for(var i=0;i<json.FilteredOptions.length&&i<this.maxValues;i++){newOptions[i]=[json.FilteredOptions[i].text,json.FilteredOptions[i].value];}Util.refreshDynamicSelect(targetField,newOptions,false,null);var tooManyValues=json.FilteredOptions.length>this.maxValues;this.showErrorMessage(tooManyValues);}else{targetField.options[0]=new Option(LC.getLabel("SelectElement","Required"),Udd.EMPTY_KEY);}};SelectFilterElement.prototype.doSearchServer=function(){if(this.ajaxFilterUrl){var searchEl=document.getElementById(this.getSearchElementId());var searchValue=searchEl.value?searchEl.value:"";if(searchValue.length===0){this.filter();return;}var controller=document.getElementById(this.controllerName);XBrowser.postHttpResponse(UserContext.getUrl(this.ajaxFilterUrl),this.onSearchComplete,XBrowser.buildPost({searchStr:searchValue,controlType:controller.value}),null,this);}else{var form=document.forms[SelectFilterElement.FORMNAME];if(form.onsubmit){form.onsubmit();}form.submit();}};SelectFilterElement.FORMNAME=EditPageConstants.pEDIT_PAGE;SelectFilterElement.prototype.handleKeyDown=function(evt){evt=getEvent(evt);if(evt.keyCode==13||evt.which==13){this.queueSearch();return false;}else{this.searchStringChanged=true;}return true;};SelectFilterElement.prototype.handlePropertyChange=function(){if(this.useJsSearch){this.queueSearch();}};SelectFilterElement.prototype.showErrorMessage=function(showMsg,errorMessage){var searchEl=document.getElementById(this.getSearchElementId());var err=document.getElementById("error_"+this.targetName);if(searchEl&&err){if(showMsg){err.style.visibility="visible";err.innerHTML=errorMessage?errorMessage:LC.getLabel("Search_Filter","too_many",this.maxValues,this.maxValues);}else{err.style.visibility="hidden";}}};SelectFilterElement.prototype.filter=function(){var controller=document.getElementById(this.controllerName);var targetField=document.getElementById(this.targetName);var searchEl=document.getElementById(this.getSearchElementId());if(this.useJsSearch&&searchEl&&searchEl.value.length!=0){searchEl.value="";}targetField.options.length=0;if(SelectFilterElement.prototype.NONE_LABEL){targetField.options[0]=new Option(SelectFilterElement.prototype.NONE_LABEL,"000000000000000");}var counter=0;var numAdded=0;var optionsOfType=this.allOptions[controller.value];if(optionsOfType){var testForAlreadySelected=this.existingName;if(testForAlreadySelected){this.initSelectedOptionsFromUi();}for(var i=0;i<optionsOfType.length&&(!searchEl||numAdded<this.maxValues+1);i++){var option=optionsOfType[i];if(testForAlreadySelected&&this.selectedOptions[option.value]){continue;}counter++;if(!searchEl||numAdded<this.maxValues){targetField.options[targetField.options.length]=option;numAdded++;}}}var tooManyValues=counter>this.maxValues;this.showErrorMessage(tooManyValues);if(targetField.options.length==0){targetField.options[0]=new Option(LC.getLabel("SelectElement","Required"),"000000000000000");}};SelectFilterElement.prototype.initSelectedOptionsFromUi=function(){if(this.existingName){this.selectedOptions=new Array();var existing=document.getElementById(this.existingName);if(existing){for(var i=0;i<existing.options.length;i++){if(existing.options[i].value.length>0){this.selectedOptions[existing.options[i].value]=true;}}}}};SelectFilterElement.prototype.init=function(){this.filter();if(this.existingName){var existing=document.getElementById(this.existingName);if(existing){existing.selectFilterEl=this;existing.onchange=function(){this.selectFilterEl.initSelectedOptionsFromUi();};}}if(this.controllerOption&&this.controllerName){var controller=document.getElementById(this.controllerName);if(controller.options!=null&&controller.options!=undefined){for(var i=0;i<controller.options.length;i++){if(controller.options[i].value==this.controllerOption){controller.options[i].selected=true;}}}}if(this.targetOption){var targetField=document.getElementById(this.targetName);for(var i=0;i<targetField.options.length;i++){if(targetField.options[i].value==this.targetOption){targetField.options[i].selected=true;}}}};SelectFilterElement.prototype.getJavascriptVarName=function(){return this.targetName+"Var";};SelectFilterElement.prototype.filterDropdown=function(name,currTypeSelect){var selected=currTypeSelect.selectedIndex;for(var i=0;i<currTypeSelect.options.length;i++){var option=currTypeSelect.options[i].value;var optionList=name+"_"+option;var currSelect=document.getElementById(optionList);if(i==selected){currSelect.style.display="inline";}else{currSelect.style.display="none";}}};SelectFilterElement.prototype.moveLeft=function(){this.filter();};SelectFilterElement.prototype.beforeMoveRight=function(){this.itemAdded=true;};
var SELECT_MENU_SELECT=1;var SELECT_MENU_SIDEWAYS=2;function SelectMenu(sourceId,targetId,displayWord,selectMenuOuterClass,selectMenuClass,style,groupClass,needScrollbars,hasDefaultAction,isRightAligned){this.sourceList=document.getElementById(sourceId);this.select=null;this.menuDiv=null;this.displayWord=displayWord;this.targetDiv=document.getElementById(targetId);this.divClass=selectMenuOuterClass+" menuButton";this.menuClass=selectMenuClass+" menuButtonMenu";this.menuOpen=false;this.hasSetPosition=false;this.scrollbars=needScrollbars;this.hasDefaultAction=hasDefaultAction;this.isCreateNew=false;this.isRightAligned=isRightAligned;if(style){this.style=style;}else{this.style=SELECT_MENU_SELECT;}var self=this;this.documentHideMenu=function(e){var elem=getEventTarget(e);if(elem.className==groupClass){return;}if(self.menuOpen){self.hideMenu();}};this.handleDocumentKeyDown=function(e){var evt=getEvent(e);if(self.menuOpen&&evt.keyCode==KEY_ESC){self.hideMenu();}};this.handleDivClick=function(e){var elem=getEventTarget(e);if(elem.className==groupClass){return;}if(self.hasDefaultAction){var nOffsetX=(e.layerX)?(e.layerX):e.offsetX;if(nOffsetX<(elem.offsetWidth-17)){window.location=self.sourceList.childNodes[0].href;eventCancelBubble(e);return;}}if(self.menuOpen){self.hideMenu();}else{self.showMenu();self.setPosition();}eventCancelBubble(e);};if(!this.sourceList){return;}if(!this.targetDiv){return;}this.init();}SelectMenu.prototype.showMenu=function(){if(!this.isCreateNew){this.targetDiv.style.position="relative";}this.menuDiv.setStyle("display","block");this.menuOpen=true;};SelectMenu.prototype.hideMenu=function(){if(!this.isCreateNew){this.targetDiv.style.position="static";}this.menuDiv.setStyle("display","none");this.menuOpen=false;};SelectMenu.prototype._setPositionSelect=function(){if(!this.hasSetPosition){this.hasSetPosition=true;if(!this.isCreateNew){this.menuDiv.setStyle("top",this.select.offsetHeight+"px");if(!this.isRightAligned){this.menuDiv.setStyle("left","0px");}else{this.menuDiv.setStyle("right","3px");}}var maxWidth=this.sourceList.childNodes[0].scrollWidth;var maxOptionWidth=maxWidth;for(var i=1;i<this.sourceList.childNodes.length;i++){if(this.sourceList.childNodes[i].scrollWidth>maxWidth){maxWidth=this.sourceList.childNodes[i].scrollWidth;}}for(var i=0;i<this.sourceList.childNodes.length;i++){this.sourceList.childNodes[i].style.width="100%";if(this.sourceList.childNodes[i].offsetWidth>maxOptionWidth){maxOptionWidth=this.sourceList.childNodes[i].offsetWidth;}}this.menuDiv.setStyle("width",maxWidth+"px");if(this.scrollbars){var maxHeight=this.sourceList.childNodes[0].offsetHeight*20;var actualHeight=this.sourceList.offsetHeight;if(actualHeight<maxHeight){maxHeight=actualHeight;}this.menuDiv.setStyle("height",maxHeight+"px");this.menuDiv.setStyle("overflowY","auto");}if(this.menuDiv.div.offsetWidth<this.select.childNodes[0].offsetWidth){this.menuDiv.setStyle("width",this.select.childNodes[0].offsetWidth+"px");if(this.scrollbars){this.menuDiv.setStyle("width",(maxOptionWidth+34)+"px");this.menuDiv.setStyle("backgroundColor","#CCC");this.menuDiv.div.childNodes[0].style.width=this.menuDiv.div.offsetWidth-34+"px";}}}};SelectMenu.prototype._setPositionSideways=function(){this.menuDiv.setStyle("top",this.select.offsetHeight/2+"px");this.menuDiv.setStyle("left",this.select.offsetWidth+"px");};SelectMenu.prototype.init=function(){this.select=document.createElement("div");this.select.className=this.divClass;this.targetDiv.insertBefore(this.select,this.targetDiv.firstChild);var upperDiv=document.createElement("div");if(this.hasDefaultAction){upperDiv.className="selectMenuButton menuButtonButton hasDefault";}else{upperDiv.className="selectMenuButton menuButtonButton";}this.select.appendChild(upperDiv);upperDiv.appendChild(document.createTextNode(this.displayWord));this.menuDiv=document.createElement("div");this.menuDiv.className=this.menuClass;this.select.appendChild(this.menuDiv);this.menuDiv.appendChild(this.sourceList);switch(this.style){case SELECT_MENU_SIDEWAYS:this.setPosition=this._setPositionSideways;break;case SELECT_MENU_SELECT:default:this.setPosition=this._setPositionSelect;}this.menuDiv=new iframeShim(this.menuDiv);this.menuDiv.setStyle("display","none");this.menuDiv.setStyle("position","absolute");addEvent(document,"click",this.documentHideMenu,false);addEvent(document,"keydown",this.handleDocumentKeyDown,true);addEvent(this.targetDiv,"click",this.handleDivClick,false);};
SfdcElement=function(){};SfdcElement.prototype.getElements=function(ids){var elements=[];for(var n=0;n<ids.length;n++){elements.push(document.getElementById(ids[n]));}return elements;};SfdcElement.prototype.setVisibleElementsById=function(ids,show){SfdcElement.prototype.setVisibleElements(SfdcElement.prototype.getElements(ids),show);};SfdcElement.prototype.setVisibleElements=function(elements,show){for(var n=0;n<elements.length;n++){elements[n].style.visibility=(show)?"visible":"hidden";}};SfdcElement.prototype.setDisplayElementsById=function(ids,display){SfdcElement.prototype.setDisplayElements(SfdcElement.prototype.getElements(ids),display);};SfdcElement.prototype.setDisplayElements=function(elements,display){for(var n=0;n<elements.length;n++){elements[n].style.display=(display)?"block":"none";}};SfdcElement.prototype.setDisabledById=function(ids,disabled){SfdcElement.prototype.setDisabled(SfdcElement.prototype.getElements(ids),disabled);};SfdcElement.prototype.setDisabled=function(elements,disabled){for(var n=0;n<elements.length;n++){elements[n].disabled=disabled;}};
var ShareRuleSelectFilterElement=function(){};ShareRuleSelectFilterElement.prototype.filterDropdown=function(name,map,currTypeSelect){var selected=currTypeSelect.selectedIndex;var selectedMappedOption=this.getMappedOption(selected,map,currTypeSelect);for(var i=0;i<currTypeSelect.options.length;i++){var mappedOption=this.getMappedOption(i,map,currTypeSelect);var optionList=name+"_"+mappedOption;var currSelect=document.getElementById(optionList);if(currSelect){if(mappedOption==selectedMappedOption){if(i==selected){currSelect.style.display="inline";}}else{currSelect.style.display="none";}}}};ShareRuleSelectFilterElement.prototype.getMappedOption=function(index,map,currTypeSelect){var option=currTypeSelect.options[index].value;var mappedOption=map[option];if(!mappedOption){mappedOption=option;}return mappedOption;};
function SimpleDialog(id,isMovable){this.id=id;this.isModal=true;this.isMovable=isMovable;this.extraClass="";this.width=450;this.title="";this.displayX=false;this.addEvents();}SimpleDialog.prototype=new OverlayDialog();SimpleDialog.prototype.createContent=function(){var content=document.getElementById(this.getContentId());var html=[];html.push("<h2 id='");html.push(this.id);html.push("Header'>");html.push(this.header);html.push("</h2>");html.push("<div id='");html.push(this.id);html.push("Inner'></div>");content.innerHTML=html.join("");};SimpleDialog.prototype.setContentInnerHTML=function(html){this.getContentElement().innerHTML=html;};SimpleDialog.prototype.importContentNode=function(element){this.setContentInnerHTML("");this.getContentElement().appendChild(element);};SimpleDialog.prototype.getContentElement=function(){return document.getElementById(this.id+"Inner");};
function SimpleTimePicker(){this.now=DateUtil.getDateTimeFromUserLocale(UserContext.today);this.created=false;this.fields=[];this.hoursDiv;this.hoursShim;this.currentField=null;this.currentHour=0;this.isVisible=false;this.timeDivs=[];this.selectedDiv=null;}function TimeDivData(divId,timeValue){this.divId=divId;this.timeValue=timeValue;}SimpleTimePicker.prototype.create=function(parentNode){this.created=true;this.hoursDiv=document.createElement("div");this.hoursDiv.className="hourPicker";this.hoursDiv.id="simpleTimePicker";var date=new Date();date.setMinutes(0);var html=[];this.timeDivs=new Array(48);for(var timeItemIndex=0;timeItemIndex<48;timeItemIndex++){var hourItem=Math.floor(timeItemIndex/2);date.setHours(hourItem);var isTimeItemIndexEven=timeItemIndex%2==0?true:false;if(isTimeItemIndexEven){date.setMinutes(0);}else{date.setMinutes(30);}var timeString=DateUtil.getTimeStringFromUserLocale(date);var timePickerItemId="timePickerItem_"+timeItemIndex;this.timeDivs[timeItemIndex]=new TimeDivData(timePickerItemId,timeString);html.push("<div class='simpleHour' id='"+timePickerItemId+"' onmouseover='SimpleTimePicker.timePicker.highLightTimeItem(");html.push(timeItemIndex);html.push(")' onclick=\"SimpleTimePicker.timePicker.selectTime('");html.push(timeString);html.push("', true)\">");html.push(timeString);html.push("</div>");}if(parentNode){parentNode.appendChild(this.hoursDiv);}else{document.body.appendChild(this.hoursDiv);}this.hoursDiv.innerHTML=html.join("");var self=this;addEvent(document,"click",function(e){self.hide(e);},false);addEvent(this.hoursDiv,"click",function(e){eventCancelBubble(getEvent(e));return false;},false);this.hoursShim=new iframeShim(this.hoursDiv);};SimpleTimePicker.prototype.highLightTimeItem=function(timeItemIndex){if(this.selectedDiv!=null){document.getElementById(this.timeDivs[this.selectedDiv].divId).className="simpleHour";}this.selectedDiv=timeItemIndex;document.getElementById(this.timeDivs[this.selectedDiv].divId).className="simpleHour hover";this.adjustScrollbar(timeItemIndex);};SimpleTimePicker.prototype.selectTimeItem=function(timeItemIndex){this.highLightTimeItem(timeItemIndex);this.selectTime(this.timeDivs[this.selectedDiv].timeValue,false);};SimpleTimePicker.prototype.positionTime=function(parentNode){var x=getObjX(this.currentField);var y=getObjY(this.currentField)+this.currentField.offsetHeight;if(parentNode){var parentX=getObjX(parentNode);var parentY=getObjY(parentNode);x=x-parentX;y=y-parentY;}this.hoursShim.setStyle("left",x+"px");this.hoursShim.setStyle("top",y+"px");var hours=0;var minutes=0;if(!this.currentField.value){hours=this.now.getHours();minutes=this.now.getMinutes();}else{var date=DateUtil.getTimeFromUserLocale(this.currentField.value);if(date.getTime()){hours=date.getHours();minutes=date.getMinutes();}}var minutesPercentageInHour=parseFloat(minutes/60);var timeItemIndex=Math.round(2*(hours+minutesPercentageInHour));SimpleTimePicker.timePicker.highLightTimeItem(timeItemIndex);};SimpleTimePicker.prototype.adjustScrollbar=function(timeItemIndex){var itemOffsetHeight=timeItemIndex*this.hoursDiv.firstChild.offsetHeight;if((itemOffsetHeight<this.hoursDiv.scrollTop)||(itemOffsetHeight>this.hoursDiv.scrollTop+this.hoursDiv.clientHeight)){this.hoursDiv.scrollTop=itemOffsetHeight;}else{if(itemOffsetHeight>(this.hoursDiv.scrollTop+this.hoursDiv.clientHeight-this.hoursDiv.firstChild.offsetHeight)){this.hoursDiv.scrollTop=this.hoursDiv.scrollTop+this.hoursDiv.firstChild.offsetHeight;}}};SimpleTimePicker.prototype.show=function(field,parentNode){if(!this.created){this.create(parentNode);}this.currentField=getElementByIdCS(field);if(this.fields[field]!==this.currentField){this.fields[field]=null;}if(!this.fields[field]){var self=this;this.currentField.onkeydown=function(e){return self.trapEnterKey(e);};addEvent(this.currentField,"keydown",function(e){return self.handleKeyPress(e);},false);this.fields[field]=this.currentField;}this.hoursDiv.style.width=this.currentField.clientWidth+2+"px";this.hoursShim.setStyle("display","block");this.positionTime(parentNode);this.isVisible=true;};SimpleTimePicker.prototype.hide=function(e){if(e&&getEventTarget(e)===this.currentField){return;}this.hoursShim.setStyle("display","none");this.isVisible=false;};SimpleTimePicker.prototype.trapEnterKey=function(e){var key=getEvent(e).keyCode;if(key==KEY_ENTER&&this.isVisible){eventCancelBubble(getEvent(e));return false;}return true;};SimpleTimePicker.prototype.handleKeyPress=function(e){var key=getEvent(e).keyCode;if(this.isVisible){if(key==KEY_ESC||key==KEY_TAB){this.hide();}else{if(key==KEY_ENTER){this.hide();eventCancelBubble(getEvent(e));return false;}else{if(key==KEY_ARROW_U){if(this.selectedDiv>0){this.selectTimeItem(this.selectedDiv-1);}}else{if(key==KEY_ARROW_D){if(this.selectedDiv<(this.timeDivs.length-1)){this.selectTimeItem(this.selectedDiv+1);}}}}}}else{if(key==KEY_ARROW_U||key==KEY_ARROW_D){this.show(this.currentField.id);}}return true;};SimpleTimePicker.prototype.selectTime=function(timeString,hideTimePicker){if(hideTimePicker){this.hide();}if(!this.currentField.disabled&&this.currentField.value!=timeString){this.currentField.value=timeString;if(this.currentField.onchange){this.currentField.onchange();}}};SimpleTimePicker.timePicker=null;SimpleTimePicker.pickTime=function(field,parentNode){if(!SimpleTimePicker.timePicker){SimpleTimePicker.timePicker=new SimpleTimePicker();}SimpleTimePicker.timePicker.show(field,parentNode);};SimpleTimePicker.hideTimePicker=function(){if(SimpleTimePicker.timePicker){SimpleTimePicker.timePicker.hide();}};SimpleTimePicker.quickTime=function(value,field){var element=getElementByIdCS(field);if(!element.disabled&&element.value!=value){element.value=value;if(element.onchange){element.onchange();}}};
function TimePicker(){this.now=DateUtil.getDateTimeFromUserLocale(UserContext.today);this.created=false;this.fields=[];this.hoursDiv;this.hoursShim;this.minutesDiv;this.minutesShim;this.currentField=null;this.currentHour=0;this.hidingMinutes=null;}TimePicker.prototype.create=function(){this.created=true;this.hoursDiv=document.createElement("div");this.hoursDiv.className="hourPicker";var d=new Date();d.setMinutes(0);var html=[];for(var i=0;i<24;i++){d.setHours(i);html.push("<div class='hour' onmouseover='TimePicker.timePicker.selectHour(");html.push(i);html.push(")' onclick='TimePicker.timePicker.selectTime(");html.push(i);html.push(", 0)'>");html.push(DateUtil.getTimeStringFromUserLocale(d));html.push("</div>");}document.body.appendChild(this.hoursDiv);this.hoursDiv.style.width=DateUtil.hasAMPM(UserContext.timeFormat)?"7em":"5.5em";this.hoursDiv.innerHTML=html.join("");this.minutesDiv=document.createElement("div");this.minutesDiv.className="minutePicker";html=[];for(i=15;i<60;i+=15){html.push("<div class='minutes' onclick='TimePicker.timePicker.selectMinutes(");html.push(i);html.push(")' onmouseover='this.className = \"minutes hover\";' onmouseout='this.className = \"minutes\";'>:");html.push(i);html.push("</div>");}document.body.appendChild(this.minutesDiv);this.minutesDiv.innerHTML=html.join("");var self=this;addEvent(document,"click",function(e){self.hide(e);},false);addEvent(this.hoursDiv,"click",function(e){eventCancelBubble(e);return false;},false);addEvent(this.minutesDiv,"click",function(e){eventCancelBubble(e);return false;},false);addEvent(this.minutesDiv,"mouseout",function(){self.delayHideMinutes();},false);addEvent(this.hoursDiv,"mouseout",function(){self.delayHideMinutes();},false);addEvent(this.minutesDiv,"mouseover",function(){self.cancelHideMinutes();},false);this.hoursShim=new iframeShim(this.hoursDiv);this.minutesShim=new iframeShim(this.minutesDiv);};TimePicker.prototype.positionHours=function(){var x=getObjX(this.currentField);var y=getObjY(this.currentField)+this.currentField.offsetHeight;this.hoursShim.setStyle("left",x+"px");this.hoursShim.setStyle("top",y+"px");var hours=0;if(!this.currentField.value){hours=this.now.getHours();}else{var d=DateUtil.getTimeFromUserLocale(this.currentField.value);if(d.getTime()){hours=d.getHours();}}this.hoursDiv.scrollTop=hours*this.hoursDiv.firstChild.offsetHeight;};TimePicker.prototype.positionMinutes=function(){var y=getObjY(this.hoursDiv)+this.currentHour*this.hoursDiv.firstChild.offsetHeight-this.hoursDiv.scrollTop+1;var x=getObjX(this.hoursDiv)+this.hoursDiv.firstChild.offsetWidth;this.minutesShim.setStyle("left",x+"px");this.minutesShim.setStyle("top",y+"px");};TimePicker.prototype.show=function(field){if(!this.created){this.create();}this.currentField=getElementByIdCS(field);if(this.fields[field]!==this.currentField){this.fields[field]=null;}if(!this.fields[field]){var self=this;addEvent(this.currentField,"keydown",function(e){self.handleKeyPress(e);},false);this.fields[field]=this.currentField;}this.hoursShim.setStyle("display","block");this.positionHours();};TimePicker.prototype.showMinutes=function(){this.cancelHideMinutes();this.positionMinutes();this.minutesShim.setStyle("display","block");};TimePicker.prototype.cancelHideMinutes=function(){if(this.hidingMinutes){clearTimeout(this.hidingMinutes);this.hidingMinutes=null;}};TimePicker.prototype.delayHideMinutes=function(){var self=this;this.hidingMinutes=setTimeout(function(){self.hideMinutes();},50);};TimePicker.prototype.hideMinutes=function(){this.minutesShim.setStyle("display","none");this.hoursDiv.childNodes[this.currentHour].className="hour";};TimePicker.prototype.hide=function(e){if(e&&getEventTarget(e)===this.currentField){return;}this.hideMinutes();this.hoursShim.setStyle("display","none");};TimePicker.prototype.handleKeyPress=function(e){var key=getEvent(e).keyCode;if(key==KEY_ESC||key==KEY_TAB){this.hide();}else{if(key==KEY_ENTER){}}};TimePicker.prototype.selectHour=function(hours){this.hoursDiv.childNodes[this.currentHour].className="hour";this.currentHour=hours;this.hoursDiv.childNodes[this.currentHour].className="hour hover";this.showMinutes();};TimePicker.prototype.selectMinutes=function(minutes){this.selectTime(this.currentHour,minutes);};TimePicker.prototype.selectTime=function(hours,minutes){this.hide();var d=new Date();d.setHours(hours);d.setMinutes(minutes);var value=DateUtil.getTimeStringFromUserLocale(d);if(!this.currentField.disabled&&this.currentField.value!=value){this.currentField.value=value;if(this.currentField.onchange){this.currentField.onchange();}}};TimePicker.timePicker=null;TimePicker.pickTime=function(field){if(!TimePicker.timePicker){TimePicker.timePicker=new TimePicker();}TimePicker.timePicker.show(field);};TimePicker.quickTime=function(value,field){var element=getElementByIdCS(field);if(!element.disabled&&element.value!=value){element.value=value;if(element.onchange){element.onchange();}}};
var TreeNodeElement=function(){};TreeNodeElement.prototype.collapsedWidget=new Image(20,16);TreeNodeElement.prototype.collapsedWidget.className="plus";TreeNodeElement.prototype.collapsedWidgetStart=new Image(20,16);TreeNodeElement.prototype.collapsedWidgetStart.className="plusStart";TreeNodeElement.prototype.collapsedWidgetEnd=new Image(20,16);TreeNodeElement.prototype.collapsedWidgetEnd.className="plusEnd";TreeNodeElement.prototype.expandedWidget=new Image(20,16);TreeNodeElement.prototype.expandedWidget.className="minus";TreeNodeElement.prototype.expandedWidgetStart=new Image(20,16);TreeNodeElement.prototype.expandedWidgetStart.className="minusStart";TreeNodeElement.prototype.expandedWidgetEnd=new Image(20,16);TreeNodeElement.prototype.expandedWidgetEnd.className="minusEnd";TreeNodeElement.prototype.getExpandedWidgetState=function(imgClassName){if(imgClassName.indexOf("Start")!=-1){return TreeNodeElement.prototype.expandedWidgetStart.className;}if(imgClassName.indexOf("End")!=-1){return TreeNodeElement.prototype.expandedWidgetEnd.className;}return TreeNodeElement.prototype.expandedWidget.className;};TreeNodeElement.prototype.getCollapsedWidgetState=function(imgClassName){if(imgClassName.indexOf("Start")!=-1){return TreeNodeElement.prototype.collapsedWidgetStart.className;}if(imgClassName.indexOf("End")!=-1){return TreeNodeElement.prototype.collapsedWidgetEnd.className;}return TreeNodeElement.prototype.collapsedWidget.className;};TreeNodeElement.prototype.toggle=function(img,blockNum){var obj=document.getElementById(blockNum);if(obj!=null){visible=(obj.style.display!="none");if(visible){obj.style.display="none";img.className=TreeNodeElement.prototype.getCollapsedWidgetState(img.className);}else{obj.style.display="block";img.className=TreeNodeElement.prototype.getExpandedWidgetState(img.className);}}};
function TwistyElement(twistyId,dependentId,showLabel,hideLabel,startHidden){this.twisty=document.getElementById(twistyId);this.dep=document.getElementById(dependentId);this.showLabel=showLabel;this.hideLabel=hideLabel;if(!this.twisty||!this.dep){return;}if(startHidden){this.dep.style.display="none";}this.hidden=startHidden;var self=this;addEvent(this.twisty.parentNode,"click",function(e){self.twistElement(e);});}TwistyElement.prototype.twistElement=function(e){var twistSpan=getElementsByClassName("twistyText",this.twisty.parentNode)[0];var target=getEventTarget(getEvent(e));if(target===twistSpan||target===this.twisty){if(this.hidden){this.dep.style.display="block";this.hidden=false;this.twisty.className="hideListButton";twistSpan.innerHTML=this.hideLabel;}else{this.dep.style.display="none";this.hidden=true;this.twisty.className="showListButton";twistSpan.innerHTML=this.showLabel;}}};
function VerticallyArrangableSelectElement(_id){this.id=_id;var vaSelectElement=this;sfdcPage.appendToOnloadQueue(function(){vaSelectElement.init();});}VerticallyArrangableSelectElement.prototype.init=function(){var containingNode=document.getElementById(this.id).parentNode.parentNode;var imgs=containingNode.getElementsByTagName("img");var _id=this.id;for(var i=0;(imgs&&(i<imgs.length));i++){if(hasStyleClass(imgs[i],vaSelectElementConst.UP_CLASS)){addEvent(imgs[i],"click",function(){moveUp(document.getElementById(_id));},false);}else{if(hasStyleClass(imgs[i],vaSelectElementConst.DOWN_CLASS)){addEvent(imgs[i],"click",function(){moveDown(document.getElementById(_id));},false);}}}};
var Captcha={formName:"",submitButtonName:"",publicKey:"",recaptchaLang:"",dialog:null,verified:false,click:function(formName,submitButtonName,publicKey,helpHref,recaptchaLang){Captcha.formName=formName;Captcha.submitButtonName=submitButtonName;Captcha.publicKey=publicKey;Captcha.recaptchaLang=recaptchaLang;if(Captcha.verified){Captcha.proceed();return;}if(typeof Recaptcha=="undefined"){Captcha.submitClientError();return;}if(!Captcha.dialog){Captcha.dialog=new SimpleDialog("captcha_dialog",true);Captcha.dialog.enter=Captcha.submit;Captcha.dialog.setupDefaultButtons();Captcha.dialog.overrideButton(0,LC.getLabel("Buttons","submit"),"Captcha.submit()");Captcha.dialog.setWidth("350px");Captcha.dialog.register();var html=[];html.push('<div id="recaptcha_widget">');html.push(LC.getLabel("CaptchaElement","dialog"));html.push('<div id="recaptcha_image"></div>');html.push('<div id="incorrect" style="display:none;color:red">');html.push(LC.getLabel("CaptchaElement","incorrect"));html.push("</div>");html.push('<table class="captchaContent" border="0" cellpadding="0" cellspacing="0">');html.push('  <tr><td><span class="recaptcha_only_if_image">');html.push(LC.getLabel("CaptchaElement","imagePrompt"));html.push("</span>");html.push('          <span class="recaptcha_only_if_audio">');html.push(LC.getLabel("CaptchaElement","audioPrompt"));html.push("</span>");html.push('          <input id="recaptcha_response_field" name="recaptcha_response_field" type="text">');html.push("      </td>");html.push('      <td style="width:25px;border-left:none;cursor:pointer">');html.push('          <img src="'+UserContext.getUrl("/img/recaptcha_refresh.gif")+'" alt="'+LC.getLabel("CaptchaElement","refresh")+'" title="'+LC.getLabel("CaptchaElement","refresh")+'" onclick="Recaptcha.reload()">');html.push('          <img class="recaptcha_only_if_image" src="'+UserContext.getUrl("/img/recaptcha_audio.gif")+'" alt="'+LC.getLabel("CaptchaElement","audio")+'" title="'+LC.getLabel("CaptchaElement","audio")+'" onclick="Recaptcha.switch_type(\'audio\')">');html.push('          <img class="recaptcha_only_if_audio" src="'+UserContext.getUrl("/img/recaptcha_text.gif")+'" alt="'+LC.getLabel("CaptchaElement","image")+'" title="'+LC.getLabel("CaptchaElement","image")+'" onclick="Recaptcha.switch_type(\'image\')">');if(helpHref!=null&&helpHref.length>0){html.push('          <img src="'+UserContext.getUrl("/img/recaptcha_help.gif")+'" alt="'+LC.getLabel("Buttons","help")+'" title="'+LC.getLabel("Buttons","help")+'" onclick="'+helpHref+'">');}html.push("      </td>");html.push("  </tr>");html.push('  <tr><td colspan="2" style="border:0px">');Captcha.dialog.createButtons(html);html.push('<a id="moreinfo" style="float:right" href="#" onclick="Captcha.toggleMoreinfo(true)">');html.push(LC.getLabel("CaptchaElement","moreinfo"));html.push("</a>");html.push("  </td></tr>");html.push('  <tr><td colspan="2" style="border:0px">');html.push('    <div id="about" style="display:none"><img src="img/reCAPTCHAlogo.png" style="float:left;padding-right:5px">');html.push('      <div style="font-size:85%">Security test provided by <a href="http://www.recaptcha.net" target="_blank">reCAPTCHA&trade;</a>');html.push("      <br>The words above come from scanned books.  By typing them, you help to digitize old texts.</div>");html.push('      <a style="float:right" href="#" onclick="Captcha.toggleMoreinfo(false)">');html.push(LC.getLabel("CaptchaElement","lessinfo"));html.push("</a>");html.push("    </div>");html.push("  </td></tr>");html.push("</table>");html.push("</div>");Captcha.dialog.setContentInnerHTML(html.join(""));}Captcha.dialog.show();Captcha.displayOnly();},toggleMoreinfo:function(show){if(show){document.getElementById("about").style.display="block";document.getElementById("moreinfo").style.display="none";}else{document.getElementById("about").style.display="none";document.getElementById("moreinfo").style.display="inline";}},displayOnly:function(){Recaptcha.create(Captcha.publicKey,null,{callback:Recaptcha.focus_response_field,theme:"custom",lang:Captcha.recaptchaLang});},hide:function(){Captcha.dialog.hide();},submit:function(){if(!Captcha.checkRecaptchaConnected()){Captcha.submitClientError();}else{Captcha.verify();}return false;},verify:function(){var challenge=Recaptcha.get_challenge();var response=Recaptcha.get_response();Recaptcha.destroy();Captcha.callVerifier(challenge,response,"false",Captcha.verifyResultCallback);},verifyResultCallback:function(response){var responseText=response.responseText;var json=Util.evalAjaxServletOutput(responseText);if(json[CaptchaVerifierServlet.VALID_KEY]==true){Captcha.verified=true;Captcha.hide();Captcha.proceed();}else{document.getElementById("incorrect").style.display="block";Captcha.displayOnly();}},proceed:function(){if(Captcha.formName){document.forms[Captcha.formName][Captcha.submitButtonName].click();}else{window.location=document.getElementById(Captcha.submitButtonName).href;}},submitClientError:function(){Captcha.callVerifier("","","true",Captcha.proceed);},callVerifier:function(chal,resp,clientError,callback){var params={};params[CaptchaVerifierServlet.CHALLENGE_PARAM]=chal;params[CaptchaVerifierServlet.RESPONSE_PARAM]=resp;params[CaptchaVerifierServlet.CLIENT_ERROR_PARAM]=clientError;var ajaxServletUrl=UrlMap.convertClassNameToUrl(CaptchaVerifierServlet.SERVLET_NAME,null);XBrowser.postHttpResponse(ajaxServletUrl,callback,XBrowser.buildPost(params));},checkRecaptchaConnected:function(){var imageHtml=document.getElementById("recaptcha_image").innerHTML;return !!imageHtml;}};
function MotifElement(id,descCellId,iconId,_motifKey){if(arguments.length>0){this.init(id,descCellId,iconId,_motifKey);}}MotifElement.prototype.init=function(id,descCellId,iconId,_motifKey){this.motifElement=document.getElementById(id);this.motifDescCell=document.getElementById(descCellId);this.motifIcon=document.getElementById(iconId);this.motifKey=_motifKey;this.motifElement.motifElement=this;};MotifElement.prototype.getDescription=function(){return this.motifDescCell.firstChild.nodeValue;};
function MotifInputElement(paramName){this.paramName=paramName;this.motifKeyInput=document.getElementById(paramName+MotifInputElementConst.FIELD_NAME_MOTIF);this.motifElement=document.getElementById(paramName+MotifInputElementConst.MOTIF_ELEMENT_SUFFIX);this.motifElementObj=this.motifElement.motifElement;this.motifDescInput=document.getElementById(paramName+MotifInputElementConst.FIELD_NAME_DESCRIPTION);this.motifDescCell=this.motifElementObj.motifDescCell;this.motifIconInput=document.getElementById(paramName+MotifInputElementConst.FIELD_NAME_ICON);this.motifIcon=this.motifElementObj.motifIcon;this.motifElement.motifInputElement=this;document.getElementById(paramName).motifInputElement=this;}MotifInputElement.prototype.setIconSrc=function(newSrc){this.motifIcon.src=newSrc;};MotifInputElement.prototype.setIconValue=function(newVal){this.motifIconInput.value=newVal;};MotifInputElement.prototype.setMotifKey=function(newKey){this.motifKeyInput.value=newKey;};MotifInputElement.prototype.setDescription=function(desc){if(this.motifDescCell.firstChild){this.motifDescCell.firstChild.nodeValue=desc;}else{this.motifDescCell.appendChild(document.createTextNode(desc));}};MotifInputElement.prototype.openWindow=function(url,width,height){openPopup(url,this.paramName+"MotifPickerWindow",width,height,"width="+width+",height="+height+",dependent=yes,resizable=yes,toolbar=no,status=no,directories=no,menubar=no,scrollbars=1",true);};MotifInputElement.prototype.isNull=function(){return(!((this.motifKeyInput.value)&&(this.motifKeyInput.value.length>0)));};
function PickableMotifElement(id,descCellId,iconId,_motifKey,motifInputElementId){this.init(id,descCellId,iconId,_motifKey);var self=this;if(window.opener){this.parentMotifInputElementObj=window.opener.document.getElementById(motifInputElementId).motifInputElement;}this.motifElement.onclick=function(){self.parentMotifInputElementObj.motifElement.className=self.motifElement.className;self.parentMotifInputElementObj.setDescription(self.getDescription());if(self.motifIcon&&self.motifIcon.src){self.parentMotifInputElementObj.setIconSrc(self.motifIcon.src);self.parentMotifInputElementObj.setIconValue("");}self.parentMotifInputElementObj.setMotifKey(self.motifKey);window.blur();window.close();return false;};}PickableMotifElement.prototype=new MotifElement;PickableMotifElement.toggleUsedMotifVisibility=function(showThem){var allMotifs=document.getElementsByTagName("a");for(var i=0;i<allMotifs.length;i++){if((showThem)&&(allMotifs[i].style.display=="none")&&(allMotifs[i].className.indexOf("motifElement")>-1)){allMotifs[i].style.display="block";}else{if((!showThem)&&(allMotifs[i].className)&&(allMotifs[i].className.indexOf("usedMotif")>-1)){allMotifs[i].style.display="none";}}}};PickableMotifElement.hideUsedStyle=function(){document.getElementById("hideUsedStyle").style.display="none";document.getElementById("showUsedStyle").style.display="block";PickableMotifElement.toggleUsedMotifVisibility(false);return false;};PickableMotifElement.showUsedStyle=function(){document.getElementById("showUsedStyle").style.display="none";document.getElementById("hideUsedStyle").style.display="block";PickableMotifElement.toggleUsedMotifVisibility(true);return false;};
function DynamicCss(){this.cssLinks=[];this.readyToWrite=false;this.delayedDocs=[];}DynamicCss.prototype.isReadyToWrite=function(){return this.readyToWrite;};DynamicCss.prototype.addCssUrl=function(url,mediaType,prepend){if(prepend){this.cssLinks.unshift(new DynamicCss.CssLink(url,mediaType));}else{this.cssLinks.push(new DynamicCss.CssLink(url,mediaType));}if(this.cssLinks.length===1){if(!window.sfdcPage){return;}var self=this;window.sfdcPage.appendToOnloadQueue(function(){self.loadingComplete();});}};DynamicCss.prototype.loadingComplete=function(){this.readyToWrite=true;if(this.delayedDocs.length>0){this.writeToDelayedDocs();}};DynamicCss.prototype.appendCssWhenReady=function(apiVersion,doc){this.delayedDocs.push({apiVersion:apiVersion,targetDoc:doc});};DynamicCss.prototype.writeCss=function(apiVersion,doc){for(var i=0;i<this.cssLinks.length;i++){doc.write(this.cssLinks[i].getLink(apiVersion));}};DynamicCss.prototype.writeToDelayedDocs=function(){for(var i=0;i<this.delayedDocs.length;i++){var doc=this.delayedDocs[i].targetDoc;var head=doc&&DynamicCss.getHead(doc);if(!head){continue;}var apiVersion=this.delayedDocs[i].apiVersion;for(var x=0;x<this.cssLinks.length;x++){head.appendChild(this.cssLinks[x].getLinkElement(apiVersion,doc));}}this.delayedDocs=[];};DynamicCss.addCssUrl=function(url,mediaType,prepend){DynamicCss.instance.addCssUrl(url,mediaType,prepend);};DynamicCss.doneLoading=function(){DynamicCss.instance.loadingComplete();};DynamicCss.writeCss=function(apiVersion,doc,dontClose){if(DynamicCss.instance.isReadyToWrite()){DynamicCss.instance.writeCss(apiVersion,doc);if(!dontClose){doc.close();}}else{DynamicCss.instance.appendCssWhenReady(apiVersion,doc);}};DynamicCss.loadCSS=function(headElem,cssUri){var commonCSSLink=document.createElement("link");commonCSSLink.setAttribute("type","text/css");commonCSSLink.setAttribute("href",cssUri);commonCSSLink.setAttribute("rel","stylesheet");headElem.appendChild(commonCSSLink);};DynamicCss.loadSkin=function(getUserInfoResult,version){var headElem=DynamicCss.getHead();if(headElem){var uiSkin="Theme2";if(getUserInfoResult&&getUserInfoResult.userUiSkin){uiSkin=getUserInfoResult.userUiSkin;}var base;if(version){base=UserContext.getUrl("/sCSS/")+version;}else{base=UserContext.getUrl("/dCSS");}base=base+"/"+uiSkin+"/default";DynamicCss.loadCSS(headElem,base+"/common.css");DynamicCss.loadCSS(headElem,base+"/custom.css");}};DynamicCss.getHead=function(doc){if(!doc){doc=document;}var headElems=doc.getElementsByTagName("head");var headElem=(headElems&&headElems.length==1)?headElems[0]:null;return headElem;};DynamicCss.CssLink=function(url,mediaType){this.url=url;if(mediaType){this.mediaType=mediaType;}else{this.mediaType=null;}};DynamicCss.CssLink.prototype.getUrl=function(){return this.url;};DynamicCss.CssLink.prototype.getMediaType=function(){return this.mediaType;};DynamicCss.CssLink.prototype.getFullUrl=function(apiVersion){var url=this.getUrl();if(apiVersion){if(!DynamicCss.CssLink.URL_VERSION_REGEX){DynamicCss.CssLink.URL_VERSION_REGEX=new RegExp("sCSS/[^/]*");}var repStr="sCSS/"+apiVersion;url=url.replace(DynamicCss.CssLink.URL_VERSION_REGEX,repStr);}return url;};DynamicCss.CssLink.prototype.getLink=function(apiVersion){var strBuf=[];strBuf.push("<link type='text/css' rel='stylesheet' href='");strBuf.push(this.getFullUrl(apiVersion));strBuf.push("'");if(this.getMediaType()){strBuf.push(" media='");strBuf.push(this.getMediaType());strBuf.push("'");}strBuf.push(">");return strBuf.join("");};DynamicCss.CssLink.prototype.getLinkElement=function(apiVersion,doc){if(!doc){doc=document;}var elem=doc.createElement("link");elem.setAttribute("type","text/css");elem.setAttribute("rel","stylesheet");elem.setAttribute("href",this.getFullUrl(apiVersion));if(this.getMediaType()){elem.setAttribute("media",this.getMediaType());}return elem;};DynamicCss.instance=new DynamicCss();
var FilterEdit=function(){};FilterEdit.prototype.disableDiv=function(divId,disableIt){var obj=document.getElementById(divId);if(obj!=null){obj.disabled=disableIt;obj.selectedIndex=obj.options.length-1;}};FilterEdit.prototype.setFocusOnSearch=function(){var els=document.getElementsByName(FilterEditPageConstants.pSEARCH_ANCHOR);if(els&&els.length==1){var anchor=els[0];anchor.focus();}};
function ListFilterColumn(columnData){if(columnData){this.columnName=columnData[InlineEditConstants.COLUMN_NAME];this.label=columnData[InlineEditConstants.COLUMN_LABEL];this.state=InlineEditState[columnData[InlineEditConstants.FIELD_STATE]];if(this.state==InlineEditState.EDIT){this.columnType=InlineEditField.resolveSwitchableField(columnData);if(this.columnType==ColumnType.PERSONNAME||this.columnType==ColumnType.SWITCHABLE_PERSONNAME){this.state=InlineEditState.NONE;}else{this.fieldId=columnData[InlineEditConstants.FIELD_ID];this.columnId=columnData[InlineEditConstants.COLUMN_ID];this.required=columnData[InlineEditConstants.FIELD_REQUIRED];if(this.columnId=="FirstName"||this.columnId=="Salutation"){this.required=false;}var extra=this.columnType.inlineEditExtraData;if(extra){this.extraData={};for(var i=0;i<extra.length;i++){this.extraData[extra[i]]=columnData[extra[i]];}}this.fieldObject=null;}}}}ListFilterColumn.prototype.getFieldId=function(){if(this.fieldId){var id=this.fieldId;if(this.columnId){id+=this.columnId;}return id;}else{return this.columnName;}};ListFilterColumn.prototype.createEditElements=function(editDiv,initialValue){var id=this.getFieldId();if(initialValue===null){var initialValue="";if(this.columnType==ColumnType.BOOLEAN){initialValue=false;}else{if(this.columnType==ColumnType.DYNAMICENUM){initialValue=["","",null];}else{if(this.columnType==ColumnType.MULTIENUM){initialValue=null;}else{if(this.columnType==ColumnType.ENTITYID){initialValue=["",Udd.EMPTY_KEY];}}}}}var ctor=this.columnType.inlineEditFieldConstructor();this.fieldObject=new ctor(id,this.state,this.required,true,initialValue,this.extraData);this.fieldObject.label=this.label;this.fieldObject.tableCell=editDiv.parentNode;this.fieldObject.editDiv=editDiv;this.fieldObject.createEditElements();this.fieldObject.created=true;};ListFilterColumn.prototype.setError=function(errorMsg){if(this.fieldObject){this.fieldObject.setError(errorMsg);}};ListFilterColumn.prototype.getDisplayValue=function(){if(this.fieldObject){return this.fieldObject.formatValue();}};ListFilterColumn.prototype.addSaveData=function(saveData){this.fieldObject.currentValue=this.fieldObject.getValueFromEdit();saveData.fieldId=this.fieldId;saveData.columnId=this.columnId;saveData.nullable=!this.required;this.fieldObject.addSaveData(saveData);};ListFilterColumn.prototype.onDisplay=function(){var editElement=this.fieldObject.editElement;if(editElement){editElement.focus();if(this.fieldObject.saveOnEnter){editElement.onkeypress=function(e){e=getEvent(e);if(e.keyCode==KEY_ENTER){eventCancelBubble(e);document.getElementById("saveButton").click();}};}if(editElement.type=="text"){editElement.select();}}};
function ListInlineEditData(data){if((data)!=null){this.viewport=data.viewport;this.isEditable=data[InlineEditConstants.EDITABLE];this.columns={};this.currentColumn=null;this.currentRow=null;if(this.isEditable){this.isMassEditable=data[InlineEditConstants.MASS_EDITABLE];this.csrf_token=data[CSRFConstants.CSRF_TOKEN];this.entityType=data[InlineEditConstants.ENTITY_TYPE];this.isPersonAccount=data[InlineEditConstants.IS_PERSON];this.dynamicDataUrl=data[InlineEditConstants.DYNAMIC_DATA];this.nameLabel=data[InlineEditConstants.NAME_LABEL];this.editUrl=data[InlineEditConstants.SAVE_URL];if((typeof(this.editUrl)=="undefined")){this.editUrl="/_ui/common/udd/object/InlineEditListSave";}var self=this;if(this.dynamicDataUrl){XBrowser.createDynamicScript(this.dynamicDataUrl,function(){self.dynamicDataLoaded();});}this.layoutInfo=data[InlineEditConstants.LAYOUT_INFO];for(var i=0;i<data.shownColumns.length;i++){var column=data.shownColumns[i];var columnLayout=this.layoutInfo[column.fieldId];column.state=columnLayout?columnLayout[0]:"READONLY";column.required=columnLayout?columnLayout[1]:false;if(this.isPersonAccount&&column[InlineEditConstants.OVERRIDE_TYPE]){column[InlineEditConstants.OVERRIDE_TYPE]="PERSONNAME";}else{if(!this.isPersonAccount&&this.entityType=="Account"&&(column.columnId=="LastName"||column.columnId=="FirstName"||column.columnId=="Salutation")){column.state="NONE";}}this.columns[column.columnName]=self.createNewListFilterColumn(column);}if(!ListInlineEditData.dialog){ListInlineEditData.dialog=this.getNewDialog("massEdit");ListInlineEditData.dialog.displayX=true;ListInlineEditData.dialog.setWidth(520);ListInlineEditData.dialog.extraClass="inlineEditDialog";ListInlineEditData.dialog.register();}}}}ListInlineEditData.prototype.getNewDialog=function(id){return new SimpleDialog(id,false);};ListInlineEditData.prototype.createNewListFilterColumn=function(column){return new ListFilterColumn(column);};ListInlineEditData.dialog=null;ListInlineEditData.prototype.dynamicDataLoaded=function(){};ListInlineEditData.prototype.getColumnById=function(id){return this.columns[id];};ListInlineEditData.prototype.openColumn=function(rowId,columnId,initialValue){var column=this.columns[columnId];if(column&&column.state==InlineEditState.EDIT){this.currentColumn=column;this.currentRow=rowId;var numRows=this.viewport.grid.getSelectionModel().getCount();var canMassEdit=this.isMassEditable&&numRows>1;var html=[];html.push("<div class='fieldTableDiv'><table class='fieldTable' border='0'><tr class='fieldRow'><td class='labelCol'>");html.push(this.currentColumn.label);html.push("</td><td class='dataCol'>");html.push("<div id='massEditFieldDiv' class='");if(this.currentColumn.required){html.push("inlineEditRequiredDiv");}else{html.push("inlineEditDiv");}html.push("'></div></td></tr></table></div>");if(canMassEdit){html.push("<table class='fieldTable'><tr class='selectionRow'><td class='labelCol'>");html.push(LC.getLabel("MassListEdit","EditLabel"));html.push("</td><td class='dataCol'>");html.push("<div class='radio'><input type='radio' name='massOrSingleEdit' id='singleEditRadio' checked='checked'><label for='singleEditRadio'>");html.push(LC.getLabel("MassListEdit","SingleEdit"));html.push("</label></div><div class='radio'><input type='radio' name='massOrSingleEdit' id='massEditRadio'><label for='massEditRadio'>");html.push(LC.getLabel("MassListEdit","MultiEdit",numRows));html.push("</label></div></td></tr></table>");}html.push("<div class='inlineEditButtons'>");html.push("<input class='btn' type='button' value='");html.push(LC.getLabel("Buttons","save"));html.push("' id='saveButton'><input class='btn' type='button'value='");html.push(LC.getLabel("Buttons","cancel"));html.push("' id='cancelButton'>");html.push("</div>");ListInlineEditData.dialog.setContentInnerHTML(html.join(""));ListInlineEditData.dialog.setTitle(LC.getLabel("List","edit")+" "+this.currentColumn.label);var editDiv=document.getElementById("massEditFieldDiv");this.currentColumn.createEditElements(editDiv,canMassEdit?null:initialValue);var self=this;document.getElementById("saveButton").onclick=function(){self.save();};document.getElementById("cancelButton").onclick=function(){self.closeColumn();};if(column.columnType.isDate){var datePicker=document.getElementById(DatePickerIds.DOM_ID);document.getElementById(ListInlineEditData.dialog.getContentId()).appendChild(datePicker);}ListInlineEditData.dialog.show();this.currentColumn.onDisplay();}};ListInlineEditData.prototype.save=function(){var saveData={};var radio=document.getElementById("massEditRadio");if(this.isMassEditable&&radio&&radio.checked){saveData[InlineEditConstants.IDS]=this.viewport.grid.getSelectionModel().selections.keys;}else{saveData[InlineEditConstants.IDS]=this.currentRow;}saveData[CSRFConstants.CSRF_TOKEN]=this.csrf_token;saveData[InlineEditConstants.ENTITY_TYPE]=this.entityType;saveData[InlineEditConstants.NULLABLE]=!this.currentColumn.required;this.currentColumn.addSaveData(saveData);ListInlineEditData.dialog.hide();this.viewport.beforeSave();var self=this;XBrowser.postHttpResponse(UserContext.getUrl(this.editUrl),function(response){self.handleSaveResponse(response.responseText);},XBrowser.buildPost(saveData));};ListInlineEditData.prototype.closeColumn=function(){ListInlineEditData.dialog.hide();this.currentColumn=null;};ListInlineEditData.prototype.handleSaveResponse=function(responseText){var json=Util.evalAjaxServletOutput(responseText);if(json.error){var div=document.createElement("div");div.innerHTML=json.error;ListInlineEditData.dialog.getContentElement().appendChild(div);ListInlineEditData.dialog.show();}else{if(json.fieldError){this.currentColumn.setError(json.fieldError);ListInlineEditData.dialog.show();}else{if(json.errorsByRow){var numSaved=json.saved.length||0;this.createErrorWindow(numSaved,json.errorsByRow);}}}if(json.error||json.fieldError||json.errorsByRow){this.csrf_token=json[CSRFConstants.CSRF_TOKEN];}this.viewport.afterSave(json.saved,this.currentColumn);};ListInlineEditData.prototype.createErrorWindow=function(numSaved,errorsByRow){var errorWin=window.open("","errorWin","width=720,height=400,resizable=yes",false);if(errorWin){var d=errorWin.document;d.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');d.writeln("<html><head><title>"+LC.getLabel("Global","errors")+"</title>");DynamicCss.writeCss(null,d,true);d.writeln('<link rel="stylesheet" type="text/css" href="/EXT/ext-2.1/resources/css/ext-all.css" />');d.writeln('<style type="text/css">.x-grid3-col-error{white-space: normal}</style>');d.writeln('<script src="/EXT/ext-2.1/ext.js"><\/script>');var html=[];html.push('<script type="text/javascript">\n');html.push("Ext.onReady(function() {\n");html.push("    var sm = new Ext.grid.CheckboxSelectionModel();\n");html.push("    new Ext.Viewport({\n");html.push('        layout: "border",\n');html.push("        items: [{\n");html.push('            region: "north",\n');html.push('            contentEl: "topNav"\n');html.push("        }, {\n");html.push('            xtype: "grid",\n');html.push('            region: "center",\n');html.push('            id: "errorGrid",\n');html.push('            autoExpandColumn: "error",\n');html.push("            sm: sm,\n");html.push('            ctCls: "errorConsole",\n');html.push("            store: new Ext.data.JsonStore({\n");html.push('                root: "errorsByRow",\n');html.push("                fields: [\n");html.push('                    { name: "entityId", type: "string" },\n');html.push('                    { name: "name", type: "string" },\n');html.push('                    { name: "errorDesc", type: "string" }\n');html.push("                ],\n");html.push("                data: { errorsByRow: [\n");var total=0;for(var i in errorsByRow){if(total!=0){html.push(",\n");}total++;html.push('{ entityId: "');html.push(i);html.push('", name: ');html.push('"');html.push(errorsByRow[i].name.replace(/"/g,'\\"'));html.push('"');html.push(', errorDesc: "');html.push(errorsByRow[i].errorDesc.replace(/"/g,'\\"'));html.push('"}\n');}html.push("                ]}\n");html.push("            }),\n");html.push("            columns: [\n");html.push("                sm,\n");html.push('                { id: "name", dataIndex: "name", sortable: false, menuDisabled: true, width: 150, header: "');html.push(this.nameLabel);html.push('",\n renderer: function(value, metadata, record, rowIndex, colIndex, store) {\n');html.push("                    var html = [];\n");html.push("                    html.push(\"<img src='"+UserContext.getUrl("/s.gif")+"' class='errorSmall'>\");\n");html.push('                    if (value === "") {\n');html.push('                        html.push("');html.push(LC.getLabel("MassListEdit","NoName"));html.push('");\n');html.push("                    } else {\n");html.push("                        html.push(\"<a target='_blank' href='"+UserContext.getUrl("/")+'");\n');html.push("                        html.push(record.data.entityId);\n");html.push('                        html.push("\'>");\n');html.push("                        html.push(value);\n");html.push('                        html.push("</a>");\n');html.push("                    }\n");html.push('                    return html.join("");\n');html.push("                } },\n");html.push('                { id: "error", header: "');html.push(LC.getLabel("MassListEdit","ErrorColumn"));html.push('", dataIndex: "errorDesc", menuDisabled: true, sortable: false }\n');html.push("            ]\n");html.push("        }]\n");html.push("    });\n");html.push('    var grid = Ext.getCmp("errorGrid");\n');html.push('    Ext.fly("clearSelected").on("click", function(e) {\n');html.push("        var selections = grid.getSelectionModel().getSelections();\n");html.push("        for (var i = 0; i < selections.length; i++) {\n");html.push("            grid.getStore().remove(selections[i]);\n");html.push("        }\n");html.push("        grid.getView().refresh();\n");html.push("    });\n");html.push('    grid.on("cellclick", function(grid, rowIndex, columnIndex, e) {\n');html.push('        if (grid.getColumnModel().getDataIndex(columnIndex) == "name" && e.getTarget("a", 1)) {\n');html.push('            Ext.fly(grid.getView().getCell(rowIndex, columnIndex)).addClass("viewedError");\n');html.push('            Ext.fly(grid.getView().getCell(rowIndex, columnIndex + 1)).addClass("viewedError");\n');html.push("        \n");html.push("        }\n");html.push("    });\n");html.push("});\n");html.push("<\/script>");d.writeln(html.join(""));html=[];html.push('</head><body class="');html.push(this.viewport.filter.bodyClass);html.push('"><div id="topNav" class="primaryPalette errorConsoleHeader"><div class="errorSummary">\n');html.push("<img src='"+UserContext.getUrl("/s.gif")+"' class='confirmSmall'>");if(numSaved==1){html.push(LC.getLabel("MassListEdit","OneSuccessful"));}else{html.push(LC.getLabel("MassListEdit","ManySuccessful",numSaved));}html.push("</div><div class='errorSummary'><img src='"+UserContext.getUrl("/s.gif")+"' class='errorSmall'>");if(total==1){html.push(LC.getLabel("MassListEdit","OneError"));}else{html.push(LC.getLabel("MassListEdit","ManyErrors",total));}html.push("</div><div class='errorTitle'>");html.push(LC.getLabel("MassListEdit","Summary"));html.push('<input type="button" class="btn" id="clearSelected" value="');html.push(LC.getLabel("MassListEdit","ClearSelected"));html.push('"></div></div>');d.writeln(html.join(""));d.writeln("</body></html>");d.close();errorWin.focus();}};
function RelatedList(id,visibleRowCount,title,hasMore,refURL,refQS,onlySkipLink,shouldLoad,listCommonId){this.listId=id;if(visibleRowCount){this.visibleRowCount=visibleRowCount;}if(title){this.title=title;}if(typeof hasMore!="undefined"){this.listHasMore=hasMore;}if(refURL){this.refreshURL=refURL;}if(refQS){this.refreshQS=refQS;}if(onlySkipLink){this.isOnlySkipLink=onlySkipLink;}this.shouldLoad=shouldLoad;this.listCommonId=listCommonId;}RelatedList.prototype.getRelatedListNode=function(){return document.getElementById(this.listId);};RelatedList.prototype.getLinkTarget=function(){return this.listId+"_target";};RelatedList.prototype.getTitle=function(){if(!this.title){var titleNode=DomUtil.findDescendantWithTag(this.getRelatedListNode(),"H3");if((titleNode)&&(titleNode.innerHTML)){this.title=titleNode.innerHTML;}else{this.title="";}}return this.title;};RelatedList.prototype.hasMore=function(){if(this.listHasMore==null){this.listHasMore=DomUtil.findDescendantWithClassName(this.getRelatedListNode(),"pShowMore");if(!this.listHasMore){this.listHasMore=false;}}return this.listHasMore;};RelatedList.prototype.getNumberVisibleRows=function(){if(!this.visibleRowCount){var rowCount=0;DomUtil.walkDomTreeApplyingFunction(this.getRelatedListNode(),function(node){if(node.className&&node.className.indexOf&&(node.className.indexOf("dataRow")>=0&&node.className.indexOf("extraRow")<0)){rowCount++;}return null;});this.visibleRowCount=rowCount;}return this.visibleRowCount;};RelatedList.prototype.refresh=function(extraParamNames,extraParamValues){if(this.refreshURL&&this.refreshQS){qs=this.refreshQS;for(var i=0;extraParamNames&&i<extraParamNames.length;i++){if(qs.length!=0){qs=qs+"&";}qs=qs+extraParamNames[i]+"="+extraParamValues[i];}this.callRelatedListAction(null,this.refreshURL,qs);}};RelatedList.prototype.getSelectedRecordIds=function(){var selectedRecordIds=[];return selectedRecordIds;};RelatedList.prototype.getVisibleRecordIds=function(){var visibleRecordsIds=[];return visibleRecordsIds;};RelatedList.prototype.showXMore=function(numRows,extraParamId){if(window.sfdcPage&&window.sfdcPage.makeRLAjaxRequest){var opts={rowsperlist:numRows,keepPref:1};if(extraParamId){var extraParams=document.getElementById(extraParamId);if(extraParams){opts[extraParamId]=extraParams.value;}}window.sfdcPage.makeRLAjaxRequest(null,this.listId,opts);}};RelatedList.showXMore=function(listId,numRows,extraParamId){if(window.sfdcPage&&window.sfdcPage.getRelatedListById){window.sfdcPage.getRelatedListById(listId).showXMore(numRows,extraParamId);}};RelatedList.prototype.performActionAndRefreshList=function(actionUrl){XBrowser.getHttpResponse(actionUrl,function(){window.sfdcPage.makeRLAjaxRequest(null,this.listId);},function(){window.location=actionUrl;});};RelatedList.performActionAndRefreshList=function(listId,actionUrl){if(window.sfdcPage&&window.sfdcPage.getRelatedListById){window.sfdcPage.getRelatedListById(listId).performActionAndRefreshList(actionUrl);}};RelatedList.prototype.showMoreList=function(listUrl,listQS){this.callRelatedListAction(null,listUrl,listQS);};RelatedList.prototype.callRelatedListAction=function(actionUrl,listUrl,listQS,oldDomId,newDomId,resizeSidebar,onSuccessCallback){var relatedList=this;function processNewList(newDoc){if(!newDoc){return;}if(window.sfdcPage&&window.sfdcPage.hasNoRelatedList&&window.sfdcPage.hasNoRelatedList(newDoc,relatedList.listId)){listUrl=removeParam(listUrl,DynamicContent.pCOOKIE_PARAM);window.location=listUrl;}if(window.sfdcPage&&window.sfdcPage.checkActionCanceled&&window.sfdcPage.checkActionCanceled(newDoc,relatedList.listId)){return;}var oldListId=oldDomId;var newListId=newDomId;if(!oldListId){oldListId=relatedList.listId;}if(!newListId){newListId=relatedList.listId;}var oldList=getElementByIdCSWithDoc(document,oldListId);var newList=getElementByIdCSWithDoc(newDoc,newListId);var panel=sfdcPage.relatedListPanel;if(!oldList||!newList){return;}if(XBrowser.userAgent.isIE||XBrowser.userAgent.isSafari||XBrowser.userAgent.isOpera){oldList.innerHTML=newList.innerHTML;if(window.sfdcPage&&window.sfdcPage.evalScripts){window.sfdcPage.evalScripts(oldList);}}else{var tempRL=document.createElement(oldList.tagName);tempRL.style.display="none";var b=document.getElementsByTagName("body")[0];b.appendChild(tempRL);oldList.innerHTML="";tempRL.innerHTML=newList.innerHTML;if(window.sfdcPage&&window.sfdcPage.evalScripts){window.sfdcPage.evalScripts(tempRL);}while(tempRL.firstChild){oldList.appendChild(tempRL.removeChild(tempRL.firstChild));}b.removeChild(tempRL);}if(window.sfdcPage&&window.sfdcPage.hook_postRelatedListActionUpdate){window.sfdcPage.hook_postRelatedListActionUpdate(listUrl);}if(oldList.id!=newListId){oldList.id=newListId;}relatedList.visibleRowCount=null;relatedList.listHasMore=null;if(panel){var buf=[];var panelList=panel.getIFrameNode().contentWindow.document.getElementById(relatedList.listId);var linkletNode=document.getElementById(panel.getLinkId(relatedList.listId));if(panelList&&panelList.innerHTML){panelList.innerHTML=newList.innerHTML;panel.fixContent(panelList);if(linkletNode&&linkletNode.className&&(linkletNode.className.indexOf("linkletOn")>-1)){panel.showRL(relatedList.listId,true);}}if(linkletNode){buf.push('<span class="listTitle">');buf.push(relatedList.getTitle());buf.push(panel.getCountIndicator(relatedList));buf.push("</span>");linkletNode.innerHTML=buf.join("");}}if(resizeSidebar){if(Sidebar.prototype.theSidebar){Sidebar.prototype.theSidebar.sizeToBody();Sidebar.prototype.theSidebar.sizeBodyToSidebarNoCheck();}}if(onSuccessCallback){onSuccessCallback();}if(typeof Sfdc!="undefined"&&typeof Sfdc.SideTabs!="undefined"&&typeof Sfdc.SideTabs.refreshDDItemTitles!="undefined"){Sfdc.SideTabs.refreshDDItemTitles([relatedList]);}}makeActionRequest(actionUrl,listUrl,listQS,processNewList);};
if(window.Ext&&window.Ext.grid){Ext.ns("Sfdc","Sfdc.grid");Sfdc.grid.GridView=Ext.extend(Ext.grid.GridView,{sortState:{field:null,dir:null},onRowSelect:function(row){var recordId=this.grid.store.getAt(row).id;var checkbox=getElementByIdCS(recordId);if(checkbox){checkbox.checked=true;updateToggleAllBox(checkbox.form,"ids");}this.addRowClass(row,"x-grid3-row-selected");this.grid.viewport.paginator.selectedOnThisPage++;},onRowDeselect:function(row){var recordId=this.grid.store.getAt(row).id;var checkbox=getElementByIdCS(recordId);if(checkbox){checkbox.checked=false;updateToggleAllBox(checkbox.form,"ids");}this.removeRowClass(row,"x-grid3-row-selected");this.grid.viewport.paginator.selectedOnThisPage--;},initTemplates:function(){var ts=this.templates||{};if(!ts.master){ts.master=new Ext.Template('<div class="x-grid3" hidefocus="true">','<div class="x-grid3-viewport">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</div>',"</div>");}if(!ts.header){ts.header=new Ext.Template('<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">','<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',"</table>");}if(!ts.hcell){ts.hcell=new Ext.Template('<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" style="{istyle}">',this.grid.enableHdMenu?'<a class="x-grid3-hd-btn" href="#"></a>':"",'{value}<img class="x-grid3-sort-icon" src="',Ext.BLANK_IMAGE_URL,'" />',"</div></td>");}if(!ts.body){ts.body=new Ext.Template("{rows}");}if(!ts.row){ts.row=new Ext.Template('<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',"<tbody><tr>{cells}</tr>",(this.enableRowBody?'<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>':""),"</tbody></table></div>");}if(!ts.cell){ts.cell=new Ext.Template('<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>','<div class="x-grid3-cell-inner x-grid3-col-{id}" id="{domId}" {attr}>{value}</div>',"</td>");}for(var k in ts){var t=ts[k];if(t&&typeof t.compile=="function"&&!t.compiled){t.disableFormats=true;t.compile();}}this.templates=ts;this.tdClass="x-grid3-cell";this.cellSelector="td.x-grid3-cell";this.hdCls="x-grid3-hd";this.rowSelector="div.x-grid3-row";this.colRe=new RegExp("x-grid3-td-([^\\s]+)","");},doRender:function(cs,rs,ds,startRow,colCount,stripe){var ts=this.templates,ct=ts.cell,rt=ts.row,last=colCount-1;var tstyle="width:"+this.getTotalWidth()+";";var buf=[],cb,c,p={},rp={tstyle:tstyle},r;for(var j=0,len=rs.length;j<len;j++){r=rs[j];cb=[];var rowIndex=(j+startRow);for(var i=0;i<colCount;i++){c=cs[i];p.domId=r.id+"_"+c.id;p.id=c.id;p.css=i==0?"x-grid3-cell-first ":(i==last?"x-grid3-cell-last ":"");p.attr=p.cellAttr="";p.value=c.renderer(r.data[c.name],p,r,rowIndex,i,ds);p.style=c.style;if(p.value==undefined||p.value===""){p.value="&#160;";}if(r.dirty&&typeof r.modified[c.name]!=="undefined"){p.css+=" x-grid3-dirty-cell";}cb[cb.length]=ct.apply(p);}var alt=[];if(stripe&&((rowIndex+1)%2==0)){alt[0]="x-grid3-row-alt";}if(r.dirty){alt[1]=" x-grid3-dirty-row";}rp.cols=colCount;if(this.getRowClass){alt[2]=this.getRowClass(r,rowIndex,rp,ds);}rp.alt=alt.join(" ");rp.cells=cb.join("");buf[buf.length]=rt.apply(rp);}return buf.join("");},getColumnStyle:function(col,isHeader){return Sfdc.grid.GridView.superclass.getColumnStyle.call(this,col,false);},sizeColumnToContent:function(colIndex){var maxwidth=0;var extra=8;var rows=this.getRows().length;for(var i=0;i<rows;i++){var cellChild=this.getCell(i,colIndex).firstChild;var w=cellChild.scrollWidth;if(w==cellChild.clientWidth){continue;}if(w>maxwidth){maxwidth=w;}}if(maxwidth==0){return;}this.grid.getColumnModel().setColumnWidth(colIndex,maxwidth+extra);}});Sfdc.grid.CheckboxSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,{header:"<input type='checkbox' id='allBox' value='' onclick='return false'/>",width:20,sortable:false,fixed:true,dataIndex:"",id:"checkbox",renderer:function(v,p,record){var html=[];html.push("<input id='");html.push(record.id);html.push("' value='");html.push(record.id);html.push("'");html.push(" type='checkbox'");html.push(" class='checkbox'");html.push(" name='ids'");html.push(" onclick='return false;'/>");return html.join("");},initEvents:function(){Sfdc.grid.CheckboxSelectionModel.superclass.initEvents.call(this);this.grid.on("render",function(){var view=this.grid.getView();view.mainBody.on("mousedown",this.onMouseDown,this);Ext.fly(view.innerHd).on("mousedown",this.onHdMouseDown,this);},this);this.on("beforerowselect",this.onBeforeRowSelect,this);},maxSelections:200,selectRow:function(index,keepExisting,preventViewNotify){if(this.locked||(index<0||index>=this.grid.store.getCount())){return false;}if(this.isSelected(index)){return true;}var r=this.grid.store.getAt(index);if(r&&this.fireEvent("beforerowselect",this,index,keepExisting,r)!==false){if(!keepExisting||this.singleSelect){this.clearSelections();}this.selections.add(r);this.last=this.lastActive=index;if(!preventViewNotify){this.grid.getView().onRowSelect(index);}this.fireEvent("rowselect",this,index,r);this.fireEvent("selectionchange",this);this.grid.viewport.paginator.setSelectCount(this.selections.length);}else{return false;}return true;},deselectRow:function(index,preventViewNotify){if(this.locked||!this.isSelected(index)){return;}this.last=index;var r=this.grid.store.getAt(index);if(r){this.selections.removeKey(r.id);if(!preventViewNotify){this.grid.getView().onRowDeselect(index);}this.fireEvent("rowdeselect",this,index,r);this.fireEvent("selectionchange",this);this.grid.viewport.paginator.setSelectCount(this.selections.length);}},selectRows:function(rows,keepExisting){if(!keepExisting){this.clearSelections();}for(var i=0,len=rows.length;i<len;i++){if(!this.selectRow(rows[i],true)){break;}}},selectRange:function(startRow,endRow,keepExisting){if(this.locked){return;}if(!keepExisting){this.clearSelections();}if(startRow<=endRow){for(var i=startRow;i<=endRow;i++){if(!this.selectRow(i,true)){break;}}}else{for(var i=startRow;i>=endRow;i--){if(!this.selectRow(i,true)){break;}}}},deselectRange:function(startRow,endRow,preventViewNotify){if(this.locked){return;}if(startRow<=endRow){for(var i=startRow;i<=endRow;i++){this.deselectRow(i,preventViewNotify);}}else{for(var i=startRow;i>=endRow;i--){this.deselectRow(i,preventViewNotify);}}},clearAllSelections:function(){this.clearSelections();this.selections.clear();this.grid.viewport.paginator.setSelectCount(0);this.grid.viewport.paginator.selectedOnThisPage=0;},clearSelections:function(){for(var i=0,len=this.grid.store.getCount();i<len;i++){this.deselectRow(i);}this.last=false;},selectAll:function(){if(this.locked){return;}for(var i=0,len=this.grid.store.getCount();i<len;i++){if(!this.selectRow(i,true)){break;}}},onBeforeRowSelect:function(sm,index,keepExisting,r){if(this.selections.length>=this.maxSelections){alert(LC.getLabel("List","selectionLimit",this.maxSelections));return false;}},handleMouseDown:function(g,rowIndex,e){return;},onEditorKey:function(field,e){return;},onMouseDown:function(e,t){if(e.button===0&&t.className=="checkbox"){e.stopEvent();var row=e.getTarget(".x-grid3-row");if(row){var index=row.rowIndex;if(e.shiftKey&&this.last!==false){var last=this.last;if(this.isSelected(last)){this.selectRange(last,index,true);}else{this.deselectRange(last,index);}this.last=last;}else{if(this.isSelected(index)){this.deselectRow(index);}else{this.selectRow(index,true);}}}}},onHdMouseDown:function(e,t){if(e.button===0){if(t.id=="allBox"){e.stopEvent();if(t.checked){this.clearSelections();}else{this.selectAll();}}}},onRefresh:function(){var all=getElementByIdCS("allBox");if(all){all.checked=false;}var ds=this.grid.store,index;var s=this.getSelections();if(this.grid.viewport.paginator){this.grid.viewport.paginator.selectedOnThisPage=0;}var offPageHTML=[];for(var i=0,len=s.length;i<len;i++){var r=s[i];if((index=ds.indexOfId(r.id))!=-1){this.grid.getView().onRowSelect(index);}else{offPageHTML.push("<input type='hidden' name='ids' value='");offPageHTML.push(s[i].id);offPageHTML.push("'/>");}}this.grid.viewport.offPageIds.innerHTML=offPageHTML.join("");if(s.length!=this.selections.getCount()){this.fireEvent("selectionchange",this);}this.last=false;if(this.grid.viewport.paginator){this.grid.viewport.paginator.draw(this.grid.viewport.paginator.totalRecords===0);}}});}
var ActivityReminder={};ActivityReminder._REMINDER_COOKIE="reminderCookie";ActivityReminder._REMINDER_INTERVAL=5000;ActivityReminder._LOCK_COOKIE="reminderLockCookie";ActivityReminder._MAX_COOKIE_LENGTH=4096;ActivityReminder.initialize=function(popupSchedule,isPopup,isRefresh){ActivityReminder._isPopup=isPopup;ActivityReminder._launched=new Date().getTime();ActivityReminder._currentSchedule=popupSchedule;ActivityReminder._checkScheduleUpdates();if(ActivityReminder._isPopup){if(!isRefresh){ActivityReminder._isBlur=false;addEvent(window,"focus",ActivityReminder._wasFocused,false);addEvent(window,"blur",ActivityReminder._wasBlured,false);setTimeout("ActivityReminder._pseudoFlash()",500);}ActivityReminder._popupCountdown();ActivityReminder._setupMeetingSummary();ActivityReminder._setupSnoozeDismiss();ActivityReminder._updateSchedule();ActivityReminder._closeIfEmpty();window.onresize=ActivityReminder._resizeToFitHorizontalChange;ActivityReminder._resizeToFitHorizontal();updateToggleAllBox(document.forms.reminder,"ids");}};ActivityReminder._checkScheduleUpdates=function(){var rc=getCookie(ActivityReminder._REMINDER_COOKIE);if(rc){ActivityReminder._currentSchedule=rc.split(",");setTimeout("deleteCookie(ActivityReminder._REMINDER_COOKIE)",ActivityReminder._REMINDER_INTERVAL);}var now=new Date().getTime();var anyScheduled=false;var kept=new Array();for(var i=0;i<ActivityReminder._currentSchedule.length;i++){if(Number(ActivityReminder._currentSchedule[i])<=(now+ActivityReminder._REMINDER_INTERVAL*2)){if(!anyScheduled){ActivityReminder._schedule(ActivityReminder._currentSchedule[i]);anyScheduled=true;}}else{kept.push(ActivityReminder._currentSchedule[i]);}}ActivityReminder._currentSchedule=kept;setTimeout("ActivityReminder._checkScheduleUpdates()",ActivityReminder._REMINDER_INTERVAL);};ActivityReminder._schedule=function(time){var milliseconds=Number(time)-new Date().getTime();if(milliseconds<2000){milliseconds=2000;}if(ActivityReminder._isPopup){milliseconds+=10000;}var timeSinceStart=Number(time)-ActivityReminder._launched;if(!ActivityReminder._isPopup&&timeSinceStart<=(-2*60*60*1000)){setTimeout("ActivityReminder._showPopup(false)",milliseconds);}else{setTimeout("ActivityReminder._showPopupIfRequired()",milliseconds);}};ActivityReminder._updateSchedule=function(){var scheduleCookieVal=ActivityReminder._currentSchedule.join(",");var dieDate=new Date(new Date().getTime()+ActivityReminder._REMINDER_INTERVAL*2);if(scheduleCookieVal.length<=ActivityReminder._MAX_COOKIE_LENGTH){setCookie(ActivityReminder._REMINDER_COOKIE,scheduleCookieVal,dieDate);}};ActivityReminder._showPopupIfRequired=function(){var fn=function(responseStr){var txt=responseStr.indexOf(ActivityReminderConstants.REMINDERS_OK);if(txt<0){txt=responseStr.indexOf(ActivityReminderConstants.REMINDERS_NONE);if(txt<0){ActivityReminder._showPopup();}}else{ActivityReminder._showPopup();}};var at=new Date().getTime();makeAjaxRequest(UrlMap.convertClassNameToUrl(ActivityReminderRefreshPage.pCLASS_NAME)+"?at="+at,fn);};ActivityReminder._showPopup=function(isTest){var rc=getCookie(ActivityReminder._LOCK_COOKIE);if(rc){return;}var dieDate=new Date(new Date().getTime()+5000);setCookie(ActivityReminder._LOCK_COOKIE,"shown",dieDate);var locval=isFirefox?"yes":"no";var at=new Date().getTime();var teststr=isTest==true?"&test=1":"";var useScrollbars=(isNetscape&&!isIE)?"yes":"no";var height=320;if(isNetscape&&isIE){height+=40;}var parentWin=window.parent;var win=parentWin.open(UrlMap.convertClassNameToUrl(ActivityReminderPage.pCLASS_NAME)+"?at="+at+teststr,"Reminder","width=450,height="+height+",status=no,location="+locval+",dependent=no,resizable=yes,toolbar=no,directories=no,menubar=no,scrollbars="+useScrollbars,false);var opened=win&&!win.closed;if(isTest&&!opened){alert(LC.getLabel("Page_ActivityReminder","popup_blocked"));return;}if(opened){win.focus();}};ActivityReminder._popupCountdown=function(){var now=new Date().getTime();for(var i=0;;i++){var el=document.getElementById(ActivityReminderConstants.DUE_MINUTES_ID+i);if(!el){break;}var time=el.getAttribute(ActivityReminderConstants.DUE_TIME_ATTR);if(time!=0){var away=time-now;ActivityReminder._updateTime(el,away);}}ActivityReminder._enableSnoozeOptions();setTimeout("ActivityReminder._popupCountdown()",30000);};ActivityReminder._updateTime=function(el,awayMillis){var awayMins=Math.round(awayMillis/(1000*60));var textNode=el.firstChild;var overDue;if(awayMins<0){overDue=true;awayMins=-awayMins;}else{overDue=false;}var msg=ActivityReminder._formatDuration(awayMins,overDue);if(overDue){msg=LC.getLabel("Page_ReminderSettings","overdue",msg);}textNode.nodeValue=msg;};ActivityReminder._formatDuration=function(awayMins,overDue){if(awayMins>=60){var awayHours=overDue?Math.floor(awayMins/60):Math.ceil(awayMins/60);if(awayHours>=24){var awayDays=Math.floor(awayHours/24);if(awayDays==1){return LC.getLabel("Page_ReminderSettings","day",awayDays);}else{return LC.getLabel("Page_ReminderSettings","days",awayDays);}}else{if(awayHours==1){return LC.getLabel("Page_ReminderSettings","hour",awayHours);}else{return LC.getLabel("Page_ReminderSettings","hours",awayHours);}}}else{if(awayMins==1){return LC.getLabel("Page_ReminderSettings","minute",awayMins);}else{return LC.getLabel("Page_ReminderSettings","minutes",awayMins);}}};ActivityReminder.showLink=function(url){ActivityReminder._stopFlash=true;var openerClosed=true;try{openerClosed=!window.opener||window.opener.closed||window.opener==window;}catch(e){}if(openerClosed){window.open(url,null,"",false);}else{var mainFrame=window.opener.document.getElementById("mainFrame");if(mainFrame&&mainFrame.tagName=="IFRAME"){mainFrame.src=url+"?"+Desktop.IS_DESKTOP+"=mn";}else{window.opener.location=url;}}};ActivityReminder._closeIfEmpty=function(){var ct=0;for(var i=0;;i++){var item=document.getElementById("ids"+i);if(item){ct++;}else{break;}}if(!ct){setTimeout("window.close()",10);}};ActivityReminder._setupMeetingSummary=function(){var r=getElementsByClassName("dataRow");for(rownum in r){var row=r[rownum];var makeHandler=function(rn){return function(event){eventCancelBubble(event);ActivityReminder._displayMeeting(rn);};};addEvent(row,"mouseover",makeHandler(rownum));}var reminderForm=document.getElementById(ActivityReminderConstants.REMINDER_ID);var defaultSelector=function(event){ActivityReminder._displayMeeting();};addEvent(reminderForm,"mouseover",defaultSelector);ActivityReminder._displayMeeting();};ActivityReminder._displayMeeting=function(rownum){if(typeof rownum=="undefined"){for(var i=0;;i++){var sel=document.getElementById("ids"+i);if(!sel){rownum=0;break;}if(sel.checked){rownum=i;break;}}}for(var i=0;;i++){var summary=document.getElementById(ActivityReminderConstants.SUMMARY_ID+i);if(!summary){break;}summary.style.display=i==rownum?"block":"none";}};ActivityReminder._setupSnoozeDismiss=function(){for(var i=0;;i++){var sel=document.getElementById("ids"+i);if(!sel){break;}addEvent(sel,"click",ActivityReminder._reenableSnoozeDismiss);}var allBox=document.getElementById("allBox");if(allBox){addEvent(allBox,"click",ActivityReminder._reenableSnoozeDismiss);}ActivityReminder._reenableSnoozeDismiss();};ActivityReminder.updateBrowserTime=function(){document.getElementById(ActivityReminderConstants.pSNOOZED_AT).value=new Date().getTime();};ActivityReminder._reenableSnoozeDismiss=function(){var anyChecked=false;for(var i=0;;i++){var sel=document.getElementById("ids"+i);if(!sel){break;}if(sel.checked){anyChecked=true;break;}}var btnCls=anyChecked?"btn":"btnDisabled";document.getElementById(ActivityReminderConstants.SNOOZE_ID).disabled=!anyChecked;document.getElementById(ActivityReminderConstants.SNOOZE_ID).className=btnCls;document.getElementById(ActivityReminderConstants.SNOOZE_TIME_ID).disabled=!anyChecked;document.getElementById(ActivityReminderConstants.DISMISS_ID).disabled=!anyChecked;document.getElementById(ActivityReminderConstants.DISMISS_ID).className=btnCls;ActivityReminder._enableSnoozeOptions();};ActivityReminder._enableSnoozeOptions=function(){var now=new Date().getTime();var minTimeAway;for(var i=0;;i++){var el=document.getElementById(ActivityReminderConstants.DUE_MINUTES_ID+i);if(!el){break;}var sel=document.getElementById("ids"+i);if(!sel.checked){continue;}var time=el.getAttribute(ActivityReminderConstants.DUE_TIME_ATTR);var isAllDay=el.getAttribute(ActivityReminderConstants.ALL_DAY_ATTR);var away=time-now;if(!minTimeAway||minTimeAway>away){minTimeAway=away;}if(isAllDay=="true"){minTimeAway=0;}}var snooze=document.getElementById(ActivityReminderConstants.SNOOZE_TIME_ID);var options=snooze.childNodes;var removedCurrentSelected=false;var leadOptions=[0,5,10,15];for(var i=0;i<leadOptions.length;i++){var val=leadOptions[i];var options=snooze.childNodes;var existingOption=null;for(var li=options.length-1;li>=0;li--){var option=options[li];if(option.text&&option.value==-val){existingOption=option;break;}}if((val+1.5)*60*1000<=minTimeAway){if(!existingOption){var option=document.createElement("option");var label;if(val==0){label=LC.getLabel("Page_ReminderSettings","hours_before",val);}else{label=LC.getLabel("Page_ReminderSettings","minutes_before",val);}var opttxt=document.createTextNode(label);option.appendChild(opttxt);option.value=-val;snooze.insertBefore(option,snooze.firstChild);removedCurrentSelected=true;}}else{if(existingOption){if(existingOption.selected==true){removedCurrentSelected=true;}snooze.removeChild(existingOption);}}}if(removedCurrentSelected==true){var options=snooze.childNodes;for(var i=0;i<options.length;i++){var option=options[i];if(option.text){option.selected="true";break;}}}};ActivityReminder.selectAll=function(){for(var i=0;;i++){var sel=document.getElementById("ids"+i);if(!sel){break;}sel.checked=true;}};ActivityReminder._wasFocused=function(){ActivityReminder._isBlur=false;};ActivityReminder._wasBlured=function(){ActivityReminder._isBlur=true;};ActivityReminder._pseudoFlash=function(){if(!ActivityReminder._originalTitle){ActivityReminder._originalTitle=document.title;}var flashCount=ActivityReminder._flashCount;if(!flashCount){flashCount=1;}else{flashCount++;}ActivityReminder._flashCount=flashCount;var flashLimit=isNetscape?6:12;if((ActivityReminder._isBlur!=true||ActivityReminder._stopFlash==true||isNetscape)&&ActivityReminder._flashCount>flashLimit){document.title=ActivityReminder._originalTitle;return;}if(flashCount%2==1){document.title=LC.getLabel("Page_ActivityReminder","new_flash");}else{document.title=ActivityReminder._originalTitle;}setTimeout("ActivityReminder._pseudoFlash()",500);};ActivityReminder.testPopup=function(){setTimeout("ActivityReminder._showPopup(true)",1500);};ActivityReminder._resizeToFitHorizontalChange=function(){if(!isIE){return;}if(document.documentElement.clientWidth==ActivityReminder._oldWidth){return;}ActivityReminder._oldWidth=document.documentElement.clientWidth;var els=getElementsByClassName("maxHorizontal");var clearedAny=false;for(var elnum in els){var el=els[elnum];if(el.style.width&&el.style.width!=null){el.style.width=null;clearedAny=true;}}if(clearedAny){window.setTimeout("ActivityReminder._resizeToFitHorizontal()",100);}};ActivityReminder._resizeToFitHorizontal=function(){if(isNetscape&&!isIE){var els=getElementsByClassName("maxHorizontal");var maxFoundWidth=0;for(var elnum in els){var el=els[elnum];var curWidth=el.offsetWidth;el.style.width="200px";el.style.overflow="hidden";}if(els[0]){var tbody=els[0].parentNode.parentNode.parentNode;tbody.style.height="auto";}return;}if(!isIE){return;}var relatedListEl=getElementsByClassName("bRelatedList")[0];var relatedListTableEl=getElementsByClassName("list")[0];var tableBasedOffsetWidth=relatedListTableEl.offsetWidth+4;var offsetWidth;if(relatedListEl.offsetWidth<tableBasedOffsetWidth){offsetWidth=tableBasedOffsetWidth;}else{offsetWidth=relatedListEl.offsetWidth;}var extraWidth=document.documentElement.clientWidth-offsetWidth;var minWidth=100;if(extraWidth!=0){var newWidth;var els=getElementsByClassName("maxHorizontal");var maxFoundWidth=0;for(var elnum in els){var el=els[elnum];var curWidth=el.offsetWidth;maxFoundWidth=Math.max(maxFoundWidth,curWidth);}newWidth=Math.max(minWidth,maxFoundWidth+extraWidth);for(var elnum in els){var el=els[elnum];var curWidth=el.offsetWidth;el.style.width=newWidth+"px";}}};
function ApexPage(){}ApexPage.prototype=new GenericSfdcPage();
function DetailPage(entityId){this.relatedListPanel=null;this.editMode=false;this.inlineEditData=null;this.detailButtons=[];this.editButtons=[];this.errorDiv=null;this.saving=false;this.entityId=entityId;this.scriptsToNotCopy=["/ext.js","/Chatter.js","/GuidedTour.js","/HighlightsPanel.js","/SideTabs.js"];}DetailPage.prototype=new GenericSfdcPage();DetailPage.prototype.registerRelatedListPanel=function(panelId,skipAppendOnLoad){this.relatedListPanel=new RelatedListPanel(panelId);var self=this;if(!skipAppendOnLoad){this.appendToOnloadQueue(function(){var iFrameWindow=self.relatedListPanel.getIFrameNode().contentWindow;var iFrameDoc=iFrameWindow.document;DomUtil.copyScriptsCssBodyClass(document,iFrameDoc,self.scriptsToNotCopy);iFrameDoc.body.className+=" rlHoverFrame";iFrameWindow.sfdcPage=self;},"rlHovers: Importing Scripts and CSS");}};DetailPage.prototype.getEntityId=function(){if(this.entityId){return this.entityId;}var href=window.location.href;var paths=href.split("?")[0].split("/");this.entityId=paths[paths.length-1];return this.entityId;};DetailPage.prototype.evalScripts=function(rlElement){var scriptElements=rlElement.getElementsByTagName("script");for(var ind=0;ind<scriptElements.length;ind++){var jsExpression=scriptElements[ind].innerHTML;eval(jsExpression);}};DetailPage.prototype.hasNoRelatedList=function(doc,listId){var retVal=getElementByIdCSWithDoc(doc,listId);if(!retVal){return true;}else{return false;}};DetailPage.prototype.desktopAjaxDisplayErrorInline=function(){return false;};DetailPage.prototype.hook_postRelatedListActionUpdate=function(listUrl){return;};DetailPage.prototype.getReferredDomIds=function(domId){return this.getFieldById(domId).lookupControllerIds;};DetailPage.prototype.getFieldValueById=function(domId){var field=this.getFieldById(domId);if(!field||field.state!=InlineEditState.EDIT){return undefined;}var val=field.currentValue;return val.constructor===Array?val[1]:val;};DetailPage.prototype.initInlineEdit=function(iled){this.inlineEditData=iled;if(iled.isEditable){var self=this;this.appendToOnloadQueue(function(){self.inlineEditData.init();},"Initialize inline edit");this.appendToOnloadQueue(function(){self.initializeButtons();},"Setup detail buttons");}};DetailPage.prototype.getFieldById=function(domId){if(this.inlineEditData){if(domId.search(InlineEditConstants.CELL_ID+"$")!=-1){return this.inlineEditData.getField(domId.substring(0,domId.length-InlineEditConstants.CELL_ID.length));}else{return this.inlineEditData.getField(domId);}}};DetailPage.prototype.initializeButtons=function(){var self=this;function getButtonsInCell(cellId){var cell=document.getElementById(cellId);var buttons=cell.getElementsByTagName("input");for(var i=0;i<buttons.length;i++){var button=buttons[i];if(button.type=="button"){if(button.name==InlineEditConstants.SAVE_BUTTON||button.name==InlineEditConstants.CANCEL_BUTTON){self.editButtons.push(button);}else{self.detailButtons.push(button);}}}var muttons=cell.getElementsByTagName("div");for(var i=0;i<muttons.length;i++){var mutton=muttons[i];if(mutton.className=="menuButton"){self.detailButtons.push(mutton);}}}getButtonsInCell(DetailElement.TOP_BUTTON_ROW);getButtonsInCell(DetailElement.BOTTOM_BUTTON_ROW);};DetailPage.prototype.focusOnSave=function(){this.editButtons[0].focus();};DetailPage.prototype.activateInlineEditMode=function(){if(!this.errorDiv){this.errorDiv=document.getElementById(DetailElement.DEFAULT_ERROR_DIV_ID);}this.editMode=true;for(var i=0;i<this.detailButtons.length;i++){this.detailButtons[i].style.display="none";}for(var i=0;i<this.editButtons.length;i++){this.editButtons[i].style.display="inline";}};DetailPage.prototype.deactivateInlineEditMode=function(){this.editMode=false;for(var i=0;i<this.detailButtons.length;i++){this.detailButtons[i].style.display="inline";}for(var i=0;i<this.editButtons.length;i++){this.editButtons[i].style.display="none";}this.clearError();};DetailPage.prototype.setError=function(error){if(this.saving){this.saving=false;for(var i=0;i<this.editButtons.length;i++){this.editButtons[i].className="btn";if(this.editButtons[i].name==InlineEditConstants.SAVE_BUTTON){this.editButtons[i].value=LC.getLabel("Buttons","save");}else{if(this.editButtons[i].name==InlineEditConstants.CANCEL_BUTTON){this.editButtons[i].value=LC.getLabel("Buttons","cancel");}}}}if(error){this.errorDiv.innerHTML=error;}this.errorDiv.style.display="block";};DetailPage.prototype.clearError=function(error){this.errorDiv.style.display="none";};DetailPage.prototype.refreshDetail=function(){var href=window.location.href;var i=href.indexOf("#");if(i!=-1){href=href.substring(0,i);}navigateToUrl(href,"DETAIL");};DetailPage.prototype.save=function(){if(!this.saving&&this.editMode){this.saving=true;for(var i=0;i<this.editButtons.length;i++){this.editButtons[i].className="btnDisabled";this.editButtons[i].value=LC.getLabel("Buttons","saving");}this.inlineEditData.save();}};DetailPage.prototype.revert=function(){if(!this.saving&&this.editMode){this.inlineEditData.revert();this.deactivateInlineEditMode();}};DetailPage.prototype.dblClickField=function(evt,element){var target=getEventTarget(getEvent(evt));if(target.nodeName.toLowerCase()!="a"){var field=this.getFieldById(element.id);if(field&&field.state==InlineEditState.EDIT){if(!this.editMode){this.activateInlineEditMode();}if(!this.inlineEditData.isCurrentField(field)){this.inlineEditData.openField(field);}eventCancelBubble(evt);}}};DetailPage.prototype.clickField=function(evt,element){var field=this.getFieldById(element.id);if(field&&this.inlineEditData.isCurrentField(field)){eventCancelBubble(evt);}};DetailPage.prototype.mouseOverField=function(evt,element){var field=this.getFieldById(element.id);if(field){delStyleClass(element,field.getCSSClass());addStyleClass(element,field.getCSSHoverClass());}};DetailPage.prototype.mouseOutField=function(evt,element){var field=this.getFieldById(element.id);if(field){delStyleClass(element,field.getCSSHoverClass());addStyleClass(element,field.getCSSClass());}};DetailPage.prototype.doRelatedListAjax=function(){var self=this;this.appendToOnloadQueue(function(){if(self.relatedListsById){var rlIds=[];for(var rl in self.relatedListsById){rlIds.push(rl);}self.makeRLAjaxRequest(self.getEntityId(),rlIds);}},"rlAjax: Making Ajax request for related list data");};DetailPage.prototype.makeRLAjaxRequest=function(parentId,rlIds,postData){Jiffy.mark("RL");var url=UserContext.getUrl("/_ui/common/list/RelatedListServlet");var parentId=parentId||this.getEntityId();var rlIds=rlIds||"";var postData=postData||{};postData=Util.applyIf(postData,{parentId:parentId,rlId:rlIds,retURL:window.location.pathname});var qs=new QueryString();postData=Util.applyIf(postData,qs.params);XBrowser.postHttpResponse(url,function(response){window.sfdcPage.handleRLAjaxResponse(response.responseText);},XBrowser.buildPost(postData));};DetailPage.prototype.handleRLAjaxResponse=function(responseText){Jiffy.measure("rlResponse","RL");var output;try{output=Util.evalAjaxServletOutput(responseText);}catch(e){window.location.reload();}if(output.exElem){this.handleRLAjaxException(output.exElem);return;}if(output.rls){var html=[];var changedRLs=[];for(var rl in output.rls){var rlTitle=getElementByIdCS(rl+"_title");var rlButtons=getElementsByClassName("pbButton",getElementByIdCS(rl),"td")[0];var rlBody=getElementByIdCS(rl+"_body");if(rlTitle&&rlButtons&&rlBody){if(output.rls[rl].title){rlTitle.innerHTML=output.rls[rl].title;}if(output.rls[rl].buttons){if(rlButtons.currentStyle){output.rls[rl].buttons='<span style="display:none" id="__REMOVE">.</span>'+output.rls[rl].buttons;}rlButtons.innerHTML=output.rls[rl].buttons;if(rlButtons.currentStyle){document.getElementById("__REMOVE").parentNode.removeChild(document.getElementById("__REMOVE"));}if(this.relatedListPanel&&this.relatedListPanel.getIFrameNode()){DomUtil.copyScripts(rlButtons,this.relatedListPanel.getIFrameNode().contentWindow.document,this.scriptsToNotCopy);}Util.evalScriptsUnderElement(rlButtons);}var newBody=document.createElement("div");newBody.innerHTML=output.rls[rl].content;rlBody.parentNode.replaceChild(newBody.firstChild,rlBody);newBody=null;this.relatedListsById[rl].visibleRowCount=null;this.relatedListsById[rl].listHasMore=null;this.relatedListsById[rl].shouldLoad=false;changedRLs.push(this.relatedListsById[rl]);}}if(this.relatedListPanel){this.relatedListPanel.refresh(changedRLs);if(Sidebar.prototype.theSidebar){Sidebar.prototype.theSidebar.sizeToBody(true);}}if(typeof Sfdc!="undefined"&&typeof Sfdc.SideTabs!="undefined"&&typeof Sfdc.SideTabs.refreshDDItemTitles!="undefined"){Sfdc.SideTabs.refreshDDItemTitles(changedRLs);}}if(output.devFooterHTML){var dev=document.getElementById("ajaxPlSql");if(dev){dev.innerHTML=output.devFooterHTML;}}Jiffy.measure("rlDisplay","RL");};DetailPage.prototype.handleRLAjaxException=function(exElem){var exDiv=document.createElement("div");exDiv.innerHTML=exElem;var rlDivs=getElementsByClassName("bRelatedList",document.getElementById("bodyCell"),"div");rlDivs[0].parentNode.replaceChild(exDiv,rlDivs[0]);for(var i=1;i<rlDivs.length;i++){rlDivs[i].parentNode.removeChild(rlDivs[i]);}if(this.relatedListPanel){var rlPanel=this.relatedListPanel.getHoverableLinksNode();rlPanel.parentNode.removeChild(rlPanel);}};
function EditPage(entityId){this.saved=false;this.submitButtons=[];this.originalButtonClasses=[];this.originalButtonValues=[];this.pressedButton=null;this.entityId=entityId;this.dependentLks={};this.controllerToControlledLookups={};var self=this;if(entityId!==undefined){this.appendToOnloadQueue(function(){self.initLookups();},"Initialize dependent lookups");}}EditPage.prototype=new GenericSfdcPage();EditPage.prototype.initButtons=function(buttonNames){var self=this;for(var i=0;i<buttonNames.length;i++){var elements=document.getElementsByName(buttonNames[i]);for(var j=0;j<elements.length;j++){this.submitButtons.push(elements[j]);this.originalButtonClasses.push(elements[j].className);this.originalButtonValues.push(elements[j].value);addEvent(elements[j],"click",function(e){self.pressedButton=getEventTarget(e);},false);}}};EditPage.prototype.getEntityId=function(){return this.entityId;};EditPage.prototype.getSubmitButtons=function(){return this.submitButtons;};EditPage.prototype.getFieldValueById=function(domId){var el=getElementByIdCS(domId+EditElement.pID_SUFFIX);if(!el){el=getElementByIdCS(domId);}if(el){if(el.type=="checkbox"){return el.checked?"1":"0";}else{if(hasStyleClass(el.parentNode,"dateOnlyInput")){var dateVal=el.value;if(LC.isEnglishLanguage()){if(LC.isEnglishUS()){dateVal=DateUtil.getCheckYearValue(el.value)||el.value;}else{dateVal=DateUtil.getEvaluateShortcutValue(el.value)||el.value;}}return dateVal;}}return el.value;}else{return undefined;}};EditPage.prototype.registerDependentLookup=function(domId,referredDomIds){this.dependentLks[domId]=referredDomIds;for(var i=referredDomIds.length-1;i>=0;i--){if(this.controllerToControlledLookups[referredDomIds[i]]){this.controllerToControlledLookups[referredDomIds[i]].push(domId);}else{this.controllerToControlledLookups[referredDomIds[i]]=[domId];}}};EditPage.prototype.getReferredDomIds=function(domId){return this.dependentLks[domId];};EditPage.prototype.getLookupFieldsControlledBy=function(domId){return this.controllerToControlledLookups[domId];};EditPage.prototype.initLookups=function(){for(var domId in ForeignKeyInputElement.allElements){if(ForeignKeyInputElement.allElements.hasOwnProperty(domId)){var foreignKeyInputElement=ForeignKeyInputElement.allElements[domId];foreignKeyInputElement.referredDomIds=this.getReferredDomIds(domId);foreignKeyInputElement.afterLoad();}}for(var domId in ForeignKeyInputElement.allElements){if(ForeignKeyInputElement.allElements.hasOwnProperty(domId)){ForeignKeyInputElement.allElements[domId].validateAfterLoadIfNecessary();}}};EditPage.prototype.disableSaveButtons=function(){if(this.saved){return false;}else{if(!this.pressedButton||this.pressedButton.name!=EditPageConstants.pCANCEL){this.disableButtons();}this.saved=true;return true;}};EditPage.prototype.disableButtons=function(){for(var i=0;i<this.submitButtons.length;i++){this.submitButtons[i].className="btnDisabled";this.submitButtons[i].value=LC.getLabel("Buttons","saving");}};EditPage.prototype.enableSaveButtons=function(){if(!this.saved){return false;}else{for(var i=0;i<this.submitButtons.length;i++){this.submitButtons[i].className=this.originalButtonClasses[i];this.submitButtons[i].value=this.originalButtonValues[i];}this.saved=false;return true;}};
function FormulaEditor(){}FormulaEditor.init=function(editorElementId,functionSelectionElementId,formId,validationStatusNotValidated){FormulaEditor.editorElementId=editorElementId;FormulaEditor.functionSelectionElementId=functionSelectionElementId;FormulaEditor.formId=formId;FormulaEditor.validationStatusNotValidated=validationStatusNotValidated;FormulaEditor.setFunctionInfo(FormulaEditor.getSelectedFunction());};FormulaEditor.setFunctionInfo=function(functionName){if(!functionName){return;}document.getElementById("funcFormat").innerHTML=functionNameToPrototypeMap[functionName];document.getElementById("funcExplain").innerHTML=functionNameToDescriptionMap[functionName];};FormulaEditor.getSelectedFunction=function(){functionSelectElement=document.getElementById(FormulaEditor.functionSelectionElementId);if(!functionSelectElement){return null;}return functionSelectElement.options[functionSelectElement.selectedIndex].value;};FormulaEditor.setListToCategory=function(category,categoryMap,targetId,defaultCategory,preserveFirstOption){var targetSelectElement=document.getElementById(targetId);var list=categoryMap[(category!="")?category:defaultCategory];var offset=(preserveFirstOption)?1:0;targetSelectElement.options.length=offset;if(!list){return;}for(var i=0;i<list.length;i++){targetSelectElement.options[i+offset]=list[i];}};FormulaEditor.switchMode=function(mode){if(document.getElementById("editorMode").value==mode){return;}document.getElementById("editorMode").value=mode;document.getElementById("changeEditorMode").value="1";document.getElementById(FormulaEditor.formId).submit();};FormulaEditor.formulaKeypressEventListener=function(){var validationStatus=document.getElementById("validationStatus");if(validationStatus){validationStatus.innerHTML=FormulaEditor.validationStatusNotValidated;}};FormulaEditor.registerFormulaEventListeners=function(name){setCurrentParamName(name);var editorDoc=getDoc();if(editorDoc.addEventListener){editorDoc.addEventListener("keypress",FormulaEditor.formulaKeypressEventListener,false);}else{editorDoc.onkeypress=FormulaEditor.formulaKeypressEventListener;}};FormulaEditor.insertFieldReference=function(name,fieldSelector,insertCurlyBangDelims){var value=fieldSelector.options[fieldSelector.selectedIndex].value;if(value){FormulaEditor.insertCode(name,value,insertCurlyBangDelims);fieldSelector.selectedIndex=0;}};FormulaEditor.insertCode=function(name,value,insertCurlyBangDelims){var insert;restoreSelection(document.getElementById(name));insert=(insertCurlyBangDelims&&!findDelimiters(name,"{!","}"))?"{!"+value+"}":" "+value+" ";insertTextAtSelectionInEditor(name,insert);};
function GoogleTalk(gadget,resizeBar,gadgetUrl){this.gadget=gadget;this.gadgetUrl=gadgetUrl;this.resizeBar=resizeBar;this.resizeBarOrigHeight=resizeBar.style.height;this.mouseStatus="up";this.popupWindow=function(){};this.showOnExitOverlay=true;var cookieHeight=getCookie(GoogleTalkConstants.HEIGHT_COOKIE);this.expandedHeight=cookieHeight==null||cookieHeight==0?GoogleTalkConstants.EXPANDED_HEIGHT:cookieHeight;if(this.gadget.height!=GoogleTalkConstants.COLLAPSED_HEIGHT){this.gadget.src=this.gadgetUrl;}GoogleTalk.prototype.toggle=function(hiddenLinks,shownLinks){var isExpanding=this.gadget.height==GoogleTalkConstants.COLLAPSED_HEIGHT;this.gadget.height=(isExpanding?this.expandedHeight:GoogleTalkConstants.COLLAPSED_HEIGHT);if(isExpanding){this.gadget.src=this.gadgetUrl;}else{this.gadget.src=UrlMap.getURL("BlankPage");}var expires=new Date();expires.setTime(expires.getTime()+(3650*24*60*60*1000));setCookie(GoogleTalkConstants.COLLAPSED_COOKIE,isExpanding?"0":"1",expires);if(isExpanding){shownLinks.style.display="inline";hiddenLinks.style.display="none";}else{shownLinks.style.display="none";hiddenLinks.style.display="inline";}this.resizeBar.style.display=isExpanding?"block":"none";if(typeof resizeFramesToFit!="undefined"){resizeFramesToFit();}};GoogleTalk.prototype.resize=function(e){if(this.mouseStatus=="down"){var curevent=(typeof event=="undefined"?e:event);var newPos=curevent.clientY;var newHeight=parseInt(this.curHeight+parseInt(newPos-this.curPos));newHeight=(newHeight<GoogleTalkConstants.MIN_EXPANDED_HEIGHT?GoogleTalkConstants.MIN_EXPANDED_HEIGHT:newHeight);this.gadget.height=newHeight;}};GoogleTalk.prototype.setStartDrag=function(e){var curevent=(typeof event=="undefined"?e:event);this.resizeBar.style.height="39px";var newHeight=this.gadget.height-35;this.gadget.height=newHeight>GoogleTalkConstants.MIN_EXPANDED_HEIGHT?newHeight:GoogleTalkConstants.MIN_EXPANDED_HEIGHT;this.mouseStatus="down";this.curPos=curevent.clientY;this.curHeight=parseInt(this.gadget.height);document.body.onmousemove=function(e){GoogleTalk.prototype.theGadget.resize(e);};document.body.onmouseup=function(e){GoogleTalk.prototype.theGadget.setEndDrag(e);};};GoogleTalk.prototype.setEndDrag=function(e){if(this.mouseStatus=="down"){this.mouseStatus="up";this.resizeBar.style.height=this.resizeBarOrigHeight;var expires=new Date();expires.setTime(expires.getTime()+(3650*24*60*60*1000));setCookie(GoogleTalkConstants.HEIGHT_COOKIE,this.gadget.height,expires);this.expandedHeight=this.gadget.height;}};GoogleTalk.prototype.popout=function(e){this.popupWindow=window.open(this.gadgetUrl,"gTalkPopup","toolbar=no,width=300,height=600,resizable=yes,toolbars=no,status=no,scrollbars=yes,menubar=no,directories=yes,location=yes,dependant=no",false,false);};GoogleTalk.prototype.hide=function(){this.gadget.height=0;};GoogleTalk.prototype.show=function(){this.gadget.height=this.expandedHeight;};GoogleTalk.prototype.isShown=function(){return this.gadget.height!=GoogleTalkConstants.COLLAPSED_HEIGHT;};}
function ListPage(){}ListPage.prototype=new GenericSfdcPage();
function FieldTree(rootList,formulaType,servletUrl){this.rootList=rootList;this.currentNode=FieldTree.ROOT_NODE;this.currentDepth=0;this.formulaType=formulaType;this.servletUrl=servletUrl;}FieldTree.LOADING_MARKER="__";FieldTree.ROOT_NODE=new Object();FieldTree.prototype.getCurrentList=function(){if(this.currentNode===FieldTree.ROOT_NODE){return this.rootList;}else{return this.getChildren(this.currentNode);}};FieldTree.prototype.ascend=function(depthIn){var depth=depthIn?depthIn:this.currentDepth-1;if(depthIn===0){depth=0;}if(depth>this.currentDepth){depth=this.currentDepth;}while(this.currentDepth>depth){var parent=this.currentNode;if(!parent){return;}else{if(!parent.parent){this.currentNode=FieldTree.ROOT_NODE;this.currentDepth=0;}else{this.currentNode=parent.parent;this.currentDepth--;}}}};FieldTree.prototype.handleChildrenResponse=function(response,nodeToRefresh,onLazyLoad){var result=eval(Util.evalAjaxServletOutput(response.responseText)[AjaxGetFieldTreeChildren.NODE_LIST]);nodeToRefresh.setChildren(result);if(onLazyLoad){onLazyLoad(nodeToRefresh);}};FieldTree.prototype.handleChildrenError=function(response,nodeToRefresh,onLazyLoad){nodeToRefresh.setChildren([new FieldTreeNode(FieldTree.LOADING_MARKER,true,null,LC.getLabel("Global","error"),true)]);if(onLazyLoad){onLazyLoad(nodeToRefresh);}};FieldTree.prototype.descend=function(selectedKey){var selectedNode=this.getNodeFromCurrentList(selectedKey);if(!selectedNode){return false;}if(selectedNode.isLeaf){return false;}this.currentNode=selectedNode;this.currentDepth++;return true;};FieldTree.prototype.getChildren=function(selectedNode,onLazyLoad){if(!selectedNode.isLeaf&&!selectedNode.children){message={};message[AjaxGetFieldTreeChildren.NODE_KEY]=selectedNode.getLabelToInsert(true);message[AjaxGetFieldTreeChildren.FORMULA_TYPE]=this.formulaType;var self=this;XBrowser.postHttpResponse(this.servletUrl,function(response){self.handleChildrenResponse(response,selectedNode,onLazyLoad);},XBrowser.buildPost(message),function(response){self.handleChildrenError(response,selectedNode,onLazyLoad);});selectedNode.setChildren([new FieldTreeNode(FieldTree.LOADING_MARKER,true,null,LC.getLabel("Global","loading"),true)]);}return selectedNode.children;};FieldTree.prototype.getNodeFromCurrentList=function(selectedKey){var selectedNode;var currentList=this.getCurrentList();for(var i=0;i<currentList.length;i++){if(currentList[i].key==selectedKey){selectedNode=currentList[i];break;}}return selectedNode;};FieldTree.prototype.getNodeFromListByAttr=function(list,attr,selectedKey,selectedIsLeaf){var selectedNode;for(var i=0;i<list.length;i++){if(list[i].attributes[attr]==selectedKey&&selectedIsLeaf==list[i].isLeaf){selectedNode=list[i];break;}}return selectedNode;};
function FieldTreeController(container,rootNodeList,elementName,selectId,insertCurlyBangDelims,afterInsertCallback,formulaType,servletUrl){if(container){this.tree=new FieldTree(rootNodeList,formulaType,servletUrl);this.selectId=selectId;this.selects=[document.getElementById(this.selectId+"0")];this.elementName=elementName;this.insertCurlyBangDelims=insertCurlyBangDelims;this.container=container;this.afterInsertCallback=afterInsertCallback;this.focusDepth=0;this.idPrefix="";var depthRE=/(\d+)$/;var self=this;this.handleSelectClick=function(e){var target=getEventTarget(getEvent(e));var match=depthRE.exec(target.name);if(!match){return;}var selectDepth=parseInt(match[1]);var selectedKey=target.options[target.selectedIndex].value;self.moveSelectionTo(selectDepth,selectedKey);};this.handleOnFocus=function(e){var target=getEventTarget(getEvent(e));var match=depthRE.exec(target.name);if(!match){return;}self.focusDepth=parseInt(match[1]);};addEvent(this.container.firstChild.firstChild,"change",this.handleSelectClick,false);addEvent(this.selects[0],"focus",this.handleOnFocus,false);this.hideSelects();}}FieldTreeController.prototype.setScrollDiv=function(div){this.scrollDiv=div;};FieldTreeController.prototype.ajaxRefreshNode=function(refreshedNode){if(refreshedNode===this.tree.currentNode){this.eraseSelects(this.tree.currentDepth);this.buildSelect(refreshedNode.children,this.tree.currentDepth);this.scrollRight();}};FieldTreeController.prototype.moveSelectionTo=function(selectDepth,selectedKey){if(!selectedKey){return;}if(selectDepth<this.tree.currentDepth){this.tree.ascend(selectDepth);}var selectedNode=this.tree.getNodeFromCurrentList(selectedKey);if(!(selectedNode.isLeaf)){var self=this;this.buildSelect(this.tree.getChildren(selectedNode,function(refreshedNode){self.ajaxRefreshNode(refreshedNode);}),selectDepth+1);this.tree.descend(selectedNode.key);this.scrollRight();}else{this.buildInsert(selectDepth+1,selectedNode);this.scrollRight();}};FieldTreeController.prototype.focusTop=function(){var topSelect=this.selects[0];if(topSelect){topSelect.focus();}};FieldTreeController.prototype.reset=function(){this.tree.ascend(0);this.selects=[document.getElementById(this.selectId+"0")];var topSelect=this.selects[0];if(topSelect.options.length>0){topSelect.selectedIndex=0;this.moveSelectionTo(0,topSelect.options[0].value);}};FieldTreeController.prototype.buildSelect=function(nodeList,index){var map=[];for(var i=0;i<nodeList.length;i++){var nodeLabel=nodeList[i].isLeaf?escapeHTML(nodeList[i].labelName):(escapeHTML(nodeList[i].labelName)+" &gt;");map[i]=[nodeLabel,nodeList[i].key];}this.eraseSelects(index);var attributeMap={size:"9",name:this.selectId+this.selects.length,"class":"fieldTreeSelect"};var selectHTML=Util.createDynamicSelect(attributeMap,map,false);var wrapper=document.createElement("TD");wrapper.id=this.idPrefix+"selectWrapper"+this.selects.length;wrapper.className="selectWrapper";this.container.appendChild(wrapper);wrapper.innerHTML=selectHTML;wrapper.isDynamicSelect=true;this.selects.push(wrapper.firstChild);addEvent(this.selects[index],"change",this.handleSelectClick,false);addEvent(this.selects[index],"focus",this.handleOnFocus,false);};FieldTreeController.prototype.getInsertDisplayHTML=function(selectedNode){return escapeHTML(selectedNode.getLabelToInsert());};FieldTreeController.prototype.getAttributesDisplayHTML=function(selectedNode){return selectedNode.getAttributesForInsert();};FieldTreeController.prototype.buildInsert=function(index,selectedNode){var insertInfoHTML=LC.getLabel("NewFormulaEditor","SelectedInfo");var insertText=LC.getLabel("Buttons","ins");var insertButtonHTML="<input type='button' id='"+this.idPrefix+"fieldInsertButton' name='insertButton' class='btn' value='"+insertText+"' />";var self=this;if(this.selects[index]){this.eraseSelects(index);}var insertBox=document.createElement("TD");this.container.appendChild(insertBox);insertBox.id=this.idPrefix+"insertBox";insertBox.className="insertBox";var wrapper=document.createElement("SPAN");wrapper.id=this.idPrefix+"insertWrapperInfo"+this.selects.length;insertBox.appendChild(wrapper);wrapper.innerHTML=insertInfoHTML;wrapper.isDynamicSelect=false;wrapper.className="insertWrapperInfo";wrapper=document.createElement("SPAN");wrapper.id=this.idPrefix+"insertWrapperString"+this.selects.length;insertBox.appendChild(wrapper);wrapper.innerHTML=this.getInsertDisplayHTML(selectedNode);wrapper.isDynamicSelect=true;wrapper.className="insertWrapperString";this.selects.push(wrapper.firstChild);var attributesHTML=this.getAttributesDisplayHTML(selectedNode);if(attributesHTML){wrapper=document.createElement("SPAN");wrapper.id=this.idPrefix+"insertWrapperAttributes"+this.selects.length;insertBox.appendChild(wrapper);wrapper.innerHTML=attributesHTML;wrapper.isDynamicSelect=false;wrapper.className="insertWrapperAttributes";}wrapper=document.createElement("SPAN");wrapper.id=this.idPrefix+"insertWrapperButton"+this.selects.length;insertBox.appendChild(wrapper);wrapper.innerHTML=insertButtonHTML;wrapper.isDynamicSelect=false;wrapper.className="insertWrapperButton";addEvent(document.getElementById(this.idPrefix+"fieldInsertButton"),"click",function(){self.insertCode(self.elementName,selectedNode,self.insertCurlyBangDelims);},false);};FieldTreeController.prototype.eraseSelects=function(index){var i=this.selects.length;while(i>index){i--;var element=this.selects[i].parentNode;while(element.nodeName!="TD"){element=element.parentNode;}this.container.removeChild(element);this.selects.pop();}};FieldTreeController.prototype.insertCode=function(elementName,selectedNode,insertCurlyBangDelims){FormulaEditor.insertCode(elementName,selectedNode.getLabelToInsert(),insertCurlyBangDelims);if(this.afterInsertCallback){this.afterInsertCallback();}};FieldTreeController.prototype.scrollRight=function(){var container=this.scrollDiv||this.container;if(container.clientWidth==0){container=container.parentNode;}container.scrollLeft=container.scrollWidth-container.clientWidth;};FieldTreeController.prototype.showSelects=function(){for(var i=0;i<this.selects.length;i++){var element=this.selects[i];if(element!=null&&element.nodeName=="SELECT"){element.style.display="inline";}}};FieldTreeController.prototype.hideSelects=function(){for(var i=0;i<this.selects.length;i++){var element=this.selects[i];if(element!=null&&element.nodeName=="SELECT"){element.style.display="none";}}};FieldTreeController.prototype.switchFocus=function(reverse){this.focusDepth=(reverse)?this.focusDepth-1:this.focusDepth+1;if(this.focusDepth<0){this.focusDepth=this.selects.length;}if(this.focusDepth>this.selects.length){this.focusDepth=0;}if(this.focusDepth<this.selects.length){var element=this.selects[this.focusDepth];if(element.nodeName=="SELECT"){element=element.focus();}else{if(this.focusDepth===this.selects.length-1){document.getElementById(this.idPrefix+"fieldInsertButton").focus();}}}else{document.getElementById(this.idPrefix+"fieldSelectClose").focus();}};
function FieldTreeNode(key,isLeaf,children,labelName,showLabel,attributes){this.key=key;this.isLeaf=isLeaf;this.labelName=labelName;this.showLabel=showLabel;this.attributes=attributes;if(children){this.setChildren(children);}}FieldTreeNode.prototype.setChildren=function(children){this.isLeaf=false;this.children=children;for(var i=0;i<children.length;i++){children[i].parent=this;}};FieldTreeNode.prototype.getLabelToInsert=function(ignoreShowLabel){if(!(this.parent&&(this.parent.showLabel||ignoreShowLabel))){return this.key;}return this.parent.getLabelToInsert(ignoreShowLabel)+"."+this.key;};FieldTreeNode.prototype.getLabelNameToInsert=function(ignoreShowLabel){if(!(this.parent&&(this.parent.showLabel||ignoreShowLabel))){return this.labelName;}return LC.getLabel("Global","labelWithColon",this.parent.getLabelNameToInsert(ignoreShowLabel))+" "+this.labelName;};FieldTreeNode.prototype.getAttributeToInsert=function(attrKey,ignoreShowLabel){if(!(this.parent&&(this.parent.showLabel||ignoreShowLabel))){return this.attributes[attrKey];}return this.parent.getAttributeToInsert(attrKey,ignoreShowLabel)+"."+this.attributes[attrKey];};FieldTreeNode.prototype.getAttributesForInsert=function(){var attributeArr=["<table class='fieldPickerAttributeTable'>"];this.addAttributeRowToTable(attributeArr,LC.getLabel("NewFormulaEditor","AttributeFieldType"),this.attributes.type);this.addAttributeRowToTable(attributeArr,LC.getLabel("NewFormulaEditor","ApiName"),this.getLabelToInsert());attributeArr.push("</table>");return attributeArr.join("");};FieldTreeNode.prototype.addAttributeRowToTable=function(arr,label,value){arr.push("<tr><td class='fieldPickerAttributeCategory'>");arr.push(LC.getLabel("Global","labelWithColonNSpace",label));arr.push(value);arr.push("</td></tr>");};
function OverviewPage(){}OverviewPage.prototype=new GenericSfdcPage();
function OwnerChangePage(entityId){this.entityId=entityId;var self=this;if(entityId!==undefined){this.appendToOnloadQueue(function(){self.initAutoComplete();},"Add AutoComplete");}}OwnerChangePage.prototype=new GenericSfdcPage();OwnerChangePage.prototype.getEntityId=function(){return this.entityId;};OwnerChangePage.prototype.getReferredDomIds=function(domId){return[];};OwnerChangePage.prototype.initAutoComplete=function(){for(var domId in ForeignKeyInputElement.allElements){if(ForeignKeyInputElement.allElements.hasOwnProperty(domId)){var foreignKeyInputElement=ForeignKeyInputElement.allElements[domId];foreignKeyInputElement.referredDomIds=[];foreignKeyInputElement.initAutoComplete();}}};
var SIDEBAR_DIV_WIDTH=216;var SIDEBAR_DIV_EDGE=19;var SIDEBAR_DIV_SPACE=0;var SIDEBAR_RIGHT_INC=20;var SIDEBAR_TIMESTEP=8;var SIDEBAR_OUT_DELAY=500;var SIDEBAR_IN_DELAY=100;var SIDEBAR_BORDER_WIDTH=0;function Sidebar(sidebarDiv,enableCollapse,isPinned){this.div=sidebarDiv;this.inOutBox=document.getElementById(SidebarConstants.HANDLE_ID);this.handle=document.getElementById(SidebarConstants.PIN_INDICATOR_ID);this.handle2=document.getElementById(SidebarConstants.PIN2_INDICATOR_ID);this.pinned=isPinned;if(!(this.inOutBox&&this.handle&&this.handle2)){return;}this.openHandleRE=/\bopen\b/;this.sidebarVisibleClass="sidebarDivVisible";this.sidebarCollapsedClass="sidebarDivCollapsed";this.sidebarVisibleContentClass="oRightSidebarVisible";this.sidebarCollapsedContentClass="oRightSidebarCollapsed";this.mainBodyContentDiv=document.getElementById(BodyLayout.BODY_TABLE_ID)||document.getElementById(BodyLayout.NO_TABLE_BODY_ID);this.heightPad=(UserContext&&UserContext.uiSkin==UiSkin.ALOHA.apiValue)?10:0;var self=this;if(!enableCollapse){deleteCookie(SidebarConstants.SIDEBAR_PINNED_COOKIE);}if((enableCollapse)&&(!this.pinned)&&(!document.getElementById(BodyLayout.BODY_TABLE_ID))&&(document.body)){document.body.className=document.body.className+" hiddenSidebar";}this.setUpSizeCheckerInterval();if((!enableCollapse)||(!document.getElementById(BodyLayout.BODY_TABLE_ID))){this.handle.style.display="none";this.handle2.style.display="none";this.sizeBodyToSidebar();this.sizeToBody();return null;}this.div.className="collapsible";var outDelay=-1;var locked=false;var leftStr=LC.isRtlPage()?"right":"left";this.mover=new Fader(this.div,function(object,currVal){return currVal<=-1*(SIDEBAR_DIV_WIDTH-SIDEBAR_DIV_EDGE);},function(object,currVal){return currVal>=0;},SIDEBAR_TIMESTEP,function(currVal,sign){return currVal+=sign*SIDEBAR_RIGHT_INC;},function(object,nextVal){object.setStyle(leftStr,nextVal+"px");},0,function(object){object.style[leftStr]=(-1*(SIDEBAR_DIV_WIDTH-SIDEBAR_DIV_EDGE))+"px";return -1*(SIDEBAR_DIV_WIDTH-SIDEBAR_DIV_EDGE);},function(object){object.style[leftStr]="0px";return 0;});this.handleInOutClick=function(e){if(!locked){self.pin();}};this.handleDocumentKeyDown=function(e){var evt=getEvent(e);var pos=self.mover.getPosition();if(evt.altKey&&String.fromCharCode(evt.keyCode)==="S"){var searchBox=document.getElementById(SidebarConstants.pSEARCH_SIDEBAR_STR);if(searchBox){searchBox.focus();searchBox.select();}if(!locked){self.pin();}}};this.addHoverClass=function(e){addStyleClass(self.inOutBox,"hover");addStyleClass(self.handle,"hover");addStyleClass(self.handle2,"hover");};this.removeHoverClass=function(e){delStyleClass(self.inOutBox,"hover");delStyleClass(self.handle,"hover");delStyleClass(self.handle2,"hover");};this.lock=function(){locked=true;};this.unlock=function(){locked=false;};this.swapClasses=function(element,oldClass,newClass){if(!element){return;}delStyleClass(element,oldClass);addStyleClass(element,newClass);};this.init();}Sidebar.prototype.setUpSizeCheckerInterval=function(){var self=this;var content=this.mainBodyContentDiv;if(content){var lastBodyHeight=content.offsetHeight;setInterval(function(){self.sizeBodyToSidebar();if(content.offsetHeight!=lastBodyHeight){self.sizeToBody();lastBodyHeight=content.offsetHeight;}},750);}};Sidebar.prototype.sizeToBody=function(){var content=this.mainBodyContentDiv;if(content){this.div.style.height=content.offsetHeight-this.heightPad+"px";if(XBrowser.userAgent.isIE6){setTimeout(function(){document.getElementById("sidebarDiv").className+="";},1);}}};Sidebar.prototype.sizeBodyToSidebar=function(){var content=this.mainBodyContentDiv;if((content)&&(this.div.offsetHeight>content.offsetHeight)){content.style.height=(this.div.offsetHeight-SIDEBAR_BORDER_WIDTH+this.heightPad)+"px";}};Sidebar.prototype.sizeBodyToSidebarNoCheck=function(){var content=this.mainBodyContentDiv;var inner=this.div.lastChild;if(content){content.style.height=(inner.offsetHeight-SIDEBAR_BORDER_WIDTH+this.heightPad)+"px";}};Sidebar.prototype.setSidebarCookie=function(val){var expires=new Date();expires.setTime(expires.getTime()+(3650*24*60*60*1000));setCookie(SidebarConstants.SIDEBAR_PINNED_COOKIE,val,expires);};Sidebar.prototype.getSidebarCookie=function(){return getCookie(SidebarConstants.SIDEBAR_PINNED_COOKIE);};Sidebar.prototype.init=function(){addEvent(document,"keydown",this.handleDocumentKeyDown,false);addEvent(this.inOutBox,"click",this.handleInOutClick,true);addEvent(this.handle,"click",this.handleInOutClick,true);addEvent(this.handle2,"click",this.handleInOutClick,true);if(!XBrowser.userAgent.isIE6){addEvent(this.inOutBox,"mouseover",this.addHoverClass,true);addEvent(this.handle,"mouseover",this.addHoverClass,true);addEvent(this.handle2,"mouseover",this.addHoverClass,true);addEvent(this.inOutBox,"mouseout",this.removeHoverClass,true);addEvent(this.handle,"mouseout",this.removeHoverClass,true);addEvent(this.handle2,"mouseout",this.removeHoverClass,true);}this.sizeBodyToSidebar();this.div.display="none";if(!this.pinned){this.pinned=true;this.pin(true);}this.setTitleAndClass();if(getElementsByClassName(EditElement.ERROR_CLASS,this.div).length>0){this.mover.jumpIn();}};Sidebar.prototype.pin=function(noCookie){if(this.pinned){this.pinned=false;this.sizeToBody();this.mover.jumpOut();if(!noCookie){this.setSidebarCookie("0");}}else{this.pinned=true;this.sizeToBody();this.mover.jumpIn();if(!noCookie){this.setSidebarCookie("1");}}this.setTitleAndClass();if(isSafari&&UserContext&&UserContext.uiSkin==UiSkin.ALOHA.apiValue){var wrapper=document.getElementById("contentWrapper");if(!wrapper){return;}var display=wrapper.style.display;wrapper.style.display="inline";setTimeout(function(){wrapper.style.display=display;},1);}};Sidebar.prototype.setTitleAndClass=function(){var content=document.getElementById(BodyLayout.BODY_CELL_ID);var sidebar=document.getElementById(SidebarConstants.SIDEBAR_DIV_ID);if(this.pinned){this.swapClasses(content,this.sidebarCollapsedContentClass,this.sidebarVisibleContentClass);this.swapClasses(sidebar,this.sidebarCollapsedClass,this.sidebarVisibleClass);this.handle.title=LC.getLabel("Sidebar","collapse");this.handle2.title=LC.getLabel("Sidebar","collapse");this.inOutBox.title=LC.getLabel("Sidebar","collapse");if(!this.handle.className.match(this.openHandleRE)){this.handle.className+=" open";this.handle2.className+=" open";}if(!this.inOutBox.className.match(this.openHandleRE)){this.inOutBox.className+=" open";}}else{this.swapClasses(content,this.sidebarVisibleContentClass,this.sidebarCollapsedContentClass);this.swapClasses(sidebar,this.sidebarVisibleClass,this.sidebarCollapsedClass);this.handle.title=LC.getLabel("Sidebar","expand");this.handle2.title=LC.getLabel("Sidebar","expand");this.inOutBox.title=LC.getLabel("Sidebar","expand");this.handle.className=this.handle.className.replace(this.openHandleRE,"");this.handle2.className=this.handle.className.replace(this.openHandleRE,"");this.inOutBox.className=this.inOutBox.className.replace(this.openHandleRE,"");}};
SearchHistory.LIST_URL="listUrl";SearchHistory.ACTION_URL="actionUrl";SearchHistory.LIST_QS="listQS";SearchHistory.LIST_ID="listId";function SearchHistory(){this.actionUrl=null;this.listUrl=null;this.listQs=null;this.listId=null;}SearchHistory.prototype.readFromQs=function(queryString){this.actionUrl=SearchPage.prototype.decodeForSearch(queryString.get(SearchHistory.ACTION_URL));this.listUrl=SearchPage.prototype.decodeForSearch(queryString.get(SearchHistory.LIST_URL));this.listQs=SearchPage.prototype.decodeForSearch(queryString.get(SearchHistory.LIST_QS));this.listId=SearchPage.prototype.decodeForSearch(queryString.get(SearchHistory.LIST_ID));};SearchHistory.prototype.setActionUrl=function(newActionUrl){this.actionUrl=newActionUrl;};SearchHistory.prototype.setListUrl=function(newListUrl){this.listUrl=newListUrl;};SearchHistory.prototype.setListQs=function(newListQs){this.listQs=newListQs;};SearchHistory.prototype.setListId=function(newListId){this.listId=newListId;};SearchHistory.prototype.getActionUrl=function(){return this.actionUrl;};SearchHistory.prototype.getListUrl=function(){return this.listUrl;};SearchHistory.prototype.getListQs=function(){return this.listQs;};SearchHistory.prototype.getListId=function(){return this.listId;};SearchHistory.prototype.toString=function(){var qs=new QueryString("");if(this.actionUrl&&this.actionUrl.length>0){qs.add(SearchHistory.ACTION_URL,SearchPage.prototype.encodeForSearch(this.actionUrl));}if(this.listUrl&&this.listUrl.length>0){qs.add(SearchHistory.LIST_URL,SearchPage.prototype.encodeForSearch(this.listUrl));}if(this.listQs&&this.listQs.length>0){qs.add(SearchHistory.LIST_QS,SearchPage.prototype.encodeForSearch(this.listQs));}if(this.listId&&this.listId.length>0){qs.add(SearchHistory.LIST_ID,SearchPage.prototype.encodeForSearch(this.listId));}var historyDescriptor=qs.toString();return historyDescriptor.substring(1,historyDescriptor.length);};
function SearchQueryTool(targetEntityInputId){this.queryTypeWithEntityStorage=new Object();this.targetEntityInputId=targetEntityInputId;this.entityInput=null;this.savedValue=null;}SearchQueryTool.prototype.addQueryTypeWithEntity=function(queryType){this.queryTypeWithEntityStorage[queryType]=queryType;};SearchQueryTool.prototype.processTargetEntity=function(queryType){if(!this.entityInput&&!this.targetEntityInputId){return;}if(!this.entityInput){this.entityInput=document.getElementById(this.targetEntityInputId);this.targetEntityInputId=null;}if(queryType in this.queryTypeWithEntityStorage){this.entityInput.disabled=true;this.savedValue=this.entityInput.value;this.entityInput.value="";}else{this.entityInput.disabled=false;if(this.savedValue){this.entityInput.value=this.savedValue;}}};
SearchSettingsPage={totalCounts:{},currentCounts:{},toggleCheckboxes:function(checkboxid,suffix){if(!checkboxid||!suffix){return;}var editform=document.getElementById(EditPageConstants.pEDIT_PAGE);var checkbox=document.getElementById(checkboxid);if(checkbox&&editform){var cbVal=checkbox.checked;var total=0;for(var i=0;i<editform.elements.length;i++){var elem=editform.elements[i];if(elem&&(elem!=checkbox)&&elem.id&&(elem.type=="checkbox")){var ind=elem.id.indexOf(suffix);if((ind>=0)&&((ind+suffix.length)==elem.id.length)){elem.checked=cbVal;total++;}}}SearchSettingsPage.totalCounts[suffix]=total;if(checkbox.checked){SearchSettingsPage.currentCounts[suffix]=total;}else{SearchSettingsPage.currentCounts[suffix]=0;}}},updateParentCheckbox:function(thisCbId,parentCbId,suffix){if(!thisCbId||!parentCbId||!suffix){return;}var editform=document.getElementById(EditPageConstants.pEDIT_PAGE);var thisCb=document.getElementById(thisCbId);var parentCb=document.getElementById(parentCbId);if(editform&&thisCb&&parentCb){if(!SearchSettingsPage.isCountInitialized(suffix)){SearchSettingsPage.initCounts(parentCb,suffix);}else{if(thisCb.checked){SearchSettingsPage.currentCounts[suffix]+=1;}else{SearchSettingsPage.currentCounts[suffix]-=1;}}if(thisCb.checked!=parentCb.checked){if(!thisCb.checked){parentCb.checked=false;}else{if(SearchSettingsPage.isAllChecked(suffix)){parentCb.checked=true;}}}}},getCurCount:function(suffix){var curcount=SearchSettingsPage.currentCounts[suffix];if(!curcount&&(curcount!==0)){return -1;}return curcount;},getTotalCount:function(suffix){var curcount=SearchSettingsPage.totalCounts[suffix];if(!curcount&&(curcount!==0)){return -1;}return curcount;},isCountInitialized:function(suffix){return((SearchSettingsPage.getCurCount(suffix)!=-1)&&(SearchSettingsPage.getTotalCount(suffix)!=-1));},initCounts:function(parentCbRef,suffix){var editform=document.getElementById(EditPageConstants.pEDIT_PAGE);var totalCount=0;var checkedCount=0;for(var i=0;i<editform.elements.length;i++){var elem=editform.elements[i];if(elem&&(elem!=parentCbRef)&&elem.id&&(elem.type=="checkbox")){var ind=elem.id.indexOf(suffix);if((ind>=0)&&((ind+suffix.length)==elem.id.length)){totalCount++;if(elem.checked){checkedCount++;}}}}SearchSettingsPage.totalCounts[suffix]=totalCount;SearchSettingsPage.currentCounts[suffix]=checkedCount;},isAllChecked:function(suffix){return SearchSettingsPage.getCurCount(suffix)==SearchSettingsPage.getTotalCount(suffix);},toggleDefaultEntitySection:function(){var parentCb=document.getElementById(SearchSettingsConstants.SIDEBAR_SEARCH_ENTITY_PICKER_ID);var searchDefaultSettings=document.getElementById(SearchSettingsConstants.DEFAULT_SEARCH_ENTITY_CHECKBOX_ID);if(parentCb&&searchDefaultSettings){searchDefaultSettings.disabled=!parentCb.checked;SearchSettingsPage.toggleDefaultEntityPicker();}},toggleDefaultEntityPicker:function(){var checkbox=document.getElementById(SearchSettingsConstants.DEFAULT_SEARCH_ENTITY_CHECKBOX_ID);var picklist=document.getElementById(SearchSettingsConstants.DEFAULT_SEARCH_ENTITY_PICKLIST_ID);if(checkbox&&picklist){picklist.disabled=!checkbox.checked||checkbox.disabled;}},toggleCJKWarning:function(){var optimizeSearchForCJKCheckbox=document.getElementById(SearchSettingsConstants.OPTIMIZE_SEARCH_FOR_CJK_NAME);var optimizeForCJKWarningMessageBox=document.getElementById(SearchSettingsConstants.OPTIMIZE_SEARCH_FOR_CJK_WARNING);if(optimizeSearchForCJKCheckbox.checked){optimizeForCJKWarningMessageBox.style.display="block";}else{optimizeForCJKWarningMessageBox.style.display="none";}}};
var HTMLTreeNode=function(){};HTMLTreeNode.prototype.toggleHTMLTree=function(topic){var obj=HTMLTreeNode.prototype.getNodeChild(topic);if(obj!=null){var visible=HTMLTreeNode.prototype.isVisible(obj);if(visible){HTMLTreeNode.prototype.close(obj,topic);SetupTreeNode.prototype.removeFromOpenSetup(topic);}else{HTMLTreeNode.prototype.open(obj,topic);SetupTreeNode.prototype.addToOpenSetup(topic);}}};HTMLTreeNode.prototype.isVisible=function(obj){return obj.style.display!="none";};HTMLTreeNode.prototype.setVisible=function(obj,visible){if(obj){if(visible){obj.style.display="";}else{obj.style.display="none";}}};HTMLTreeNode.prototype.getNode=function(topic){var informationDiv=document.getElementById("treeInformation");if(informationDiv==null){return;}return document.getElementById(topic);};HTMLTreeNode.prototype.getNodeChild=function(topic){var informationDiv=document.getElementById("treeInformation");if(informationDiv==null){return;}var id=topic+informationDiv.getAttribute("child");return document.getElementById(id);};HTMLTreeNode.prototype.open=function(obj,topic){var informationDiv=document.getElementById("treeInformation");if(informationDiv==null){return;}obj.style.display="block";var key=document.getElementById(topic+informationDiv.getAttribute("icon"));if(key!=null){var currentTitle=key.getElementsByTagName("img")[0].title;var image=key.getElementsByTagName("img")[0];image.src=informationDiv.getAttribute("minusSrc");image.title=HTMLTreeNode.prototype.changePreTitle(currentTitle,informationDiv.getAttribute("collapse"));image.alt=HTMLTreeNode.prototype.changePreTitle(currentTitle,informationDiv.getAttribute("collapse"));}};HTMLTreeNode.prototype.close=function(obj,topic){var informationDiv=document.getElementById("treeInformation");if(informationDiv==null){return;}obj.style.display="none";var key=document.getElementById(topic+informationDiv.getAttribute("icon"));if(key!=null){var currentTitle=key.getElementsByTagName("img")[0].title;var image=key.getElementsByTagName("img")[0];image.src=informationDiv.getAttribute("plusSrc");image.title=HTMLTreeNode.prototype.changePreTitle(currentTitle,informationDiv.getAttribute("expand"));image.alt=HTMLTreeNode.prototype.changePreTitle(currentTitle,informationDiv.getAttribute("expand"));}};HTMLTreeNode.prototype.changePreTitle=function(currentTitle,preTitle){return preTitle+" "+currentTitle.substr(currentTitle.indexOf("-"));};HTMLTreeNode.prototype.openHTMLTree=function(sectionEsc,topicEsc){var section=(sectionEsc)?unescapeJsInHtml(sectionEsc):null;var topic=(topicEsc)?unescapeJsInHtml(topicEsc):null;var informationDiv=document.getElementById("treeInformation");if(informationDiv==null){return;}if(topic!=null){HTMLTreeNode.prototype.unHighlightAll();var leaf=document.getElementById(topic+informationDiv.getAttribute("leaf"));if(leaf&&leaf.className){leaf.className="setupHighlightLeaf";informationDiv.setAttribute("lastHighlight",topic+informationDiv.getAttribute("leaf"));}}var obj=document.getElementById(section+informationDiv.getAttribute("child"));if(obj==null&&topic!=null){var leaf=document.getElementById(topic+informationDiv.getAttribute("leaf"));if(leaf!=null){var divParent=leaf.parentNode;if(divParent!=null&&divParent.id.indexOf(informationDiv.getAttribute("child"))>0){section=divParent.id.substr(0,divParent.id.indexOf(informationDiv.getAttribute("child")));obj=divParent;}}}if(obj!=null){var key=document.getElementById(section+informationDiv.getAttribute("icon"));var currentTitle=key.getElementsByTagName("img")[0].title;obj.style.display="block";var image=key.getElementsByTagName("img")[0];image.src=informationDiv.getAttribute("minusSrc");image.title=HTMLTreeNode.prototype.changePreTitle(currentTitle,informationDiv.getAttribute("collapse"));image.alt=HTMLTreeNode.prototype.changePreTitle(currentTitle,informationDiv.getAttribute("collapse"));var divParent=obj.parentNode;if(divParent!=null){divParent=divParent.parentNode;if(divParent!=null&&divParent.id.indexOf(informationDiv.getAttribute("child"))>0){var section=divParent.id.substr(0,divParent.id.indexOf(informationDiv.getAttribute("child")));HTMLTreeNode.prototype.openHTMLTree(section,null);}}if(topic!=null){window.scrollTo(0,key.offsetTop);}}else{if(topic!=null){var leaf=document.getElementById(topic+informationDiv.getAttribute("leaf"));if(leaf!=null){window.scrollTo(0,leaf.offsetTop);}}}};HTMLTreeNode.prototype.unHighlightAll=function(){var informationDiv=document.getElementById("treeInformation");if(informationDiv==null){return;}var lastHighlight=informationDiv.getAttribute("lastHighlight");if(lastHighlight==null){return;}var elementH=document.getElementById(lastHighlight);if(elementH!=null&&elementH.className==informationDiv.getAttribute("highlightClass")){elementH.className=informationDiv.getAttribute("leafClass");}};HTMLTreeNode.prototype.populateTheTreeInformation=function(font,child,icon,leaf,expand,collapse,plusSrc,minusSrc,highlightClass,leafClass){var informationDiv=document.getElementById("treeInformation");if(informationDiv==null){return;}informationDiv.setAttribute("font",font);informationDiv.setAttribute("child",child);informationDiv.setAttribute("icon",icon);informationDiv.setAttribute("leaf",leaf);informationDiv.setAttribute("expand",expand);informationDiv.setAttribute("collapse",collapse);informationDiv.setAttribute("plusSrc",plusSrc);informationDiv.setAttribute("minusSrc",minusSrc);informationDiv.setAttribute("highlightClass",highlightClass);informationDiv.setAttribute("leafClass",leafClass);informationDiv.setAttribute("lastHighlight","none");};
var SetupTreeNode=function(){};SetupTreeNode.prototype.openListSetup=new Array();SetupTreeNode.prototype.addToOpenSetup=function(item){for(var i=0;i<SetupTreeNode.prototype.openListSetup.length;i++){if(SetupTreeNode.prototype.openListSetup[i]==null){SetupTreeNode.prototype.openListSetup[i]=item;SetupTreeNode.prototype.updateCookiesSetup();return;}}SetupTreeNode.prototype.openListSetup[SetupTreeNode.prototype.openListSetup.length]=item;SetupTreeNode.prototype.updateCookiesSetup();};SetupTreeNode.prototype.removeFromOpenSetup=function(item){for(var i=0;i<SetupTreeNode.prototype.openListSetup.length;i++){if(SetupTreeNode.prototype.openListSetup[i]==item){SetupTreeNode.prototype.openListSetup[i]=null;}}SetupTreeNode.prototype.updateCookiesSetup();};SetupTreeNode.prototype.getNodes=function(){var allNodes=new Array();var parents=getElementsByClassName("parent");allNodes=allNodes.concat(parents);var leaves=getElementsByClassName("setupLeaf");allNodes=allNodes.concat(leaves);return allNodes;};SetupTreeNode.prototype.search=function(){if(SetupTreeNode.prototype.isTypingFast()){return;}var val=SetupTreeNode.prototype.getSearchTerm();if(!val){SetupTreeNode.prototype.reset();return;}var vals=val.split(" ");if(!vals||vals.length==0){return;}var elements=SetupTreeNode.prototype.getNodes();for(var i=0;elements&&i<elements.length;i++){var obj=elements[i];var topic=obj.id;SetupTreeNode.prototype.searchNode(obj,topic,vals);}};SetupTreeNode.prototype.searchNode=function(obj,topic,vals){if(obj!=null){var containsText=true;var txt=obj.getAttribute(SetupSearchElement.ATT_SEARCH_TEXT);if(!txt){containsText=false;}else{for(var j=0;j<vals.length;j++){if(txt.indexOf(vals[j])==-1){containsText=false;break;}}}if(containsText){HTMLTreeNode.prototype.setVisible(obj,true);if(obj.className=="parent"){obj=HTMLTreeNode.prototype.getNodeChild(topic);HTMLTreeNode.prototype.open(obj,topic);}}else{HTMLTreeNode.prototype.setVisible(obj,false);if(obj.className=="parent"){obj=HTMLTreeNode.prototype.getNodeChild(topic);HTMLTreeNode.prototype.close(obj,topic);}}}};SetupTreeNode.prototype.reset=function(){document.getElementById(SetupSearchElement.SETUP_SEARCH_PARAM).value="";var elements=SetupTreeNode.prototype.getNodes();for(var i=0;elements&&i<elements.length;i++){var obj=elements[i];HTMLTreeNode.prototype.setVisible(obj,true);}};SetupTreeNode.prototype.getSearchTerm=function(){var term=document.getElementById(SetupSearchElement.SETUP_SEARCH_PARAM).value;if(term){term=term.toLowerCase();}return term;};SetupTreeNode.prototype.updateCookiesSetup=function(){var stringlist="";for(var i=0;i<SetupTreeNode.prototype.openListSetup.length;i++){if(SetupTreeNode.prototype.openListSetup[i]!=null){stringlist=stringlist+SetupTreeNode.prototype.openListSetup[i]+":";}}Cookies.prototype.SetCookie(SetupTreeNodeConstants.COOKIE_KEY,stringlist,null,"/");};SetupTreeNode.prototype.TYPING_THRESHOLD_MILLIS=250;SetupTreeNode.prototype.LAST_DATE=null;SetupTreeNode.prototype.TIMEOUT_ID=null;SetupTreeNode.prototype.isTypingFast=function(){if(SetupTreeNode.prototype.TIMEOUT_ID){clearTimeout(SetupTreeNode.prototype.TIMEOUT_ID);}var d=new Date();if(SetupTreeNode.prototype.LAST_DATE==null){SetupTreeNode.prototype.LAST_DATE=d;return true;}else{var diff=d.getTime()-SetupTreeNode.prototype.LAST_DATE.getTime();SetupTreeNode.prototype.LAST_DATE=d;if(diff<SetupTreeNode.prototype.TYPING_THRESHOLD_MILLIS){var delayedExec="SetupTreeNode.prototype.search();";SetupTreeNode.prototype.TIMEOUT_ID=setTimeout(delayedExec,SetupTreeNode.prototype.TYPING_THRESHOLD_MILLIS);return true;}else{return false;}}};
function InlineEditData(json){this.isEditable=json[InlineEditConstants.EDITABLE];this.sysMod=json[InlineEditConstants.LAST_MOD];this.id=json[InlineEditConstants.ENTITY_ID];this.csrf_token=json[CSRFConstants.CSRF_TOKEN];this.fields={};this.dependencyGroups=[];this.hasCompoundFields=false;this.allFieldData=json[InlineEditConstants.FIELD_DATA];this.dynamicDataUrl=json[InlineEditConstants.DYNAMIC_DATA];this.initHook=json[InlineEditConstants.INIT_HOOK];this.loadedDynamicData=false;this.sentRequest=false;this.currentField=null;sfdcPage.initInlineEdit(this);}InlineEditData.prototype.init=function(){this.createFields();if(this.hasCompoundFields){InlineEditField.overlay=new InlineEditDialog();InlineEditField.overlay.register();}var self=this;addEvent(document,"click",function(){self.closeCurrentField();},false);};InlineEditData.prototype.createFields=function(){if(this.allFieldData){for(var i=0;i<this.allFieldData.length;i++){var fieldData=this.allFieldData[i];var field=InlineEditField.createField(fieldData);this.fields[fieldData.fieldId]=field;if(field){if(field.compound){this.hasCompoundFields=true;}}}for(var i in this.fields){var f=this.fields[i];if(f&&f.afterLoad){f.afterLoad();}if(f&&f.controllerId){this.createDependency(f);this.hasCompoundFields=true;}if(f&&f.lookupControllerIds){for(var j=0;j<f.lookupControllerIds.length;j++){var controller=this.getField(f.lookupControllerIds[j]);if(controller){if(!controller.dependentIds){controller.dependentIds=[];}controller.dependentIds.push(f.id);}}}}if(this.initHook){var obj=window[this.initHook];if(obj&&typeof obj.initInlineEditData==="function"){obj.initInlineEditData(this);}}}};InlineEditData.prototype.createDependency=function(field){if(field.group){return;}var f=this.getField(field.controllerId);var existingGroup=null;while(f!=null){existingGroup=f.group;if(existingGroup){break;}f=this.getField(f.controllerId);}if(existingGroup){var temp=field;var start=existingGroup.length;while(temp!=f){existingGroup.splice(start,0,temp.id);temp.group=existingGroup;if(temp instanceof BooleanField){temp.waitForLoad=true;}temp=this.getField(temp.controllerId);}}else{var newGroup=[];var temp=field;while(temp!=null){newGroup.unshift(temp.id);temp.group=newGroup;if(temp instanceof BooleanField){temp.waitForLoad=true;}temp=this.getField(temp.controllerId);}this.dependencyGroups.push(newGroup);}};InlineEditData.prototype.openField=function(field){if(field.group){field=this.fields[field.group[0]];}else{if(!this.isCurrentField(field)){this.closeCurrentField();}}this.currentField=field;if(field.waitForLoad&&!this.loadedDynamicData){this.loadDynamicData();return;}else{if(field.group){this.openGroup(field.group);}else{field.openField();}}};InlineEditData.prototype.openGroup=function(group){var first=this.fields[group[0]];if(!first.created){var div=document.createElement("div");div.className="inlineEditDiv";document.body.appendChild(div);var html=[];html.push("<table border=0>");for(var i=0;i<group.length;i++){var f=this.fields[group[i]];html.push("<tr><td class='labelCol'>");html.push(f.getFieldLabel());html.push("</td><td></td></tr>");if(f.state==InlineEditState.EDIT){f.createEditDiv();}else{f.createDummy();}}html.push("</table>");div.innerHTML=html.join("");for(var i=0;i<group.length;i++){var f=this.fields[group[i]];var node;if(f.state==InlineEditState.EDIT){f.load();div.firstChild.rows[i].lastChild.appendChild(f.editDiv);}else{div.firstChild.rows[i].lastChild.innerHTML=f.initialHTML;}}InlineEditField.overlay.addField(first.id,div,LC.getLabel("DependentElement","dependentFields"));}InlineEditField.overlay.setActiveField(first.id);InlineEditField.overlay.setMaxWidth(400);InlineEditField.overlay.show();};InlineEditData.prototype.isCurrentField=function(field){return this.currentField&&this.currentField==field&&!this.currentField.group;};InlineEditData.prototype.closeCurrentField=function(forRevert){if(this.currentField){if(this.currentField.group){this.closeGroup(this.currentField.group,true);this.currentField=null;}else{this.currentField.closeField(true);this.currentField=null;}}};InlineEditData.prototype.closeGroup=function(group){for(var i=0;i<group.length;i++){var f=this.fields[group[i]];if(f.state==InlineEditState.EDIT){var newValue=f.getValueFromEdit();if(f.isDifferentValue(newValue)){if(!f.changed){f.changed=true;addStyleClass(f.readDiv,"inlineEditModified");}f.currentValue=newValue;f.updateReadElement();f.updateDependents();if(f.changed){f.readDiv.appendChild(f.undoButton);if(f.undoButton.innerHTML===""){f.attachUndoButtonImage();}f.undoButton.style.display="inline";}}else{if(f.changed){f.changed=false;f.currentValue=newValue;delStyleClass(f.readDiv,"inlineEditModified");f.updateReadElement();f.undoButton.style.display="none";}}}}InlineEditField.overlay.hide();};InlineEditData.prototype.resetCurrentField=function(){this.resetField(this.currentField);this.currentField=null;};InlineEditData.prototype.resetFieldById=function(id){this.resetField(this.fields[id]);};InlineEditData.prototype.resetField=function(field){if(field){if(field.group){this.resetGroup(field.group);}else{field.reset(true);}}};InlineEditData.prototype.resetGroup=function(group){for(var i=0;i<group.length;i++){var f=this.fields[group[i]];if(f.state==InlineEditState.EDIT){f.reset(true);}}InlineEditField.overlay.hide();};InlineEditData.prototype.getField=function(id){if(id){return this.fields[id];}return null;};InlineEditData.prototype.save=function(){if(this.isEditable){this.closeCurrentField();var saveData={};saveData[InlineEditConstants.ENTITY_ID]=this.id;saveData[InlineEditConstants.LAST_MOD]=this.sysMod;saveData[CSRFConstants.CSRF_TOKEN]=this.csrf_token;saveData[EditPageConstants.pSAVE]="1";DesktopContext.setCurrentDesktopParam(saveData);for(var id in this.fields){var field=this.fields[id];if(field&&field.doPost()){field.clearError();field.addSaveData(saveData);}}var self=this;XBrowser.postHttpResponse(UserContext.getUrl("/ui/common/InlineEditEntitySave"),function(response){self.handleResponse(response.responseText);},XBrowser.buildPost(saveData),function(response){var url=escape(window.location.pathname+window.location.search);window.location.replace(UserContext.getUrl("/ex/errorduringprocessing.jsp?retURL=")+url);});}};InlineEditData.prototype.handleResponse=function(responseText){var response=Util.evalAjaxServletOutput(responseText);if(response[InlineEditConstants.SUCCESS]){var afterSaveUrl=response[InlineEditConstants.AFTER_SAVE_REDIRECT_URL];if(afterSaveUrl){navigateToUrl(afterSaveUrl,"DETAIL");}else{sfdcPage.refreshDetail();}}else{this.csrf_token=response[CSRFConstants.CSRF_TOKEN];this.handleErrors(response);}};InlineEditData.prototype.handleErrors=function(response){sfdcPage.setError(response[InlineEditConstants.NON_SPECIFIC_ERRORS]);var specific=response[InlineEditConstants.VALIDATION_ERRORS];var first;for(var id in specific){var f=this.getField(id);if(f){if(!f.compound&&!f.group){if(!first||first.tableCell.offsetTop>f.tableCell.offsetTop){first=f;}}f.setError(specific[id]);}}if(first){this.openField(first);}};InlineEditData.prototype.revert=function(){if(this.isEditable){this.closeCurrentField(true);var resetGroups={};for(var id in this.fields){var field=this.fields[id];if(field){if(field.changed){if(field.group){resetGroups[field.group[0]]=true;}else{field.reset();}}else{field.clearError();}}}for(var id in resetGroups){this.resetGroup(this.fields[id].group);}}};InlineEditData.prototype.loadDynamicData=function(){if(!this.sentRequest){this.sentRequest=true;var self=this;XBrowser.createDynamicScript(this.dynamicDataUrl,function(){self.dynamicDataLoaded();});}};InlineEditData.prototype.dynamicDataLoaded=function(){if(!this.loadedDynamicData){this.loadedDynamicData=true;if(this.currentField.waitForLoad){this.openField(this.currentField);}}};
function InlineEditField(){this.id=null;this.tableCell=null;this.readDiv=null;this.created=false;this.editDiv=null;this.state=InlineEditState.NONE;this.required=false;this.label=null;this.initialValue=null;this.initialHTML=null;this.currentValue=null;this.changed=false;this.undoButton=null;this.error=null;this.errorDiv=null;this.compound=false;this.waitForLoad=false;this.controllerId=null;this.saveOnEnter=false;}InlineEditField.overlay=null;InlineEditField.prototype.init=function(id,state,required,isColumn,initialValue){this.id=id;this.state=state;this.required=required;this.isColumn=isColumn;if(initialValue===undefined||initialValue===null){this.initialValue="";}else{this.initialValue=initialValue;}this.currentValue=this.initialValue;if(!this.isColumn){this.tableCell=getElementByIdCS(id+InlineEditConstants.CELL_ID);this.readDiv=getElementByIdCS(id+InlineEditConstants.INNER_ID);if(!this.tableCell||!this.readDiv){this.state=InlineEditState.NONE;return;}this.initialHTML=this.readDiv.innerHTML;}};InlineEditField.prototype.isDifferentValue=function(newValue){};InlineEditField.prototype.openField=function(){};InlineEditField.prototype.showEdit=function(){};InlineEditField.prototype.hideEdit=function(){};InlineEditField.prototype.closeField=function(){};InlineEditField.prototype.createEditElements=function(){};InlineEditField.prototype.getValueFromEdit=function(){return null;};InlineEditField.prototype.updateReadElement=function(){};InlineEditField.prototype.updateEditElementImpl=function(){};InlineEditField.prototype.formatValue=function(){};InlineEditField.prototype.addSaveData=function(saveData){};InlineEditField.prototype.createDummy=function(){};InlineEditField.prototype.load=function(){};InlineEditField.prototype.mayUndo=function(){return true;};InlineEditField.prototype.updateEditElement=function(){if(this.created){this.updateEditElementImpl();}};InlineEditField.prototype.doPost=function(){return this.state==InlineEditState.EDIT||this.state==InlineEditState.POSTONLY;};InlineEditField.prototype.reset=function(){};InlineEditField.prototype.cleanValue=function(value){if(value&&value.replace){return this.cleanValueNoBR(value).replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\n/g,"<br>");}return value;};InlineEditField.prototype.getDeletedValue=function(){return this.isColumn?"":"<em>"+LC.getLabel("Global","deleted")+"</em>";};InlineEditField.prototype.cleanValueNoBR=function(value){if(value&&value.replace){return value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");}return value;};InlineEditField.prototype.createUndoButton=function(){this.undoButton=document.createElement("a");this.undoButton.className="inlineEditUndoLink";this.undoButton.title=LC.getLabel("Icons","inlineEditUndo");this.undoButton.href="javascript:sfdcPage.inlineEditData.resetFieldById('"+this.id+"');";this.attachUndoButtonImage();};InlineEditField.prototype.attachUndoButtonImage=function(){if(this.undoButton===null){return;}this.undoButton.innerHTML="<img width='16px' height='16px' src='s.gif' alt='"+LC.getLabel("Icons","inlineEditUndo")+"' class='inlineEditUndo'>";};InlineEditField.prototype.getFieldLabel=function(){var labelNode=this.tableCell.previousSibling;while(labelNode&&labelNode.nodeType!=Node.TEXT_NODE){labelNode=labelNode.firstChild;}return labelNode?labelNode.nodeValue:"";};InlineEditField.prototype.setError=function(message){this.error=message;if(!this.errorDiv){this.errorDiv=document.createElement("div");this.errorDiv.className="errorMsg";this.errorDiv.innerHTML=this.error;this.tableCell.appendChild(this.errorDiv);}else{this.errorDiv.innerHTML=this.error;this.errorDiv.style.display="block";}};InlineEditField.prototype.updateDependents=function(){if(!this.dependentIds){return;}for(var i=0;i<this.dependentIds.length;i++){var f=sfdcPage.getFieldById(this.dependentIds[i]);if(f.performValidation&&f.currentValue[0]!=""){f.performValidation();}}};InlineEditField.prototype.clearError=function(){if(this.errorDiv){this.errorDiv.style.display="none";}this.error=null;};InlineEditField.prototype.getCSSClass=function(){return this.state.cssClass;};InlineEditField.prototype.getCSSHoverClass=function(){return this.state.cssClass+"On";};InlineEditField.createField=function(fieldData){var fieldType=InlineEditField.resolveSwitchableField(fieldData);var fieldId=fieldData[InlineEditConstants.FIELD_ID];var state=InlineEditState[fieldData[InlineEditConstants.FIELD_STATE]];var required=fieldData[InlineEditConstants.FIELD_REQUIRED];var initialValue=fieldData[InlineEditConstants.FIELD_VALUE];var extraData={};if(fieldType&&fieldType.inlineEditExtraData){for(var i=0;i<fieldType.inlineEditExtraData.length;i++){extraData[fieldType.inlineEditExtraData[i]]=fieldData[fieldType.inlineEditExtraData[i]];}}try{if(fieldType&&fieldType.inlineEditFieldObject&&fieldId&&state){var specialMapping=InlineEditField.specialFieldMappings[fieldId];if(specialMapping){var result=specialMapping(fieldData);}var ctor=result?result:fieldType.inlineEditFieldConstructor();return new ctor(fieldId,state,required,false,initialValue,extraData);}}catch(ilee){}return null;};InlineEditField.resolveSwitchableField=function(fieldData){var type=ColumnType[fieldData[InlineEditConstants.FIELD_TYPE]];if(type==ColumnType.SWITCHABLE_PERSONNAME){return ColumnType[fieldData[InlineEditConstants.OVERRIDE_TYPE]];}return type;};InlineEditField.specialFieldMappings={opp11:function(fieldData){if(window.OpportunityInlineEditing.OpportunityStageField){return OpportunityInlineEditing.OpportunityStageField;}},ForecastCategoryName:function(fieldData){if(window.OpportunityInlineEditing.OpportunityForecastingField){return OpportunityInlineEditing.OpportunityForecastingField;}},opp2:function(fieldData){if(window.OpportunityInlineEditing.OpportunityPrivateCheckboxField){return OpportunityInlineEditing.OpportunityPrivateCheckboxField;}}};
function PreferenceBits(preferences){this.bitsByName={};for(var i=0;i<preferences.length;i++){var pref=preferences[i];this.bitsByName[pref.name]={index:pref.index,val:pref.value};}}PreferenceBits.prototype.getBoolean=function(name){return this.bitsByName[name].val;};PreferenceBits.prototype.getIndexByName=function(name){return this.bitsByName[name].index;};PreferenceBits.prototype.setBoolean=function(name,val,callback){if(typeof val=="boolean"){var current=this.bitsByName[name];if(current&&current.val!=val){this.bitsByName[name].val=val;this.save(name,callback);}}};PreferenceBits.prototype.save=function(name,callback){var pref=this.bitsByName[name];var fn=callback||function(){};if(pref){XBrowser.postHttpResponse(UserContext.getUrl("/_ui/common/request/servlet/PreferenceServlet"),fn,XBrowser.buildPost({val:pref.val,bit:pref.index}));}};
var Animation={ANIMATION_SLAVE:"_animationEventHandler",RESIZE_HEIGHT_STEPS:8,RESIZE_HEIGHT_DELAY:20,animations:{},animateResizeHeight:function(elem,heightBefore,heightAfter,finalize){if(!elem){return;}var savedState;var autoFinalHeight=false;if(Animation.animations[elem]){savedState=Animation.animations[elem];savedState.clean();}else{savedState={};savedState.height=XBrowser.getElementStyle(elem,"height");savedState.overflow=elem.style.overflow;}Animation.animations[elem]=savedState;elem.style.overflow="hidden";if(heightAfter===-1){elem.style.height=heightBefore+"px";elem.style.display="block";heightAfter=XBrowser.getActualHeight(elem,true);autoFinalHeight=true;}var self=this;var series=Animation._getLinearSeries(heightBefore,heightAfter,Animation.RESIZE_HEIGHT_STEPS);if(autoFinalHeight&&XBrowser.userAgent.isFirefox){series.pop();}var i=0;savedState.clean=function(){elem.style.height=savedState.height;elem.style.overflow=savedState.overflow;clearInterval(savedState.intervalHandle);Animation.animations[elem]=null;if(finalize){finalize();}};savedState.stepper=function(){if(i<Animation.RESIZE_HEIGHT_STEPS){var curHeight=series[i];elem.style.height=curHeight+"px";i++;}else{savedState.clean();}};savedState.intervalHandle=setInterval(savedState.stepper,Animation.RESIZE_HEIGHT_DELAY);savedState.stepper();},rollIn:function(element,finalize){Animation.animateResizeHeight(element,1,-1,finalize);},rollOut:function(element,finalize){element.style.display="block";Animation.animateResizeHeight(element,XBrowser.getActualHeight(element),1,function(){element.style.display="none";if(finalize){finalize();}});},rollInRollOut:function(element,delay,finalize){Animation.rollIn(element,function(){setTimeout(function(){Animation.rollOut(element,finalize);},delay);});},animateOpacity:function(elem,opacityBefore,opacityAfter,finalize){if(!elem){return;}if(window[Animation.ANIMATION_SLAVE]){return;}if(opacityBefore<0){opacityBefore=0;}else{if(opacityBefore>100){opacityBefore=100;}}if(opacityAfter<0){opacityAfter=0;}else{if(opacityAfter>100){opacityAfter=100;}}var STEP=5;var DELAY=20;var self=this;var isIncreasing=(opacityBefore<opacityAfter);currentOpacity=Animation.setOpacity(elem,opacityBefore);if(opacityBefore==opacityAfter){return;}window[Animation.ANIMATION_SLAVE]=function(){if((isIncreasing&&(currentOpacity>opacityAfter))||((!isIncreasing)&&(currentOpacity<opacityAfter))){window[Animation.ANIMATION_SLAVE]=false;Animation.setOpacity(elem,opacityAfter);if(finalize){finalize();}return;}if(isIncreasing){currentOpacity=Animation.setOpacity(elem,currentOpacity+STEP);}else{currentOpacity=Animation.setOpacity(elem,currentOpacity-STEP);}setTimeout("window."+Animation.ANIMATION_SLAVE+"();",DELAY);};window[Animation.ANIMATION_SLAVE]();},fadeOut:function(elem,finalize){Animation.animateOpacity(elem,100,0,finalize);},fadeIn:function(elem,finalize){Animation.animateOpacity(elem,0,100,finalize);},setOpacity:function(element,opacity){if(XBrowser.userAgent.isIE){element.style.filter="alpha(opacity="+opacity+")";}else{element.style.opacity=opacity/100;}return opacity;},clearOpacity:function(element){if(XBrowser.userAgent.isIE){element.style.filter="alpha(opacity=100)";}else{element.style.opacity=1;}},_getLinearSeries:function(start,end,steps){ret=[];steps-=1;ret.push(start);step=(end-start)/steps;var current=start;for(var i=0;i<(steps-1);i++){current+=step;ret.push(current);}ret.push(end);return ret;}};
var Cookies=function(){};Cookies.prototype.getCookieVal=function(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1){endstr=document.cookie.length;}return unescape(document.cookie.substring(offset,endstr));};Cookies.prototype.GetCookie=function(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg){return Cookies.prototype.getCookieVal(j);}i=document.cookie.indexOf(" ",i)+1;if(i==0){break;}}return null;};Cookies.prototype.SetCookie=function(name,value,expires,path,domain,secure){document.cookie=name+"="+value+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");};Cookies.prototype.DeleteCookie=function(name){var cval=Cookies.prototype.GetCookie(name);if(cval==null){return;}var exp=new Date();exp.setTime(exp.getTime()-1);Cookies.prototype.SetCookie(name,"",exp,"/");};
function DateUtil(){}DateUtil.MONTH_NAMES=new Array("January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");DateUtil.DAY_NAMES=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat");DateUtil.LZ=function(x){return(x<0||x>9?"":"0")+x;};DateUtil.isDate=function(val,format){var date=DateUtil.getDateFromFormat(val,format);if(date==0){return false;}return true;};DateUtil.compareDates=function(date1,dateformat1,date2,dateformat2){var d1=DateUtil.getDateFromFormat(date1,dateformat1);var d2=DateUtil.getDateFromFormat(date2,dateformat2);if(d1==0||d2==0){return -1;}else{if(d1>d2){return 1;}}return 0;};DateUtil.formatDate=function(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getFullYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(LC.isThaiTHLocale()){y=(y-0+LC.BUDDHIST_CAL_OFFSET)+"";}value.y=""+y;value.yyyy=y;value.yy=y.substring(2,4);value.M=M;value.MM=DateUtil.LZ(M);value.MMM=DateUtil.MONTH_NAMES[M-1];value.NNN=DateUtil.MONTH_NAMES[M+11];value.d=d;value.dd=DateUtil.LZ(d);value.E=DateUtil.DAY_NAMES[E+7];value.EE=DateUtil.DAY_NAMES[E];value.H=H;value.HH=DateUtil.LZ(H);if(H==0){value.h=12;}else{if(H>12){value.h=H-12;}else{value.h=H;}}value.hh=DateUtil.LZ(value.h);if(H>11){value.K=H-12;}else{value.K=H;}value.k=H+1;value.KK=DateUtil.LZ(value.K);value.kk=DateUtil.LZ(value.k);if(H>11){value.a=DateUtil.getPMSymbol();}else{value.a=DateUtil.getAMSymbol();}value.m=m;value.mm=DateUtil.LZ(m);value.s=s;value.ss=DateUtil.LZ(s);while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}if(value[token]!=null){result=result+value[token];}else{result=result+token;}}return result;};DateUtil._isInteger=function(val){var digits="1234567890";for(var i=0;i<val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false;}}return true;};DateUtil._getInt=function(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length<minlength){return null;}if(DateUtil._isInteger(token)){return token;}}return null;};DateUtil.getDateFromFormat=function(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getFullYear();var month=now.getMonth()+1;var date=1;var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var ampm="";while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}if(token=="yyyy"||token=="yy"||token=="y"){if(token=="yyyy"){x=2;y=4;}if(token=="yy"){x=2;y=2;}if(token=="y"){x=2;y=4;}year=DateUtil._getInt(val,i_val,x,y);if(year==null){return 0;}i_val+=year.length;if(year.length==2){if(year>70){year=1900+(year-0);}else{year=2000+(year-0);}}}else{if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i<DateUtil.MONTH_NAMES.length;i++){var month_name=DateUtil.MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){if(token=="MMM"||(token=="NNN"&&i>11)){month=i+1;if(month>12){month-=12;}i_val+=month_name.length;break;}}}if((month<1)||(month>12)){return 0;}}else{if(token=="EE"||token=="E"){for(var i=0;i<DateUtil.DAY_NAMES.length;i++){var day_name=DateUtil.DAY_NAMES[i];if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){i_val+=day_name.length;break;}}}else{if(token=="MM"||token=="M"){month=DateUtil._getInt(val,i_val,1,2);if(month==null||(month<1)||(month>12)){return 0;}i_val+=month.length;}else{if(token=="dd"||token=="d"){date=DateUtil._getInt(val,i_val,1,2);if(date==null||(date<1)||(date>31)){return 0;}i_val+=date.length;}else{if(token=="hh"||token=="h"){hh=DateUtil._getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0;}i_val+=hh.length;}else{if(token=="HH"||token=="H"){hh=DateUtil._getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0;}i_val+=hh.length;}else{if(token=="KK"||token=="K"){hh=DateUtil._getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0;}i_val+=hh.length;}else{if(token=="kk"||token=="k"){hh=DateUtil._getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0;}i_val+=hh.length;hh--;}else{if(token=="mm"||token=="m"){mm=DateUtil._getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0;}i_val+=mm.length;}else{if(token=="ss"||token=="s"){ss=DateUtil._getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0;}i_val+=ss.length;}else{if(token=="a"){var am=DateUtil.getAMSymbol();var pm=DateUtil.getPMSymbol();var stra=val.substring(i_val,i_val+am.length);var strp=val.substring(i_val,i_val+pm.length);if(stra==am||stra.toUpperCase()==am){ampm=am;}else{if(strp==pm||strp.toUpperCase()==pm){ampm=pm;}else{return 0;}}i_val+=ampm.length;}else{if(val.substring(i_val,i_val+token.length)!=token){return 0;}else{i_val+=token.length;}}}}}}}}}}}}}}if(i_val!=val.length){return 0;}if(LC.isThaiTHLocale()){year=year-LC.BUDDHIST_CAL_OFFSET;}if(month==2){if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(date>29){return 0;}}else{if(date>28){return 0;}}}if((month==4)||(month==6)||(month==9)||(month==11)){if(date>30){return 0;}}if(hh<12&&ampm==DateUtil.getPMSymbol()){hh=hh-0+12;}else{if(hh>11&&ampm==DateUtil.getAMSymbol()){hh-=12;}}var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime();};DateUtil.parseDate=function(val){var preferEuro=(arguments.length==2)?arguments[1]:false;generalFormats=new Array("y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d");monthFirst=new Array("M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d","M.d");dateFirst=new Array("d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M","d.M");var checkList=new Array("generalFormats",preferEuro?"dateFirst":"monthFirst",preferEuro?"monthFirst":"dateFirst");var d=null;for(var i=0;i<checkList.length;i++){var l=window[checkList[i]];for(var j=0;j<l.length;j++){d=DateUtil.getDateFromFormat(val,l[j]);if(d!=0){return new Date(d);}}}return null;};DateUtil.TIMEZONES;DateUtil.getTimezoneOffset=function(){var browserDate=new Date();var browserOffsetFromGMT=browserDate.getTimezoneOffset()*(60*1000);var index=DateUtil.getTimezoneIndex(browserDate);if(DateUtil.TIMEZONES==undefined){DateUtil.TIMEZONES=DateUtil.getTimezones(browserDate);}var sfdcOffsetFromGMT=DateUtil.TIMEZONES[index];var offset=sfdcOffsetFromGMT+browserOffsetFromGMT;return offset;};DateUtil.isBrowserAndSystemTimezoneSame=function(){var offset=DateUtil.getTimezoneOffset();return offset==0;};DateUtil.getTimezoneIndex=function(date){return DateUtil.formatDate(date,"yyyyMMdd");};DateUtil.getTimezones=function(date){var qs=new QueryString("");qs.add("ts",date.getTime());var url=UserContext.getUrl("/home/timezones.jsp")+qs.toString();var tz=null;var text=DesktopAjax.prototype.doGet(url);if(text){text=trim(text);var local=eval("("+text+")");return local;if(local){tz=local;}}return tz;};DateUtil.rollDate=function(day,numDays){var newDate=new Date(day.getTime());newDate.setDate(newDate.getDate()+numDays);return newDate;};DateUtil.roundDate=function(date){var newDate=new Date(date.getTime());newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);return newDate;};DateUtil.getDateStringFromUserLocale=function(date){return DateUtil.formatDate(date,UserContext.dateFormat);};DateUtil.getDateFromUserLocale=function(str){return new Date(DateUtil.getDateFromFormat(str,UserContext.dateFormat));};DateUtil.getDateTimeStringFromUserLocale=function(date){return DateUtil.formatDate(date,UserContext.dateTimeFormat);};DateUtil.getDateTimeFromUserLocale=function(str){return new Date(DateUtil.getDateFromFormat(str,UserContext.dateTimeFormat));};DateUtil.getTimeStringFromUserLocale=function(date){return DateUtil.formatDate(date,UserContext.timeFormat);};DateUtil.getTimeFromUserLocale=function(str){return new Date(DateUtil.getDateFromFormat(str,UserContext.timeFormat));};DateUtil.getAMSymbol=function(){if(UserContext.initialized){return UserContext.ampm[0];}else{return"AM";}};DateUtil.getPMSymbol=function(){if(UserContext.initialized){return UserContext.ampm[1];}else{return"PM";}};DateUtil.is24Hour=function(format){return format.indexOf("k")>-1;};DateUtil.hasAMPM=function(format){return format.indexOf("a")>-1;};DateUtil.equals=function(date1,date2){return date1&&date2&&DateUtil.compare(date1,date2)==0;};DateUtil.lessThan=function(date1,date2){return DateUtil.compare(date1,date2)<0;};DateUtil.greaterThan=function(date1,date2){return DateUtil.compare(date1,date2)>0;};DateUtil.compare=function(date1,date2){if(date1.getFullYear()!=date2.getFullYear()){return date1.getFullYear()-date2.getFullYear();}else{if(date1.getMonth()!=date2.getMonth()){return date1.getMonth()-date2.getMonth();}else{return date1.getDate()-date2.getDate();}}};DateUtil.separators=["/","-","."];DateUtil.checkYear=function(field,callOnChange){var val=field.value.toLowerCase();var dateVal=DateUtil.getCheckYearValue(val);if(dateVal){field.value=dateVal;if(callOnChange&&field.onchange){field.onchange();}}};DateUtil.getCheckYearValue=function(val){if(!(val&&val.length>0)){return null;}var separator=null;for(var i=0;i<DateUtil.separators.length;i++){if(val.indexOf(DateUtil.separators[i])!=-1){separator=DateUtil.separators[i];break;}}var date=DateUtil.getDateTimeFromUserLocale(UserContext.today);if(separator){date.setDate(1);var nums=val.split(separator);if(nums.length==2){if(!isNaN(nums[0])&&!isNaN(parseInt(nums[1],10))){date.setMonth(parseInt(nums[0],10)-1);date.setDate(parseInt(nums[1],10));return DateUtil.getDateStringFromUserLocale(date);}}else{if(nums.length==3){if(!isNaN(parseInt(nums[2],10))&&!isNaN(nums[0])&&!isNaN(nums[1])){var year=parseInt(nums[2],10);if(year/1000<1){date.setMonth(parseInt(nums[0],10)-1);date.setDate(parseInt(nums[1],10));if(year>=60&&year<100){date.setFullYear(year+1900);}else{date.setFullYear(year+2000);}return DateUtil.getDateStringFromUserLocale(date);}else{if(separator!="/"){return nums[0]+"/"+nums[1]+"/"+nums[2];}}}}}}else{return DateUtil.getEvaluateShortcutValue(val);}};DateUtil.DAY_SHORTCUTS=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];DateUtil.evaluateShortcut=function(field,callOnChange){var val=field.value.toLowerCase();var newDate=DateUtil.getEvaluateShortcutValue(val);if(newDate){field.value=newDate;if(callOnChange&&field.onchange){field.onchange();}}};DateUtil.getEvaluateShortcutValue=function(val){if(!(val&&val.length>0)){return null;}var date=DateUtil.getDateTimeFromUserLocale(UserContext.today);if(val.indexOf("tod")==0){return DateUtil.getDateStringFromUserLocale(date);}else{if(val.indexOf("yes")==0){date.setDate(date.getDate()-1);return DateUtil.getDateStringFromUserLocale(date);}else{if(val.indexOf("tom")==0){date.setDate(date.getDate()+1);return DateUtil.getDateStringFromUserLocale(date);}else{if(val.length>=3){for(var i=0;i<DateUtil.DAY_SHORTCUTS.length;i++){if(val.indexOf(DateUtil.DAY_SHORTCUTS[i].toLowerCase())==0){var dif=i-date.getDay();if(dif<0){dif+=7;}date.setDate(date.getDate()+dif);return DateUtil.getDateStringFromUserLocale(date);}}}}}}return null;};DateUtil.differenceInMinutes=function(date1,date2){var diffInMillis=date2.getTime()-date1.getTime();return Math.round(diffInMillis/(60*1000));};DateUtil.getDateFromValue=function(fieldValue,hasTime){var time=hasTime?DateUtil.getDateFromFormat(fieldValue,UserContext.dateTimeFormat):DateUtil.getDateFromFormat(fieldValue,UserContext.dateFormat);if(time!=0){return new Date(time);}return null;};
function DomUtil(){}DomUtil.walkDomTreeApplyingFunction=function(node,funk){if(!node){return null;}var ans=funk(node);if(ans){return ans;}else{if(node.firstChild){for(var i=0;i<node.childNodes.length;i++){ans=DomUtil.walkDomTreeApplyingFunction(node.childNodes[i],funk);if(ans){return ans;}}}}return null;};DomUtil.findDescendantWithProperty=function(startNode,property,value,caseInSensitive){if(caseInSensitive){var lowerVal=value.toLowerCase();return DomUtil.walkDomTreeApplyingFunction(startNode,function(node){if(node[property]&&node[property].toLowerCase&&(node[property].toLowerCase()==lowerVal)){return node;}else{return null;}});}else{return DomUtil.walkDomTreeApplyingFunction(startNode,function(node){if((node[property]==value)){return node;}else{return null;}});}};DomUtil.findDescendantWithTag=function(startNode,tagType){return DomUtil.findDescendantWithProperty(startNode,"tagName",tagType,true);};DomUtil.findDescendantWithClassName=function(startNode,className){if(!className){return;}var spacedClass=" "+className+" ";return DomUtil.walkDomTreeApplyingFunction(startNode,function(node){if(node.className&&((" "+node.className+" ").indexOf(spacedClass)>-1)){return node;}else{return null;}});};DomUtil.importNode=function(node,targetDocument){if(!node){Gack.sendGack("invalid Node");return;}if(targetDocument.importNode){return targetDocument.importNode(node,false);}else{var copy=targetDocument.createElement(node.tagName);for(var at=0;at<node.attributes.length;at++){if(node.attributes[at].specified){copy.setAttribute(node.attributes[at].name,node.attributes[at].value);}}return copy;}};DomUtil.copyScripts=function(srcDoc,targetDoc,ignoreScripts){var targetHead=targetDoc.body.parentNode.firstChild;var scripts=srcDoc.getElementsByTagName("SCRIPT");var existingScripts=targetHead.getElementsByTagName("script");var scriptElement;for(var i=0,script;i<scripts.length;i++){script=scripts[i];var scriptAlreadyLoaded=false;var skip=false;if(script.src&&ignoreScripts){for(var y=0;y<ignoreScripts.length;y++){if(script.src.indexOf(ignoreScripts[y])!==-1){skip=true;break;}}}if(!skip&&script.src){for(var x=0;x<existingScripts.length;x++){if(existingScripts[x].src===script.src){scriptAlreadyLoaded=true;}}if(!scriptAlreadyLoaded){scriptElement=targetDoc.createElement("script");scriptElement.src=script.src;targetHead.appendChild(scriptElement);}}}};DomUtil.copyCSS=function(srcDoc,targetDoc,apiVersion){var targetHead=targetDoc.body.parentNode.firstChild;for(var i=0,sheet;i<srcDoc.styleSheets.length;i++){sheet=srcDoc.styleSheets[i];var newNode;if(sheet.ownerNode){newNode=DomUtil.importNode(sheet.ownerNode,targetDoc);}else{newNode=DomUtil.importNode(sheet.owningElement,targetDoc);}if(apiVersion&&newNode.href&&newNode.href.replace){newNode.href=newNode.href.replace("/sCSS/","/sCSS"+apiVersion+"/");}targetHead.appendChild(newNode);}};DomUtil.copyScriptsCssBodyClass=function(srcDoc,targetDoc,ignoreScripts){DomUtil.copyCSS(srcDoc,targetDoc);DomUtil.copyScripts(srcDoc,targetDoc,ignoreScripts);targetDoc.body.className=srcDoc.body.className;};DomUtil.setHelpLink=function(doc,url,helpTarget,helpSection){if(helpTarget&&helpSection){url=UserContext.getUrl("/help/doc/user_ed.jsp?loc=help&target=")+helpTarget+"&section="+helpSection;}var link=DomUtil.findDescendantWithClassName(doc,"helpLink");if(link){var par=link.parentNode;if(par&&par.href&&par.href.indexOf("openPopupFocusEscapePounds")>0){par.href=par.href.replace(/'.*?'/,"'"+url+"'");}}};
function Map(){this.size=0;this.map=new Object();}Map.prototype.put=function(key,val){if(!key||typeof(val)=="undefined"){return;}if(!(key in this.map)){this.size++;}this.map[key]=val;};Map.prototype.remove=function(key){if(key in this.map){delete (this.map[key]);this.size--;}};Map.prototype.get=function(key){return this.map[key];};Map.prototype.getSize=function(){return this.size;};Map.prototype.containsKey=function(key){return(this.get(key)!=null);};Map.prototype.each=function(func){for(var key in this.map){func(key);}};
function SimpleDecimalFormat(decimalSeparator,groupingSeparator,posPrefix,negPrefix,posSuffix,negSuffix){this.decimalSeparator=decimalSeparator;this.groupingSeparator=groupingSeparator;this.posPrefix=posPrefix;this.negPrefix=negPrefix;this.posSuffix=posSuffix;this.negSuffix=negSuffix;}SimpleDecimalFormat.prototype.formatNumber=function(n){n=parseFloat(n);var whole=String(parseInt(n,10));var sub=Math.round((n-parseInt(n,10))*100);sub=(sub<0)?sub*-1:sub;if(sub==100){whole++;sub="00";}else{sub=sub==0?"00":sub<10?"0"+sub:String(sub);}var r=/(\d+)(\d{3})/;while(r.test(whole)){whole=whole.replace(r,"$1"+this.groupingSeparator+"$2");}return whole+this.decimalSeparator+sub;};SimpleDecimalFormat.prototype.formatCurrency=function(n){val=parseFloat(n);n=this.formatNumber(n);if(val>=0){return this.posPrefix+n+this.posSuffix;}else{if(n.charAt(0)=="-"){n=n.substr(1);}return this.negPrefix+n+this.negSuffix;}};SimpleDecimalFormat.prototype._parseFloat=function(n){n=String(n);if(n.indexOf(this.decimalSeparator)<0){return parseInt(n,10);}var ps=n.split(this.decimalSeparator);var sub=ps[1]?parseInt(ps[1],10):0;if(isNaN(ps[0])||isNaN(sub)){return NaN;}sub=ps[1]?sub/(Math.pow(10,ps[1].length)):0;return parseInt(ps[0])+sub;};SimpleDecimalFormat.prototype._isNaN=function(n){for(var i=0;i<n.length;i++){var c=n.charAt(i);if(isNaN(parseInt(c))&&c!=this.decimalSeparator){return true;}}return false;};
var UrlMap=new function(){this.urlMap=[];this.urlMap.EventTeamView=UserContext.getUrl("/appex/calendar/cal.jsp");this.urlMap.Login=UserContext.getUrl("/secur/login_page.jsp");this.urlMap.Home=UserContext.getUrl("/home/home.jsp");this.urlMap.Inviter=UserContext.getUrl("/email/inviter.jsp");this.urlMap.ComboBox=UserContext.getUrl("/widg/combobox.jsp");this.urlMap.EmailAuthorPopupCloser=UserContext.getUrl("/email/author/popupcloser.jsp");this.urlMap.BlankPage=UserContext.getUrl("/blank.html");this.getURL=function(key){return this.urlMap[key];};this.convertClassNameToUrl=function(className,qs){var result=new String(UserContext.getUrl("/"));var classString=new String(className);if(classString.indexOf(JSPDispatcher.STANDARD_PACKAGE+".")!=0){result=result.concat(JSPDispatcher.NONSTANDARD_PACKAGE_PREFIX);}result=result.concat(classString.replace(/\./g,"/"));if(qs!=null){result=result.concat(qs.toString());}return result.valueOf();};};
var XBrowser={userAgent:{isIE:navigator.userAgent.indexOf("MSIE")!=-1,isIE8:navigator.userAgent.indexOf("MSIE 8")!=-1,isIE7:navigator.userAgent.indexOf("MSIE 7")!=-1&&navigator.userAgent.indexOf("MSIE 8")==-1,isIE6:navigator.userAgent.indexOf("MSIE 6")!=-1&&navigator.userAgent.indexOf("MSIE 7")==-1&&navigator.userAgent.indexOf("MSIE 8")==-1,isOpera:navigator.userAgent.indexOf("Opera")!=-1,isSafari:navigator.userAgent.indexOf("AppleWebKit")!=-1,isSafari3:navigator.userAgent.indexOf("AppleWebKit")!=-1&&navigator.userAgent.indexOf("Version/3")!=-1,isFirefox:navigator.userAgent.indexOf("Firefox/")!=-1,isFirefox2:navigator.userAgent.indexOf("Firefox/2")!=-1,isNetscape:navigator.userAgent.indexOf("Netscape/")!=-1},dashify:function(str){return str.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();},getCurrentStyle:function(element,styleProp){if(element.currentStyle){return element.currentStyle[styleProp];}else{if(document.defaultView&&document.defaultView.getComputedStyle){return document.defaultView.getComputedStyle(element,null).getPropertyValue(XBrowser.dashify(styleProp));}}return null;},getElementStyle:function(element,styleProp){if(element.currentStyle){return element.currentStyle[styleProp];}else{if(element.style.getPropertyValue){return element.style.getPropertyValue(styleProp);}}return null;},getActualHeight:function(element,useScrollHeight){var regex=/.*px$/;var height=useScrollHeight?element.scrollHeight:element.offsetHeight;var paddingTop=XBrowser.getCurrentStyle(element,"paddingTop");var paddingBottom=XBrowser.getCurrentStyle(element,"paddingBottom");if((!regex.exec(paddingTop))||(!regex.exec(paddingBottom))){return height;}paddingTop=paddingTop.substring(0,paddingTop.length-2);paddingBottom=paddingBottom.substring(0,paddingBottom.length-2);return height-paddingTop-paddingBottom;},createHttpRequest:function(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else{if(window.ActiveXObject){try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}}return null;},getHttpResponse:function(url,handler,errorHandler,method,body,scope){var request=XBrowser.createHttpRequest();var theMethod=method||"GET";request.open(theMethod,url,true);request.onreadystatechange=(!handler&&!errorHandler)?function(){}:function(){if(request.readyState==4){if(request.status==200&&handler){handler.call(scope,request);}else{if(errorHandler){errorHandler.call(scope,request);}}}};if(body&&method=="POST"){request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-13");}request.send(body);return request;},postHttpResponse:function(url,handler,postBody,errorHandler,scope){return XBrowser.getHttpResponse(url,handler,errorHandler,"POST",postBody,scope);},buildPost:function(map){var arr=[];var first=true;for(var key in map){if(!first){arr.push("&");}first=false;if(map[key] instanceof Array){var valueArray=map[key];if(valueArray.length==0){arr.push(key);arr.push("=");}else{for(var i=0;i<valueArray.length;i++){if(i>0){arr.push("&");}arr.push(key);arr.push("=");arr.push(encodeURIComponent(valueArray[i]));}}}else{arr.push(key);arr.push("=");arr.push(encodeURIComponent(map[key]));}}return arr.join("");},createDynamicScript:function(url,handler){var script=document.createElement("script");if(handler){if(window.ActiveXObject){script.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){handler();}};}else{script.onload=handler;}}script.type="text/javascript";script.src=url;document.body.appendChild(script);},turnOnBackgroundImageCache:function(){try{document.execCommand("BackgroundImageCache",false,true);}catch(error){}},fireEvent:function(element,event){if(document.createEvent&&element.dispatchEvent){var evt=document.createEvent("HTMLEvents");evt.initEvent(event,true,true);return element.dispatchEvent(evt);}else{if(document.createEventObject&&element.fireEvent){return element.fireEvent("on"+event,document.createEventObject());}else{return null;}}}};if(!window.Node){var Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};}
var dpdLkUtil={scrapePage:function(domIds){var res=[sfdcPage.getEntityId()];for(var i=0;i<domIds.length;i++){var val=sfdcPage.getFieldValueById(domIds[i]);res.push(val===undefined?val:escape(val));}return res;},serialize:function(domIds){return SimpleJson.encode(dpdLkUtil.scrapePage(domIds));}};
function Attachments(){}var hasPendingAttachments=false;function addPendingAttachment(attId){document.getElementById(Activity.pNEW_ATTACHMENTS).value=document.getElementById(Activity.pNEW_ATTACHMENTS).value+attId+",";hasPendingAttachments=true;displayAttachmentWarning(true);}function removePendingAttachment(attId,listDomId){var att=document.getElementById(Activity.pNEW_ATTACHMENTS);if(att){var attStr=new String(att.value);att.value=attStr.replace(attId+",","");hasPendingAttachments=(att.value.length>=15);if(!hasPendingAttachments){displayAttachmentWarning(false);}var extraParamNames=null;var attIds=document.getElementById(Activity.pNEW_ATTACHMENTS);if(attIds){extraParamNames=new Array(attIds.id);}var rl=sfdcPage.getRelatedListById(listDomId);if(rl){rl.refresh(extraParamNames,attIds?new Array(attIds.value):null);}}}function displayAttachmentWarning(showWarning){var aw=document.getElementById(Activity.pATT_WARNING);if(aw){if(showWarning){aw.style.display="block";}else{aw.style.display="none";}}}function activityBodyOnLoad(attachmentId,relatedListId){window.opener.addPendingAttachment(attachmentId);var extraParamNames=null;var attIds=window.opener.document.getElementById(Activity.pNEW_ATTACHMENTS);if(attIds){extraParamNames=new Array(attIds.id);}var rl=window.opener.sfdcPage.getRelatedListById(relatedListId);if(rl){rl.refresh(extraParamNames,attIds?new Array(attIds.value):null);}}Attachments.prototype.promoteAttachments=function(sessionId,parentId,attachments,checkSize){var promotionResult=null;if(sessionId&&parentId&&(attachments||checkSize)){var qs=new QueryString("");qs.add("sid",sessionId);qs.add("pid",parentId);qs.add("att",attachments);if(checkSize){qs.add("check","1");}var promoteURL=UserContext.getUrl("/servlet/promoteAtt")+qs.toString();var response=DesktopAjax.prototype.doGet(promoteURL);if(response){promotionResult=eval("("+response+")");}}return promotionResult;};
var CSNWelcomeMessageElement={close:function(){UserContext.userPreferences.setBoolean("HideCSNWelcomeMessage",true);document.getElementById(CSNWelcomeMessage.DOM_ID).style.display="none";}};
var EmailRoutingAddress={};EmailRoutingAddress.toggleTaskStatus=function(createTaskElem,statusElem){var createTask=document.getElementById(createTaskElem);var status=document.getElementById(statusElem);if(createTask.checked){status.options[status.selectedIndex].text=EmailRoutingAddress.taskStatusPrevValue;status.disabled=false;}else{EmailRoutingAddress.taskStatusPrevValue=status.options[status.selectedIndex].text;status.options[status.selectedIndex].text=" ";status.disabled=true;}};
function EmailRelay(){}EmailRelay.prototype.checkActivateRestrictToDomains=function(){var restrictRelayToDomainsCheckbox=document.getElementById(EmailRelayConstants.ACTIVATE_RESTRICT_TO_DOMAINS_ID);var restrictRelayToDomains=document.getElementById(EmailRelayConstants.RESTRICT_TO_DOMAINS_ID);var restrictRelayToDomainsHidden=document.getElementById(EmailRelayConstants.RESTRICT_TO_DOMAINS_HIDDEN_ID);if(restrictRelayToDomainsCheckbox.checked){restrictRelayToDomains.disabled=false;}else{restrictRelayToDomains.value="";restrictRelayToDomainsHidden.value="";restrictRelayToDomains.disabled=true;}};EmailRelay.prototype.changeRestrictToDomains=function(){var restrictRelayToDomains=document.getElementById(EmailRelayConstants.RESTRICT_TO_DOMAINS_ID);var restrictRelayToDomainsHidden=document.getElementById(EmailRelayConstants.RESTRICT_TO_DOMAINS_HIDDEN_ID);restrictRelayToDomainsHidden.value=restrictRelayToDomains.value;};EmailRelay.prototype.handleTlsChange=function(){var TLS_OFF_VALUE=0;var DEFAULT_EMAIL_HOST_PORT_INDEX=0;var DEFAULT_TLS_PORT_INDEX=1;var emailRelayTlsSetting=document.getElementById(EmailRelayConstants.EMAIL_RELAY_TLS_SETTING_ID);var relayPort=document.getElementById(EmailRelayConstants.EMAIL_HOST_PORT_ID);var emailRelayTlsSettingVal=emailRelayTlsSetting.options[emailRelayTlsSetting.selectedIndex].value;var relayPortSelectedIndex=relayPort.selectedIndex;if(emailRelayTlsSettingVal==TLS_OFF_VALUE&&relayPortSelectedIndex==DEFAULT_TLS_PORT_INDEX){relayPort.options[DEFAULT_EMAIL_HOST_PORT_INDEX].selected=true;}else{if(emailRelayTlsSettingVal!=TLS_OFF_VALUE&&relayPortSelectedIndex==DEFAULT_EMAIL_HOST_PORT_INDEX){relayPort.options[DEFAULT_TLS_PORT_INDEX].selected=true;}}};
function EmailAttachmentManagement(){}EmailAttachmentManagement.prototype.toggleSelectOption=function(selectOption){var filename=document.getElementById(EmailAttachmentManagementConstants.FILE_NAME_ID);var senderLookup=document.getElementById(EmailAttachmentManagementConstants.SENDER_LOOKUP_ID);var startDate=document.getElementById(EmailAttachmentManagementConstants.START_DATE_ID);var endDate=document.getElementById(EmailAttachmentManagementConstants.END_DATE_ID);var lookupUrl=document.getElementById(EmailAttachmentManagementConstants.LOOKUP_URL_ID);if(selectOption==EmailAttachmentManagementConstants.SEARCH_BY_DATA){filename.disabled=false;senderLookup.disabled=false;startDate.disabled=false;endDate.disabled=false;lookupUrl.disabled=true;}else{filename.disabled=true;senderLookup.disabled=true;startDate.disabled=true;endDate.disabled=true;lookupUrl.disabled=false;}};
function EmailAddrEdit(){}EmailAddrEdit.prototype.changeToCancelRetURL=function(){var qs=new QueryString("");qs.add(EmailAddrEditConstants.pSAVE_CANCEL,"true");document.editPage.elements.retURL.value=UrlMap.getURL("EmailAuthorPopupCloser")+qs.toString();};
function EmailCCBccLookup(){}EmailCCBccLookup.prototype.storeAddrs=function(select,names,addrs,skipValue){names.value="";addrs.value="";if(select!=null){var isFirst=true;for(var i=0;i<select.length;i++){if(select.options[i]!=null&&select.options[i].value!=""&&select.options[i].value!=skipValue){if(isFirst){isFirst=false;}else{names.value+=EmailAuthorConstants.EMAIL_ADDR_DELIM;addrs.value+=EmailAuthorConstants.EMAIL_ADDR_DELIM;}names.value+=select.options[i].text;addrs.value+=select.options[i].value;}}}};EmailCCBccLookup.prototype.storeAllAddresses=function(skipValue){EmailCCBccLookup.prototype.storeAddrs(document.getElementById(EmailCCBccLookupConstants.ADDITIONAL_TO_ID),document.getElementById(EmailCCBccLookupConstants.ADDITIONAL_TO_NAME_ID),document.getElementById(EmailCCBccLookupConstants.ADDITIONAL_TO_ADDR_ID),skipValue);EmailCCBccLookup.prototype.storeAddrs(document.getElementById(EmailCCBccLookupConstants.CC_ID),document.getElementById(EmailCCBccLookupConstants.CC_NAME_ID),document.getElementById(EmailCCBccLookupConstants.CC_ADDR_ID),skipValue);EmailCCBccLookup.prototype.storeAddrs(document.getElementById(EmailCCBccLookupConstants.BCC_ID),document.getElementById(EmailCCBccLookupConstants.BCC_NAME_ID),document.getElementById(EmailCCBccLookupConstants.BCC_ADDR_ID),skipValue);};EmailCCBccLookup.prototype.changeContactType=function(skipValue){EmailCCBccLookup.prototype.storeAllAddresses(skipValue);var form=document.forms[EditPageConstants.pEDIT_PAGE];form.submit();return true;};EmailCCBccLookup.prototype.sizeToContent=function(){var documentHeight;var windowHeight;for(var i=0;i<5;i++){if(document.height){documentHeight=document.height;}else{if(document.body.offsetHeight){documentHeight=document.body.offsetHeight;}else{return;}}windowHeight=documentHeight;if(window.innerHeight){windowHeight=window.innerHeight;}else{if(document.documentElement.clientHeight&&document.documentElement.clientHeight>0){windowHeight=document.documentElement.clientHeight;}else{windowHeight=document.body.clientHeight;}}if(documentHeight>windowHeight&&window.resizeBy){window.resizeBy(0,documentHeight-windowHeight);}else{break;}}};
var backgroundIFrameTitle;function EmailTemplateEditorUi(title,isCustomP,formNameP){registerEmptyCellText(LC.getLabel("EmailTemplate","emptyCellText"));this.editAreaIds=null;backgroundIFrameTitle=title;this.isCustom=isCustomP;this.formName=formNameP;}EmailTemplateEditorUi.prototype.gatherEditableIds=function(){var tempIds=new Object(20);var elements=document.getElementsByTagName("td");var index=0;for(var i=0;i<elements.length;i++){var element=elements[i];if(element.id!=null&&element.id.length>0){tempIds[index]=element.id;index++;}}editAreaIds=new Object(index);for(var i=0;i<index;i++){editAreaIds[i]=tempIds[i];}};EmailTemplateEditorUi.prototype.getTopTable=function(){var topTable=document.getElementById("topTable");var allTables=document.getElementsByTagName("table");if((!topTable)&&allTables){topTable=allTables[0];}return topTable;};EmailTemplateEditorUi.prototype.getDefaultPopupWidth=function(){var topTable=getTopTable();if(topTable){return Math.min(Math.max(topTable.offsetWidth+60,500),1024);}else{return 500;}};EmailTemplateEditorUi.prototype.getDefaultPopupHeight=function(){var topTable=getTopTable();if(topTable){return Math.min(Math.max(topTable.offsetHeight+200,500),768);}else{return 500;}};EmailTemplateEditorUi.prototype.init=function(){if(top!=this){if(this.isCustom){if(document.body){parent.setFrameWidth(document.body.scrollWidth);parent.setFrameHeight(document.body.scrollHeight);}}else{this.gatherEditableIds();setEditableIds(editAreaIds);registerLockingConfirmText(LC.getLabel("EmailTemplate","SetLockedConfirmText"));setLockedImageSrc(UserContext.getUrl("/email/wysiwyg/images/locked.gif"));setUnlockedImageSrc(UserContext.getUrl("/email/wysiwyg/images/unlocked.gif"));registerEditForm(parent.document.forms[this.formName]);initializeEditor();top.editFinishedLoading=true;}}else{window.resizeTo(this.getDefaultPopupWidth(),this.getDefaultPopupHeight());}};
function EmailTemplatePreview(){}EmailTemplatePreview.prototype.toggleRctOptions=function(typePrefix,lookupPrefix){var lookupOption=document.getElementById(typePrefix+"Option0");var idInput=document.getElementById(typePrefix+"Id");var lookupInput=document.getElementById(lookupPrefix);var lookupLink=document.getElementById(lookupPrefix+LookupInputElement.pLOOKUP_WIDGET);var lookupRequiredBlockDiv=document.getElementById(typePrefix+EmailTemplatePreviewConstants.LOOKUP_REQUIRED_BLOCK_ID);var idRequiredBlockDiv=document.getElementById(typePrefix+EmailTemplatePreviewConstants.ID_REQUIRED_BLOCK_ID);if(lookupOption.checked){idInput.disabled=true;idRequiredBlockDiv.className="";lookupInput.disabled=false;lookupLink.disabled=false;lookupRequiredBlockDiv.className=EmailTemplatePreviewConstants.REQUIRED_BLOCK_CLASS;}else{idInput.disabled=false;idRequiredBlockDiv.className=EmailTemplatePreviewConstants.REQUIRED_BLOCK_CLASS;lookupInput.disabled=true;lookupLink.disabled=true;lookupRequiredBlockDiv.className="";}};
function MailmergeTemplateSelectElement(_id,_items,_fileDownloadUrl){this.id=_id;this.items=_items;this.fileDownloadUrl=_fileDownloadUrl;var element=this;sfdcPage.appendToOnloadQueue(function(){element.init();});}MailmergeTemplateSelectElement.prototype.init=function(){var selectEle=document.getElementById(this.id);var mmtseEle=this;var previewEle=document.getElementById(MailmergeTemplateSelectElementConst.TEMPLATE_VIEW_BUTTON+"_"+this.id);if(previewEle){addEvent(previewEle,"mouseup",function(){MailmergeTemplateSelectElement.showPreview(mmtseEle.fileDownloadUrl,selectEle);},false);}addEvent(selectEle,"mousemove",function(){MailmergeTemplateSelectElement.showDetails(mmtseEle.id,selectEle,mmtseEle.items);},false);addEvent(selectEle,"change",function(){MailmergeTemplateSelectElement.showDetails(mmtseEle.id,selectEle,mmtseEle.items);},false);MailmergeTemplateSelectElement.showDetails(mmtseEle.id,selectEle,mmtseEle.items);};MailmergeTemplateSelectElement.showDetails=function(_id,selectEle,items){if(selectEle.selectedIndex<0){return;}var selectedOption=selectEle.options[selectEle.selectedIndex];var templateItem=(selectedOption)?items[selectedOption.value]:null;if(templateItem==null){return;}var tName=templateItem[MailmergeTemplateSelectElementConst.TEMPLATE_TITLE];var description=templateItem[MailmergeTemplateSelectElementConst.TEMPLATE_DESCRIPTION];document.getElementById(MailmergeTemplateSelectElementConst.TEMPLATE_TITLE+"_"+_id).innerHTML=tName;document.getElementById(MailmergeTemplateSelectElementConst.TEMPLATE_DESCRIPTION+"_"+_id).innerHTML=description;};MailmergeTemplateSelectElement.showPreview=function(url,selectEle){if(selectEle.selectedIndex<0){return;}window.open(url+"?file="+selectEle.options[selectEle.selectedIndex].value,"_blank");};
var PortalStyleConfigEditor={themes:{},themeLoader:null,previewUrls:{},inputs:[]};PortalStyleConfigEditor.updateAllPreviews=function(){for(key in this.previewUrls){this.updatePreview(this.previewUrls[key],key);}};PortalStyleConfigEditor.ThemeLoader=function(id){this.id=id;this.select=document.getElementById(id);var self=this;this.handleChange=function(e){self.loadTheme();};this.init();};PortalStyleConfigEditor.ThemeLoader.prototype.loadTheme=function(){var newTheme=this.select.value;var styleMap=PortalStyleConfigEditor.themes[newTheme];for(key in styleMap){var field=document.getElementById(key);field.value=styleMap[key];if(field.updateColor){field.updateColor();}}this.select.value=newTheme;PortalStyleConfigEditor.updateAllPreviews();};PortalStyleConfigEditor.ThemeLoader.prototype.reset=function(){this.select.value="";};PortalStyleConfigEditor.ThemeLoader.prototype.init=function(){addEvent(this.select,"change",this.handleChange,false);PortalStyleConfigEditor.themeLoader=this;};PortalStyleConfigEditor.FontSizeInputElement=function(id){this.id=id;this.input=document.getElementById(id);var self=this;this.handleChange=function(e){self.formatInput();};this.init();};PortalStyleConfigEditor.FontSizeInputElement.prototype.formatInput=function(){var fontSize=this.input.value;if("%"!=fontSize.charAt(fontSize.length-1)){this.input.value=fontSize+"%";}};PortalStyleConfigEditor.FontSizeInputElement.prototype.init=function(){addEvent(this.input,"change",this.handleChange,false);};PortalStyleConfigEditor.CssWidthInputElement=function(id){this.id=id;this.select=document.getElementById(id);};PortalStyleConfigEditor.FontFamilyInputElement=function(id){this.id=id;this.select=document.getElementById(id);};PortalStyleConfigEditor.BorderStyleInputElement=function(id){this.id=id;this.input=document.getElementById(id);};PortalStyleConfigEditor.getPostBody=function(){var params={};for(var i=0;i<this.inputs.length;i++){var input=this.inputs[i];params[input.id]=input.value;}return XBrowser.buildPost(params);};PortalStyleConfigEditor.updatePreview=function(url,target){var handler=function(r){var iframe=document.getElementById(target);var doc=iframe.contentWindow||iframe.contentDocument;if(doc.document){doc=doc.document;}doc.body.innerHTML="";doc.write(r.responseText);doc.close();iframe.style.height=doc.body.offsetHeight+"px";};var postBody=this.getPostBody();XBrowser.postHttpResponse(url,handler,postBody);};PortalStyleConfigEditor.init=function(){var tmp=document.getElementById(EditPageConstants.pEDIT_PAGE).elements;var handler=function(e){PortalStyleConfigEditor.themeLoader.reset();PortalStyleConfigEditor.updateAllPreviews();};for(var i=0;i<tmp.length;i++){var field=tmp[i];if(0==field.id.indexOf(PortalStyleConfigEditorConstants.PARAM_PREFIX)&&field.id!=this.themeLoader.id){addEvent(field,"change",handler);this.inputs.push(field);}}};
function PortalTabSetEditor(selectToUpdateId){this.selectToUpdateId=selectToUpdateId;}PortalTabSetEditor.prototype.update=function(availableSelectId){var selectedTabs=document.getElementById(availableSelectId);var selectToUpdate=document.getElementById(this.selectToUpdateId);var selectedDefault=selectToUpdate.options[selectToUpdate.selectedIndex].value;var options=selectedTabs.options;var optionsArr=[];var isSelectedInOptions=false;for(var i=0;i<options.length;i++){var option=options[i];optionsArr[i]=[option.text,option.value];if(option.value==selectedDefault){isSelectedInOptions=true;}}if(!isSelectedInOptions){selectedDefault=optionsArr[0].value;}Util.refreshDynamicSelect(selectToUpdate,optionsArr,false,selectedDefault);};
var CustomObjectTeamMemberPage={};CustomObjectTeamMemberPage.getMemberRow=function(rowIndex){return document.getElementById(CustomObjectTeamMemberUiConstants.MEMBERS_TABLE_ROW_PREFIX+rowIndex);};CustomObjectTeamMemberPage.initializeRoles=function(){var maxMemberIndex=parseInt(document.getElementById(CustomObjectTeamMemberUiConstants.pMEMBERS_COUNT).value);for(var i=0;i<maxMemberIndex;i++){CustomObjectTeamMemberPage.roleChangeHandler(i);var removedElement=document.getElementById(CustomObjectTeamMemberUiConstants.pREMOVED_MEMBERS_PREFIX+i);if(removedElement.value=="1"){CustomObjectTeamMemberPage.getMemberRow(i).style.display="none";}}var maxTeamIndex=parseInt(document.getElementById(CustomObjectTeamMemberUiConstants.pTEAM_RECORDS_COUNT).value);for(var i=0;i<maxTeamIndex;i++){var removedElement=document.getElementById(CustomObjectTeamMemberUiConstants.pREMOVED_TEAMS_PREFIX+i);if(removedElement.value=="1"){CustomObjectTeamMemberPage.getTeamRecordRow(i).style.display="none";}}};CustomObjectTeamMemberPage.roleChangeHandler=function(rowIndex){var selectElement=document.getElementById(CustomObjectTeamMemberUiConstants.pROLE_PREFIX+rowIndex);var shareElement=document.getElementById(CustomObjectTeamMemberUiConstants.pSHARE_ACCESS_PREFIX+rowIndex);var cspElement=document.getElementById(CustomObjectTeamMemberUiConstants.pCSP_PORTAL_PREFIX+rowIndex);var roleId=selectElement.options[selectElement.selectedIndex].value;if(roleId==""){shareElement.innerHTML="";cspElement.innerHTML="";}else{shareElement.innerHTML=document.getElementById(CustomObjectTeamMemberUiConstants.pSHARE_ACCESS_PREFIX+roleId).value;cspElement.innerHTML=document.getElementById(CustomObjectTeamMemberUiConstants.pCSP_PORTAL_PREFIX+roleId).innerHTML;}};CustomObjectTeamMemberPage.addMemberRow=function(roles,lookupDomains,removeActionLabel,lookupName){var countElement=document.getElementById(CustomObjectTeamMemberUiConstants.pMEMBERS_COUNT);var currentIndex=parseInt(countElement.value);countElement.value=currentIndex+1;var newRowTr=document.createElement("tr");newRowTr.id=CustomObjectTeamMemberUiConstants.MEMBERS_TABLE_ROW_PREFIX+currentIndex;var removeLink=document.createElement("a");removeLink.className="actionLink";removeLink.innerHTML=removeActionLabel;removeLink.href="javascript:CustomObjectTeamMemberPage.removeMemberRow("+currentIndex+");";var removeTd=document.createElement("td");removeTd.className="actionColumn";removeTd.appendChild(removeLink);newRowTr.appendChild(removeTd);var memberLookupTdId="new_tm_"+currentIndex;var memberLookupTd=document.createElement("td");memberLookupTd.id=memberLookupTdId;newRowTr.appendChild(memberLookupTd);var roleSelect=document.createElement("select");roleSelect.id=CustomObjectTeamMemberUiConstants.pROLE_PREFIX+currentIndex;roleSelect.name=CustomObjectTeamMemberUiConstants.pROLE_PREFIX+currentIndex;var roleIndex;for(roleIndex=0;roleIndex<roles.length;roleIndex+=1){var option1=document.createElement("option");option1.innerHTML=roles[roleIndex][0];option1.value=roles[roleIndex][1];roleSelect.appendChild(option1);}var roleTd=document.createElement("td");roleTd.appendChild(roleSelect);newRowTr.appendChild(roleTd);var shareTd=document.createElement("td");shareTd.id=CustomObjectTeamMemberUiConstants.pSHARE_ACCESS_PREFIX+currentIndex;newRowTr.appendChild(shareTd);var cspVisibleTd=document.createElement("td");cspVisibleTd.className="booleanColumn";cspVisibleTd.id=CustomObjectTeamMemberUiConstants.pCSP_PORTAL_PREFIX+currentIndex;newRowTr.appendChild(cspVisibleTd);roleSelect.onchange=function(){CustomObjectTeamMemberPage.roleChangeHandler(currentIndex);};var tableElement=document.getElementById(CustomObjectTeamMemberUiConstants.MEMBERS_TABLE);tableElement.firstChild.appendChild(newRowTr);var removedElement=document.createElement("input");removedElement.id=CustomObjectTeamMemberUiConstants.pREMOVED_MEMBERS_PREFIX+currentIndex;removedElement.name=removedElement.id;document.getElementById(CustomObjectTeamMemberUiConstants.REMOVED_MEMBERS_CONTAINER).appendChild(removedElement);var fkf=new ForeignKeyField(CustomObjectTeamMemberUiConstants.pMEMBER_PREFIX+currentIndex,true,false,false,["",""],{domain:lookupDomains,useNewLookups:false});fkf.tableCell={previousSibling:{nodeType:Node.TEXT_NODE,nodeValue:lookupName}};fkf.editDiv=document.getElementById(memberLookupTdId);fkf.createEditElements();};CustomObjectTeamMemberPage.removeMemberRow=function(rowIndex){CustomObjectTeamMemberPage.getMemberRow(rowIndex).style.display="none";document.getElementById(CustomObjectTeamMemberUiConstants.pREMOVED_MEMBERS_PREFIX+rowIndex).value="1";};CustomObjectTeamMemberPage.getTeamRecordRow=function(rowIndex){return document.getElementById(CustomObjectTeamMemberUiConstants.TEAMS_TABLE_ROW_PREFIX+rowIndex);};CustomObjectTeamMemberPage.addTeamRecordRow=function(lookupDomains,removeActionLabel,lookupName){var countElement=document.getElementById(CustomObjectTeamMemberUiConstants.pTEAM_RECORDS_COUNT);var currentIndex=parseInt(countElement.value);countElement.value=currentIndex+1;var newRowTr=document.createElement("tr");newRowTr.id=CustomObjectTeamMemberUiConstants.TEAMS_TABLE_ROW_PREFIX+currentIndex;var removeLink=document.createElement("a");removeLink.className="actionLink";removeLink.innerHTML=removeActionLabel;removeLink.href="javascript:CustomObjectTeamMemberPage.removeTeamRecordRow("+currentIndex+");";var removeTd=document.createElement("td");removeTd.className="actionColumn";removeTd.appendChild(removeLink);newRowTr.appendChild(removeTd);var memberLookupTdId="new_tt_"+currentIndex;var memberLookupTd=document.createElement("td");memberLookupTd.id=memberLookupTdId;newRowTr.appendChild(memberLookupTd);var tableElement=document.getElementById(CustomObjectTeamMemberUiConstants.TEAMS_TABLE);tableElement.firstChild.appendChild(newRowTr);var removedElement=document.createElement("input");removedElement.id=CustomObjectTeamMemberUiConstants.pREMOVED_TEAMS_PREFIX+currentIndex;removedElement.name=removedElement.id;document.getElementById(CustomObjectTeamMemberUiConstants.REMOVED_TEAMS_CONTAINER).appendChild(removedElement);var fkf=new ForeignKeyField(CustomObjectTeamMemberUiConstants.pTEAM_RECORD_PREFIX+currentIndex,true,false,false,["",""],{domain:lookupDomains,useNewLookups:false});fkf.tableCell={previousSibling:{nodeType:Node.TEXT_NODE,nodeValue:lookupName}};fkf.editDiv=document.getElementById(memberLookupTdId);fkf.createEditElements();};CustomObjectTeamMemberPage.removeTeamRecordRow=function(rowIndex){CustomObjectTeamMemberPage.getTeamRecordRow(rowIndex).style.display="none";document.getElementById(CustomObjectTeamMemberUiConstants.pREMOVED_TEAMS_PREFIX+rowIndex).value="1";};
var CustomObjectTeamTemplatePage={};CustomObjectTeamTemplatePage.getMemberRow=function(rowIndex){return document.getElementById(CustomObjectTeamTemplateUiConstants.pSHARE_ACCESS_PREFIX+rowIndex).parentNode;};CustomObjectTeamTemplatePage.initializeRoles=function(){var maxIndex=parseInt(document.getElementById(CustomObjectTeamTemplateUiConstants.pMEMBERS_COUNT).value);for(var i=0;i<maxIndex;i++){CustomObjectTeamTemplatePage.roleChangeHandler(i);var removedElement=document.getElementById(CustomObjectTeamTemplateUiConstants.pREMOVED_PREFIX+i);if(removedElement.value=="1"){CustomObjectTeamTemplatePage.getMemberRow(i).style.display="none";}}};CustomObjectTeamTemplatePage.roleChangeHandler=function(rowIndex){var selectElement=document.getElementById(CustomObjectTeamTemplateUiConstants.pROLE_PREFIX+rowIndex);var shareElement=document.getElementById(CustomObjectTeamTemplateUiConstants.pSHARE_ACCESS_PREFIX+rowIndex);var cspElement=document.getElementById(CustomObjectTeamTemplateUiConstants.pCSP_PORTAL_PREFIX+rowIndex);var roleId=selectElement.options[selectElement.selectedIndex].value;if(roleId==""){shareElement.innerHTML="";cspElement.innerHTML="";}else{shareElement.innerHTML=document.getElementById(CustomObjectTeamTemplateUiConstants.pSHARE_ACCESS_PREFIX+roleId).value;cspElement.innerHTML=document.getElementById(CustomObjectTeamTemplateUiConstants.pCSP_PORTAL_PREFIX+roleId).innerHTML;}};CustomObjectTeamTemplatePage.addMemberRow=function(roles,lookupDomains,removeActionLabel){var countElement=document.getElementById(CustomObjectTeamTemplateUiConstants.pMEMBERS_COUNT);var currentIndex=parseInt(countElement.value);countElement.value=currentIndex+1;var newRowTr=document.createElement("tr");var removeLink=document.createElement("a");removeLink.className="actionLink";removeLink.innerHTML=removeActionLabel;removeLink.href="javascript:CustomObjectTeamTemplatePage.removeMemberRow("+currentIndex+");";var removeTd=document.createElement("td");removeTd.className="actionColumn";removeTd.appendChild(removeLink);newRowTr.appendChild(removeTd);var memberLookupTdId="new_tm_"+currentIndex;var memberLookupTd=document.createElement("td");memberLookupTd.id=memberLookupTdId;newRowTr.appendChild(memberLookupTd);var roleSelect=document.createElement("select");roleSelect.id=CustomObjectTeamTemplateUiConstants.pROLE_PREFIX+currentIndex;roleSelect.name=CustomObjectTeamTemplateUiConstants.pROLE_PREFIX+currentIndex;var roleIndex;for(roleIndex=0;roleIndex<roles.length;roleIndex+=1){var option1=document.createElement("option");option1.innerHTML=roles[roleIndex][0];option1.value=roles[roleIndex][1];roleSelect.appendChild(option1);}var roleTd=document.createElement("td");roleTd.appendChild(roleSelect);newRowTr.appendChild(roleTd);var shareTd=document.createElement("td");shareTd.id=CustomObjectTeamTemplateUiConstants.pSHARE_ACCESS_PREFIX+currentIndex;newRowTr.appendChild(shareTd);var cspVisibleTd=document.createElement("td");cspVisibleTd.className="booleanColumn";cspVisibleTd.id=CustomObjectTeamTemplateUiConstants.pCSP_PORTAL_PREFIX+currentIndex;newRowTr.appendChild(cspVisibleTd);roleSelect.onchange=function(){CustomObjectTeamTemplatePage.roleChangeHandler(currentIndex);};var tableElement=document.getElementById("tm_t");tableElement.firstChild.appendChild(newRowTr);var removedElement=document.createElement("input");removedElement.id=CustomObjectTeamTemplateUiConstants.pREMOVED_PREFIX+currentIndex;removedElement.name=removedElement.id;document.getElementById(CustomObjectTeamTemplateUiConstants.REMOVED_CONTAINER).appendChild(removedElement);var fkf=new ForeignKeyField(CustomObjectTeamTemplateUiConstants.pMEMBER_PREFIX+currentIndex,true,false,false,["",""],{domain:lookupDomains,useNewLookups:false});fkf.tableCell={previousSibling:{nodeType:Node.TEXT_NODE,nodeValue:"node"}};fkf.editDiv=document.getElementById(memberLookupTdId);fkf.createEditElements();};CustomObjectTeamTemplatePage.removeMemberRow=function(rowIndex){document.getElementById(CustomObjectTeamTemplateUiConstants.pMEMBER_PREFIX+rowIndex).value=document.getElementById(CustomObjectTeamTemplateUiConstants.pMEMBER_PREFIX+rowIndex+EditElement.pOLD_NAME_SUFFIX).value;CustomObjectTeamTemplatePage.getMemberRow(rowIndex).style.display="none";document.getElementById(CustomObjectTeamTemplateUiConstants.pREMOVED_PREFIX+rowIndex).value="1";};
var RuleFilterPage={};RuleFilterPage.toggleReassignElements=function(baseName,baseTemplateName){var isChecked=document.getElementById(baseName+RuleFilterPageConstants.NO_REASSIGN_SUFFIX).checked;document.getElementById(baseName).disabled=isChecked;document.getElementById(baseName+MultiLookupInputElement.MULTI_LOOKUP_SELECT_SUFFIX).disabled=isChecked;document.getElementById(baseName+LookupInputElement.pLOOKUP_WIDGET).style.display=(isChecked)?"none":"inline";document.getElementById(baseName).parentNode.parentNode.firstChild.style.display=(isChecked)?"none":"inline";document.getElementById(baseTemplateName).disabled=isChecked;document.getElementById(baseTemplateName+LookupInputElement.pLOOKUP_WIDGET).style.display=(isChecked)?"none":"inline";};
var KEY_BACKSPACE=8;var KEY_TAB=9;var KEY_ENTER=13;var KEY_ESC=27;var KEY_SPACE=32;var KEY_PAGEDOWN=33;var KEY_PAGEUP=34;var KEY_ARROW_L=37;var KEY_ARROW_U=38;var KEY_ARROW_R=39;var KEY_ARROW_D=40;var KEY_SHIFT=16;var KEY_CTRL=17;var KEY_ALT=18;var KEY_CAPSLOCK=20;var KEY_0=48;var KEY_1=49;var KEY_2=50;var KEY_3=51;var KEY_4=52;var KEY_5=53;var KEY_6=54;var KEY_7=55;var KEY_8=56;var KEY_9=57;var KEY_A=65;var KEY_B=66;var KEY_C=67;var KEY_D=68;var KEY_E=69;var KEY_F=70;var KEY_G=71;var KEY_H=72;var KEY_I=73;var KEY_J=74;var KEY_K=75;var KEY_L=76;var KEY_M=77;var KEY_N=78;var KEY_O=79;var KEY_P=80;var KEY_Q=81;var KEY_R=82;var KEY_S=83;var KEY_T=84;var KEY_U=85;var KEY_V=86;var KEY_W=87;var KEY_X=88;var KEY_Y=89;var KEY_Z=90;var KEY_WINDOWS_L=91;var KEY_WINDOWS_R=92;var KEY_SELECT=93;var KEY_NUMPAD_0=96;var KEY_NUMPAD_1=97;var KEY_NUMPAD_2=98;var KEY_NUMPAD_3=99;var KEY_NUMPAD_4=100;var KEY_NUMPAD_5=101;var KEY_NUMPAD_6=102;var KEY_NUMPAD_7=103;var KEY_NUMPAD_8=104;var KEY_NUMPAD_9=105;var KEY_NUMPAD_MULTIPLY=106;var KEY_NUMPAD_PLUS=107;var KEY_NUMPAD_MINUS=109;var KEY_NUMPAD_DECIMAL=110;var KEY_NUMPAD_DIVIDE=111;var KEY_F1=112;var KEY_F2=113;var KEY_F3=114;var KEY_F4=115;var KEY_F5=116;var KEY_F6=117;var KEY_F7=118;var KEY_F8=119;var KEY_F9=120;var KEY_F10=121;var KEY_F11=122;var KEY_F12=123;var KEY_PAUSE=19;var KEY_END=35;var KEY_HOME=36;var KEY_INSERT=45;var KEY_DELETE=46;var KEY_NUMLOCK=144;var KEY_SCROLLLOCK=145;var KEY_SEMICOLON=186;var KEY_EQUALS=61;var KEY_COMMA=188;var KEY_DASH=109;var KEY_PERIOD=190;var KEY_FORWARDSLASH=191;var KEY_GRAVE=192;var KEY_OPENBRACKET=219;var KEY_BACKSLASH=220;var KEY_CLOSEBRACKET=221;var KEY_APOSTROPHE=222;var KEY_PROCESS=229;
var CampaignInfluenceSetupUi={};CampaignInfluenceSetupUi.setAutomaticAssociation=function(enabled){var i=1;var nextField=document.getElementById("fcol"+i);var nextOp=document.getElementById("fop"+i);var nextVal=document.getElementById("fval"+i);while(nextField){nextField.disabled=!enabled;nextOp.disabled=!enabled;nextVal.disabled=!enabled;i++;nextField=document.getElementById("fcol"+i);nextOp=document.getElementById("fop"+i);nextVal=document.getElementById("fval"+i);}var bool=document.getElementById("bool_filter");if(bool){bool.disabled=!enabled;}var timeframe=document.getElementById("citf");if(timeframe){timeframe.disabled=!enabled;}};
function FctSummaryPage(){}FctSummaryPage.onForecastLookupBoxInput=function(element,oEvent){if((oEvent.keyCode&&oEvent.keyCode==13)||(oEvent.which&&oEvent.which==13)){document.getElementById(ForecastSummaryPage.pLOOKUP_INPUT_ENTERED).value=1;element.form.submit();}};
function leadConvertLookupPick(formName,selectId,accountId,accountName){var acc_select=document.getElementById(selectId);for(i=0;i<acc_select.options.length;i++){var option=acc_select.options[i];if(option.value==accountId){option.selected=true;if(acc_select.onchange){acc_select.onchange();}return;}}var accountNameFull=LC.getLabel("Page_Lead_Convert","attach",accountName);var accOption=new Option(accountNameFull,accountId,true,true);acc_select.options[acc_select.options.length]=accOption;var i=0;var lastHidden=document.getElementById("accids");if(lastHidden){lastHidden.id="accids0";document.getElementById("accnames").id="accnames0";i=1;}else{do{lastHidden=document.getElementById("accids"+i++);}while(lastHidden);i--;}var hiddenId=document.createElement("input");hiddenId.type="hidden";hiddenId.id="accids"+i;hiddenId.name="accids";hiddenId.value=accountId;var hiddenName=document.createElement("input");hiddenName.type="hidden";hiddenName.id="accnames"+i;hiddenName.name="accnames";hiddenName.value=accountNameFull;document[formName].appendChild(hiddenId);document[formName].appendChild(hiddenName);if(acc_select.onchange){acc_select.onchange();}}
if(window.Ext&&window.Ext.form){Ext.ns("Sfdc.html");Sfdc.html.QuickfindInput=Ext.extend(Ext.form.TriggerField,{cls:"quickfindInput",ctCls:"quickfindContainer",enableKeyEvents:true,hideTrigger:true,buffer:false,initComponent:function(){var args=this.buffer?{buffer:this.buffer}:null;var scope=this.scope||this;this.on("keyup",function(queryObj){var query=queryObj.getRawValue();if(query.length>0){this.trigger.show();}else{this.trigger.hide();}if(this.searchFunction){this.searchFunction.call(scope,query);}},this,args);Sfdc.html.QuickfindInput.superclass.initComponent.call(this);},onTriggerClick:function(){this.trigger.hide();this.reset();this.focus();if(this.clearFunction){var scope=this.scope||this;this.clearFunction.call(scope);}}});}
var QueryString=function(qs,allowMultipleValuesForParam){this.allowMultipleValuesForParam=allowMultipleValuesForParam;this.params=new Object();if(qs==null){qs=location.search.substring(1,location.search.length);}if(qs.length==0){return;}qs=qs.replace(/\+/g," ");var args=qs.split("&");for(var i=0;i<args.length;i++){var index=args[i].indexOf("=");if(index>0){var name=decodeURIComponent(args[i].substr(0,index));var value=decodeURIComponent(args[i].substr(index+1));this.add(name,value);}}};QueryString.prototype.getAllParams=function(){return this.params;};QueryString.prototype.getAllowMultipleValuesForParam=function(name,defaultVal){return this.allowMultipleValuesForParam;};QueryString.prototype.get=function(name,defaultVal){var value=this.params[name];if(value){return value;}else{if(defaultVal){return defaultVal;}else{return null;}}};QueryString.prototype.add=function(name,value){if(!this.allowMultipleValuesForParam){this.params[name]=value;}else{var valueArray=this.params[name];if(!valueArray){valueArray=new Array();valueArray[0]=value;}else{valueArray[valueArray.length]=value;}this.params[name]=valueArray;}};QueryString.prototype.addAll=function(qs){for(var name in qs.params){this.add(name,qs.params[name]);}};QueryString.prototype.append=function(name,value,delim){if(this.allowMultipleValuesForParam){throw"Append is not supported with multi param mode";}if(this.params[name]){this.add(name,this.params[name]+delim+value);}else{this.add(name,value);}};QueryString.prototype.remove=function(name){this.params[name]=null;};QueryString.prototype.toString=function(){var str="?";for(var name in this.params){var value=this.params[name];if(value!=undefined){if(!this.allowMultipleValuesForParam){str=str+name+"="+encodeURIComponent(value)+"&";}else{for(var ind=0;ind<value.length;ind++){if(value[ind]){str=str+name+"="+encodeURIComponent(value[ind])+"&";}}}}}return str;};QueryString.getURI=function(url){var q=url.indexOf("?");return(q>0)?url.substring(0,q):url;};QueryString.createQueryString=function(url,allowMultipleValuesForParam){var q=url.indexOf("?");var qs=(q>=0)?url.substring(q+1):"";return new QueryString(qs,allowMultipleValuesForParam);};QueryString.valueFromHash=function(key,delimiter){if(window.location.href.indexOf("#")==-1){return;}var hash=window.location.href.split("#")[1];var pairs=hash.split(delimiter);for(var c=0;c<pairs.length;c++){if(pairs[c]===key){return pairs[c+1];}}return null;};QueryString.clearHash=function(){window.location.hash="#";};QueryString.prototype.equals=function(comparedQueryString){if(this.allowMultipleValuesForParam||comparedQueryString.getAllowMultipleValuesForParam()){throw"QueryString.prototype.equals does not support AllowMultipleValuesForParam query strings";}var size=0;var comparedQueryStringSize=0;for(var name in this.params){size++;var value=this.params[name];var comparedQueryStringValue=comparedQueryString.get(name);if(value!=comparedQueryStringValue){return false;}}for(var name in comparedQueryString.getAllParams()){comparedQueryStringSize++;}if(size!=comparedQueryStringSize){return false;}return true;};QueryString.urlsEqual=function(url1,url2){return(url1.length==url2.length)&&(QueryString.getURI(url1)==QueryString.getURI(url2))&&QueryString.createQueryString(url1).equals(QueryString.createQueryString(url2));};
SimpleJson={encode:function(obj){if(obj===undefined){return"";}if(obj===null){return"null";}switch(obj.constructor){case String:return'"'+obj.replace(/\"/g,'\\"').replace(/\r|\n|\f/g,"\\n")+'"';case Array:var buf=[];for(var i=0;i<obj.length;i++){buf.push(arguments.callee(obj[i]));}return"["+buf.join(",")+"]";case Object:var buf=[];for(var k in obj){if(obj.hasOwnProperty(k)){buf.push(arguments.callee(k)+":"+arguments.callee(obj[k]));}}return"{"+buf.join(",")+"}";default:return obj.toString();}}};
var BusinessHoursPage={};BusinessHoursPage.set24x7Hours=function(checked,startInputId,endInputId,twelveOClock){var startInputElement=document.getElementById(startInputId);var endInputElement=document.getElementById(endInputId);if(checked){startInputElement.className="timeInputActive";startInputElement.value=twelveOClock;startInputElement.disabled=true;endInputElement.className="timeInputActive";endInputElement.value=twelveOClock;endInputElement.disabled=true;}else{startInputElement.disabled=false;endInputElement.disabled=false;}};
function EmailToCaseSettings(e2cId,ode2cId,overLimitId,unAuthId){this.e2cElem=document.getElementById(e2cId);this.ode2cElem=document.getElementById(ode2cId);this.overLimitElem=document.getElementById(overLimitId);this.unAuthElem=document.getElementById(unAuthId);}EmailToCaseSettings.prototype.toggleFailureSettings=function(){if(this.ode2cElem.checked){this.overLimitElem.disabled=false;this.unAuthElem.disabled=false;}else{this.overLimitElem.disabled=true;this.unAuthElem.disabled=true;}};EmailToCaseSettings.prototype.toggleEmailToCase=function(){if(this.e2cElem.checked){this.ode2cElem.disabled=false;}else{this.ode2cElem.checked=false;this.ode2cElem.disabled=true;}this.toggleFailureSettings();};
var HolidayFunction={};HolidayFunction.setNoEndDate=function(checked,recEndDateId){var recEndDateElem=document.getElementById(recEndDateId);recEndDateElem.disabled=checked;if(checked){recEndDateElem.value="";}};HolidayFunction.setIsRecurrent=function(checked,activityDateId,recStartDateId,recEndDateId,noEndDateId){var recStartDateElem=document.getElementById(recStartDateId);var recEndDateElem=document.getElementById(recEndDateId);var activityDateElem=document.getElementById(activityDateId);var noEndDate=document.getElementById(noEndDateId).checked;activityDateElem.disabled=checked;recStartDateElem.disabled=!checked;if(checked){if(recStartDateElem.value==""){recStartDateElem.value=activityDateElem.value;}recEndDateElem.disabled=noEndDate;document.getElementById(ActivityUi.RECURRENCE_PATTERN_DIV).style.display="";}else{recEndDateElem.disabled=true;document.getElementById(ActivityUi.RECURRENCE_PATTERN_DIV).style.display="none";}};HolidayFunction.setIsAllDay=function(checked){document.getElementById(HolidayUi.START_TIME_PARAM).disabled=checked;document.getElementById(HolidayUi.END_TIME_PARAM).disabled=checked;};HolidayFunction.setActivityDate=function(activityDateId,recStartDateId){var dateStr=document.getElementById(activityDateId).value;var date=DateUtil.getDateFromUserLocale(dateStr);if(date.getTime()!=0){document.getElementById(recStartDateId).value=dateStr;document.getElementById(Activity.pYEARLY_MONTHOFYEAR).value=date.getMonth();document.getElementById(Activity.pYEARLY_DAYOFMONTH).value=date.getDate();}};
function LC(){}LC.getLabel=function(){var retVal="";var args=this.getLabel.arguments;if(args[0]&&args[1]){retVal=LC.labels[args[0]][args[1]];}for(i=2;i<args.length;i++){var regexp=new RegExp("\\{"+(i-2)+"\\}","g");retVal=retVal.replace(regexp,args[i]);}return retVal;};LC.isEnglishLanguage=function(){return UserContext.initialized&&UserContext.language=="en_US";};LC.isUSLocale=function(){return UserContext.initialized&&UserContext.locale=="en_US";};LC.isEnglishUS=function(){return LC.isEnglishLanguage()&&LC.isUSLocale();};LC.isThaiTHLocale=function(){return UserContext.locale=="th_TH";};LC.isRtlPage=function(){return getCurrentStyle(document.body,"direction")=="rtl";};LC.BUDDHIST_CAL_OFFSET=543;
var ChangePassword=function(minLength,isAlphaNumericRequired,passwordPolicy,answerCannotContainPassword,lowerCaseLabels){this.minLength=minLength;this.isAlphaNumericRequired=isAlphaNumericRequired;this.passwordPolicy=passwordPolicy;this.answerCannotContainPassword=answerCannotContainPassword;this.weakLabel=LC.getLabel("Page_Change_Password","password_strength_weak");this.acceptableLabel=LC.getLabel("Page_Change_Password","password_strength_acceptable");this.strongLabel=LC.getLabel("Page_Change_Password","password_strength_strong");this.strengthTips=LC.getLabel("Page_Change_Password","password_strength_tips");this.strengthStrong=LC.getLabel("Page_Change_Password","password_strength_good");this.neutralAltText=LC.getLabel("Page_Change_Password","neutral_alt_text");this.weakAltText=LC.getLabel("Page_Change_Password","weak_alt_text");this.acceptableAltText=LC.getLabel("Page_Change_Password","acceptable_alt_text");this.strongAltText=LC.getLabel("Page_Change_Password","strong_alt_text");if(lowerCaseLabels){this.weakLabel=this.weakLabel.toLowerCase();this.acceptableLabel=this.acceptableLabel.toLowerCase();this.strongLabel=this.strongLabel.toLowerCase();}if(this.getElementsByClassNameWorkaroundForIE("div","errorMsg").length==0){this.errorPageLoad=false;}else{this.errorPageLoad=true;}this.genericListener();this.addListeners();};ChangePassword.prototype.addListeners=function(){var ref=this;if(document.getElementById(ChangePasswordConstants.pOLD_PASSWORD_ELEM)){document.getElementById(ChangePasswordConstants.pOLD_PASSWORD_ELEM).onkeyup=function(){ref.genericListener();};}document.getElementById(ChangePasswordConstants.pNEW_PASSWORD_ELEM).onkeyup=function(){ref.genericListener();};document.getElementById(ChangePasswordConstants.pNEW_PASSWORD_CONFIRMATION_ELEM).onkeyup=function(){ref.genericListener();};if(document.getElementById(ChangePasswordConstants.pQUESTION_ELEM)){document.getElementById(ChangePasswordConstants.pQUESTION_ELEM).onchange=function(){ref.genericListener();};}if(document.getElementById(ChangePasswordConstants.pANSWER_ELEM)){document.getElementById(ChangePasswordConstants.pANSWER_ELEM).onkeyup=function(){ref.genericListener();};}};ChangePassword.prototype.genericListener=function(){if(this.errorPageLoad){this.errorPageLoad=false;}else{this.passwordStrengthChecker();this.passwordVerify();if(document.getElementById(ChangePasswordConstants.pANSWER_ELEM)){this.answerVerify();}this.cleanUpErrorMessages();}};ChangePassword.prototype.passwordStrengthChecker=function(){this.newPasswordUntrimmed=document.getElementById(ChangePasswordConstants.pNEW_PASSWORD_ELEM).value;this.newPassword=this.newPasswordUntrimmed.replace(/^\s+|\s+$/g,"");if(this.checkBlankPassword()){return;}this.orgSpecificChecks();};ChangePassword.prototype.updateNewPasswordIconAndLabel=function(imagePath,label,labelClass,altText,infoIconText){this.updateIcon(ChangePasswordConstants.pNEW_PASSWORD_ICON_ELEM,UserContext.getUrl(imagePath),altText);this.updateLabel(ChangePasswordConstants.pNEW_PASSWORD_STRENGTH_ELEM,label,labelClass);this.updateLabel(ChangePasswordConstants.pNEW_PASSWORD_STRENGTH_INFO_ELEM,infoIconText,undefined);this.updatePromptVisibility(label);};ChangePassword.prototype.updatePromptVisibility=function(label){var promptElement=document.getElementById(ChangePasswordConstants.pNEW_PASSWORD_STRENGTH_PROMPT);if(promptElement){if(label.length>0){this.setStyleText(promptElement,"display:inline;");}else{this.setStyleText(promptElement,"display:none;");}}};ChangePassword.prototype.checkBlankPassword=function(){if(this.newPassword.length==0){this.updateNewPasswordIconAndLabel("/img/passwordStrength/neutral.gif","","pscNoEntry",this.neutralAltText,this.passwordPolicy);return true;}return false;};ChangePassword.prototype.orgSpecificChecks=function(){if(this.newPassword.length>=this.minLength){if(this.isAlphaNumericRequired){if((!this.newPassword.match(/\d+/)&&(this.newPassword.match(/[a-z]/)||this.newPassword.match(/[A-Z]/)))||(this.newPassword.match(/\d+/)&&!(this.newPassword.match(/[a-z]/)||this.newPassword.match(/[A-Z]/)))){this.strength=this.weakLabel;this.updateNewPasswordIconAndLabel("/img/passwordStrength/weak.gif",this.weakLabel,"pscWeak",this.weakAltText,this.passwordPolicy);return;}}this.strength=this.acceptableLabel;this.updateNewPasswordIconAndLabel("/img/passwordStrength/acceptable.gif",this.acceptableLabel,"pscAcceptable",this.acceptableAltText,this.strengthTips);this.passwordStrengthExtraChecks();return;}this.strength=this.weakLabel;this.updateNewPasswordIconAndLabel("/img/passwordStrength/weak.gif",this.weakLabel,"pscWeak",this.weakAltText,this.passwordPolicy);};ChangePassword.prototype.passwordStrengthExtraChecks=function(){if(this.newPassword.length>=8){if(this.newPassword.match(/\d+/)&&this.newPassword.match(/[a-z]/)&&this.newPassword.match(/[A-Z]/)){this.strength=this.strongLabel;this.updateNewPasswordIconAndLabel("/img/passwordStrength/strong.gif",this.strength,"pscStrong",this.strongAltText,this.strengthStrong);}}};ChangePassword.prototype.passwordVerify=function(){var verifyNewPassword=document.getElementById(ChangePasswordConstants.pNEW_PASSWORD_CONFIRMATION_ELEM).value;if((verifyNewPassword==this.newPasswordUntrimmed)&&this.newPassword!=""&&(this.strength!=this.weakLabel)){this.updateIcon(ChangePasswordConstants.pNEW_PASSWORD_CONFIRMATION_ICON_ELEM,UserContext.getUrl("/img/msg_icons/confirm16.gif"),LC.getLabel("Images","password_verify_alt"));return;}this.updateIcon(ChangePasswordConstants.pNEW_PASSWORD_CONFIRMATION_ICON_ELEM,UserContext.getUrl("/img/s.gif"),LC.getLabel("Images","blank_alt"));};ChangePassword.prototype.answerVerify=function(){if(!document.getElementById(ChangePasswordConstants.pANSWER_ELEM)||!document.getElementById(ChangePasswordConstants.pANSWER_ERROR_ELEM)){return;}var answer=document.getElementById(ChangePasswordConstants.pANSWER_ELEM).value;if(this.answerCannotContainPassword){if((answer.toLowerCase().indexOf(this.newPassword.toLowerCase())!=-1)&&this.newPassword!=""){this.updateIcon(ChangePasswordConstants.pANSWER_ICON_ELEM,UserContext.getUrl("/img/msg_icons/error16.gif"),LC.getLabel("Password","SecretAnswerContainsPassword"));this.updateLabel(ChangePasswordConstants.pANSWER_ERROR_ELEM,LC.getLabel("Password","SecretAnswerContainsPassword"),undefined);return;}this.updateIcon(ChangePasswordConstants.pANSWER_ICON_ELEM,UserContext.getUrl("/img/s.gif"),LC.getLabel("Images","blank_alt"));this.updateLabel(ChangePasswordConstants.pANSWER_ERROR_ELEM,"",undefined);}};ChangePassword.prototype.updateIcon=function(elementId,imageSrc,imageAlt){var element=document.getElementById(elementId);if(element){element.innerHTML="<img src = '"+imageSrc+"' alt = '"+imageAlt+"'></img>";}};ChangePassword.prototype.updateLabel=function(elementId,label,labelClass){var element=document.getElementById(elementId);if(element){element.innerHTML=label;if(labelClass){element.setAttribute("class",labelClass);element.setAttribute("className",labelClass);}}};ChangePassword.prototype.cleanUpErrorMessages=function(){var errorArray=this.getElementsByClassNameWorkaroundForIE("div","errorMsg");var loopCounter=errorArray.length;while(loopCounter>0){loopCounter--;errorArray[loopCounter].parentNode.removeChild(errorArray[loopCounter]);}};ChangePassword.prototype.getElementsByClassNameWorkaroundForIE=function(tag,elementName){var tagArray=document.getElementsByTagName(tag);var nameArray=new Array();var attributeName=document.all?"className":"class";for(i=0,j=0;i<tagArray.length;i++){if(tagArray[i].getAttribute(attributeName)==elementName){nameArray[j]=tagArray[i];j++;}}return nameArray;};ChangePassword.prototype.setStyleText=function(node,styleText){if(node){if(node.style.setAttribute){node.style.setAttribute("cssText",styleText);}else{node.setAttribute("style",styleText);}}};
function HTPortal(){}HTPortal.HELP_LINKS_IDS=new Array("contents","index","faq","glossary","tips");HTPortal.SUPPORT_LINKS_IDS=new Array("logACase","myOpenCases","myClosedCases","allOpenCases","allClosedCases");HTPortal.getHelpDocsDir=function(contentUrl){return contentUrl.substring(contentUrl.indexOf("/help/doc"),contentUrl.lastIndexOf("/")+1);};HTPortal.getParameter=function(url,name){var index=url.lastIndexOf(name+"=");if(index==-1){return null;}var value=url.substr(index);if(value.indexOf("&")==-1){value=value.substr(value.indexOf("=")+1);}else{value=value.substring(value.indexOf("=")+1,value.indexOf("&"));}return value;};HTPortal.getTopLevelPageUrl=function(){var host=location.host;var protocol=location.protocol;var url=protocol+"//"+host+UserContext.getUrl("/help/doc/user_ed.jsp");var qs="?";if(top&&top.frames.nav&&top.frames.body){var navFrameUrl=top.frames.nav.location.href;var tab=HTPortal.getParameter(navFrameUrl,HTPortal.pLOCATION);if(tab=="help"){if(top.frames.body.frames.content&&top.frames.body.frames.toc){var contentFrameUrl=top.frames.body.frames.content.location.href;var target=contentFrameUrl.substr(contentFrameUrl.lastIndexOf("/")+1);var section;var tocFrameUrl=top.frames.body.frames.toc.location.href;if(tocFrameUrl.match("sfix.htm")){section="index";}else{section=HTPortal.getParameter(tocFrameUrl,HTPortal.pSECTION);}qs=qs+HTPortal.pSECTION+"="+section+"&"+HTPortal.pLOCATION+"="+tab+"&"+HTPortal.pTARGET+"="+encodeURIComponent(target);}}else{if(tab=="null"){var body=top.frames.body.location.pathname;if(body==UserContext.getUrl("/help/doc/user_ed_feature.jsp")){var bodyFrameUrl=top.frames.body.location.href;var feature=HTPortal.getParameter(bodyFrameUrl,HTPortal.pFEATURE);qs=qs+HTPortal.pFEATURE+"="+feature;}else{if(body==UserContext.getUrl("/_ui/training/help/CombinedSearchPage")||body==UserContext.getUrl("/_ui/training/help/HelpSearchPage")||body==UserContext.getUrl("/_ui/training/help/LocalSfdcSolutionSearchPage")){var bodyFrameUrl=top.frames.body.location.href;var q=HTPortal.getParameter(bodyFrameUrl,"str");qs=qs+HTPortal.pBODY+"="+encodeURIComponent(body)+"&str="+q;}else{if(body==UserContext.getUrl("/_ui/training/help/pub/UserEdSolution")){var bodyFrameUrl=top.frames.body.location.href;var orgId=HTPortal.getParameter(bodyFrameUrl,HTPortal.pORG_ID);var solnId=HTPortal.getParameter(bodyFrameUrl,HTPortal.pID);qs=qs+HTPortal.pBODY+"="+encodeURIComponent(body)+"&"+HTPortal.pORG_ID+"="+orgId+"&"+HTPortal.pID+"="+solnId;}}}}else{if(tab=="support"){qs=qs+HTPortal.pLOCATION+"="+tab;}else{if(tab=="training"){var qs_training="";var body=top.frames.body.location.pathname;if(body==UserContext.getUrl("/train/register.jsp")){var bodyFrameUrl=top.frames.body.location.href;var classId=HTPortal.getParameter(bodyFrameUrl,HTPortal.pID);var classDay=HTPortal.getParameter(bodyFrameUrl,HTPortal.pCLASS_DAY);qs_training=qs_training+"&"+HTPortal.pID+"="+classId+"&"+HTPortal.pCLASS_DAY+"="+classDay;}else{if(body==UserContext.getUrl("/train/training_frame.jsp")){var leftFrameUrl=top.frames.body.frames.nav.location.href;var track=HTPortal.getParameter(leftFrameUrl,HTPortal.pTRACK);var region=HTPortal.getParameter(leftFrameUrl,HTPortal.pSELECT_LOCATION);qs_training=qs_training+"&"+HTPortal.pTRACK+"="+track+"&"+HTPortal.pSELECT_LOCATION+"="+region;var rightFrameUrl=top.frames.body.frames.detail.location.href;var className=HTPortal.getParameter(rightFrameUrl,"class");if(className!=null){qs_training=qs_training+"&"+HTPortal.pCLASS_NAME+"="+className;}}}qs=qs+HTPortal.pLOCATION+"="+tab+"&"+HTPortal.pBODY+"="+encodeURIComponent(body)+qs_training;}}}}}return url+qs;};HTPortal.updatePageUrl=function(){try{var url=HTPortal.getTopLevelPageUrl();var email=top.frames.nav.document.getElementById("email");if(email&&url){email.href="mailto:?body="+encodeURIComponent(url);}}catch(err){}};HTPortal.highlightToc=function(){var topic=top.frames.body.frames.content.location.href;topic=topic.substring(topic.lastIndexOf("/")+1,topic.indexOf(".htm"));top.frames.body.frames.toc.HTMLTreeNode.prototype.openHTMLTree("none",topic);};HTPortal.checkHighlighting=function(){var navFrameUrl=top.frames.nav.location.href;var tab=HTPortal.getParameter(navFrameUrl,HTPortal.pLOCATION);if(navFrameUrl){if(tab=="help"){var contentUrl=top.frames.body.frames.content.location.pathname;var tocUrl=top.frames.body.frames.toc.location.pathname;if(contentUrl&&tocUrl){if(tocUrl.match("sfix.htm")){HTPortal.clearHighlightingExceptLinkIndex(tab,1);HTPortal.highlightId("index");}else{if(contentUrl.match("faq.htm")){HTPortal.clearHighlightingExceptLinkIndex(tab,2);HTPortal.highlightId("faq");}else{if(contentUrl.match("glossary.htm")){HTPortal.clearHighlightingExceptLinkIndex(tab,3);HTPortal.highlightId("glossary");}else{if(contentUrl.match("quicktour_tips.htm")){HTPortal.clearHighlightingExceptLinkIndex(tab,4);HTPortal.highlightId("tips");}else{if(tocUrl.match("helptoc.jsp")){HTPortal.clearHighlightingExceptLinkIndex(tab,0);HTPortal.highlightId("contents");}}}}}}}}};HTPortal.clearHighlightingExceptLinkIndex=function(tab,linkIndex){var id;if(tab=="help"){for(id in HTPortal.HELP_LINKS_IDS){if(id!=linkIndex){HTPortal.clearHighlightId(HTPortal.HELP_LINKS_IDS[id]);}}}else{if(tab=="support"){for(id in HTPortal.SUPPORT_LINKS_IDS){if(id!=linkIndex){HTPortal.clearHighlightId(HTPortal.SUPPORT_LINKS_IDS[id]);}}}}};HTPortal.highlightId=function(linkId){var linkObj=top.frames.nav.document.getElementById(linkId);if(linkObj){HTPortal.highlight(linkObj);}};HTPortal.clearHighlightId=function(linkId){var linkObj=top.frames.nav.document.getElementById(linkId);if(linkObj){HTPortal.clearHighlight(linkObj);}};HTPortal.highlight=function(linkObj){if(linkObj.className!="selected"){linkObj.className="selected";}};HTPortal.clearHighlight=function(linkObj){if(linkObj.className!=""){linkObj.className="";}};
function LookupHoverDetail(id,url){this.lookup=getElementByIdCS(id);this.width=LookupHoverDetail.STANDARD_BUBBLE_WIDTH;this.bubbleOffset=XBrowser.userAgent.isIE6?5:14;this.height=LookupHoverDetail.STANDARD_BUBBLE_HEIGHT;this.hover=document.createElement("div");this.hover.id=id+"Hover";this.hover.className="individualPalette lookupHoverDetail lookupHoverDetailLoading lookupHoverDetailOverridable";this.hover.innerHTML='<div class="topLeft"><div class="bPageBlock"><div class="pbBody">'+LC.getLabel("Global","loading")+'<\div><div class="pbFooter"><div class="bg"><\div></div></div><\div>';document.body.appendChild(this.hover);var self=this;addEvent(this.hover,"mouseover",function(){self.show();},true);addEvent(this.hover,"mouseout",function(){self.hide();},true);addEvent(this.hover,"click",function(e){var target=getEventTarget(e);var tag=target.tagName;if(tag==="A"||(tag==="INPUT"&&target.type==="button")){self.hide();}},false);this.hover=new iframeShim(this.hover);this.originalClass="";this.fadingOut=null;this.fadingIn=null;this.loaderURL=url;this.loaded=false;}LookupHoverDetail.STANDARD_BUBBLE_WIDTH=302;LookupHoverDetail.STANDARD_BUBBLE_HEIGHT=262;LookupHoverDetail.SHOW_DELAY=800;LookupHoverDetail.HIDE_DELAY=250;LookupHoverDetail.stopLoading=false;LookupHoverDetail.hovers={};LookupHoverDetail.getHover=function(id,url){if(LookupHoverDetail.hovers[id]){return LookupHoverDetail.hovers[id];}var hover=new LookupHoverDetail(id,url);LookupHoverDetail.hovers[id]=hover;return hover;};LookupHoverDetail.prototype.show=function(){if(this.fadingOut){clearTimeout(this.fadingOut);this.fadingOut=null;}else{var self=this;this.fadingIn=setTimeout(function(){self.showNow();},LookupHoverDetail.SHOW_DELAY);}};LookupHoverDetail.prototype.showNow=function(){if(!this.loaded){if(this.loaderURL!=null){var self=this;XBrowser.getHttpResponse(this.loaderURL,function(response){self.load(response.responseText);},function(response){self.load(response.responseText);});}else{return;}}this.position();this.hover.setStyle("visibility","visible");this.fadingIn=null;};LookupHoverDetail.prototype.hide=function(){if(this.fadingIn){clearTimeout(this.fadingIn);this.fadingIn=null;}else{var self=this;this.fadingOut=setTimeout(function(){self.hideNow();},LookupHoverDetail.HIDE_DELAY);}};LookupHoverDetail.prototype.hideNow=function(){this.hover.setStyle("visibility","hidden");this.fadingOut=null;};LookupHoverDetail.prototype.load=function(responseText){this.hover.div.innerHTML=responseText;Util.evalScriptsUnderElement(this.hover.div);this.originalClass=this.hover.div.firstChild.className;this.height=this.hover.div.offsetHeight;delStyleClass(this.hover.div,"lookupHoverDetailLoading");this.position();this.loaded=true;};LookupHoverDetail.prototype.position=function(){var lookupX=getObjX(this.lookup);var lookupY=getObjY(this.lookup);var lookupW=this.lookup.offsetWidth;var lookupH=this.lookup.offsetHeight;var winX=getScrollX();var winY=getScrollY();var winWidth=getWindowWidth();var winHeight=getWindowHeight();var bubbleClass=this.originalClass+" ";var hoverX,hoverY;if(lookupY+lookupH+this.height<winY+winHeight){bubbleClass+="top";hoverY=lookupY+lookupH;}else{bubbleClass+="bottom";hoverY=lookupY-this.height;}if(lookupX+lookupW-this.bubbleOffset+this.width<winX+winWidth){bubbleClass+="Left";hoverX=lookupX+lookupW/2-this.bubbleOffset;}else{bubbleClass+="Right";hoverX=lookupX+lookupW/2-this.width;}this.hover.setStyle("left",hoverX+"px");this.hover.setStyle("top",hoverY+"px");this.hover.div.firstChild.className=bubbleClass;if(this.hover.div.firstChild){var overrideClass=Util.hasStyleEndsWith(this.hover.div.firstChild,"Override");if(overrideClass){delStyleClass(this.hover.div,"lookupHoverDetailOverridable");delStyleClass(this.hover.div.firstChild,overrideClass);addStyleClass(this.hover.div,overrideClass);}}};
function MRUHoverDetail(id){this.id=id;this.mruItem=getElementByIdCS("mru"+id);this.hover=document.createElement("div");this.hover.id=id+"Hover";this.hover.className="mruHoverDetail mruHoverLoading";this.hover.innerHTML='<div class="bPageBlock secondaryPalette"><div class="pbBody">'+LC.getLabel("Global","loading")+'</div><div class="pbFooter"></div></div>';this.mruItem.appendChild(this.hover);this.originalClass=this.mruItem.className;var width=this.mruItem.offsetWidth;if(this.mruItem.currentStyle&&XBrowser.userAgent.isIE6){width-=30;}var dir=LC.isRtlPage()?"right":"left";this.hover.style[dir]=width+"px";this.hover=new iframeShim(this.hover);this.fadingOut=null;this.fadingIn=null;this.loaded=false;}MRUHoverDetail.SHOW_DELAY=800;MRUHoverDetail.HIDE_DELAY=400;MRUHoverDetail.loaderURL=null;MRUHoverDetail.sentRequest=false;MRUHoverDetail.response=null;MRUHoverDetail.hovers={};MRUHoverDetail.openHover=null;MRUHoverDetail.getHover=function(id){if(MRUHoverDetail.hovers[id]){return MRUHoverDetail.hovers[id];}var hover=new MRUHoverDetail(id);MRUHoverDetail.hovers[id]=hover;return hover;};MRUHoverDetail.bulkLoad=function(){if(!MRUHoverDetail.sentRequest&&MRUHoverDetail.loaderURL!=null){MRUHoverDetail.sentRequest=true;XBrowser.getHttpResponse(MRUHoverDetail.loaderURL,function(request){MRUHoverDetail.response=request.responseText;if(MRUHoverDetail.openHover!=null){MRUHoverDetail.hovers[MRUHoverDetail.openHover].load();}},function(request){MRUHoverDetail.response=request.responseText;if(MRUHoverDetail.openHover!=null){MRUHoverDetail.hovers[MRUHoverDetail.openHover].load();}});}};MRUHoverDetail.prototype.show=function(){if(this.fadingOut){clearTimeout(this.fadingOut);this.fadingOut=null;}else{var self=this;this.fadingIn=setTimeout(function(){self.showNow();},MRUHoverDetail.SHOW_DELAY);}};MRUHoverDetail.prototype.showNow=function(){if(!MRUHoverDetail.sentRequest){if(MRUHoverDetail.loaderURL!=null){MRUHoverDetail.bulkLoad();}else{return;}}MRUHoverDetail.openHover=this.id;if(!this.loaded&&MRUHoverDetail.response!=null){this.load();}this.hover.setStyle("display","block");if(this.mruItem.currentStyle&&XBrowser.userAgent.isIE6){var dir=LC.isRtlPage()?"right":"left";this.hover.iframe.style[dir]=this.hover.div.style[dir];}this.mruItem.className=this.originalClass+" secondaryPalette";this.fadingIn=null;};MRUHoverDetail.prototype.hide=function(id){if(this.fadingIn){clearTimeout(this.fadingIn);this.fadingIn=null;}else{var self=this;this.fadingOut=setTimeout(function(){self.hideNow();},MRUHoverDetail.HIDE_DELAY);}};MRUHoverDetail.prototype.hideNow=function(){MRUHoverDetail.openHover=null;this.hover.setStyle("display","none");this.mruItem.className=this.originalClass;this.fadingOut=null;};MRUHoverDetail.prototype.load=function(){var startTag="<"+this.id+">";var endTag="</"+this.id+">";var start=MRUHoverDetail.response.indexOf(startTag);var end=MRUHoverDetail.response.indexOf(endTag);if(start!=-1&&end!=-1){this.hover.div.innerHTML=MRUHoverDetail.response.slice(start+startTag.length,end);Util.evalScriptsUnderElement(this.hover.div);delStyleClass(this.hover.div,"mruHoverLoading");this.loaded=true;}};
var TimePickerInputElement={};TimePickerInputElement.FocusInput=function(inputId){var inputElement=document.getElementById(inputId);inputElement.className="timeInputActive";if(inputElement.value==TimePickerInputElementConstants.EMPTY_TIME_STANDIN){inputElement.value="";inputElement.select();}else{if(inputElement.value!=""){inputElement.select();}}};TimePickerInputElement.BlurInput=function(inputId){var inputElement=document.getElementById(inputId);if(inputElement.value==""){inputElement.className="timeInputInactive";inputElement.value=TimePickerInputElementConstants.EMPTY_TIME_STANDIN;}};
function ToggleDealView(){}ToggleDealView.setShowDealViewUserPref=function(curValue,isBrowserSupported){if(isBrowserSupported){UserContext.userPreferences.setBoolean("ShowDealView",curValue,ToggleDealView.refreshPage);}else{Sfdc.NextGenDetail.openBrowserCompatibilityMsgWindow(false);}};ToggleDealView.refreshPage=function(request){window.location.reload(true);};ToggleDealView.goBackToClassicView=function(){this.setShowDealViewUserPref(false,true);};
function AppPicker(appExchangeUrl,appStoreUrl,developerUrl,cloudAppServlet,servletParam,pick,urlMap,btn){this.appExchangeUrl=appExchangeUrl;this.appStoreUrl=appStoreUrl;this.developerUrl=developerUrl;this.cloudAppServlet=cloudAppServlet;this.servletParam=servletParam;this.picker=pick;this.originalIndex=pick.selectedIndex;this.urlMap=urlMap;var self=this;if(btn){addEvent(btn,"click",function(){self.handleChange();},false);addEvent(pick,"change",function(){self.changeAlt();},false);}else{addEvent(pick,"change",function(){self.handleChange();},false);}this.changeAlt();}AppPicker.prototype.changeAlt=function(){this.picker.title=this.picker[this.picker.selectedIndex].text;};AppPicker.prototype.handleChange=function(){if(this.picker.options[this.picker.selectedIndex].value=="AppExchange"){var newWindow=window.open(this.appExchangeUrl,"AppExchangePopup");this.picker.selectedIndex=this.originalIndex;newWindow.focus();}else{if(this.picker.options[this.picker.selectedIndex].value=="AppStore"){var newWindow=window.open(this.appStoreUrl,"AppStorePopup");this.picker.selectedIndex=this.originalIndex;newWindow.focus();}else{if(this.picker.options[this.picker.selectedIndex].value=="DeveloperForce"){var newWindow=window.open(this.developerUrl,"DeveloperForcePopup");this.picker.selectedIndex=this.originalIndex;newWindow.focus();}else{if(this.picker.options[this.picker.selectedIndex].value=="EMPTY"){this.picker.selectedIndex=this.originalIndex;}else{var appId=this.picker.options[this.picker.selectedIndex].value;if(appId.match(/^0hc/)){var newWindow=window.open(this.cloudAppServlet+"?"+this.servletParam+"="+appId,"CloudApp"+appId);this.picker.selectedIndex=this.originalIndex;newWindow.focus();}else{var url=this.urlMap[appId];var tmpUrl=url.replace(UserContext.getUrl("/"),"/");if(tmpUrl.length>=4&&tmpUrl.substring(0,4)=="/sfc"){this.handleSFCTabSwitch(url);return;}else{if(url.indexOf("?")>=0){url=this.parseUrlParamsIntoHiddens(url);}}this.picker.form.action=this.urlMap[this.picker.options[this.picker.selectedIndex].value];this.picker.form.submit();}}}}}};AppPicker.prototype.parseUrlParamsIntoHiddens=function(url){var urlWithoutParams=url.split("?")[0];var paramString=url.split("?")[1];var params=paramString.split("&");for(var i=0;i<params.length;i++){var newHidden=document.createElement("INPUT");newHidden.type="hidden";newHidden.name=params[i].split("=")[0];newHidden.id=params[i].split("=")[0];newHidden.value=params[i].split("=")[1];this.picker.form.appendChild(newHidden);}return urlWithoutParams;};AppPicker.prototype.handleSFCTabSwitch=function(url){var tsidParam=this.picker.name+"="+this.picker.options[this.picker.selectedIndex].value;if(url.indexOf("?")>-1){url+="&";}else{url+="?";}url+=tsidParam;document.location.href=url;};
function Fader(object,testMin,testMax,timestep,nextStep,increment,initVal,finalMin,finalMax,startIn){var self=this;if(!(object&&testMin&&testMax&&timestep&&nextStep&&increment)){return null;}this.object=object;this.testMin=testMin;this.testMax=testMax;this.timestep=timestep;this.nextStep=nextStep;this.increment=increment;this.currVal=initVal;this.finalMin=finalMin;this.finalMax=finalMax;this.startIn=startIn;this.inId=-1;this.outId=-1;this.position="out";this.fadeIn=function(){if(self.startIn){self.startIn(this.object);}if(self.outId>=0){clearInterval(self.outId);self.outId=-1;}if(this.inId<0){self.inId=setInterval(fadeInCaller,self.timestep);self.position="moving_in";}};this.fadeOut=function(){if(self.inId>=0){clearInterval(self.inId);self.inId=-1;}if(self.outId<0){self.outId=setInterval(fadeOutCaller,self.timestep);self.position="moving_out";}};function fadeInCaller(){self.fadeInHelp();}function fadeOutCaller(){self.fadeOutHelp();}this.isMoving=function(){return(this.inId>=0||this.outId>=0);};this.getPosition=function(){return self.position;};}Fader.prototype.fadeInHelp=function(){var nextVal=this.nextStep(this.currVal,1);if(this.testMax(this.object,nextVal)){var finalVal=this.finalMax&&this.finalMax(this.object);if(typeof finalVal=="number"){this.currVal=finalVal;}clearInterval(this.inId);this.inId=-1;this.position="in";return;}this.increment(this.object,nextVal);this.currVal=nextVal;};Fader.prototype.fadeOutHelp=function(){var nextVal=this.nextStep(this.currVal,-1);if(this.testMin(this.object,nextVal)){var finalVal=this.finalMin&&this.finalMin(this.object);if(typeof finalVal=="number"){this.currVal=finalVal;}clearInterval(this.outId);this.outId=-1;this.position="out";return;}this.increment(this.object,nextVal);this.currVal=nextVal;};Fader.prototype.stopFade=function(){if(this.inId>=0){clearInterval(this.inId);this.inId=-1;}if(this.outId>=0){clearInterval(this.outId);this.outId=-1;}this.position="stopped";};Fader.prototype.jumpIn=function(){if(this.startIn){this.startIn(this.object);}var newCur=null;if(this.finalMax){newCur=this.finalMax(this.object);}if(newCur!==null){this.currVal=newCur;}this.position="in";};Fader.prototype.jumpOut=function(){var newCur=null;if(this.finalMin){newCur=this.finalMin(this.object);}if(newCur!==null){this.currVal=newCur;}this.position="out";};
function iframeShim(theDiv){this.div=theDiv;if(this.div.currentStyle){if(!XBrowser.userAgent.isIE6){this.setStyle=this.setStyleNonIE;this.setOpacity=this.setOpacityIE;this.getOpacity=this.getOpacityIE;}else{var frame=document.createElement("iframe");frame.src=IFrameElement.BLANK_SRC;frame.frameBorder="0";frame.scrolling="no";frame.className="iframeShim";frame.style.zIndex=this.div.currentStyle.zIndex-1;var offsetLeft=getLocalOffsetLeft(this.div);var styleLeft=this.div.currentStyle.left;if(offsetLeft==0&&styleLeft){frame.style.left=styleLeft;}else{frame.style.left=offsetLeft;}var offsetTop=getLocalOffsetTop(this.div);var styleTop=this.div.currentStyle.top;var styleBottom=this.div.currentStyle.bottom;if(offsetTop==0&&(styleTop||styleBottom)){frame.style.top=styleTop;frame.style.bottom=styleBottom;}else{frame.style.top=offsetTop;}frame.style.height=this.div.offsetHeight;frame.style.position="absolute";frame.style.display=this.div.currentStyle.display;this.iframe=frame;this.div.parentNode.insertBefore(this.iframe,this.div);this.setStyle=this.setStyleIE;this.setOpacity=this.setOpacityIE;this.getOpacity=this.getOpacityIE;}}else{this.setStyle=this.setStyleNonIE;this.setOpacity=this.setOpacityNonIE;this.getOpacity=this.getOpacityNonIE;}}iframeShim.prototype={setStyleNonIE:function(prop,val){this.div.style[prop]=val;},setStyleIE:function(prop,val){this.div.style[prop]=val;if(prop!="position"){this.iframe.style[prop]=val;}this.iframe.style.width=this.div.offsetWidth+"px";this.iframe.style.height=this.div.offsetHeight+"px";this.iframe.style.left=getLocalOffsetLeft(this.div);this.iframe.style.top=getLocalOffsetTop(this.div);},setOpacityNonIE:function(val){if(val<0){val=0;}if(val>1){val=1;}this.div.style.opacity=val;},setOpacityIE:function(val){if(val<0){val=0;}if(val>1){val=1;}this.div.filters.alpha.opacity=(val*100);},getOpacityNonIE:function(){return getCurrentStyle(this.div,"opacity");},getOpacityIE:function(){return this.div.filters.alpha.opacity/100;},getStyle:function(prop){return this.div.style[prop];}};
function LoadingScreen(theDiv,waitingText,id){this.div=theDiv;this.text=waitingText;this.id=id;}LoadingScreen.prototype={show:function(){if(!this.transparantElement){this.createElements();}if((XBrowser.userAgent.isIE6)||(XBrowser.userAgent.isIE7)){var h=this.div.clientHeight+"px";this.transparantElement.style.height=h;this.opaqueElement.style.height=h;}this.transparantElement.style.display="block";this.opaqueElement.style.display="block";},hide:function(){if(this.transparantElement){this.transparantElement.style.display="none";this.opaqueElement.style.display="none";}},createElements:function(){if(XBrowser.getCurrentStyle(this.div,"position")=="static"){this.div.style.position="relative";}this.transparantElement=this.createLoadingElement(this.div);this.transparantElement.className="waitingSearchDiv waitingSearchDivOpacity";this.opaqueElement=this.createLoadingElement(this.div);this.opaqueElement.className="waitingSearchDiv";if(this.id){this.opaqueElement.id=this.id;}this.addLoadingDescription(this.text,this.opaqueElement);},createLoadingElement:function(element){var loading=document.createElement("div");loading.style.width="100%";loading.style.height="100%";if((XBrowser.userAgent.isIE6)||(XBrowser.userAgent.isIE7)){loading.style.left=0;loading.style.height=this.div.clientHeight+"px";}element.appendChild(loading);return loading;},addLoadingDescription:function(description,element){var newWaitingHolder=document.createElement("div");element.appendChild(newWaitingHolder);newWaitingHolder.className="waitingHolder";var limitedOffset=(element.offsetHeight)/5;if(limitedOffset>100){limitedOffset=100;}newWaitingHolder.style.top=limitedOffset+"px";var newWaitingImage=document.createElement("img");newWaitingHolder.appendChild(newWaitingImage);newWaitingImage.src=UserContext.getUrl("/img/loading.gif");newWaitingImage.className="waitingImage";var newWaitingDescription=document.createElement("span");newWaitingHolder.appendChild(newWaitingDescription);newWaitingDescription.innerHTML=description;newWaitingDescription.className="waitingDescription";if(XBrowser.userAgent.isIE7){newWaitingHolder.style.position="absolute";newWaitingHolder.style.width="auto";}else{newWaitingHolder.style.width=(newWaitingImage.offsetWidth+newWaitingDescription.offsetWidth+20)+"px";}return newWaitingHolder;}};
function alertBlockSubmit(msg){window.ffInAlert=true;alert(msg);window.ffInAlert=false;}function Modal(){}Modal.confirm=function(msg){top.ffInAlert=true;var ans=window.confirm(msg);top.ffInAlert=false;return ans;};Modal.isBlocked=function(){return top.ffInAlert;};
var MOUSE_OVER_FADE_MAP=[];function addMouseOver(div,hotSpot,direction){for(var i=0;i<MOUSE_OVER_FADE_MAP.length;i++){if(MOUSE_OVER_FADE_MAP[i]===div){return;}}var inner;for(var i=0;i<div.childNodes.length;i++){if(div.childNodes[i].className==MouseOverElement.DEFAULT_CLASS_INNER){inner=div.childNodes[i];break;}}if(!inner){return;}var foo;if(hotSpot){foo=new MouseOverFade(hotSpot,inner,direction);}else{foo=new MouseOverFade(div,inner,direction);}foo.handleMouseOver();MOUSE_OVER_FADE_MAP.push(div);}function MouseOverFade(hotSpot,divToFade,direction){this.mover=new MouseOverFadeHandler(hotSpot,divToFade,true,direction);var self=this;this.handleMouseOver=function(e){self.mover.fadeIn();};this.handleMouseOut=function(e){self.mover.fadeOut();};this.init();}MouseOverFade.prototype.init=function(){addEvent(this.mover.controller,"mouseover",this.handleMouseOver,false);addEvent(this.mover.controller,"mouseout",this.handleMouseOut,false);addEvent(this.mover.div,"mouseover",this.handleMouseOver,false);addEvent(this.mover.div,"mouseout",this.handleMouseOut,false);};MouseOverFade.createMouseOverHtml=function(innerText){var html=[];html.push('<div onmouseover="addMouseOver(this, null, \'left\')" onfocus="addMouseOver(this, null, \'left\')" class="mouseOverInfoOuter">');html.push('<img title="" class="infoIcon" alt="" src="/s.gif"/>');html.push('<div style="display: none; opacity: 0;" class="mouseOverInfo">');if(innerText){html.push(innerText);}html.push("</div>");html.push("</div>");return html.join("");};function MouseOverFadeHandler(hotSpot,divToFade,saveOrigPos,direction){this.controller=hotSpot;this.div=divToFade;this.shim=new iframeShim(divToFade);this.saveOrigPos=saveOrigPos;var self=this;this.setPosition=function(object){if(!object){object=self.shim;}object.setStyle("display","block");if(self.saveOrigPos){if(!self.origL){self.origL=self.div.style.left;}else{object.setStyle("left",self.origL);}}var calloutLeft=getOffsetLeft(self.div);var calloutRight=calloutLeft+self.div.offsetWidth;var windowRight=getScrollX()+getWindowWidth()-15;if(direction==="left"){var parentLeftOffset=getOffsetLeft(self.div.parentNode);var leftOffset=self.div.offsetWidth;var topLeftDestination=parentLeftOffset-leftOffset;if(topLeftDestination>0){object.setStyle("left",(-1*leftOffset)+"px");}else{object.setStyle("left",-1*(leftOffset+topLeftDestination)+"px");}}else{if(calloutLeft<0){object.setStyle("left","0");}else{if(calloutRight>windowRight){object.setStyle("left",(self.div.offsetLeft-(calloutRight-windowRight)-20)+"px");}}}if(self.saveOrigPos){if(!self.origTop){self.origTop=self.div.style.top;}else{object.setStyle("top",self.origTop);}}var calloutTop=getObjY(self.div);var calloutBottom=calloutTop+self.div.offsetHeight;var windowBottom=getScrollY()+getWindowHeight()-15;if(calloutTop<0){object.setStyle("top","0");}else{if(calloutBottom>windowBottom){object.setStyle("top",(self.div.offsetTop-(calloutBottom-windowBottom)-15)+"px");}}};this.mover=new Fader(this.shim,function(object,currVal){return object.getOpacity()<=0;},function(object,currVal){return object.getOpacity()>=0.99;},30,function(currVal,sign){return currVal+=sign*0.2;},function(object,nextVal){object.setOpacity(nextVal);},0,function(object){object.setOpacity(0);object.setStyle("display","none");},function(object){object.setOpacity(0.99);object.setStyle("display","block");},this.setPosition);this.fadeIn=function(){self.mover.fadeIn();};this.fadeOut=function(){self.mover.fadeOut();};}
var FilterLookupPage=function(){};FilterLookupPage.prototype.checked=new Array();FilterLookupPage.prototype.checkAll=function(val){for(var i=0;;i++){var chkbox=document.getElementById("chkbox"+i);if(!chkbox){break;}chkbox.checked=val;FilterLookupPage.prototype.checked[i]=(val?chkbox.value:null);}};FilterLookupPage.prototype.transfer=function(isBooleanField){var valueElem=opener.document.getElementById(opener.filterLookupValueElem);var string=valueElem.value;if(isBooleanField){if(document.getElementById("chkbox0").checked){string=document.getElementById("chkbox0").value;}else{if(document.getElementById("chkbox1").checked){string=document.getElementById("chkbox1").value;}}}else{for(var i=0;i<FilterLookupPage.prototype.checked.length;i++){var value=FilterLookupPage.prototype.checked[i];if(value!=null){if(string.length>0){string=string+", ";}if(value.indexOf(",")>=0){value='"'+value+'"';}string=string+value;}}if(string.length>valueElem.maxLength){string=string.substring(0,valueElem.maxLength);}}valueElem.value=string;self.close();return false;};FilterLookupPage.prototype.doCheckbox=function(i){var chkbox=document.getElementById("chkbox"+i);if(chkbox.checked){FilterLookupPage.prototype.checked[i]=chkbox.value;}else{FilterLookupPage.prototype.checked[i]=null;}};FilterLookupPage.prototype.initBoolean=function(){for(i=0;i<2;i++){var chkbox=document.getElementById("chkbox"+i);chkbox.checked=chkbox.value==opener.document.getElementById(opener.filterLookupValueElem).value;}};
function AdvCurrencyEnable(){}AdvCurrencyEnable.checkSaveButton=function(checkCheckBox){var checked;if(checkCheckBox){checked=document.getElementById(AdvancedCurrencyEnable.pENABLE).checked;}else{checked=!document.getElementById(AdvancedCurrencyEnable.pENABLE).checked;}if(checked){document.getElementsByName(AdvancedCurrencyEnable.enableButton)[0].className="btn";document.getElementsByName(AdvancedCurrencyEnable.enableButton)[0].disabled=false;}else{document.getElementsByName(AdvancedCurrencyEnable.enableButton)[0].className="btnDisabled";document.getElementsByName(AdvancedCurrencyEnable.enableButton)[0].disabled=true;}};
function ForecastRoleUser(){}ForecastRoleUser.checkDisplayAllowSharing=function(){var selectedElement=document.getElementById(ForecastRoleUser.pUSER);if(selectedElement.options[selectedElement.selectedIndex].value==""){document.getElementsByName(ForecastRoleUser.pCAN_SHARE)[0].disabled=true;document.getElementsByName(ForecastRoleUser.pCAN_SHARE)[1].disabled=true;document.getElementById(ForecastRoleUser.FORECAST_SHARE_RADIO).style.visibility="hidden";}else{document.getElementsByName(ForecastRoleUser.pCAN_SHARE)[0].disabled=false;document.getElementsByName(ForecastRoleUser.pCAN_SHARE)[1].disabled=false;document.getElementById(ForecastRoleUser.FORECAST_SHARE_RADIO).style.visibility="visible";}};ForecastRoleUser.confirmRemoveShares=function(hadMgr){var selectedElement=document.getElementById(ForecastRoleUser.pUSER);return selectedElement.options[selectedElement.selectedIndex].value!=""||!hadMgr||window.confirm(LC.getLabel("ForecastSharingPref","confirmAssignNoMgr"));};
function FctSettingsPage(){}function FctShareDialog(){}FctSettingsPage.fctShareFormSubmit=false;FctShareDialog.allowMgrShare="0";FctSettingsPage.submitCheck=function(url,isFctShareEnabled){if(validateForm()){FctSettingsPage.fctShareFormSubmit=(isFctShareEnabled==document.getElementById(ForecastSettings.pFORECAST_SHARING).checked);if(FctSettingsPage.fctShareFormSubmit){return true;}else{openPopupFocus(url,"fctSharingDialog",300,500,"height=350,width=600,location=no,dependent=no,resizable=no,toolbar=no,status=yes,directories=no,menubar=no,scrollbars=no",true,true,true);return false;}}else{return false;}};FctShareDialog.checkSaveButton=function(checkCheckBox){var checked;if(checkCheckBox){checked=document.getElementById(ForecastSharingPrefPopup.DISABLE_CHECKBOX).checked;}else{checked=document.getElementsByName(ForecastSharingPrefPopup.CAN_SHARE_RADIO)[0].checked||document.getElementsByName(ForecastSharingPrefPopup.CAN_SHARE_RADIO)[1].checked;}if(checked){document.getElementsByName("save")[0].className="btn";document.getElementsByName("save")[0].disabled=false;document.getElementsByName("save")[0].onclick=function(){FctShareDialog.saveResult(true);};if(!checkCheckBox){FctShareDialog.allowMgrShare=document.getElementsByName(ForecastSharingPrefPopup.CAN_SHARE_RADIO)[1].checked?"1":"0";}}else{document.getElementsByName("save")[0].className="btnDisabled";document.getElementsByName("save")[0].disabled=true;}};FctShareDialog.saveResult=function(doSave){if(doSave){window.opener.FctSettingsPage.submit(FctShareDialog.allowMgrShare);}window.close();};FctSettingsPage.submit=function(allowMgrShare){var qs=new QueryString("");document.getElementById(ForecastSettings.pALLOW_FM_SHARING).value=allowMgrShare;qs.add(EditPageConstants.pSAVE,"Save");document.forms[EditPageConstants.pEDIT_PAGE].action+=qs.toString();document.forms[EditPageConstants.pEDIT_PAGE].submit();};
function LMACheckboxesManager(){var self=this;this.radios=document.getElementsByName(DeveloperSettings.LICENSE_MGR_CHOICE_STR);this.divNames=[];for(var i=0;i<arguments.length;i++){this.divNames[i]=arguments[i];}this.onClickHandler=function(e){self.setVisibility(getEventTarget(getEvent(e)).value);};for(var i=0;i<this.radios.length;i++){addEvent(this.radios[i],"click",this.onClickHandler,false);if(this.radios[i].checked){this.setVisibility(this.radios[i].value);}}}LMACheckboxesManager.prototype.setVisibility=function(radioName){for(var i=0;i<this.divNames.length;i++){document.getElementById(this.divNames[i]+DeveloperSettings.DIV_SUFFIX).style.display=(this.divNames[i]===radioName?"block":"none");}};
var ContentSettingsPage=function(){};ContentSettingsPage.toggleContentPrefs=function(elemId,item){var section=document.getElementById(elemId);if(item.checked){section.style.display="block";}else{section.style.display="none";}};
var TagSettingsPage=function(){};TagSettingsPage.toggleTags=function(elemId,item){var section=document.getElementById(elemId);if(item.checked){section.style.display="block";}else{section.style.display="none";}};
var AlohaSkin=(function(){var bodyTable;var bodyTableWidth=0;var contentWrapper;return{init:function(){bodyTable=document.getElementById("bodyTable");contentWrapper=document.getElementById("contentWrapper");if(!contentWrapper){return;}AlohaSkin.doSizing();if(!XBrowser.userAgent.isIE7){addStyleClass(contentWrapper,"mainContentWrapper");window.sfdcPage.prependToOnResizeQueue(function(){AlohaSkin.doSizing();});}else{if(bodyTable){addEvent(bodyTable,"resize",function(){if(bodyTable.clientWidth!=bodyTableWidth){bodyTableWidth=bodyTable.clientWidth;AlohaSkin.doSizing();}});}}},doSizing:function(){var bodyWidth=document.body.clientWidth;if(bodyTable&&!XBrowser.userAgent.isIE7){bodyTable.style.maxWidth=bodyWidth+"px";if(XBrowser.userAgent.isSafari){bodyTable.style.width=bodyWidth-20+"px";}}var phHeader=document.getElementById("phHeader");if(phHeader){phHeader.style.maxWidth=bodyWidth+"px";if(XBrowser.userAgent.isSafari){phHeader.style.width=bodyWidth+"px";}}var tabNav=document.getElementById("tabNavigation");if(tabNav){var leftOffset=10;var minTabWidth=bodyWidth;if(XBrowser.userAgent.isIE7){var motifCurve=document.getElementById("motifCurve");tabNav.style.minWidth="";motifCurve.style.minWidth="";minTabWidth=contentWrapper.clientWidth;motifCurve.style.minWidth=minTabWidth-leftOffset+"px";}tabNav.style.minWidth=minTabWidth-leftOffset+"px";}}};})();
function TagMenuButton(muttonId,loaderURL){MenuButton.call(this,muttonId,false);TagMenuButton.fetched=false;TagMenuButton.requesting=false;this.loaderURL=loaderURL;this.buttonWidth=TagMenuButton.BUTTON_WIDTH;}TagMenuButton.prototype=new MenuButton();TagMenuButton.BUTTON_WIDTH=33;TagMenuButton.prototype.show=function(){if(!TagMenuButton.fetched){this.getMRUTags(this.muttonId,this.isCached,this.loaderURL);}MenuButton.prototype.show.apply(this);};TagMenuButton.prototype.getMRUTags=function(){if(!TagMenuButton.requesting){TagMenuButton.requesting=true;this.menuDiv.innerHTML="";this.addOption(LC.getLabel("Page_SearchResult","dhtmlLoading"),"");var self=this;XBrowser.postHttpResponse(this.loaderURL,function(response){self.processMRUdata(response.responseText);},"");}};TagMenuButton.prototype.processMRUdata=function(responseText){var response=Util.evalAjaxServletOutput(responseText);var mruList=response.mruList;TagMenuButton.fetched=true;TagMenuButton.requesting=false;if(mruList.length==0){this.menuDiv.innerHTML="<span>"+LC.getLabel("BrowseTags","noRecentTags")+"</span>";}else{this.menuDiv.innerHTML="";for(var i=0;i<mruList.length;i++){this.addOption(mruList[i].value,mruList[i].href);}}this.position();};TagMenuButton.flushCache=function(){TagMenuButton.fetched=false;};
function TagLinkEditElement(id,useDefaulAction,tagLinkUrl){MenuButton.call(this,id,useDefaulAction);this.tagLinkUrl=tagLinkUrl;}TagLinkEditElement.prototype=new MenuButton();TagLinkEditElement.prototype.defaultAction=function(){navigateToUrl(this.tagLinkUrl);};TagLinkEditElement.prototype.show_hook=function(){if(window.sfdcPage.setMenuButtonOpen){window.sfdcPage.setMenuButtonOpen(this.parentDiv);}};TagLinkEditElement.prototype.hide_hook=function(){if(window.sfdcPage.setMenuButtonClosed){window.sfdcPage.setMenuButtonClosed();}};TagLinkEditElement.prototype.getMenuWidth=function(){var ret=this.buttonDiv.offsetWidth;if(XBrowser.userAgent.isIE){ret-=8;}return ret;};TagLinkEditElement.prototype.initAccessibilityMode=function(){};
function BouncedEmailAddressDialog(id,saveLocation,linkId){this.id=id;this.isModal=true;this.formId="bouncedEmailAddressOverlayInputForm";this.errorElementId="errorMsg";this.windowName="";this.width=400;this.linkId=linkId;this.emailAddress=document.getElementById(BounceEmailConstants.HIDDEN_EMAIL_ADDRESS).value;this.emailBounceReason=document.getElementById(BounceEmailConstants.HIDDEN_BOUNCE_REASON).value;this.emailBounceDate=document.getElementById(BounceEmailConstants.HIDDEN_BOUNCE_DATE).value;this.saveLocation=saveLocation;this.addEvents();}BouncedEmailAddressDialog.HEIGHT=80;BouncedEmailAddressDialog.prototype=new OverlayDialog();BouncedEmailAddressDialog.prototype.showBouncedEmail=function(){this.setTitle(LC.getLabel("Page_BouncedEmailOverlay","page_title"));this.createContent();this.show();this.focusInOverlay();};BouncedEmailAddressDialog.prototype.createContent=function(){var content=document.getElementById(this.getContentId());var html=[];var emailAddressLabel=LC.getLabel("Page_BouncedEmailOverlay","emailAddress");html.push('<table border="0">');html.push("<tr><td>");html.push(emailAddressLabel);html.push("</td><td>");html.push('<input id="overlayEmailAddress" type="text" size="30" name="emailAddress" title="'+emailAddressLabel+'" value="'+this.emailAddress+'"/>');html.push("</td></tr>");html.push("<tr><td>");html.push(LC.getLabel("Page_BouncedEmailOverlay","bounceReason"));html.push("</td><td>");html.push(this.emailBounceReason);html.push("</td></tr>");html.push("<tr><td>");html.push(LC.getLabel("Page_BouncedEmailOverlay","bounceDate"));html.push("</td><td>");html.push(this.emailBounceDate);html.push("</td></tr>");html.push("</table>");html.push("<div class='buttons'>");var makeValidLabel=LC.getLabel("Page_BouncedEmailOverlay","makeValidButton");html.push("<input class='btn' type='button' value='");html.push(makeValidLabel);html.push("' title='");html.push(makeValidLabel);html.push("' onclick=\"");html.push("if(sfdcPage.getDialogById('");html.push(this.id);html.push("').savePage()) { sfdcPage.getDialogById('");html.push(this.id);html.push("').hide(); }\">");var cancelLabel=LC.getLabel("Buttons","cancel");html.push("<input class='btn' type='button' value='");html.push(cancelLabel);html.push("' title='");html.push(cancelLabel);html.push("' onclick=\"");html.push("sfdcPage.getDialogById('");html.push(this.id);html.push("').cancel(); document.getElementById('");html.push(this.linkId);html.push("').focus();\">");html.push("</div>");content.innerHTML=html.join("");};BouncedEmailAddressDialog.prototype.focusInOverlay=function(){document.getElementById("overlayEmailAddress").focus();};BouncedEmailAddressDialog.prototype.savePage=function(){var emailAddress=document.getElementById("overlayEmailAddress");var newSaveLocation=this.saveLocation+"&"+EmailAddrEditConstants.pPASS_IN_EMAIL_ADDRESS+"="+escape(emailAddress.value);window.location=newSaveLocation;return true;};BouncedEmailAddressDialog.getDialog=function(id,saveLocation,linkId){var dialog=sfdcPage.getDialogById(id);if(dialog){return dialog;}dialog=new BouncedEmailAddressDialog(id,saveLocation,linkId);dialog.register();return dialog;};
var Dialogs={num:0,getNextId:function(){return"simpleDialog"+Dialogs.num++;},doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',types:{WARN:{backgroundClass:"backgroundWarn",contentClass:"contentWarn",iconClass:"warningLarge",getIconAlt:function(){return LC.getLabel("Icon","WARNING");}},INFO:{backgroundClass:"backgroundInfo",contentClass:"contentInfo",iconClass:"infoLarge",getIconAlt:function(){return LC.getLabel("Icon","INFO");}},ERROR:{backgroundClass:"backgroundError",contentClass:"contentError",iconClass:"errorLarge",getIconAlt:function(){LC.getLabel("Icon","ERROR");}},CONFIRM:{backgroundClass:"backgroundConfirm",contentClass:"contentConfirm",iconClass:"confirmLarge",getIconAlt:function(){LC.getLabel("Icon","CONFIRM");}}},showSimpleWarning:function(title,message,onOK){Dialogs.createSimpleWarning(title,message,onOK).show();},createSimpleWarning:function(title,message,onOK){return Dialogs.createSimpleDialog(title,message,Dialogs.types.WARN,onOK);},showSimpleError:function(title,message,onOK){Dialogs.createSimpleError(title,message,onOK).show();},createSimpleError:function(title,message,onOK){return Dialogs.createSimpleDialog(title,message,Dialogs.types.ERROR,onOK);},showSimpleInfo:function(title,message,onOK){Dialogs.createSimpleInfo(title,message,onOK).show();},createSimpleInfo:function(title,message,onOK){return Dialogs.createSimpleDialog(title,message,Dialogs.types.INFO,onOK);},showSimpleConfirmation:function(title,message,onOK){Dialogs.createSimpleConfirmation(title,message,onOK).show();},createSimpleConfirmation:function(title,message,onOK){return Dialogs.createSimpleDialog(title,message,Dialogs.types.CONFIRM,onOK);},createSimpleDialog:function(title,message,type,onOK){return Dialogs.createDialog({id:Dialogs.getNextId(),title:title,message:message,backgroundClass:type.backgroundClass,contentClass:type.contentClass,iconClass:type.iconClass,iconAlt:type.getIconAlt(),actions:[onOK,null],actionLabels:[LC.getLabel("Buttons","ok"),LC.getLabel("Buttons","cancel")]},true);},createCheckboxConfirmationDialog:function(title,message,checkboxLabel,okLabel,cancelLabel,onOK,onCancel){return Dialogs.createDialog({id:Dialogs.getNextId(),title:title,message:message,backgroundClass:Dialogs.types.CONFIRM.backgroundClass,contentClass:Dialogs.types.CONFIRM.contentClass,iconClass:Dialogs.types.CONFIRM.iconClass,iconAlt:Dialogs.types.CONFIRM.getIconAlt(),actions:[onOK,onCancel],actionLabels:[okLabel,cancelLabel],checkboxLabel:checkboxLabel},true);},createDialog:function(dialogOptions,doRegister){var d=new AccessibleDialog(dialogOptions);if(doRegister){d.register();}return d;}};function AccessibleDialog(config){this.id=config.id;this.isModal=true;this.extraClass="";this.width=400;this.title=config.title;this.displayX=true;this.message=config.message;this.backgroundClass=config.backgroundClass;this.contentClass=config.contentClass;this.iconClass=config.iconClass;this.iconAlt=config.iconAlt;this.actions=config.actions;this.actionLabels=config.actionLabels;this.checkboxLabel=config.checkboxLabel;if(UserContext.isAccessibleMode){this.popupWindow=null;}else{this.addEvents();}}AccessibleDialog.prototype=new OverlayDialog();AccessibleDialog.prototype.doAction=function(index){this.hide();if(this.actions[index]&&typeof this.actions[index]=="function"){this.actions[index]();}};AccessibleDialog.prototype.toggle=function(checked){var btn=document.getElementById(this.id+"button0");if(btn){btn.disabled=!checked;btn.className=checked?"btn":"btnDisabled";}};AccessibleDialog.prototype.createDialog=function(){if(!UserContext.isAccessibleMode){OverlayDialog.prototype.createDialog.call(this);}};AccessibleDialog.prototype.createContent=function(){var content=document.getElementById(this.getContentId());content.innerHTML=this.getContent();};AccessibleDialog.prototype.getContent=function(){var html=[];html.push("<table border='0'><tr><td style='vertical-align: top'><img src='/s.gif' class='");html.push(this.iconClass);html.push("' alt='");html.push(this.iconAlt);html.push("'></td><td style='padding-left: 8px; vertical-align: top; line-height: 16px'>");html.push(this.message);if(this.checkboxLabel){html.push("<div style='line-height:12px; margin-top: 12px'>");html.push("<input type='checkbox' id='");html.push(this.id);html.push("checkbox' onclick='");if(!UserContext.isAccessibleMode){html.push('sfdcPage.getDialogById("');html.push(this.id);html.push('").');}html.push("toggle(this.checked);'/><label for='");html.push(this.id);html.push("checkbox'>");html.push(this.checkboxLabel);html.push("</label></div>");if(UserContext.isAccessibleMode){html.push("<script>function toggle(checked) { ");html.push("window.confirmOnClose = checked;");html.push("var btn = document.getElementById('");html.push(this.id);html.push("button0');");html.push("if (btn) {");html.push("btn.disabled = !checked;");html.push("btn.className = checked ? 'btn' : 'btnDisabled';}");html.push("}<\/script>");}}html.push("</td></tr></table>");html.push("<div class='buttons'>");for(var i=0;i<this.actionLabels.length;i++){var disable=this.checkboxLabel&&i===0;html.push("<input type='button' id='");html.push(this.id);html.push("button");html.push(i);html.push("' onclick='");if(UserContext.isAccessibleMode){html.push("window.opener.");}html.push('sfdcPage.getDialogById("');html.push(this.id);html.push('").doAction(');html.push(i);html.push(")' class='btn");if(disable){html.push("Disabled");}html.push("' value='");html.push(this.actionLabels[i]);html.push("'");if(this.checkboxLabel&&i===0){html.push(" disabled='disabled'");}html.push("/>");}html.push("</div>");return html.join("");};AccessibleDialog.prototype.hide=function(){if(UserContext.isAccessibleMode){if(this.popupWindow){try{this.popupWindow.confirmOnClose=false;this.popupWindow.close();}catch(e){}this.popupWindow=null;}}else{OverlayDialog.prototype.hide.call(this);}};AccessibleDialog.prototype.show=function(){if(UserContext.isAccessibleMode){this.popupWindow=window.open("","modalDialog","width="+this.width+",height=300,dialog=yes");if(this.popupWindow){var d=this.popupWindow.document;d.writeln(Dialogs.doctype);d.writeln("<html class="+this.backgroundClass+"><head><title>");d.writeln(this.title);d.writeln("</title>");DynamicCss.writeCss(null,d,true);d.writeln("</head><body class='accessibleDialogPopup "+this.contentClass+"'>");d.writeln(this.getContent());d.writeln("</body></html>");d.close();this.popupWindow.focus();this.popupWindow.confirmOnCloseLabel=LC.getLabel("Global","dialogCloseConfirm");curPopupWindow=this.popupWindow;}}else{OverlayDialog.prototype.show.call(this);}};function IFrameDialog(id,title,url,height,width){this.id=id;this.url=url;this.title=title;this.contentId=id+"ContentId";this.height=height;this.width=width;}IFrameDialog.prototype=new AccessibleDialog({});IFrameDialog.prototype.getContent=function(){return'<iframe frameborder="no" id="'+this.contentId+'" style="border:0;height:'+this.height+'px;width: 100%;" src="'+this.url+'"></iframe>';};IFrameDialog.superclass=AccessibleDialog.prototype;IFrameDialog.prototype.display=function(){if(!UserContext.isAccessibleMode){this.createContent();}this.show();};
function FeedPostContentUploadDialog(id,url,escapeParams,parentId){this.id=id;this.url=url;this.escapeParams=escapeParams;this.parentId=parentId;this.isModal=true;this.width=480;this.displayX=false;this.addEvents();}FeedPostContentUploadDialog.prototype=new OverlayDialog();FeedPostContentUploadDialog.prototype.hide=function(){OverlayDialog.prototype.hide.apply(this,new Array());this.createContent();};FeedPostContentUploadDialog.prototype.createContent=function(fileName){var content=document.getElementById(this.getContentId());var html=[];html.push("<div id='contentContainer'>");html.push("<div id='uploadProgress'></div>");html.push("<div id='uploadFileContainer'>");html.push("<p id='uploadFileInfo'>"+LC.getLabel("Publisher","postFileUploading")+" ");html.push(fileName+"</p>");html.push("<p id='uploadFileText'>"+LC.getLabel("Publisher","postFileProgressText")+"</p>");html.push("</div><div class='clear'></div>");html.push("</div>");this.createButtons(html);content.innerHTML=html.join("");this.clearButtons();this.overrideButton(0,LC.getLabel("Publisher","postFileProgressCancel"),"chatter.getPublisher().handleFileUploadCancel()");};FeedPostContentUploadDialog.getDialog=function(id){var dialog=sfdcPage.getDialogById(id);if(dialog){return dialog;}dialog=new FeedPostContentUploadDialog(id);dialog.register();return dialog;};
function GoogleDocNameInputDialog(id,url,escapeParams,parentId){this.id=id;this.url=url;this.escapeParams=escapeParams;this.parentId=parentId;this.isModal=true;this.formId="nameInputForm";this.errorElementId="errorMsg";this.windowName="createDoc";this.width=600;this.addEvents();LC.getLabel("GoogleDocs","DOCUMENT");LC.getLabel("GoogleDocs","SPREADSHEET");LC.getLabel("GoogleDocs","PRESENTATION");LC.getLabel("GoogleDocs","LOWER_DOCUMENT");LC.getLabel("GoogleDocs","LOWER_SPREADSHEET");LC.getLabel("GoogleDocs","LOWER_PRESENTATION");}GoogleDocNameInputDialog.HEIGHT=80;GoogleDocNameInputDialog.prototype=new OverlayDialog();GoogleDocNameInputDialog.prototype.hide=function(){OverlayDialog.prototype.hide.apply(this,new Array());this.createContent();};GoogleDocNameInputDialog.prototype.enter=function(){this.dependent=1;var win=this.validate();if(win){this.win=win;this.processStep();}else{this.dependent=0;}};GoogleDocNameInputDialog.prototype.cancel=function(){if(this.dependent){try{this.win.close();}catch(e){}}this.hide();};GoogleDocNameInputDialog.prototype.setDocTypeAndShow=function(docType,docTypeStr){this.docType=docType;this.docTypeStr=docTypeStr;this.setTitle(LC.getLabel("GoogleDocCreatorPage","nameText",docTypeStr));this.createContent();this.show();this.focusInOverlay();};GoogleDocNameInputDialog.prototype.createContent=function(){if(!this.docType){return;}var content=document.getElementById(this.getContentId());var type=LC.getLabel("GoogleDocs",this.docType);var createType=LC.getLabel("GoogleDocs","LOWER_"+this.docType);var html=[];html.push('<form enctype="multipart/form-data" method="POST" id="'+GoogleDocCreator.FORM_NAME+'">');html.push("<table align=center>");html.push("<tbody>");html.push('<tr><td colspan="2">');html.push('<input type="radio" id="create_method" name="'+GoogleDocCreator.METHOD+'" value="0" checked>');html.push('<label for="create_method" onclick="document.getElementById(\'create_method\').checked=true">'+LC.getLabel("GoogleDocCreator","CreateByNew",createType)+"</label>");html.push("</td></tr>");html.push('<tr><td align=right><label for="'+GoogleDocCreator.DOC_NAME+'">');html.push(LC.getLabel("GoogleDocCreator","EntityName",type));html.push('</label>: </td><td class="inlineEditCompoundDiv"><span class="inlineEditRequiredMark">*</span><input id="'+GoogleDocCreator.DOC_NAME+'" type="text" width="64" name="'+GoogleDocCreator.DOC_NAME+'" onchange="document.getElementById(\'create_method\').checked=true" onclick="document.getElementById(\'create_method\').checked=true"/></td></tr>');html.push('<tr><td>&nbsp;</td><td><div class="errorMsg" id="'+this.errorElementId+'" style= "display:none"></div>');html.push("</td></tr>");html.push("</tbody>");html.push("<tbody>");html.push('<tr><td colspan="2">');html.push('<input type="radio" id="upload_method" name="'+GoogleDocCreator.METHOD+'" value="1">');html.push('<label for="upload_method" onclick="document.getElementById(\'upload_method\').checked=true">'+LC.getLabel("GoogleDocCreator","CreateByUpload")+"</label>");html.push("</td></tr>");html.push('<tr><td align=right><label for="'+GoogleDocCreator.DOC_UPLOAD+'">');html.push(LC.getLabel("GoogleDocCreator","FileLocation"));html.push('</label>: </td><td class="inlineEditCompoundDiv"><span class="inlineEditRequiredMark">*</span><input id="'+GoogleDocCreator.DOC_UPLOAD+'" type="file" width="64" name="'+GoogleDocCreator.DOC_UPLOAD+'" onchange="document.getElementById(\'upload_method\').checked=true" onclick="document.getElementById(\'upload_method\').checked=true"/> ');if(this.help[this.docType]){html.push(decodeURIComponent(this.help[this.docType]));}html.push("</td></tr>");html.push('<tr><td align=right><label for="'+GoogleDocCreator.DOC_UPLOAD_NAME+'">');html.push(LC.getLabel("GoogleDocCreator","NewName",type));html.push('</label>: </td><td class="inlineEditCompoundDiv"><input id="'+GoogleDocCreator.DOC_UPLOAD_NAME+'" type="text" width="64" name="'+GoogleDocCreator.DOC_UPLOAD_NAME+'" onchange="document.getElementById(\'upload_method\').checked=true" onclick="document.getElementById(\'upload_method\').checked=true"/>');html.push(LC.getLabel("GoogleDocCreator","Different"));html.push("</td></tr>");html.push("<tr><td>&nbsp;</td><td>");html.push('<div class="errorMsg" id="'+GoogleDocCreator.DOC_UPLOAD+'_error" style= "display:none"></div>');html.push("</td></tr>");html.push("</tbody>");html.push("</table>");html.push('<input type="hidden" id="'+GoogleDocCreator.PARENT_ID+'" name="'+GoogleDocCreator.PARENT_ID+'" value="'+this.parentId+'"/>');html.push('<input type="hidden" id="'+GoogleDocCreator.DOC_TYPE+'" name="'+GoogleDocCreator.DOC_TYPE+'" value="'+this.docType+'"/>');html.push("</form>");content.innerHTML=html.join("");this.setupDefaultButtons();this.overrideButton(0,LC.getLabel("GoogleDocCreatorPage","pageTitle"),function(id){sfdcPage.getDialogById(id).enter();return false;});this.overrideButton(1,LC.getLabel("Buttons","cancel"),function(id){sfdcPage.getDialogById(id).cancel();return true;});content.appendChild(this.createDomButtons());};GoogleDocNameInputDialog.prototype.processStep=function(){var content=document.getElementById(this.getContentId());var elements=content.getElementsByTagName("input");for(var i=0;i<elements.length;i++){if(elements[i].value==LC.getLabel("Buttons","cancel")){continue;}else{if(elements[i].value==LC.getLabel("GoogleDocCreatorPage","pageTitle")){elements[i].className="btnDisabled";}}elements[i].disabled=true;}var dialog=this;this.checkId=window.setInterval(function(){dialog.checkStatus();},250);};GoogleDocNameInputDialog.prototype.checkStatus=function(){if(this.win.closed||!this.dependent){window.clearTimeout(this.checkId);this.win=0;this.checkId=0;this.hide();}};GoogleDocNameInputDialog.prototype.createDomButtons=function(){var div=document.createElement("div");div.className="buttons";var buttonT=document.createElement("input");buttonT.className="btn";buttonT.type="button";for(var i=0;i<this.buttons.length;i++){var button=buttonT.cloneNode(true);var display=this.buttons[i].display;var action=this.buttons[i].action;button.dialogId=this.id;button.value=display;button.action=this.buttons[i].action;if(typeof action=="string"){button.onclick=function(){if(eval(this.action)){sfdcPage.getDialogById(this.dialogId).hide();}};}else{if(typeof action=="function"){button.onclick=function(){if(this.action(this.dialogId)){sfdcPage.getDialogById(this.dialogId).hide();}};}else{button.onclick=function(){sfdcPage.getDialogById(this.dialogId).hide();};}}div.appendChild(button);}return div;};GoogleDocNameInputDialog.prototype.focusInOverlay=function(){if(XBrowser.userAgent.isIE6){setTimeout('document.getElementById(GoogleDocCreator["DOC_NAME"]).focus()',100);}else{document.getElementById(GoogleDocCreator.DOC_NAME).focus();}};GoogleDocNameInputDialog.prototype.checkExtension=function(str){if(!this.MIME){return true;}var index=str.lastIndexOf(".")+1;if(index>-1){var ext=str.substr(index).toUpperCase();return this.MIME[ext]!=undefined;}return false;};GoogleDocNameInputDialog.prototype.validate=function(){var form=document.getElementById(GoogleDocCreator.FORM_NAME);var method=0;for(var i=0;i<form[GoogleDocCreator.METHOD].length;i++){if(form[GoogleDocCreator.METHOD][i].checked){method=form[GoogleDocCreator.METHOD][i].value;break;}}var docName=document.getElementById(GoogleDocCreator.DOC_NAME).value;var upload=document.getElementById(GoogleDocCreator.DOC_UPLOAD).value;document.getElementById(this.errorElementId).style.display="none";document.getElementById(GoogleDocCreator.DOC_UPLOAD+"_error").style.display="none";if((docName==null||trim(docName)=="")&&method==GoogleDocCreator.CREATE){document.getElementById(this.errorElementId).innerHTML=LC.getLabel("GoogleDocCreatorPage","errorMsgNoValue");document.getElementById(this.errorElementId).style.display="";this.focusInOverlay();return false;}else{if(method==GoogleDocCreator.UPLOAD&&(upload==null||upload=="")){document.getElementById(GoogleDocCreator.DOC_UPLOAD+"_error").innerHTML=LC.getLabel("GoogleDocCreatorPage","errorMsgNoValue");document.getElementById(GoogleDocCreator.DOC_UPLOAD+"_error").style.display="";return false;}else{if(method==GoogleDocCreator.UPLOAD&&!this.checkExtension(upload)){document.getElementById(GoogleDocCreator.DOC_UPLOAD+"_error").innerHTML=LC.getLabel("GoogleDocCreatorPage","errorMsgType");document.getElementById(GoogleDocCreator.DOC_UPLOAD+"_error").style.display="";return false;}else{var get={};get[GoogleDocCreator.METHOD]=method;get[GoogleDocCreator.DOC_NAME]=docName;get[GoogleDocCreator.PARENT_ID]=document.getElementById(GoogleDocCreator.PARENT_ID).value;get[GoogleDocCreator.DOC_TYPE]=document.getElementById(GoogleDocCreator.DOC_TYPE).value;this.secret=Math.floor(Math.random()*42000000);get.secret=this.secret;var qs="?"+XBrowser.buildPost(get);qs=encodeURIComponent(qs);if(this.escapeParams){qs=encodeURIComponent(qs);}win=window.open(this.url+qs,this.windowName+this.secret,"width=900, height=600, location=yes, menubar=yes, status=yes, toolbar=yes, scrollbars=yes, resizable=yes");if(method==GoogleDocCreator.CREATE){this.dependent=0;}return win;}}}};GoogleDocNameInputDialog.getDialog=function(id,url,escapeParams,parentId){var dialog=sfdcPage.getDialogById(id);if(dialog){return dialog;}dialog=new GoogleDocNameInputDialog(id,url,escapeParams,parentId);dialog.register();return dialog;};
function InlineEditDialog(){this.id="InlineEditDialog";this.isModal=true;this.extraClass="inlineEditDialog";this.width=null;this.title="";this.setupButtons();this.activeDiv=null;this.errorDiv=null;this.editDivPool=null;this.currentField=null;this.displayX=true;this.fields={};this.addEvents();}InlineEditDialog.prototype=new OverlayDialog();InlineEditDialog.prototype.setInnerHeight=function(){};InlineEditDialog.prototype.enter=function(){sfdcPage.inlineEditData.closeCurrentField();};InlineEditDialog.prototype.setupButtons=function(){this.buttons=[];this.buttons[0]={display:LC.getLabel("Buttons","ok"),action:"sfdcPage.inlineEditData.closeCurrentField()"};this.buttons[1]={display:LC.getLabel("Buttons","cancel"),action:"sfdcPage.inlineEditData.resetCurrentField()"};};InlineEditDialog.prototype.createContent=function(){addEvent(this.dialog,"click",function(e){eventCancelBubble(getEvent(e));},false);var content=document.getElementById(this.getContentId());var html=[];this.createButtons(html);content.innerHTML=html.join("");this.activeDiv=document.createElement("div");this.activeDiv.className="activeField";this.errorDiv=document.createElement("div");this.editDivPool=document.createElement("div");this.editDivPool.style.display="none";content.insertBefore(this.activeDiv,content.lastChild);content.insertBefore(this.errorDiv,content.lastChild);content.insertBefore(this.editDivPool,content.lastChild);};InlineEditDialog.prototype.addField=function(fieldId,editDiv,editLabel){this.fields[fieldId]={title:editLabel,div:editDiv};this.editDivPool.appendChild(editDiv);};InlineEditDialog.prototype.setActiveField=function(fieldId){if(this.currentField){if(this.currentField==fieldId){return;}this.editDivPool.appendChild(this.fields[this.currentField].div);}var f=this.fields[fieldId];this.setTitle(f.title);this.currentField=fieldId;this.activeDiv.appendChild(f.div);};InlineEditDialog.prototype.setMaxWidth=function(width){if(width>OverlayDialog.MAX_WIDTH){width=OverlayDialog.MAX_WIDTH;}if(this.dialog.currentStyle){this.dialog.style.width=width+"px";}else{this.dialog.style.maxWidth=width+"px";}};InlineEditDialog.prototype.cancel=function(){sfdcPage.inlineEditData.resetCurrentField();this.hide();};
function OverlayDialogElement(id){this.id=id;this.windowName=id;this.setupDefaultButtons();this.addEvents();this.contents="";this.buttonContents="";this.hasButtonsBar=true;}OverlayDialogElement.prototype=new OverlayDialog();OverlayDialogElement.prototype.createContent=function(){var content=document.getElementById(this.getContentId());var html=[];html.push(this.contents);if(this.hasButtonsBar){if(this.buttonContents.length==0){this.createButtons(html);}else{html.push("<div id='"+this.id+"_buttons' class='buttons'>");html.push(this.buttonContents);html.push("</div>");}}content.innerHTML=html.join("");};OverlayDialogElement.getDialog=function(id){var dialog=sfdcPage.getDialogById(id);if(dialog){return dialog;}dialog=new OverlayDialogElement(id);dialog.register();return dialog;};
function FieldSelectDialog(id,isModal,title,selectId,info,innerHeight,idPrefix){this.id=id;this.isModal=isModal;this.isMovable=true;this.buttons=[];this.selectId=selectId;this.info=info;this.width=OverlayDialog.MAX_WIDTH;if(idPrefix==null){idPrefix="";}this.buttons[0]={id:idPrefix+"fieldSelectClose",display:LC.getLabel("Buttons","close"),action:null};this.title=title;this.addEvents();this.manualTab=false;this.innerHeight=innerHeight;}FieldSelectDialog.prototype=new OverlayDialog();FieldSelectDialog.prototype.setController=function(controller){this.controller=controller;this.controller.setScrollDiv(document.getElementById(this.selectId));};FieldSelectDialog.prototype.setInnerHeight=function(){this.getContentElement().style.height=this.innerHeight+"px";};FieldSelectDialog.prototype.setManualTabControl=function(enabled){this.manualTab=enabled;};FieldSelectDialog.prototype.handleKeyPress=function(e){if(this.manualTab&&this.isOpen){e=getEvent(e);var key=e.keyCode;if(key==KEY_TAB){if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}return this.tab(e.shiftKey);}}OverlayDialog.prototype.handleKeyPress.call(this,e);};FieldSelectDialog.prototype.tab=function(reverse){this.controller.switchFocus(reverse);};FieldSelectDialog.prototype.createContent=function(){var content=document.getElementById(this.getContentId());var html=[];if(this.info){html.push("<p id='");html.push(this.id);html.push("Info'>");html.push(this.info);html.push("</p>");}html.push("<div class='fieldSelectorScrollableArea'  id='");html.push(this.getInnerId());html.push("'></div>");this.createButtons(html);content.innerHTML=html.join("");this.getContentElement().appendChild(document.getElementById(this.selectId));};FieldSelectDialog.prototype.getContentElement=function(){return document.getElementById(this.getInnerId());};FieldSelectDialog.prototype.getInnerId=function(){return this.id+"Inner";};FieldSelectDialog.prototype.show=function(){var selectContainer=this.getContentElement().firstChild;while(selectContainer.firstChild.nodeName!="TD"){selectContainer=selectContainer.firstChild;}while(selectContainer.lastChild!=selectContainer.firstChild){selectContainer.removeChild(selectContainer.lastChild);}this.controller.reset();this.controller.showSelects();OverlayDialog.prototype.show.call(this);this.controller.focusTop();this.controller.scrollRight();};FieldSelectDialog.prototype.hide=function(){OverlayDialog.prototype.hide.call(this);this.controller.hideSelects();if(this.controller.reFocusToFieldPickerIcon){this.controller.reFocusToFieldPickerIcon();}};
function EmailToSalesforceDeactivationDialog(id,sendEmailNotificationId,btnId,isEmailConfigEnabled){this.id=id;this.isModal=true;this.formId="emailDeactivation";this.windowName="";this.width=480;this.btnId=btnId;this.sendEmailNotificationId=sendEmailNotificationId;this.isEmailConfigEnabled=isEmailConfigEnabled;this.addEvents();}EmailToSalesforceDeactivationDialog.HEIGHT=80;EmailToSalesforceDeactivationDialog.prototype=new OverlayDialog();EmailToSalesforceDeactivationDialog.prototype.showDeActivationNotification=function(){this.setTitle(LC.getLabel("GoogleAppsActivationUi","deactivateTitle"));this.createContent();this.show();this.focusInOverlay();};EmailToSalesforceDeactivationDialog.prototype.createContent=function(){var content=document.getElementById(this.getContentId());var html=[];html.push("<div>");html.push("<table >");html.push("<tr><td>");html.push('<img src="'+UserContext.getUrl("/s.gif")+'" alt="Warning"  class="warningLarge" style=\'margin-right: 15px\'="style=\'margin-right: 15px\'" title="Warning"/>');html.push("</td><td>");html.push('<span  class="deactivateWarningHeader">');html.push(LC.getLabel("GoogleDocsActivationUi","deactivateWarningHeader"));html.push("</span>");html.push('<ul class="deactivateWarningUl">');html.push("<li>"+LC.getLabel("Page_EmailToSalesforceOrgSetup","whatDeactivatingWillDo1")+"</li>");html.push("<li>"+LC.getLabel("Page_EmailToSalesforceOrgSetup","whatDeactivatingWillDo2")+"</li>");if(this.isEmailConfigEnabled){html.push("<li>"+LC.getLabel("Page_EmailToSalesforceOrgSetup","whatDeactivatingWillDo3")+"</li>");}html.push("</ul>\n</td></tr>\n");html.push("</table></div>");html.push("<div class='buttons'>");var deactivateLabel=LC.getLabel("GoogleAppsActivationUi","deactivateButton");html.push("<input class='btn' type='button' id='overlayDeactivateButton' value='");html.push(deactivateLabel);html.push("' title='");html.push(deactivateLabel);html.push("' onclick=\"");html.push("if(EmailToSalesforceNotificationEmailDialog.prototype.savePage('dontsend','");html.push(this.sendEmailNotificationId);html.push("','");html.push(this.btnId);html.push("')) { sfdcPage.getDialogById('");html.push(this.id);html.push("').hide(); }\">");var cancelLabel=LC.getLabel("Buttons","cancel");html.push("<input class='btn' type='button' value='");html.push(cancelLabel);html.push("' title='");html.push(cancelLabel);html.push("' onclick=\"");html.push("sfdcPage.getDialogById('");html.push(this.id);html.push("').cancel(); document.getElementById('");html.push(this.btnId);html.push("').focus();\">");html.push("</div>");content.innerHTML=html.join("");};EmailToSalesforceDeactivationDialog.prototype.focusInOverlay=function(){document.getElementById("overlayDeactivateButton").focus();};EmailToSalesforceDeactivationDialog.getDialog=function(id,sendEmailNotificationId,btnId,isEmailConfigEnabled){var dialog=sfdcPage.getDialogById(id);if(dialog){return dialog;}dialog=new EmailToSalesforceDeactivationDialog(id,sendEmailNotificationId,btnId,isEmailConfigEnabled);dialog.register();return dialog;};
function EmailToSalesforceNotificationEmailDialog(id,userSetupUrl,adminUserName,emailSubjectId,emailBodyId,sendEmailNotificationId,btnId){this.id=id;this.userSetupUrl=userSetupUrl;this.adminUserName=adminUserName;this.isModal=true;this.formId="emailNotificationInputForm";this.errorElementId="errorMsg";this.windowName="";this.width=600;this.emailSubjectId=emailSubjectId;this.emailBodyId=emailBodyId;this.sendEmailNotificationId=sendEmailNotificationId;this.btnId=btnId;this.addEvents();}EmailToSalesforceNotificationEmailDialog.HEIGHT=80;EmailToSalesforceNotificationEmailDialog.prototype=new OverlayDialog();EmailToSalesforceNotificationEmailDialog.prototype.showEmailNotification=function(){this.setTitle(LC.getLabel("Page_EmailToUsers","page_title"));this.createContent();this.show();this.focusInOverlay();};EmailToSalesforceNotificationEmailDialog.prototype.createContent=function(){var content=document.getElementById(this.getContentId());var html=[];html.push("<table>");html.push('<tr><td align="right">');html.push("<B>"+LC.getLabel("Page_EmailToUsers","to")+"</B>");html.push("</td><td>");html.push(LC.getLabel("Page_EmailToUsers","allActiveUsers"));html.push("</td></tr>");html.push('<tr><td align="right">');html.push("<B>"+LC.getLabel("Page_EmailToUsers","emailSubjectLabel")+"</B>");html.push("</td><td>");html.push('<input id="subject" type="text" size="75" name="subject" title="');html.push(LC.getLabel("Page_EmailToUsers","emailSubjectTitle"));html.push('" value="'+LC.getLabel("Page_EmailToUsers","emailSubject")+'"/>');html.push("</td></tr>");html.push("<tr><td>");html.push("<B>"+LC.getLabel("Page_EmailToUsers","emailBodyLabel")+"</B>");html.push("</td><td>&nbsp;</td></tr>");html.push("</table>");html.push('<textarea id="body" name="body" rows="10" cols="100" title="'+LC.getLabel("Page_EmailToUsers","emailBodyTitle")+'">');html.push(LC.getLabel("Page_EmailToUsers","emailBody",this.userSetupUrl,this.adminUserName));html.push("</textarea>");html.push("<div class='buttons'>");var sendNotificationEmailLabel=LC.getLabel("Page_EmailToUsers","sendNotificationEmail");html.push("<input class='btn' type='button' value='");html.push(sendNotificationEmailLabel);html.push("' title='");html.push(sendNotificationEmailLabel);html.push("' onclick=\"");html.push("if(sfdcPage.getDialogById('");html.push(this.id);html.push("').sendEmail()) { sfdcPage.getDialogById('");html.push(this.id);html.push("').hide(); }\">");if(this.btnId.indexOf("saveBtn")>=0){var skipThisStepLabel=LC.getLabel("Page_EmailToUsers","skipThisStep");html.push("<input class='btn' type='button' value='");html.push(skipThisStepLabel);html.push("' title='");html.push(skipThisStepLabel);html.push("' onclick=\"");html.push("if(sfdcPage.getDialogById('");html.push(this.id);html.push("').savePage('dontsend','");html.push(this.sendEmailNotificationId);html.push("','");html.push(this.btnId);html.push("')) { sfdcPage.getDialogById('");html.push(this.id);html.push("').hide(); }\">");}else{var cancelLabel=LC.getLabel("Buttons","cancel");html.push("<input class='btn' type='button' value='");html.push(cancelLabel);html.push("' title='");html.push(cancelLabel);html.push("' onclick=\"");html.push("sfdcPage.getDialogById('");html.push(this.id);html.push("').cancel(); document.getElementById('");html.push(this.btnId);html.push("').focus();\">");}html.push("</div>");content.innerHTML=html.join("");};EmailToSalesforceNotificationEmailDialog.prototype.focusInOverlay=function(){document.getElementById("body").focus();};EmailToSalesforceNotificationEmailDialog.prototype.sendEmail=function(){var overlaySubject=document.getElementById("subject");var overlayBody=document.getElementById("body");var hiddenSubject=document.getElementById(this.emailSubjectId);var hiddenBody=document.getElementById(this.emailBodyId);hiddenSubject.value=overlaySubject.value;hiddenBody.value=overlayBody.value;return this.savePage("send",this.sendEmailNotificationId,this.btnId);};EmailToSalesforceNotificationEmailDialog.prototype.savePage=function(sendEmailNotificationValue,sendEmailNotificationId,btnId){var sendEmailNotification=document.getElementById(sendEmailNotificationId);sendEmailNotification.value=sendEmailNotificationValue;var button=document.getElementById(btnId);button.click();return true;};EmailToSalesforceNotificationEmailDialog.getDialog=function(id,userSetupUrl,adminUserName,emailSubjectId,emailBodyId,sendEmailNotificationId,btnId){var dialog=sfdcPage.getDialogById(id);if(dialog){return dialog;}dialog=new EmailToSalesforceNotificationEmailDialog(id,userSetupUrl,adminUserName,emailSubjectId,emailBodyId,sendEmailNotificationId,btnId);dialog.register();return dialog;};
function PrintableViewPage(){}PrintableViewPage.prototype=new DetailPage();PrintableViewPage.prototype.getEntityId=function(){var href=window.location.href;var paths=href.split("?")[0].split("/");return paths[paths.length-2];};
SearchHistory.TIMEOUT=1000;SearchHistory.TIMEOUT_STEP=5;function SearchPage(){this.openComponent=null;this.dhtmlHistory=null;this.historyCounter=0;this.historyPrefix="hst";this.historyStorage=new Object();this.actionIdStorage=new Object();this.cancelCalls=new Object();this.duelingBoxRef={};var self=this;this.closeOpenedComponent=function(e){if(self.openComponent){var element=document.getElementById(self.openComponent);if(element){element.style.display="none";self.openComponent=null;}}};}SearchPage.prototype=new DetailPage();SearchPage.prototype.wrapDhtmlWaitingRequest=function(actionUrl,currentUrl,listUrl,listQS,listId,description,addAdditionalParams){var identifier=this.createIdentifier();if(!this.hook_shouldProceedWithAction()){return;}this.processAction(listId,description,identifier);listUrl=this.addActionIdentifier(listUrl,identifier);if(addAdditionalParams){listUrl=this.addAdditionalParams(listUrl);}this.callRelatedListActionAndSaveHistory(actionUrl,currentUrl,listUrl,listQS,listId);};SearchPage.prototype.hook_shouldProceedWithAction=function(){return true;};SearchPage.prototype.addAdditionalParams=function(listUrl){return listUrl;};SearchPage.prototype.addActionIdentifier=function(listUrl,identifier){if(listUrl){var parts=listUrl.split("?");var qs=(parts.length>1)?parts[1]:"";var listQs=new QueryString(qs,true);listQs.remove(SearchRelatedList.SEARCH_ACTION_IDENTIFIER_PARAM);listQs.add(SearchRelatedList.SEARCH_ACTION_IDENTIFIER_PARAM,identifier);var newListQs=listQs.toString();return parts[0]+newListQs;}return listUrl;};SearchPage.prototype.createIdentifier=function(){return"_"+new Date().getTime();};SearchPage.prototype.checkActionCanceled=function(doc,listId){var retVal=false;var identifierElement=getElementByIdCSWithDoc(doc,SearchRelatedList.SEARCH_ACTION_IDENTIFIER_PARAM+listId);if(identifierElement){var identifier=identifierElement.innerHTML;retVal=identifier in this.actionIdStorage;if(retVal){delete this.actionIdStorage[identifier];}}this.clearVariablesOnActionLoad();return retVal;};SearchPage.prototype.clearVariablesOnActionLoad=function(){};SearchPage.prototype.registerOpenComponent=function(idOfComponent){this.openComponent=idOfComponent;};SearchPage.prototype.searchEntity=function(isAll,searchEntity){var elems=document.getElementsByName(searchEntity);if(!elems){return;}for(i=0;i<elems.length;++i){elems[i].checked=isAll;}};SearchPage.prototype.checkEntitySelection=function(formElement,searchEntity){var elems=document.getElementsByName(searchEntity);if(!elems){return;}var checkedArrayValues=new Array();var counterUnchecked=0;for(i=0;i<elems.length;i++){if(!elems[i].type||elems[i].type!="checkbox"||!elems[i].value){continue;}if(elems[i].checked){checkedArrayValues.push(elems[i].value);}else{counterUnchecked++;}}if(checkedArrayValues.length==0){for(i=0;i<elems.length;i++){elems[i].checked=true;}}if(checkedArrayValues.length==0||counterUnchecked==0){var inputElement=document.createElement("input");inputElement.type="hidden";inputElement.name=searchEntity;inputElement.value=SearchRelatedList.pENTITY_ALL;formElement.appendChild(inputElement);}else{for(i=0;i<checkedArrayValues.length;i++){var inputElement=document.createElement("input");inputElement.type="hidden";inputElement.name=searchEntity;inputElement.value=checkedArrayValues[i];formElement.appendChild(inputElement);}}};SearchPage.prototype.submitSearchForm=function(event,formId){if(formId){var form=document.getElementById(formId);if(form){var keynum=this.getKeyNumForEvent(event);if(keynum&&keynum==KEY_ENTER){if(form.onsubmit){form.onsubmit();}form.submit();}}}};SearchPage.prototype.getKeyNumForEvent=function(event){var evt=getEvent(event);if(!evt){return;}var keynum;if(window.event){keynum=evt.keyCode;}else{if(evt.which){keynum=evt.which;}}return keynum;};SearchPage.prototype.setDlbeRef=function(relList,dlbeRef){if(dlbeRef){this.duelingBoxRef[relList]=dlbeRef;}};SearchPage.prototype.toggleSearchElement=function(idOfComponent,listId,shouldRegister,displayType){var self=this;function handleKeyUp(e){var keynum=self.getKeyNumForEvent(e);if(keynum&&keynum==KEY_ESC&&shouldRegister){self.closeOpenedComponent();if(self.duelingBoxRef){if(self.duelingBoxRef[listId]){self.duelingBoxRef[listId].resetSelection();self.duelingBoxRef[listId].quickUnwarn();}}}}if(!displayType){displayType="block";}var element=document.getElementById(idOfComponent);if(XBrowser.userAgent.isIE7){element.style.position="absolute";}if(element){if(element.onkeyup==null){element.onkeyup=handleKeyUp;}if(idOfComponent!=this.openComponent){this.closeOpenedComponent();}if(element.style.display=="none"){element.style.display=displayType;var focusObjects=element.getElementsByTagName("input");if(focusObjects&&focusObjects.length>0){focusObjects[0].focus();}if(shouldRegister){this.registerOpenComponent(idOfComponent);}}else{element.style.display="none";}}if(this.duelingBoxRef){if(this.duelingBoxRef[listId]){this.duelingBoxRef[listId].resetSelection();this.duelingBoxRef[listId].quickUnwarn();}}};SearchPage.prototype.processAction=function(listId,description,identifier,notCancelable){var listSection=document.getElementById(listId);if(!listSection){return;}var dataSection=getElementsByClassName("pbBody",listSection,"div");var headerSection=this.getControlHeadersForCover(listSection);if(!(dataSection&&dataSection[0]&&headerSection)){return;}dataSection[0].style.position="relative";for(i=0;i<headerSection.length;++i){if(headerSection[i]){headerSection[i].style.position="relative";}}var opacityElement=this.createLoadingElement(dataSection[0]);opacityElement.className="waitingSearchDiv waitingSearchDivOpacity";var clearElement=this.createLoadingElement(dataSection[0]);clearElement.className="waitingSearchDiv";if(!description){description=LC.getLabel("Page_SearchResult","dhtmlLoading");}var controlCover=new Array();for(i=0;i<headerSection.length;++i){if(headerSection[i]){controlCover[i]=document.createElement("div");headerSection[i].appendChild(controlCover[i]);controlCover[i].style.height=headerSection[i].clientHeight+"px";controlCover[i].style.width=headerSection[i].clientWidth+"px";controlCover[i].className="waitingHeaderSearchDiv";}}var waitingInformationElement=this.addLoadingDescription(description,clearElement);var storageVariable=this.actionIdStorage;var cancelCall=function(){for(i=0;i<headerSection.length;++i){if(headerSection[i]){headerSection[i].removeChild(controlCover[i]);}}dataSection[0].removeChild(opacityElement);dataSection[0].removeChild(clearElement);if(identifier){storageVariable[identifier]=identifier;}};if(!notCancelable){var cancelButton=document.createElement("input");cancelButton.title=LC.getLabel("Global","cancel");cancelButton.className="waitingCancel";cancelButton.type="button";waitingInformationElement.appendChild(cancelButton);cancelButton.onclick=cancelCall;cancelButton=null;}this.hook_saveCancelCall(listId,cancelCall);};SearchPage.prototype.hook_saveCancelCall=function(listId,cancelCall){this.cancelCalls[listId]=cancelCall;};SearchPage.prototype.getControlHeadersForCover=function(listSection){return getElementsByClassName("pbHeader",listSection,"div");};SearchPage.prototype.createLoadingElement=function(dataElement){var loadingElement=document.createElement("div");dataElement.appendChild(loadingElement);var height=this.getHeightForLoadingElement(dataElement);loadingElement.style.width=this.getWidthForLoadingElement(dataElement);loadingElement.style.height=height;return loadingElement;};SearchPage.prototype.isTagBrowser=function(dataElement){return dataElement.id&&dataElement.id.indexOf(TagConstants.TAG_RESULTS_BODY_ID)==0;};SearchPage.prototype.getHeightForLoadingElement=function(dataElement){if(this.isTagBrowser(dataElement)){return this.getHeightForLoadingElementTag(dataElement);}else{return this.getHeightForLoadingElementNonTag(dataElement);}};SearchPage.prototype.getWidthForLoadingElement=function(dataElement){if(this.isTagBrowser(dataElement)){return this.getWidthForLoadingElementTag(dataElement);}else{return this.getWidthForLoadingElementNonTag(dataElement);}};SearchPage.prototype.getHeightForLoadingElementTag=function(dataElement){var borderOffset=-4;return dataElement.scrollHeight+borderOffset+"px";};SearchPage.prototype.getWidthForLoadingElementTag=function(dataElement){var borderOffset=-4;return dataElement.scrollWidth+borderOffset+"px";};SearchPage.prototype.getHeightForLoadingElementNonTag=function(dataElement){var height=dataElement.offsetHeight+5;if(XBrowser.userAgent.isIE){height=dataElement.offsetHeight;}return height+"px";};SearchPage.prototype.getWidthForLoadingElementNonTag=function(dataElement){return dataElement.offsetWidth+"px";};SearchPage.prototype.addLoadingDescription=function(description,element){var newWaitingHolder=document.createElement("span");element.appendChild(newWaitingHolder);newWaitingHolder.className="waitingSearchHolder";var limitedOffset=(element.offsetHeight)/5;if(limitedOffset>100){limitedOffset=100;}newWaitingHolder.style.top=limitedOffset+"px";var newWaitingImage=document.createElement("img");newWaitingHolder.appendChild(newWaitingImage);newWaitingImage.src=UserContext.getUrl("/img/loading.gif");newWaitingImage.className="waitingImage";var newWaitingDescription=document.createElement("span");newWaitingHolder.appendChild(newWaitingDescription);newWaitingDescription.innerHTML=description;newWaitingDescription.className="waitingDescription";return newWaitingHolder;};SearchPage.prototype.savePerEntityEnum=function(entityParam,valueParam){var url=UserContext.getUrl("/setup/search/")+SearchRelatedList.SearchFilterInfoServletName+"?timeStamp="+new Date().getTime();var queryString=new QueryString("");if(entityParam){queryString.add(SearchRelatedList.ENTITY_PARAMETER,entityParam);}queryString.add(SearchRelatedList.PER_ENTITY_VALUE,valueParam);var queryString=queryString.toString();XBrowser.postHttpResponse(url,handler,queryString.substring(1,queryString.length));function handler(reponseText){}};SearchPage.prototype.saveSearchColumnSelection=function(idOfSelectedColumns,entityName,layoutType,actionUrl,currentUrl,listUrl,listQS,listId){if(!this.hook_shouldProceedWithAction()){return;}var identifier=this.createIdentifier();this.processAction(listId,LC.getLabel("Page_SearchResult","dhtmlCustomizing"),identifier);var selectElement=document.getElementById(idOfSelectedColumns);if(!selectElement){return;}var selectedElements="";for(var ind=0;ind<selectElement.options.length;ind++){selectedElements=selectedElements+selectElement.options[ind].value+",";}var url=UserContext.getUrl("/setup/search/")+SearchRelatedList.SearchUserLayoutServletName+"?timeStamp="+new Date().getTime();var queryString=new QueryString("");queryString.add(SearchRelatedList.COLUMN_PARAMETER,selectedElements);queryString.add(SearchRelatedList.ENTITY_PARAMETER,entityName);queryString.add(SearchRelatedList.LIST_LAYOUT_TYPE_PARAMETER,layoutType);queryString=queryString.toString();XBrowser.postHttpResponse(url,handler,queryString.substring(1,queryString.length),errorHandler);listUrl=this.addActionIdentifier(listUrl,identifier);var self=this;function handler(request){if(request.status==200){callRelatedListAction(actionUrl,listUrl,listQS,listId,true);}else{if(self.cancelCalls[listId]){self.cancelCalls[listId]();}self.displayErrorForSearch(LC.getLabel("Page_SearchResult","unknown_error"),listId);}}function errorHandler(err){if(self.cancelCalls[listId]){self.cancelCalls[listId]();}self.displayErrorForSearch(LC.getLabel("Page_SearchResult","unknown_error"),listId);}};SearchPage.prototype.displayErrorForSearch=function(msg,listId){var errorDiv=document.getElementById(SearchRelatedList.ERROR_DIV_ID_PREFIX+listId);if(errorDiv){if(errorDiv.lastChild){errorDiv.lastChild.innerHTML=LC.getLabel("Global","error")+": "+msg;}if(errorDiv.style.display=="none"){Animation.rollInRollOut(errorDiv,5000);}}};SearchPage.prototype.filterResults=function(fieldNames,actionUrl,currentUrl,listUrl,listQS,listId){if(!this.hook_shouldProceedWithAction()){return;}var identifier=this.createIdentifier();this.processAction(listId,LC.getLabel("Page_SearchResult","dhtmlFiltering"),identifier);var allFields=fieldNames.split(",");var selectedElements="";var fieldList="";for(var i=0;i<allFields.length;i++){var field=allFields[i];if(field==""){continue;}var fieldElement=document.getElementById(field);if(!fieldElement){continue;}var value=fieldElement.value;if(value&&value!=""){selectedElements=selectedElements+"&"+field+"="+this.encodeForSearch(value);fieldList=fieldList+field+",";}}var newUrl=listUrl;if(selectedElements!=""){newUrl=newUrl+selectedElements+"&"+SearchRelatedList.FILTER_FIELDS_PARAM+"="+fieldList;newUrl=newUrl+"&"+SearchRelatedList.ShouldNotLookUp+"="+true;}newUrl=this.addActionIdentifier(newUrl,identifier);this.callRelatedListActionAndSaveHistory(actionUrl,currentUrl,newUrl,listQS,listId);};SearchPage.prototype.encodeForSearch=function(initialString){var encodedValue;if(window.encodeURIComponent){encodedValue=encodeURIComponent(initialString);}else{encodedValue=escape(initialString);}return encodedValue;};SearchPage.prototype.decodeForSearch=function(encodedString){if(!encodedString){return encodedString;}var decodedValue;if(window.encodeURIComponent){decodedValue=decodeURIComponent(encodedString);}else{decodedValue=unescape(encodedString);}return decodedValue;};SearchPage.prototype.toggleAllFilterInfoElement=function(elementClass){var elements=getElementsByClassName(elementClass,document.body,"div");if(!elements){return;}for(var i=0;i<elements.length;i++){elements[i].style.display="none";}if(Sidebar.prototype.theSidebar){Sidebar.prototype.theSidebar.sizeToBody();Sidebar.prototype.theSidebar.sizeBodyToSidebarNoCheck();}};SearchPage.prototype.callRelatedListActionAndSaveHistory=function(actionUrl,currentUrl,newUrl,listQS,listId){var self=this;function onSuccessCallback(){if(!self.dhtmlHistory){self.dhtmlHistory=new DhtmlHistory(self.historyStorage,self.historyChange,self);}var optionalStorageHash;var currentHash=self.dhtmlHistory.getCurrentLocation();if(currentHash){var currentData=self.historyStorage[currentHash];if(currentData&&currentData.listId!=listId){optionalStorageHash=self.historyPrefix+self.historyCounter;self.historyCounter=self.historyCounter+1;}}if(self.historyCounter==0&&!optionalStorageHash){optionalStorageHash=self.historyPrefix+self.historyCounter;self.historyCounter=self.historyCounter+1;}if(optionalStorageHash){var dataObject=new SearchHistory();dataObject.setActionUrl(actionUrl);dataObject.setListUrl(currentUrl);dataObject.setListQs(listQS);dataObject.setListId(listId);self.dhtmlHistory.add(optionalStorageHash,dataObject);self.saveStateToInput(optionalStorageHash,dataObject);}var dataObject=new SearchHistory();dataObject.setActionUrl(actionUrl);dataObject.setListUrl(newUrl);dataObject.setListQs(listQS);dataObject.setListId(listId);self.dhtmlHistory.add(self.historyPrefix+self.historyCounter,dataObject);self.saveStateToInput(self.historyPrefix+self.historyCounter,dataObject);self.updateLastListState(actionUrl,newUrl,listQS,listId);self.historyCounter=self.historyCounter+1;}callRelatedListAction(actionUrl,newUrl,listQS,listId,true,onSuccessCallback);};SearchPage.prototype.loadStateFromInput=function(){if(!XBrowser.userAgent.isFirefox){return;}this.allHistoryStorage=document.getElementById(SearchRelatedList.ALL_STATES_PREFIX+this.currentSearchId);if(!this.allHistoryStorage){return;}var input=this.allHistoryStorage.value;if(!input||input.length==0){return;}var qs=new QueryString(input);for(var loc in qs.params){var dataObject=new SearchHistory();dataObject.readFromQs(new QueryString(SearchPage.prototype.decodeForSearch(qs.get(loc))));this.historyStorage[loc]=dataObject;this.historyCounter=this.historyCounter+1;}if(this.historyCounter>0&&!this.dhtmlHistory){this.dhtmlHistory=new DhtmlHistory(this.historyStorage,this.historyChange,this);}};SearchPage.prototype.saveStateToInput=function(loc,object){if(!XBrowser.userAgent.isFirefox||!this.allHistoryStorage||!object||!loc){return;}var qs=new QueryString("");qs.add(loc,SearchPage.prototype.encodeForSearch(object.toString()));var queryString=qs.toString();this.allHistoryStorage.value=this.allHistoryStorage.value+queryString.substring(1,queryString.length);};SearchPage.prototype.historyChange=function(oldLocation,newLocation){if(!this.hook_shouldProceedWithAction()){return;}if(newLocation&&this.historyStorage[newLocation]){var historyData=this.historyStorage[newLocation];if(oldLocation&&this.historyStorage[oldLocation]){if(!window.parseInt){return;}var oldNumber=parseInt(oldLocation.substring(3,oldLocation.length));var newNumber=parseInt(newLocation.substring(3,oldLocation.length));var oldRelatedListId=this.historyStorage[oldLocation].getListId();var newRelatedListId=historyData.getListId();if(oldRelatedListId!=newRelatedListId){if(oldNumber>newNumber){window.history.go(-1);return;}else{if(oldNumber<newNumber){window.history.go(1);return;}}}}if(oldLocation){var identifier=this.createIdentifier();this.processAction(historyData.listId,null,identifier);var listUrl=this.addActionIdentifier(historyData.getListUrl(),identifier);var self=this;function onSuccessCallback(){self.updateLastListState(historyData.getActionUrl(),listUrl,historyData.getListQs(),historyData.getListId());}callRelatedListAction(historyData.getActionUrl(),listUrl,historyData.getListQs(),historyData.getListId(),true,onSuccessCallback);}}};SearchPage.prototype.hook_updatedStateOnLoad=function(listUrl,listId){};SearchPage.prototype.setCookieFormState=function(listId,entityName,prefName){var currentCookie=getCookie(prefName);var tempQs;if(currentCookie){tempQs=new QueryString(currentCookie);}else{tempQs=new QueryString("");}var filterForm=document.getElementById(SearchRelatedList.FILTER_FIELDS_PREFIX+listId);if(filterForm){if(filterForm.style.display=="none"){tempQs.add(entityName,"1");}else{tempQs.add(entityName,"0");}}var now=new Date();now.setTime(now.getTime()+(120*60*1000));var qsString=tempQs.toString();setCookie(prefName,qsString.substring(1,qsString.length),now,null);};SearchPage.prototype.onLoadUpdateState=function(){var sIdElement=document.getElementById(SearchRelatedList.SEARCH_IDENTIFIER_PARAM);this.currentSearchId=sIdElement?sIdElement.innerHTML:null;if(!this.currentSearchId){return;}this.loadStateFromInput();var registryInput=document.getElementById(this.currentSearchId);var allStates;if(registryInput&&registryInput.value){allStates=this.decodeForSearch(registryInput.value).split(",");}else{return;}var requestTimeout=0;var actualTimeout=SearchHistory.TIMEOUT;var counter=0;for(var i=allStates.length-1;i>=0;i--){var stateListId=allStates[i];if(!stateListId||stateListId==""){continue;}var list=document.getElementById(stateListId);if(!list){continue;}var listStateInput=document.getElementById(this.currentSearchId+stateListId);if(listStateInput&&listStateInput.value){var dataObject=new SearchHistory();dataObject.readFromQs(new QueryString(listStateInput.value));if(dataObject.getListUrl()){var identifier=this.createIdentifier();var listUrl=this.addActionIdentifier(dataObject.getListUrl(),identifier);this.hook_updatedStateOnLoad(listUrl,dataObject.getListId());var callString="callRelatedListAction("+this.buildParam(dataObject.getActionUrl())+this.buildParam(listUrl)+this.buildParam(dataObject.getListQs())+this.buildParam(dataObject.getListId())+"true);";window.setTimeout(callString,requestTimeout);counter++;if(counter>0&&counter%SearchHistory.TIMEOUT_STEP==0){actualTimeout+=SearchHistory.TIMEOUT;}requestTimeout+=actualTimeout;this.processAction(dataObject.getListId(),null,identifier);}}}};SearchPage.prototype.buildParam=function(parameter,isLast){var retVal;if(parameter){retVal="'"+parameter+"'";}else{retVal="null";}retVal+=",";return retVal;};SearchPage.prototype.updateLastListState=function(actionUrl,newUrl,listQS,listId){if(!this.currentSearchId){return;}var registryInput=document.getElementById(this.currentSearchId);if(!registryInput){return;}var listStateInput=document.getElementById(this.currentSearchId+listId);if(!listStateInput){return;}var allStates;if(registryInput.value){allStates=this.decodeForSearch(registryInput.value).split(",");}else{allStates=new Array();}var newListOfStates="";for(var i=0;i<allStates.length;i++){var stateListId=allStates[i];if(!stateListId||stateListId==""||listId==stateListId){continue;}newListOfStates=newListOfStates+stateListId+",";}newListOfStates=newListOfStates+listId;registryInput.value=this.encodeForSearch(newListOfStates);var dataObject=new SearchHistory();if(actionUrl){dataObject.setActionUrl(actionUrl);}if(newUrl){dataObject.setListUrl(newUrl);}if(listQS){dataObject.setListQs(listQS);}if(listId){dataObject.setListId(listId);}listStateInput.value=dataObject.toString();};SearchPage.prototype.addCloser=function(rellistId){var customizediv=document.getElementById(SearchRelatedList.COMBO_BUTTON_ID+rellistId);if(customizediv){addEvent(customizediv,"click",this.closeOpenedComponent,false);}};SearchPage.prototype.addUnloadClearState=function(){if(XBrowser.userAgent.isIE){if(this.dhtmlHistory){this.dhtmlHistory.iframe=null;this.dhtmlHistory.parentObject=null;this.dhtmlHistory.listener=null;this.dhtmlHistory.historyStorage=null;}this.dhtmlHistory=null;this.openComponent=null;this.historyCounter=null;this.historyPrefix=null;this.historyStorage=null;this.cancelCalls=null;this.actionIdStorage=null;this.duelingBoxRef=null;}};
function OpportunitySalesTeamEditPage(currentRow,newRowCells,firstSplitColIndex,oppAmount,decimalSep,groupingSep,posPrefix,negPrefix,posSuffix,negSuffix,userDecimalSep,userGroupingSep){this.currentRow=currentRow;this.totalRows=currentRow;this.newRowCells=newRowCells;this.firstSplitColIndex=firstSplitColIndex;this.splitCellDisplayRule=null;this.showingSplits=false;this.oppAmount=oppAmount;this.invalidAmountText=LC.getLabel("OpportunitySplit","invalidAmt");this.invalidTotalPctMsg=LC.getLabel("OpportunitySplit","invalidTotalPct");this.invalidTotalAmtMsg=LC.getLabel("OpportunitySplit","invalidTotalAmt");errorCssClass="errorMsg";var page=this;this.appendToOnloadQueue(function(){page.init();});this.currencyNumberFormatter=new SimpleDecimalFormat(decimalSep,groupingSep,posPrefix,negPrefix,posSuffix,negSuffix);this.decimalSep=decimalSep;this.userNumberFormatter=new SimpleDecimalFormat(userDecimalSep,userGroupingSep,posPrefix,negPrefix,posSuffix,negSuffix);actionColumn=0;nameColumn=1;}OpportunitySalesTeamEditPage.prototype=new EditPage();OpportunitySalesTeamEditPage.prototype.init=function(){var styles=document.styleSheets;for(var i=0;i<styles.length;i++){if(styles[i].href!=null&&styles[i].href.indexOf("opportunitySalesTeamEdit")>=0){var rules=(styles[i].cssRules)?styles[i].cssRules:styles[i].rules;for(var j=0;j<rules.length;j++){if(rules[j].selectorText.toLowerCase().indexOf("#stt tr .splitcell")>=0){this.splitCellDisplayRule=rules[j];break;}}break;}}for(var i=0;i<this.currentRow;i++){this.updateSplitDisplay(i);this.updateRowDisplay(i);this.formatPct(i);this.updateAmt(i);}this.updateTotals();this.showingSplits=this.countSplits()==0;this.showHideSplits();var focusRow=0;document.getElementById(OppSalesTeamRowEdit.USER_LOOKUP_ID_LABEL+focusRow).focus();};OpportunitySalesTeamEditPage.prototype.showHideSplits=function(){var count=this.countSplits();if(count>0&&!this.showingSplits){this.splitCellDisplayRule.style.visibility="visible";this.splitCellDisplayRule.style.display="";this.showingSplits=true;document.getElementById(OpportunitySalesTeamEdit.SPLIT_TOTAL_ID).style.visibility="visible";document.getElementById(OpportunitySalesTeamEdit.SPLIT_TOTAL_ID).style.display="";}else{if(count==0&&this.showingSplits){this.splitCellDisplayRule.style.visibility="hidden";this.splitCellDisplayRule.style.display="none";this.showingSplits=false;document.getElementById(OpportunitySalesTeamEdit.SPLIT_TOTAL_ID).style.visibility="hidden";document.getElementById(OpportunitySalesTeamEdit.SPLIT_TOTAL_ID).style.display="none";}}};OpportunitySalesTeamEditPage.prototype.countSplits=function(){var count=0;for(var i=0;i<this.currentRow;i++){var rowType=document.getElementById(OppSalesTeamRowEdit.ROW_TYPE_LABEL+i).value;var isSplit=document.getElementById(OppSalesTeamRowEdit.IS_SPLIT_LABEL+i).checked;if(isSplit&&rowType!=SalesTeamRowTypeEnum.EXISTING_DELETED&&rowType!=SalesTeamRowTypeEnum.NEW_DELETED){count++;}}return count;};OpportunitySalesTeamEditPage.prototype.delRow=function(rowNum){var rowTypeEle=document.getElementById(OppSalesTeamRowEdit.ROW_TYPE_LABEL+rowNum);var currentType=rowTypeEle.value;if(currentType==SalesTeamRowTypeEnum.EXISTING||currentType==SalesTeamRowTypeEnum.EXISTING_INACTIVE){currentType=SalesTeamRowTypeEnum.EXISTING_DELETED;}else{if(currentType==SalesTeamRowTypeEnum.NEW){currentType=SalesTeamRowTypeEnum.NEW_DELETED;}}rowTypeEle.value=currentType;this.totalRows--;this.updateRowDisplay(rowNum);this.updateTotals();this.showHideSplits();};OpportunitySalesTeamEditPage.prototype.updateRowDisplay=function(rowNum){var rowType=document.getElementById(OppSalesTeamRowEdit.ROW_TYPE_LABEL+rowNum).value;if(rowType==SalesTeamRowTypeEnum.EXISTING_DELETED||rowType==SalesTeamRowTypeEnum.NEW_DELETED){document.getElementById(OppSalesTeamRowEdit.ROW_ID_LABEL+rowNum).className="deleted";}};OpportunitySalesTeamEditPage.prototype.updateSplitDisplay=function(rowNum){var isSplit=document.getElementById(OppSalesTeamRowEdit.IS_SPLIT_LABEL+rowNum).checked;var visibility=isSplit?"visible":"hidden";var display=isSplit?"":"none";document.getElementById(OppSalesTeamRowEdit.SPLIT_NOTE_LABEL+rowNum).parentNode.style.visibility=visibility;document.getElementById(OppSalesTeamRowEdit.SPLIT_AMOUNT_LABEL+rowNum).parentNode.style.visibility=visibility;document.getElementById(OppSalesTeamRowEdit.SPLIT_PERCENTAGE_LABEL+rowNum).parentNode.style.visibility=visibility;document.getElementById(OppSalesTeamRowEdit.SPLIT_NOTE_LABEL+rowNum).parentNode.style.display=display;document.getElementById(OppSalesTeamRowEdit.SPLIT_AMOUNT_LABEL+rowNum).parentNode.style.display=display;document.getElementById(OppSalesTeamRowEdit.SPLIT_PERCENTAGE_LABEL+rowNum).parentNode.style.display=display;};OpportunitySalesTeamEditPage.prototype.getRemainderPercent=function(){var totalPercent=this.getTotalPercent(true);return this.userNumberFormatter.formatNumber((totalPercent<=100)?100-totalPercent:0);};OpportunitySalesTeamEditPage.prototype.updateTotals=function(){var totalPctEle=document.getElementById(OpportunitySalesTeamEdit.SPLIT_TOTAL_PER_ID);var totalAmtEle=document.getElementById(OpportunitySalesTeamEdit.SPLIT_AMOUNT_TOTAL_ID);var totalPercent=this.getTotalPercent(false);if(totalPercent==null){totalPctEle.innerHTML=this.invalidTotalPctMsg;totalPctEle.className=errorCssClass;if(this.oppAmount!=null&&!isNaN(this.oppAmount)){totalAmtEle.innerHTML=this.invalidTotalAmtMsg;totalAmtEle.className=errorCssClass;}}else{totalPctEle.innerHTML=this.formatNumber(totalPercent)+"%";totalPctEle.className=(totalPercent!=100)?errorCssClass:"";if(this.oppAmount!=null&&!isNaN(this.oppAmount)){totalAmtEle.innerHTML=this.formatCurrency(totalPercent/100*this.oppAmount);totalAmtEle.className=(totalPercent!=100)?errorCssClass:"";}}};OpportunitySalesTeamEditPage.prototype.getTotalPercent=function(ignoreNaN){var totalPercent=0;for(var i=0;i<this.currentRow;i++){var rowType=document.getElementById(OppSalesTeamRowEdit.ROW_TYPE_LABEL+i).value;var isSplit=document.getElementById(OppSalesTeamRowEdit.IS_SPLIT_LABEL+i).checked;var percentValue=document.getElementById(OppSalesTeamRowEdit.SPLIT_PERCENTAGE_LABEL+i).value;if(percentValue==""||percentValue==this.decimalSep){percentValue=0;}var percent=this.userNumberFormatter._parseFloat(percentValue);if(!ignoreNaN&&(this.userNumberFormatter._isNaN(percentValue)||isNaN(percent)||percent<0||percent>100)){return null;}if(isSplit&&!this.userNumberFormatter._isNaN(percentValue)&&!isNaN(percent)&&percent>=0&&percent<=100&&rowType!=SalesTeamRowTypeEnum.EXISTING_DELETED&&rowType!=SalesTeamRowTypeEnum.NEW_DELETED){totalPercent+=percent;}}return Math.round((totalPercent*100))/100;};OpportunitySalesTeamEditPage.prototype.updateIsSplit=function(rowNum){this.updateSplitDisplay(rowNum);this.showHideSplits();var percent=document.getElementById(OppSalesTeamRowEdit.IS_SPLIT_LABEL+rowNum).checked?this.getRemainderPercent():"";document.getElementById(OppSalesTeamRowEdit.SPLIT_PERCENTAGE_LABEL+rowNum).value=percent;this.formatPct(rowNum);this.updateAmt(rowNum);this.updateTotals();};OpportunitySalesTeamEditPage.prototype.addRow=function(){var newRow=document.createElement("tr");for(var i=0;i<8;i++){var newTd;if(i==nameColumn){newTd=document.createElement("th");}else{newTd=document.createElement("td");}newTd.innerHTML=this.newRowCells[i].replace(/9999/g,this.currentRow);newTd.innerHTML=newTd.innerHTML.replace(/10000/g,this.currentRow+1);if(i==actionColumn){newTd.className="actionColumn";}else{if(i==nameColumn){newTd.className="nameCol";newTd.scope="row";}else{if(i>this.firstSplitColIndex){newTd.className="splitCell";}}}newRow.appendChild(newTd);}newRow.setAttribute("id",OppSalesTeamRowEdit.ROW_ID_LABEL+this.currentRow);document.getElementById(OpportunitySalesTeamEdit.SALES_TEAM_MEMBER_TABLE_ID).firstChild.insertBefore(newRow,document.getElementById(OppSalesTeamRowEdit.SUMMARY_ROW_ID));this.updateSplitDisplay(this.currentRow);document.getElementById(OppSalesTeamRowEdit.USER_LOOKUP_ID_LABEL+this.currentRow).focus();this.currentRow++;this.totalRows++;};OpportunitySalesTeamEditPage.prototype.updateAmt=function(rowNum){var amountText="";var amountCssClass="";if(this.oppAmount!=null&&!isNaN(this.oppAmount)){var percentEleValue=document.getElementById(OppSalesTeamRowEdit.SPLIT_PERCENTAGE_LABEL+rowNum).value;if(percentEleValue==this.decimalSep){percentEleValue=0;}percent=this.userNumberFormatter._parseFloat(percentEleValue);amountText=(this.userNumberFormatter._isNaN(percentEleValue)||isNaN(percent)||percent<0||percent>100)?this.invalidAmountText:percentEleValue.length==0?"0.00":this.formatCurrency(this.oppAmount*percent/100);if(this.userNumberFormatter._isNaN(percentEleValue)||isNaN(percent)||percent<0||percent>100){amountCssClass=errorCssClass;}}var amountEle=document.getElementById(OppSalesTeamRowEdit.SPLIT_AMOUNT_LABEL+rowNum);amountEle.innerHTML=amountText;amountEle.className=amountCssClass;};OpportunitySalesTeamEditPage.prototype.formatPct=function(rowNum){var percentEle=document.getElementById(OppSalesTeamRowEdit.SPLIT_PERCENTAGE_LABEL+rowNum);var percentValue=percentEle.value;if(this.userNumberFormatter._isNaN(percentValue)){this.updateAmt(rowNum);return;}if(percentValue==this.decimalSep||percentValue==""){percentValue=0;}if(!isNaN(percentValue)||percentValue.indexOf(this.decimalSep)>=0){percentEle.value=this.formatNumber(this.userNumberFormatter._parseFloat(percentValue));}this.updateAmt(rowNum);};OpportunitySalesTeamEditPage.prototype.onSave=function(){if(this.isDeletingAllExisting()&&!confirm(LC.getLabel("OpportunitySplit","deleteAllConfirm"))){return false;}return true;};OpportunitySalesTeamEditPage.prototype.isDeletingAllExisting=function(){var hadExisting=false;for(var i=0;i<this.currentRow;i++){var rowType=document.getElementById(OppSalesTeamRowEdit.ROW_TYPE_LABEL+i).value;if(rowType==SalesTeamRowTypeEnum.EXISTING_DELETED){hadExisting=true;}if(rowType==SalesTeamRowTypeEnum.EXISTING||(rowType==SalesTeamRowTypeEnum.NEW&&document.getElementById(OppSalesTeamRowEdit.USER_LOOKUP_ID_LABEL+i).value.length>0)){return false;}}return hadExisting;};OpportunitySalesTeamEditPage.prototype.formatNumber=function(pctStr){if(pctStr==null||pctStr==""||pctStr==this.decimalSep){return this.userNumberFormatter.formatNumber(0);}return this.userNumberFormatter.formatNumber(pctStr);};OpportunitySalesTeamEditPage.prototype.formatCurrency=function(pctStr){if(pctStr==null||pctStr==""||pctStr==this.decimalSep){return this.currencyNumberFormatter.formatCurrency(0);}if(!isNaN(pctStr)){return this.currencyNumberFormatter.formatCurrency(pctStr);}return pctStr;};
function PrintableListPage(){}PrintableListPage.prototype=new ListPage();
InlineEditField.CompoundField=function(){this.compound=true;this.overlay=null;this.width=0;this.editElements=[];this.elementToFocus=null;};InlineEditField.CompoundField.prototype=new InlineEditField();InlineEditField.CompoundField.prototype.openField=function(){if(!this.created){this.createEditDiv();}this.showEdit();};InlineEditField.CompoundField.prototype.createEditDiv=function(){var title=this.getFieldLabel();this.overlay=InlineEditField.overlay;this.editDiv=document.createElement("div");this.editDiv.className="inlineEditCompoundDiv";this.editDiv.id=this.id+InlineEditConstants.INNER_ID+"edit";this.overlay.addField(this.id,this.editDiv,title);this.createEditElements();this.createUndoButton();this.created=true;};InlineEditField.CompoundField.prototype.reset=function(){this.currentValue=this.initialValue;delStyleClass(this.readDiv,"inlineEditModified");this.changed=false;this.undoButton.style.display="none";this.editDiv.appendChild(this.undoButton);this.readDiv.innerHTML=this.initialHTML;if(sfdcPage.inlineEditData.isCurrentField(this)){this.hideEdit();sfdcPage.inlineEditData.currentField=null;}this.clearError();this.updateEditElement();};InlineEditField.CompoundField.prototype.showEdit=function(){this.overlay.setActiveField(this.id);this.overlay.setMaxWidth(this.width);this.updateEditElement();this.overlay.show();if(this.elementToFocus){this.elementToFocus.focus();if(this.elementToFocus.type=="text"){this.elementToFocus.select();}}};InlineEditField.CompoundField.prototype.hideEdit=function(){this.overlay.hide();if(this.changed){if(this.undoButton.parentNode!=this.readDiv){this.readDiv.appendChild(this.undoButton);}this.undoButton.style.display="inline";}else{this.undoButton.style.display="none";}};InlineEditField.CompoundField.prototype.closeField=function(){var newValue=this.getValueFromEdit();if(this.isDifferentValue(newValue)){if(!this.changed){this.changed=true;addStyleClass(this.readDiv,"inlineEditModified");}this.currentValue=newValue;this.updateReadElement();}this.hideEdit();};InlineEditField.CompoundField.prototype.updateReadElement=function(){this.readDiv.innerHTML=this.formatValue();};InlineEditField.CompoundField.prototype.formatValue=function(){};function PersonNameField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.hasSalutation=extraData.hasSalutation;this.salutationPid=extraData.picklistId;this.reverse=extraData.reverse;this.labels=extraData.labels;this.waitForLoad=true;this.initialIndex=0;this.currentIndex=0;this.width=360;}PersonNameField.S=ColumnTypeConstants.PERSONNAME_SALUTATION_OFFSET;PersonNameField.F=ColumnTypeConstants.PERSONNAME_FIRSTNAME_OFFSET;PersonNameField.L=ColumnTypeConstants.PERSONNAME_LASTNAME_OFFSET;PersonNameField.prototype=new InlineEditField.CompoundField();PersonNameField.prototype.getComponentId=function(which){var prefix;switch(which){case PersonNameField.S:prefix=EditElement.FIELD_NAME_SALUTATION;break;case PersonNameField.F:prefix=EditElement.FIELD_NAME_FIRST;break;case PersonNameField.L:prefix=EditElement.FIELD_NAME_LAST;break;}return prefix+this.id;};PersonNameField.prototype.createEditElements=function(){var html=[];html.push("<table border=0>");if(this.reverse){this.createLastNameElement(html);this.createFirstNameElement(html);}else{this.createFirstNameElement(html);this.createLastNameElement(html);}html.push("</table>");this.editDiv.innerHTML=html.join("");this.editElements[PersonNameField.F]=getElementByIdCS(this.getComponentId(PersonNameField.F));this.editElements[PersonNameField.L]=getElementByIdCS(this.getComponentId(PersonNameField.L));if(this.hasSalutation){var salId=this.getComponentId(PersonNameField.S);var att=' id="'+salId+'" title="'+this.labels[PersonNameField.S]+'"';var p=new picklist(salId,this.salutationPid,null,this.initialValue[PersonNameField.S],att,true,true);p.onLoad();this.editElements[PersonNameField.S]=getElementByIdCS(salId);this.initialIndex=this.editElements[PersonNameField.S].selectedIndex;this.currentIndex=this.initialIndex;}this.elementToFocus=this.editElements[PersonNameField.L];};PersonNameField.prototype.createFirstNameElement=function(html){html.push("<tr><td class='labelCol'><label for='");html.push(this.getComponentId(PersonNameField.F));html.push("'>");html.push(this.labels[PersonNameField.F]);html.push("</label></td><td>");if(this.hasSalutation&&!this.reverse){this.createSalutationElement(html);}html.push("<input type='text' id='");html.push(this.getComponentId(PersonNameField.F));html.push("' value=\"");html.push(this.cleanValue(this.currentValue[PersonNameField.F]));html.push("\" size='12' maxLength='");html.push(ColumnTypeConstants.DEFAULT_FIRSTNAME_LENGTH);html.push("'>");if(this.hasSalutation&&this.reverse){this.createSalutationElement(html);}html.push("</td></tr>");};PersonNameField.prototype.createSalutationElement=function(html){html.push("<span><select id='");html.push(this.getComponentId(PersonNameField.S));html.push("' title='");html.push(this.labels[PersonNameField.S]);html.push("'><option selected value=\"");html.push(this.cleanValue(this.currentValue[PersonNameField.S][1]));html.push('">');html.push(this.cleanValue(this.currentValue[PersonNameField.S][0]));html.push("</select></span>");};PersonNameField.prototype.createLastNameElement=function(html){html.push("<tr><td class='labelCol'><label for='");html.push(this.getComponentId(PersonNameField.L));html.push("'>");html.push(this.labels[PersonNameField.L]);html.push("</label></td><td>");html.push("<span class='inlineEditRequiredMark'>*</span><input type='text' id='");html.push(this.getComponentId(PersonNameField.L));html.push("' value=\"");html.push(this.cleanValue(this.currentValue[PersonNameField.L]));html.push("\" size='20' maxLength='");html.push(ColumnTypeConstants.DEFAULT_LASTNAME_LENGTH);html.push("'>");html.push("</td></tr>");};PersonNameField.prototype.formatValue=function(){var str=this.currentValue;var value;if(this.reverse){value=str[PersonNameField.L]+" "+str[PersonNameField.F];}else{value=this.hasSalutation&&str[PersonNameField.S][0]!=LC.getLabel("SelectElement","Required")?str[PersonNameField.S][0]+" ":"";value+=str[PersonNameField.F]+" "+str[PersonNameField.L];}return this.cleanValue(value);};PersonNameField.prototype.isDifferentValue=function(newValue){return this.currentValue[PersonNameField.L]!=newValue[PersonNameField.L]||this.currentValue[PersonNameField.F]!=newValue[PersonNameField.F]||(this.hasSalutation&&this.currentValue[PersonNameField.S][1]!=newValue[PersonNameField.S][1]);};PersonNameField.prototype.getValueFromEdit=function(){if(this.hasSalutation){this.currentIndex=this.editElements[PersonNameField.S].selectedIndex;var sel=this.editElements[PersonNameField.S].options[this.currentIndex];return[[sel.text,sel.value],this.editElements[PersonNameField.F].value,this.editElements[PersonNameField.L].value];}else{return[null,this.editElements[PersonNameField.F].value,this.editElements[PersonNameField.L].value];}};PersonNameField.prototype.updateEditElementImpl=function(){this.currentIndex=this.initialIndex;if(this.hasSalutation){this.editElements[PersonNameField.S].selectedIndex=this.currentIndex;}this.editElements[PersonNameField.F].value=this.cleanValue(this.currentValue[PersonNameField.F]);this.editElements[PersonNameField.L].value=this.cleanValue(this.currentValue[PersonNameField.L]);};PersonNameField.prototype.addSaveData=function(saveData){if(this.hasSalutation){saveData[this.getComponentId(PersonNameField.S)]=this.currentValue[PersonNameField.S][1];}saveData[this.getComponentId(PersonNameField.F)]=this.currentValue[PersonNameField.F];saveData[this.getComponentId(PersonNameField.L)]=this.currentValue[PersonNameField.L];};function AddressField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.showState=extraData.showState||this.currentValue[AddressField.STATE];this.labels=extraData.labels;this.width=400;}AddressField.STREET=ColumnTypeConstants.ADDRESS_STREET_OFFSET;AddressField.CITY=ColumnTypeConstants.ADDRESS_CITY_OFFSET;AddressField.STATE=ColumnTypeConstants.ADDRESS_STATE_OFFSET;AddressField.ZIP=ColumnTypeConstants.ADDRESS_POSTAL_CODE_OFFSET;AddressField.COUNTRY=ColumnTypeConstants.ADDRESS_COUNTRY_OFFSET;AddressField.prototype=new InlineEditField.CompoundField();AddressField.prototype.getComponentId=function(which){var suffix;switch(which){case AddressField.STREET:suffix=EditElement.FIELD_NAME_STREET;break;case AddressField.CITY:suffix=EditElement.FIELD_NAME_CITY;break;case AddressField.STATE:suffix=EditElement.FIELD_NAME_STATE;break;case AddressField.ZIP:suffix=EditElement.FIELD_NAME_ZIP;break;case AddressField.COUNTRY:suffix=EditElement.FIELD_NAME_COUNTRY;break;}return this.id+suffix;};AddressField.prototype.getMaxLengthOfComponent=function(which){switch(which){case AddressField.STREET:return ColumnTypeConstants.DEFAULT_STREET_LENGTH;case AddressField.CITY:return ColumnTypeConstants.DEFAULT_CITY_LENGTH;case AddressField.STATE:return ColumnTypeConstants.DEFAULT_STATE_LENGTH;case AddressField.ZIP:return ColumnTypeConstants.DEFAULT_ZIP_LENGTH;case AddressField.COUNTRY:return ColumnTypeConstants.DEFAULT_COUNTRY_LENGTH;}return 255;};AddressField.prototype.createEditElements=function(){var html=[];html.push("<table border=0>");if(UserContext.locale.indexOf("ja")==0||UserContext.locale.indexOf("zh")==0||UserContext.locale.indexOf("ko")==0){this.createInputElement(html,AddressField.COUNTRY);this.createInputElement(html,AddressField.ZIP);if(this.showState){this.createInputElement(html,AddressField.STATE);}this.createInputElement(html,AddressField.CITY);this.createStreetElement(html);}else{if(UserContext.locale.indexOf("de")==0){this.createStreetElement(html);this.createInputElement(html,AddressField.ZIP);this.createInputElement(html,AddressField.CITY);if(this.showState){this.createInputElement(html,AddressField.STATE);}this.createInputElement(html,AddressField.COUNTRY);}else{if(UserContext.locale.indexOf("CH")!=-1){this.createStreetElement(html);this.createInputElement(html,AddressField.CITY);this.createInputElement(html,AddressField.COUNTRY);if(this.showState){this.createInputElement(html,AddressField.STATE);}this.createInputElement(html,AddressField.ZIP);}else{this.createStreetElement(html);this.createInputElement(html,AddressField.CITY);if(this.showState){this.createInputElement(html,AddressField.STATE);}this.createInputElement(html,AddressField.ZIP);this.createInputElement(html,AddressField.COUNTRY);}}}html.push("</table>");this.editDiv.innerHTML=html.join("");var key=null;if(this.showState){key=this.getComponentId(AddressField.STATE);this.editElements[key]=getElementByIdCS(key);}key=this.getComponentId(AddressField.CITY);this.editElements[key]=getElementByIdCS(key);key=this.getComponentId(AddressField.ZIP);this.editElements[key]=getElementByIdCS(key);key=this.getComponentId(AddressField.COUNTRY);this.editElements[key]=getElementByIdCS(key);key=this.getComponentId(AddressField.STREET);this.editElements[key]=getElementByIdCS(key);this.elementToFocus=this.editElements[key];};AddressField.prototype.createStreetElement=function(html){html.push("<tr><td class='labelCol'><label for='");html.push(this.getComponentId(AddressField.STREET));html.push("'>");html.push(this.labels[AddressField.STREET]);html.push("</label></td><td>");html.push("<textarea wrap='soft' type='text' id='");html.push(this.getComponentId(AddressField.STREET));html.push("' rows='");html.push(EditElement.STREET_NUM_ROWS);html.push("' cols='");html.push(EditElement.STREET_NUM_COLS);html.push("' maxlength='");html.push(this.getMaxLengthOfComponent(AddressField.STREET));html.push("'>");html.push(this.cleanValueNoBR(this.currentValue[AddressField.STREET]));html.push("</textarea>");html.push("</td></tr>");};AddressField.prototype.createInputElement=function(html,which){html.push("<tr><td class='labelCol'><label for='");html.push(this.getComponentId(which));html.push("'>");html.push(this.labels[which]);html.push("</label></td><td>");html.push("<input type='text' id='");html.push(this.getComponentId(which));html.push("' value=\"");html.push(this.cleanValue(this.currentValue[which]));html.push("\" size='20' maxLength='");html.push(this.getMaxLengthOfComponent(which));html.push("'>");html.push("</td></tr>");};AddressField.prototype.formatValue=function(){var add=[];if(UserContext.locale.indexOf("ja")==0||UserContext.locale.indexOf("zh")==0||UserContext.locale.indexOf("ko")==0){if(this.cleanValue(this.currentValue[AddressField.COUNTRY])!=""){add.push(this.cleanValue(this.currentValue[AddressField.COUNTRY]));add.push("<br>");}if(this.cleanValue(this.currentValue[AddressField.ZIP])!=""){add.push(this.cleanValue(this.currentValue[AddressField.ZIP]));add.push("&nbsp;");}if(this.showState&&this.cleanValue(this.currentValue[AddressField.STATE])!=""){add.push(this.cleanValue(this.currentValue[AddressField.STATE]));add.push("&nbsp;");}add.push(this.cleanValue(this.currentValue[AddressField.CITY]));add.push("<br>");add.push(this.cleanValue(this.currentValue[AddressField.STREET]));}else{if(this.cleanValue(this.currentValue[AddressField.STATE])==""&&(UserContext.locale.indexOf("sv")==0||UserContext.locale.indexOf("da")==0||UserContext.locale.indexOf("fi")==0||UserContext.locale.indexOf("no")==0)){add.push(this.cleanValueNoBR(this.currentValue[AddressField.STREET]));add.push("<br>");add.push(this.cleanValue(this.currentValue[AddressField.ZIP]));if(this.cleanValue(this.currentValue[AddressField.ZIP])!=""&&this.cleanValue(this.currentValue[AddressField.CITY])!=""){add.push("&nbsp;");}add.push(this.cleanValue(this.currentValue[AddressField.CITY]));if(this.cleanValue(this.currentValue[AddressField.COUNTRY])!=""){add.push("<br>");add.push(this.cleanValue(this.currentValue[AddressField.COUNTRY]));}}else{if(UserContext.locale.indexOf("de")==0){add.push(this.cleanValue(this.currentValue[AddressField.STREET]));add.push("<br>");add.push(this.cleanValue(this.currentValue[AddressField.ZIP]));if(this.cleanValue(this.currentValue[AddressField.ZIP])!=""&&this.cleanValue(this.currentValue[AddressField.CITY])!=""){add.push("&nbsp;");}add.push(this.cleanValue(this.currentValue[AddressField.CITY]));if(this.cleanValue(this.currentValue[AddressField.COUNTRY])!=""||this.cleanValue(this.currentValue[AddressField.STATE])!=""){add.push("<br>");if(this.showState&&this.cleanValue(this.currentValue[AddressField.STATE])!=""){add.push(this.cleanValue(this.currentValue[AddressField.STATE]));add.push("&nbsp;");}add.push(this.cleanValue(this.currentValue[AddressField.COUNTRY]));}}else{if(UserContext.locale.indexOf("CH")!=-1){add.push(this.cleanValue(this.currentValue[AddressField.STREET]));if(this.cleanValue(this.currentValue[AddressField.STREET])!=""&&this.cleanValue(this.currentValue[AddressField.CITY])!=""){add.push("<br>");}add.push(this.cleanValue(this.currentValue[AddressField.CITY]));if(this.cleanValue(this.currentValue[AddressField.COUNTRY])!=""||this.cleanValue(this.currentValue[AddressField.STATE])!=""||this.cleanValue(this.currentValue[AddressField.ZIP])!=""){add.push("<br>");if(this.cleanValue(this.currentValue[AddressField.COUNTRY])!=""){add.push(this.cleanValue(this.currentValue[AddressField.COUNTRY]));add.push("&nbsp;-&nbsp;");}if(this.cleanValue(this.currentValue[AddressField.STATE])!=""&&this.showState){add.push(this.cleanValue(this.currentValue[AddressField.STATE]));add.push("&nbsp;");}add.push(this.cleanValue(this.currentValue[AddressField.ZIP]));}}else{add.push(this.cleanValue(this.currentValue[AddressField.STREET]));add.push("<br>");add.push(this.cleanValue(this.currentValue[AddressField.CITY]));if(this.cleanValue(this.currentValue[AddressField.CITY])!=""&&(this.cleanValue(this.currentValue[AddressField.STATE])!=""||this.cleanValue(this.currentValue[AddressField.ZIP])!=""||this.cleanValue(this.currentValue[AddressField.COUNTRY])!="")){add.push(",&nbsp;");}if(this.showState&&this.cleanValue(this.currentValue[AddressField.STATE])!=""){add.push(this.cleanValue(this.currentValue[AddressField.STATE]));add.push("&nbsp;");}add.push(this.cleanValue(this.currentValue[AddressField.ZIP]));if(this.cleanValue(this.currentValue[AddressField.COUNTRY])!=""){add.push("<br>");add.push(this.cleanValue(this.currentValue[AddressField.COUNTRY]));}}}}}return add.join("");};AddressField.prototype.isDifferentValue=function(newValue){return this.currentValue[AddressField.STREET]!=newValue[AddressField.STREET]||this.currentValue[AddressField.CITY]!=newValue[AddressField.CITY]||this.currentValue[AddressField.ZIP]!=newValue[AddressField.ZIP]||this.currentValue[AddressField.COUNTRY]!=newValue[AddressField.COUNTRY]||(this.showState&&this.currentValue[AddressField.STATE]!=newValue[AddressField.STATE]);};AddressField.prototype.getValueFromEdit=function(){var newValue=[];if(this.showState){newValue[AddressField.STATE]=this.editElements[this.getComponentId(AddressField.STATE)].value;}newValue[AddressField.STREET]=this.editElements[this.getComponentId(AddressField.STREET)].value;newValue[AddressField.CITY]=this.editElements[this.getComponentId(AddressField.CITY)].value;newValue[AddressField.ZIP]=this.editElements[this.getComponentId(AddressField.ZIP)].value;newValue[AddressField.COUNTRY]=this.editElements[this.getComponentId(AddressField.COUNTRY)].value;return newValue;};AddressField.prototype.updateEditElementImpl=function(){if(this.showState){this.editElements[this.getComponentId(AddressField.STATE)].value=this.cleanValueNoBR(this.currentValue[AddressField.STATE]);}this.editElements[this.getComponentId(AddressField.STREET)].value=this.cleanValueNoBR(this.currentValue[AddressField.STREET]);this.editElements[this.getComponentId(AddressField.CITY)].value=this.cleanValueNoBR(this.currentValue[AddressField.CITY]);this.editElements[this.getComponentId(AddressField.ZIP)].value=this.cleanValueNoBR(this.currentValue[AddressField.ZIP]);this.editElements[this.getComponentId(AddressField.COUNTRY)].value=this.cleanValueNoBR(this.currentValue[AddressField.COUNTRY]);};AddressField.prototype.addSaveData=function(saveData){if(this.showState){saveData[this.getComponentId(AddressField.STATE)]=this.currentValue[AddressField.STATE];}saveData[this.getComponentId(AddressField.STREET)]=this.currentValue[AddressField.STREET];saveData[this.getComponentId(AddressField.CITY)]=this.currentValue[AddressField.CITY];saveData[this.getComponentId(AddressField.ZIP)]=this.currentValue[AddressField.ZIP];saveData[this.getComponentId(AddressField.COUNTRY)]=this.currentValue[AddressField.COUNTRY];};function MultiEnumField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.width=400;this.picklistId=extraData.picklistId;this.controllerId=extraData.controller;this.controllerLabel=extraData.controllerLabel;this.height=extraData.height;this.waitForLoad=true;this.initialSelections=[];}MultiEnumField.H=0;MultiEnumField.U=1;MultiEnumField.S=2;MultiEnumField.prototype=new InlineEditField.CompoundField();MultiEnumField.prototype.getComponentId=function(which){var suffix;switch(which){case MultiEnumField.H:suffix="";break;case MultiEnumField.U:suffix=EditElement.UNSELECTED_ID_SUFFIX;break;case MultiEnumField.S:suffix=EditElement.SELECTED_ID_SUFFIX;break;}return this.id+suffix;};MultiEnumField.prototype.createEditElements=function(){var attributes=[];attributes.push(" style='display: none;' size='");attributes.push(this.height);attributes.push("' multiple='multiple' id='");attributes.push(this.getComponentId(MultiEnumField.H));attributes.push("'");attributes=attributes.join("");var html=[];html.push("<span><select");html.push(attributes);html.push("></select></span><table border='0' cellspacing='0' cellpadding='0' class='multiSelectPicklistTable'><tr class='multiSelectPicklistRow'>");html.push("<td><span><select multiple='multiple' id='");html.push(this.getComponentId(MultiEnumField.U));html.push("' size='");html.push(this.height);html.push("'></select></span></td><td class='multiSelectPicklistCell'>");html.push("<img onclick='MultiSelectPicklist.handleMSPSelect(\"");html.push(this.getComponentId(MultiEnumField.H));html.push("\");' class='picklistArrowRight' src='"+UserContext.getUrl("/s.gif")+"'><br><br><img onclick='MultiSelectPicklist.handleMSPUnSelect(\"");html.push(this.getComponentId(MultiEnumField.H));html.push("\");' class='picklistArrowLeft' src='"+UserContext.getUrl("/s.gif")+"'></td><td>");html.push("<span><select multiple='multiple' id='");html.push(this.getComponentId(MultiEnumField.S));html.push("' size='");html.push(this.height);html.push("'></select></span></td>");if(this.controllerId){html.push("<td><div onmouseover='addMouseOver(this)' class='mouseOverInfoOuter'><img class='infoIcon' src='"+UserContext.getUrl("/s.gif")+"'><div style='display: none;' class='mouseOverInfo'>");html.push(LC.getLabel("DependentElement","dependsOn",this.controllerLabel));html.push("</div></div></td>");}html.push("</tr></table>");this.editDiv.innerHTML=html.join("");new multiPicklist(this.getComponentId(MultiEnumField.H),this.picklistId,this.controllerId,Util.convertOptionsForPicklistData(this.initialValue),attributes,this.getFieldLabel(),this.height,!this.required,false,-1);MultiSelectPicklist.loadMSP(this.id);if(!this.group){this.load();}};MultiEnumField.prototype.retrieveFields=function(){this.editElements[MultiEnumField.H]=getElementByIdCS(this.getComponentId(MultiEnumField.H));this.editElements[MultiEnumField.U]=getElementByIdCS(this.getComponentId(MultiEnumField.U));this.editElements[MultiEnumField.S]=getElementByIdCS(this.getComponentId(MultiEnumField.S));};MultiEnumField.prototype.load=function(){picklist.picklists[this.getComponentId(MultiEnumField.H)].onLoad();this.retrieveFields();var all=this.editElements[MultiEnumField.H].options;for(var i=0;i<all.length;i++){this.initialSelections[i]=all[i].selected;}};MultiEnumField.prototype.showEdit=function(){this.retrieveFields();this.overlay.setActiveField(this.id);this.overlay.show();MultiSelectPicklist.resizeMSP(this.editElements[MultiEnumField.S],this.editElements[MultiEnumField.U]);this.width=this.editDiv.childNodes[1].offsetWidth+50;this.overlay.setMaxWidth(this.width);this.overlay.position();};MultiEnumField.prototype.formatValue=function(){var str=[];for(var i=0;i<this.currentValue.length;i++){str.push(this.cleanValue(this.currentValue[i][0]));if(i+1!=this.currentValue.length){str.push("; ");}}if(str.length==0){return this.getDeletedValue();}return str.join("");};MultiEnumField.prototype.isDifferentValue=function(newValue){if(newValue.length!=this.initialValue.length){return true;}for(var i=0;i<this.initialValue.length;i++){if(newValue[i][0]!=this.initialValue[i][0]||newValue[i][1]!=this.initialValue[i][1]){return true;}}return false;};MultiEnumField.prototype.getValueFromEdit=function(){this.retrieveFields();var newValue=[];var all=this.editElements[MultiEnumField.H].options;for(var i=0;i<all.length;i++){if(all[i].selected){newValue.push([all[i].text,all[i].value]);}}return newValue;};MultiEnumField.prototype.updateEditElementImpl=function(){this.retrieveFields();var options=this.editElements[MultiEnumField.H].options;for(var i=0;i<options.length;i++){options[i].selected=this.initialSelections[i];}if(this.editElements[MultiEnumField.H].onchange){this.editElements[MultiEnumField.H].onchange();}};MultiEnumField.prototype.addSaveData=function(saveData){var values=[];if(!this.created&&this.required&&this.controllerId&&!this.initialValue){values.push(picklistNAMarker);}else{var vals=this.created?this.getValueFromEdit():this.currentValue;for(var i=0;i<vals.length;i++){values.push(vals[i][1]);}}saveData[this.id]=values;};function MultiLineTextField(id,state,required,isColumn,initialValue,extraData){if(extraData.isHtml){state=InlineEditState.NONE;}this.init(id,state,required,isColumn,initialValue);this.maxLength=extraData.maxLength;if(window.ActiveXObject){this.width=380;}else{this.width=500;}}MultiLineTextField.prototype=new InlineEditField.CompoundField();MultiLineTextField.prototype.createEditElements=function(){var html=[];html.push("<textarea type='text' wrap='soft' maxlength='");html.push(this.maxLength);html.push("'");html.push(" rows='6'");html.push(" cols='52'");html.push(" id='");html.push(this.id);html.push("'>");html.push(this.cleanValueNoBR(this.currentValue));html.push("</textarea>");html.push("<div class='textCounterMiddle'>");html.push("<div class='textCounter'");html.push(" id='");html.push(this.id);html.push("_counter'>");html.push("</div>");html.push("</div>");this.editDiv.innerHTML=html.join("");this.editElement=getElementByIdCS(this.id);this.elementToFocus=this.editElement;this.attachCountHandler();};MultiLineTextField.prototype.attachCountHandler=function(){var hid=this.id;var hmaxlength=this.maxLength;var remaining=LC.getLabel("Edit","CharactersRemaining");var over=LC.getLabel("Edit","CharactersOver");var handler=function(){handleTextAreaElementChange(hid,hmaxlength,remaining,over);};var attrs=window.ActiveXObject?["propertychange","focus"]:["keydown","keyup","change","click","mousedown","focus"];for(var i in attrs){addEvent(this.editElement,attrs[i],handler,true);}};MultiLineTextField.prototype.addSaveData=function(saveData){saveData[this.id]=this.currentValue;};MultiLineTextField.prototype.isDifferentValue=function(newValue){return this.initialValue!=newValue;};MultiLineTextField.prototype.getValueFromEdit=function(){return this.editElement.value;};MultiLineTextField.prototype.formatValue=function(){if(this.currentValue===""&&this.initialValue!==""){return this.getDeletedValue();}else{return this.cleanValue(this.currentValue);}};MultiLineTextField.prototype.updateEditElementImpl=function(){this.editElement.value=this.currentValue;};
InlineEditField.SimpleField=function(){this.editElement=null;this.group=null;this.saveOnEnter=true;};InlineEditField.SimpleField.prototype=new InlineEditField();InlineEditField.SimpleField.prototype.addSaveData=function(saveData){saveData[this.id]=this.currentValue;};InlineEditField.SimpleField.prototype.openField=function(){if(!this.created){this.createEditDiv();}this.showEdit();};InlineEditField.SimpleField.prototype.createEditDiv=function(){this.editDiv=document.createElement("div");if(this.required){this.editDiv.className="inlineEditRequiredDiv";}else{this.editDiv.className="inlineEditDiv";}if(this.group){this.editDiv.className=this.editDiv.className+" inlineEditGroup";}this.editDiv.id=this.id+InlineEditConstants.INNER_ID+"edit";if(this.errorDiv){this.tableCell.insertBefore(this.editDiv,this.errorDiv);}else{this.tableCell.appendChild(this.editDiv);}this.createEditElements();if(this.error&&!this.group){this.editElement.className=EditElement.ERROR_CLASS;}if(this.mayUndo()){this.createUndoButton();}if(!this.group){var self=this;addEvent(this.editElement,"keypress",function(e){self.handleKeyPress(e);},true);}this.created=true;};InlineEditField.SimpleField.prototype.handleKeyPress=function(e){e=getEvent(e);var key=e.keyCode;if(key==KEY_ESC){this.reset();eventCancelBubble(e);}else{if(key==KEY_ENTER&&this.saveOnEnter){this.closeField();sfdcPage.inlineEditData.currentField=null;eventCancelBubble(e);setTimeout(function(){sfdcPage.focusOnSave();},10);}}};InlineEditField.SimpleField.prototype.showEdit=function(){if(this.editElement.disabled&&document.selection&&document.selection.empty){document.selection.empty();}this.readDiv.style.display="none";if(this.undoButton){if(this.undoButton.parentNode!=this.editDiv){this.editDiv.appendChild(this.undoButton);}this.undoButton.style.display="inline";}this.editDiv.style.display="block";if(!(this.editElement.disabled||this.editElement.readOnly)){this.editElement.focus();if(this.editElement.type=="text"){this.editElement.select();}}};InlineEditField.SimpleField.prototype.hideEdit=function(){this.editElement.blur();this.editDiv.style.display="none";if(this.changed&&this.undoButton){this.readDiv.appendChild(this.undoButton);}this.readDiv.style.display="block";};InlineEditField.SimpleField.prototype.closeField=function(skipValidation){var newValue=this.getValueFromEdit();this.updateFieldValue(newValue);if(!this.group){this.hideEdit();}};InlineEditField.SimpleField.prototype.updateFieldValue=function(newValue,dontCascade){if(this.isDifferentValue(newValue)){if(!this.changed){this.changed=true;addStyleClass(this.readDiv,"inlineEditModified");}this.currentValue=newValue;if(!dontCascade){this.updateDependents();}this.updateReadElement();}else{if(this.changed){this.reset(true);return;}}};InlineEditField.SimpleField.prototype.isDifferentValue=function(newValue){return this.initialValue!=newValue;};InlineEditField.SimpleField.prototype.reset=function(doCascade){this.currentValue=this.initialValue;if(doCascade){this.updateDependents();}delStyleClass(this.readDiv,"inlineEditModified");this.changed=false;if(this.undoButton){this.undoButton.style.display="none";this.editDiv.appendChild(this.undoButton);}this.readDiv.innerHTML=this.initialHTML;if(sfdcPage.inlineEditData.isCurrentField(this)){this.hideEdit();sfdcPage.inlineEditData.currentField=null;}this.clearError();this.updateEditElement();};InlineEditField.SimpleField.prototype.getValueFromEdit=function(){return this.editElement.value;};InlineEditField.SimpleField.prototype.updateReadElement=function(){this.readDiv.innerHTML=this.formatValue();};InlineEditField.SimpleField.prototype.formatValue=function(){if(this.currentValue===""&&this.initialValue!==""){return this.getDeletedValue();}else{return this.cleanValue(this.currentValue);}};InlineEditField.SimpleField.prototype.updateEditElementImpl=function(){this.editElement.value=this.currentValue;};InlineEditField.SimpleField.prototype.setError=function(message){InlineEditField.prototype.setError.call(this,message);if(this.editElement){addStyleClass(this.editElement,EditElement.ERROR_CLASS);}};InlineEditField.SimpleField.prototype.clearError=function(){InlineEditField.prototype.clearError.call(this);if(this.editElement){delStyleClass(this.editElement,EditElement.ERROR_CLASS);}};function BooleanField(id,state,required,isColumn,initialValue,extraData){if(id){this.init(id,state,required,isColumn,initialValue);this.checkboxImage=getElementByIdCS(this.id+EditElement.CHECKBOX_SUFFIX);this.checkLabel=LC.getLabel("Images","checkbox_checked");this.uncheckLabel=LC.getLabel("Images","checkbox_unchecked");}}BooleanField.prototype=new InlineEditField.SimpleField();BooleanField.prototype.createEditElements=function(){var html=[];html.push("<input type='checkbox' id='");html.push(this.id);html.push("'");if(this.currentValue){html.push(" checked='checked'");}html.push(">");this.editDiv.innerHTML=html.join("");this.editElement=getElementByIdCS(this.id);};BooleanField.prototype.createDummy=function(){var dummy=document.createElement("input");dummy.type="hidden";dummy.id=this.id;dummy.value=this.currentValue?"1":"0";this.tableCell.appendChild(dummy);this.created=true;};BooleanField.prototype.getValueFromEdit=function(){return this.editElement.checked;};BooleanField.prototype.updateReadElement=function(){if(this.currentValue){this.checkboxImage.src=UserContext.getUrl("/img/checkbox_checked.gif");this.checkboxImage.title=this.checkLabel;this.checkboxImage.alt=this.checkLabel;}else{this.checkboxImage.src=UserContext.getUrl("/img/checkbox_unchecked.gif");this.checkboxImage.title=this.uncheckLabel;this.checkboxImage.alt=this.uncheckLabel;}};BooleanField.prototype.formatValue=function(){var html=[];html.push('<img src="');html.push(this.currentValue?UserContext.getUrl("/img/checkbox_checked.gif"):UserContext.getUrl("/img/checkbox_unchecked.gif"));html.push('" width="21" height="16" alt="');html.push(this.currentValue?this.checkLabel:this.uncheckLabel);html.push('" class="checkImg">');return html.join("");};BooleanField.prototype.updateEditElementImpl=function(){this.editElement.checked=this.currentValue;if(this.editElement.onclick){this.editElement.onclick();}};BooleanField.prototype.addSaveData=function(saveData){saveData[this.id]=this.currentValue?"1":"0";};BooleanField.prototype.reset=function(){this.currentValue=this.initialValue;delStyleClass(this.readDiv,"inlineEditModified");this.changed=false;this.updateReadElement();if(!this.group){if(sfdcPage.inlineEditData.isCurrentField(this)){this.hideEdit();sfdcPage.inlineEditData.currentField=null;}}if(this.undoButton){this.undoButton.style.display="none";}this.clearError();this.updateEditElement();};function TextField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);if(extraData.maxLength){this.maxLength=extraData.maxLength;}else{this.maxLength=255;}}TextField.prototype=new InlineEditField.SimpleField();TextField.prototype.createEditElements=function(){var html=[];html.push("<input type='text' id='");html.push(this.id);html.push("' value=\"");html.push(this.cleanValue(this.currentValue));html.push("\" size='20' maxLength='");html.push(this.maxLength);html.push("'>");this.editDiv.innerHTML=html.join("");this.editElement=getElementByIdCS(this.id);};function NumberField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);}NumberField.prototype=new InlineEditField.SimpleField();NumberField.prototype.createEditElements=function(){var html=[];html.push("<input type='text' id='");html.push(this.id);html.push("' value=\"");html.push(this.cleanValue(this.currentValue));html.push('">');this.editDiv.innerHTML=html.join("");this.editElement=getElementByIdCS(this.id);};function DateField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.hasTime=extraData.hasTime;}DateField.prototype=new InlineEditField.SimpleField();DateField.prototype.createEditElements=function(){var html=[];html.push("<input type='text' id='");html.push(this.id);html.push("' value=\"");html.push(this.cleanValue(this.currentValue));html.push('" onFocus="DatePicker.pickDate(true, \'');html.push(this.id);html.push("', ");html.push(this.hasTime);html.push(');">');this.editDiv.innerHTML=html.join("");this.editElement=getElementByIdCS(this.id);};DateField.prototype.hideEdit=function(){InlineEditField.SimpleField.prototype.hideEdit.apply(this);DatePicker.datePicker.hide();};function PhoneField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.formatPhone=extraData.formatPhone;}PhoneField.prototype=new InlineEditField.SimpleField();PhoneField.prototype.createEditElements=function(){var html=[];html.push("<input type='text' id='");html.push(this.id);html.push("' value=\"");html.push(this.cleanValue(this.currentValue));html.push('"');if(this.formatPhone){html.push(" onblur='formatPhone(this);'");html.push(" onkeydown='formatPhoneOnEnter(this, event);'");}html.push(">");this.editDiv.innerHTML=html.join("");this.editElement=getElementByIdCS(this.id);};function ForeignKeyField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.domains=extraData.domain;this.useNewLookups=extraData.useNewLookups;this.lookupEntityPrefix=extraData.lookupEntityPrefix;this.lookupFieldEnumOrId=extraData.lookupFieldEnumOrId;this.mruServletUri=extraData.mruServletUri;this.mruAutoComplete=[];if(typeof extraData.mruAutoComplete!=="undefined"){this.mruAutoComplete=extraData.mruAutoComplete;}this.lookupControllerIds=extraData.controllerIds;this.validationServletURI=extraData.validationServletURI;this.idElement=null;this.oldElement=null;this.domainElement=null;this.initialDomain=0;this.lookupAutoCompleter=null;this.matchBlanks=extraData.matchBlanks;}ForeignKeyField.prototype=new InlineEditField.SimpleField();ForeignKeyField.ID=0;ForeignKeyField.OLD=1;ForeignKeyField.DOMAIN=2;ForeignKeyField.MULTIDOMAIN=3;ForeignKeyField.prototype.getComponentId=function(which){var suffix;switch(which){case ForeignKeyField.ID:suffix=EditElement.pID_SUFFIX;break;case ForeignKeyField.OLD:suffix=EditElement.pOLD_NAME_SUFFIX;break;case ForeignKeyField.DOMAIN:suffix=EditElement.pTYPE_SUFFIX;break;case ForeignKeyField.MULTIDOMAIN:suffix=MultiLookupInputElement.MULTI_LOOKUP_SELECT_SUFFIX;break;}return this.id+suffix;};ForeignKeyField.prototype.createEditElements=function(){var alt=this.cleanValue(this.getFieldLabel()+" "+LC.getLabel("Icons","lookup"));var html=[];html.push("<span class='lookupInput bEditBlock'>");if(this.domains.length>1){var change='getElementByIdCS("'+this.getComponentId(ForeignKeyField.DOMAIN)+'").value=getElementByIdCS("'+this.getComponentId(ForeignKeyField.MULTIDOMAIN)+'").options[getElementByIdCS("'+this.getComponentId(ForeignKeyField.MULTIDOMAIN)+'").selectedIndex].value;getElementByIdCS("'+this.getComponentId(ForeignKeyField.ID)+'").value = "";getElementByIdCS("'+this.id+'").value = "";';html.push(Util.createDynamicSelect({id:this.getComponentId(ForeignKeyField.MULTIDOMAIN),name:this.getComponentId(ForeignKeyField.MULTIDOMAIN),onchange:change},this.domains,false));}html.push("<input type='hidden' id='");html.push(this.getComponentId(ForeignKeyField.ID));html.push("' name='");html.push(this.getComponentId(ForeignKeyField.ID));html.push("' value='");html.push(this.currentValue[1]);html.push("'><input type='hidden' id='");html.push(this.getComponentId(ForeignKeyField.OLD));html.push("' name='");html.push(this.getComponentId(ForeignKeyField.OLD));html.push("' value=\"");html.push(this.cleanValue(this.currentValue[0]));html.push("\"><input type='hidden' id='");html.push(this.getComponentId(ForeignKeyField.DOMAIN));html.push("' name='");html.push(this.getComponentId(ForeignKeyField.DOMAIN));html.push("' value='");html.push(this.domains[0][1]);html.push("'><input type='text' size='20' maxlength='255' id='");html.push(this.id);html.push("' name='");html.push(this.id);html.push("' value=\"");html.push(this.cleanValue(this.currentValue[0]));if(this.mruAutoComplete.length>0){html.push('"\' autocomplete="off"\'');}html.push('">');if(this.dependentIds&&this.dependentIds.length>0){html.push("<img class='closeIcon' alt='"+LC.getLabel("Global","clear")+"' title='"+LC.getLabel("Global","clear")+"' src='/s.gif'>");}html.push("<a href='' id='");html.push(this.id);html.push("Icon' title='");html.push(alt);html.push("'><img onmouseover=\"this.className='lookupIconOn';\" alt='");html.push(alt);html.push("' onmouseout=\"this.className='lookupIcon';\" class='lookupIcon' src='"+UserContext.getUrl("/s.gif")+"'></a>");var mouseOverText=this.getMouseOverInfoText();if(mouseOverText){html.push(MouseOverFade.createMouseOverHtml(mouseOverText));}html.push("</span>");this.editDiv.innerHTML=html.join("");var self=this;var arrEl=getElementsByClassName("closeIcon",this.editDiv,"img");if(arrEl&&arrEl.length==1){self.clearButton=arrEl[0];addEvent(self.clearButton,"mouseover",function(){this.className="closeIconOn";},true);addEvent(self.clearButton,"mouseout",function(){this.className="closeIcon";},true);addEvent(self.clearButton,"focus",function(){this.className="closeIconOn";},true);addEvent(self.clearButton,"blur",function(){this.className="closeIcon";},true);addEvent(self.clearButton,"click",function(){self.updateFieldValue(["",""],true);self.updateEditElement();self.editElement.value=LC.getLabel("Global","click_lookup_icon");self.isEmpty=true;self.updateClearButtonStatus();},true);}var handler=function(e){setLastMousePosition(e);self.openLookup();if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}};addEvent(getElementByIdCS(this.id+"Icon"),"click",handler,false);this.editElement=getElementByIdCS(this.id);this.idElement=getElementByIdCS(this.getComponentId(ForeignKeyField.ID));this.oldElement=getElementByIdCS(this.getComponentId(ForeignKeyField.OLD));if(this.dependentIds&&this.dependentIds.length>0){this.editElement.readOnly=true;if(self.editElement.value==""){this.updateClearButtonStatus();self.editElement.value=LC.getLabel("Global","click_lookup_icon");self.isEmpty=true;}}if(this.domains.length>1){this.domainElement=getElementByIdCS(this.getComponentId(ForeignKeyField.MULTIDOMAIN));for(var i=0;i<this.domains.length;i++){if(this.initialValue[1].indexOf(this.domains[i][1])==0){this.initialDomain=i;break;}}this.domainElement.selectedIndex=this.initialDomain;}if(this.mruAutoComplete.length>0){this.addAutoCompleter();}};ForeignKeyField.prototype.afterLoad=function(){if(sfdcPage.getReferredDomIds){var referredDomIds=sfdcPage.getReferredDomIds(this.id);if(referredDomIds){for(var i=0;i<referredDomIds.length;i++){var field=sfdcPage.getFieldById(referredDomIds[i]);if(field&&field.domains){field.validationServletURI=this.validationServletURI;}}}}};ForeignKeyField.prototype.getMouseOverInfoText=function(){var dependentLabels=this.idsToLabels(this.dependentIds);var controllerLabels=this.idsToLabels(this.lookupControllerIds);var html=[];if(dependentLabels){html.push(LC.getLabel("Global","click_lookup_icon_info"));html.push("<br/>");html.push(escapeHTML(LC.getLabel("DependentElement","controls",dependentLabels.join(", "))));if(controllerLabels){html.push("<br/>");}}if(controllerLabels){html.push(escapeHTML(LC.getLabel("DependentElement","dependsOnMultiple",controllerLabels.join(", "))));}return html.join("");};ForeignKeyField.prototype.idsToLabels=function(idArray){var labels;if(idArray){labels=[];for(var i=0;i<idArray.length;i++){var field=sfdcPage.getFieldById(idArray[i]);if(field){labels.push(field.getFieldLabel());}}}if(labels&&labels.length>0){return labels;}else{return null;}};ForeignKeyField.prototype.addAutoCompleter=function(){var t=this,ac=t.mruAutoComplete,de=t.domainElement,pr,la,se={},params;if(ac.length>1){return;pr=de.options[this.domainElement.selectedIndex].value;for(var i=0;i<ac.length;i++){if(ac[i][1]===prefix){la=ac[i][0];}se[ac[i][1]]=[ac[i][0],ac[i][1],null];}LookupAutoCompleteInputElement.registerSupportedEntities(this.id,se);}else{la=ac[0][0];}params={lknm:this.id,acEntity:la};if(this.lookupEntityPrefix&&this.lookupFieldEnumOrId){params.aclkent=this.lookupEntityPrefix;params.aclkfield=this.lookupFieldEnumOrId;}this.lookupAutoCompleter=new LookupAutoCompleteInputElement(this.id,this.mruServletUri,1,params,this.matchBlanks,this.lookupControllerIds?this.id:null,false);var self=this;var cb=function(e){self.closeOnTab(e);};this.lookupAutoCompleter.addOnAfterTabDownListener(cb);};InlineEditField.SimpleField.prototype.closeOnTab=function(e){this.closeField();sfdcPage.inlineEditData.currentField=null;InlineEditField.SimpleField.captureEvent(e);};InlineEditField.SimpleField.captureEvent=function(event){if(XBrowser.userAgent.isIE){event.returnValue=false;event.cancelBubble=false;}else{event.preventDefault();event.stopPropagation();}};ForeignKeyField.prototype.closeField=function(skipValidation){if(this.lookupAutoCompleter){this.lookupAutoCompleter.clearSuggestions();}InlineEditField.SimpleField.prototype.closeField.call(this,skipValidation);this.clearError();if(this.validationServletURI&&this.currentValue[0]&&!skipValidation){this.performValidation();}};ForeignKeyField.prototype.performValidation=function(){var qs=new QueryString();qs.add(LookupValidationServlet.pLKENTITY_NAME,this.lookupEntityPrefix);qs.add(LookupValidationServlet.pLKFIELD_NAME,this.lookupFieldEnumOrId);var domain;if(this.domains.length>1){domain=this.domainElement.options[this.domainElement.selectedIndex].value;}else{domain=this.domains[0][1];}qs.add(LookupValidationServlet.pENTITY_NAME,domain);qs.add(LookupUi.pSEARCH_VALUE,this.currentValue[0]);if(sfdcPage.getReferredDomIds){var referredDomIds=sfdcPage.getReferredDomIds(this.id);if(referredDomIds){qs.add(LookupValidationServlet.pDEPDATA_NAME,dpdLkUtil.serialize(referredDomIds));}}qs.add(EditElement.pBASE_NAME,this.id);var self=this;var url=this.validationServletURI+qs.toString();XBrowser.getHttpResponse(url,function(request){var resp=request.responseText;if(resp){var tmpResp=Util.evalAjaxServletOutput(resp);if(tmpResp&&tmpResp[LookupValidationServlet.pFILTER_RESULTS]){self.applyValidationChanges(tmpResp[LookupValidationServlet.pFILTER_RESULTS]);}}});return true;};ForeignKeyField.prototype.reset=function(doCascade){InlineEditField.SimpleField.prototype.reset.apply(this,arguments);if(this.initialValue[0]==""){this.editElement.value=LC.getLabel("Global","click_lookup_icon");this.isEmpty=true;this.updateClearButtonStatus();}else{if(this.initialValue[0]!=""&&this.isEmpty){this.isEmpty=false;this.updateClearButtonStatus();}}};ForeignKeyField.prototype.lookupPickCalled=function(newValue,dontCascade){this.isEmpty=false;this.updateClearButtonStatus();};ForeignKeyField.prototype.updateClearButtonStatus=function(){if(this.clearButton){if(this.editElement.value!=""&&!this.isEmpty){this.clearButton.style.display="inline-block";delStyleClass(this.editElement,"emptyDependentLookup");}else{this.clearButton.style.display="none";addStyleClass(this.editElement,"emptyDependentLookup");}}};ForeignKeyField.prototype.updateFieldValue=function(newValue,dontCascade){var modNewValue=newValue;if(newValue[0]===""||this.isEmpty){modNewValue=["",Udd.EMPTY_KEY];}InlineEditField.SimpleField.prototype.updateFieldValue.call(this,modNewValue,dontCascade);};ForeignKeyField.prototype.applyValidationChanges=function(obj){if(obj.error){this.setError(obj.error);}else{this.clearError();}};ForeignKeyField.prototype.openLookup=function(){var mod="1";var domain;if(this.domains.length>1){domain=this.domainElement.options[this.domainElement.selectedIndex].value;}else{domain=this.domains[0][1];}var lookupSource="";if(this.lookupEntityPrefix){lookupSource="&lkent="+this.lookupEntityPrefix+"&lkfield="+this.lookupFieldEnumOrId;}if(sfdcPage.getReferredDomIds){var referredDomIds=sfdcPage.getReferredDomIds(this.id);if(referredDomIds){lookupSource+="&dplp="+dpdLkUtil.serialize(referredDomIds);}}if(sfdcPage.getEnhancedLookupParams){lookupSource+=sfdcPage.getEnhancedLookupParams(this.id);}var searchStr;if(this.isEmpty){searchStr="";}else{searchStr=escapeUTF(this.editElement.value);}if(this.useNewLookups){if(!window.lookupElement){window.lookupElement=new LookupElement();}window.lookupElement.openLookup(UserContext.getUrl("/_ui/common/data/LookupPage?lknm=")+this.id+"&lktp="+domain+lookupSource,670,mod,"&lksrch="+searchStr);}else{openLookup(UserContext.getUrl("/_ui/common/data/LookupPage?lknm=")+this.id+"&lktp="+domain+lookupSource,670,mod,"&lksrch="+searchStr);}};ForeignKeyField.prototype.getValueFromEdit=function(){return[this.editElement.value,this.idElement.value];};ForeignKeyField.prototype.isDifferentValue=function(newValue){return this.initialValue[0]!=newValue[0]||this.initialValue[1]!=newValue[1];};ForeignKeyField.prototype.formatValue=function(){if(this.currentValue[0]===""&&this.initialValue[1]!==Udd.EMPTY_KEY){return this.getDeletedValue();}else{return this.cleanValue(this.currentValue[0]);}};ForeignKeyField.prototype.updateEditElementImpl=function(){if(this.domains.length>1){this.domainElement.selectedIndex=this.initialDomain;}this.editElement.value=this.currentValue[0];this.oldElement.value=this.currentValue[0];this.idElement.value=this.currentValue[1];};ForeignKeyField.prototype.addSaveData=function(saveData){saveData[this.id]=this.currentValue[0];saveData[this.getComponentId(ForeignKeyField.ID)]=this.currentValue[1];if(this.created){saveData[this.getComponentId(ForeignKeyField.OLD)]=this.oldElement.value;if(this.isDifferentValue(this.getValueFromEdit())){saveData[this.id+EditElement.pMOD_SUFFIX]=1;}}else{saveData[this.getComponentId(ForeignKeyField.OLD)]=this.currentValue[0];}};function StaticEnumField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.picklistData=extraData.picklistData.slice();this.initialIndex=-1;this.currentIndex=-1;this.showNone=!required;for(var i=0;i<this.picklistData.length;i++){if(this.picklistData[i][0]==this.initialValue){this.initialIndex=i;this.currentIndex=i;break;}}if(this.initialIndex==-1){this.showNone=true;}if(this.showNone){this.picklistData.unshift([LC.getLabel("SelectElement","Required"),""]);this.initialIndex++;this.currentIndex++;}}StaticEnumField.prototype=new InlineEditField.SimpleField();StaticEnumField.prototype.createEditElements=function(){this.editDiv.innerHTML=Util.createDynamicSelect({id:this.id},this.picklistData,false);this.editElement=getElementByIdCS(this.id);this.editElement.selectedIndex=this.initialIndex;};StaticEnumField.prototype.getValueFromEdit=function(){this.currentIndex=this.editElement.selectedIndex;return this.currentIndex;};StaticEnumField.prototype.formatValue=function(){var text=this.editElement.options[this.currentIndex].text;if(text==LC.getLabel("SelectElement","Required")){return this.getDeletedValue();}else{return this.cleanValue(text);}};StaticEnumField.prototype.isDifferentValue=function(newValue){return this.initialIndex!=newValue;};StaticEnumField.prototype.updateEditElementImpl=function(){this.currentIndex=this.initialIndex;this.editElement.selectedIndex=this.currentIndex;};StaticEnumField.prototype.addSaveData=function(saveData){if(this.created){saveData[this.id]=this.editElement.options[this.currentIndex].value;}else{saveData[this.id]=this.picklistData[this.currentIndex][1];}};function DynamicEnumField(id,state,required,isColumn,initialValue,extraData){if(id){this.init(id,state,required,isColumn,initialValue);this.initialValue=[initialValue[0],initialValue[1]];this.currentValue=this.initialValue;this.filterValue=initialValue[2];this.picklistId=extraData.picklistId;this.controllerId=extraData.controller;this.controllerLabel=extraData.controllerLabel;this.waitForLoad=true;this.initialIndex=0;this.currentIndex=0;}}DynamicEnumField.prototype=new InlineEditField.SimpleField();DynamicEnumField.prototype.isDifferentValue=function(newValue){return this.initialValue[1]!=newValue;};DynamicEnumField.prototype.createEditElements=function(){var html=[];if(this.controllerId){html.push("<span style='white-space: nowrap;'>");}html.push("<span><select id='");html.push(this.id);html.push("'><option selected value=\"");html.push(this.cleanValue(this.currentValue[1]));html.push('">');html.push(this.cleanValue(this.currentValue[0]));html.push("</select></span>");if(this.controllerId){html.push("<div onmouseover='addMouseOver(this)' class='mouseOverInfoOuter'><img class='infoIcon' src='"+UserContext.getUrl("/s.gif")+"'><div style='display: none;' class='mouseOverInfo'>");html.push(LC.getLabel("DependentElement","dependsOn",this.controllerLabel));html.push("</div></div>");}this.editDiv.innerHTML=html.join("");var att=' id="'+this.id+'"';if(!picklist.picklists){picklist.picklists={};}new picklist(this.id,this.picklistId,this.controllerId,Util.convertOptionsForPicklistData([this.initialValue]),att,!this.required,true,this.filterValue);if(!this.group){this.load();}};DynamicEnumField.prototype.createDummy=function(){var dummy=document.createElement("input");dummy.type="hidden";dummy.id=this.id;dummy.value=this.currentValue[1];this.tableCell.appendChild(dummy);this.created=true;};DynamicEnumField.prototype.load=function(){picklist.picklists[this.id].onLoad();this.editElement=getElementByIdCS(this.id);this.initialIndex=this.editElement.selectedIndex;this.currentIndex=this.initialIndex;};DynamicEnumField.prototype.getValueFromEdit=function(){this.editElement=getElementByIdCS(this.id);this.currentIndex=this.editElement.selectedIndex;return this.editElement.options[this.currentIndex].value;};DynamicEnumField.prototype.formatValue=function(){this.editElement=getElementByIdCS(this.id);var text=this.editElement.options[this.currentIndex].text;if(text==LC.getLabel("SelectElement","Required")){if(this.initialValue[1]===""){return"";}else{return this.getDeletedValue();}}else{return this.cleanValue(text);}};DynamicEnumField.prototype.reset=function(){if(this.group){this.currentValue=this.initialValue;delStyleClass(this.readDiv,"inlineEditModified");this.changed=false;this.readDiv.innerHTML=this.initialHTML;if(this.undoButton){this.undoButton.style.display="none";}this.clearError();this.updateEditElement();}else{InlineEditField.SimpleField.prototype.reset.apply(this,arguments);}};DynamicEnumField.prototype.updateEditElementImpl=function(){this.editElement=getElementByIdCS(this.id);this.currentIndex=this.initialIndex;this.editElement.selectedIndex=this.currentIndex;if(this.editElement.onchange){this.editElement.onchange();}};DynamicEnumField.prototype.addSaveData=function(saveData){if(!this.created&&this.required&&this.controllerId&&!this.initialValue[1]){saveData[this.id]=picklistNAMarker;}else{if(typeof this.currentValue=="string"){saveData[this.id]=this.currentValue;}else{saveData[this.id]=this.currentValue[1];}}};function EncryptedTextField(id,state,required,isColumn,initialValue,extraData){this.init(id,state,required,isColumn,initialValue);this.maxLength=extraData.maxLength;this.masked=extraData.masked;this.encryptedElement=null;}EncryptedTextField.prototype=new InlineEditField.SimpleField();EncryptedTextField.prototype.createEditElements=function(){var html=[];html.push("<input type='text' id='");html.push(this.id);html.push("' value=\"");html.push(this.cleanValue(this.currentValue));html.push("\" size='20' maxLength='");if(this.masked){html.push("255");}else{html.push(this.maxLength);}html.push("'>");this.editDiv.innerHTML=html.join("");this.editElement=getElementByIdCS(this.id);if(this.masked){this.encryptedElement=new EncryptedTextInputElement(this.editElement.id,this.maxLength,this.masked);}};EncryptedTextField.prototype.reset=function(){InlineEditField.SimpleField.prototype.reset.apply(this,arguments);if(this.masked&&this.encryptedElement){this.encryptedElement.wasCleared=false;}};
function Gack(){}Gack.sendGack=function(message){if(window.devMode){alert("Gack: "+message);}else{window.status=message;}};Gack.handleException=function(ex){var errMsg=ex.sfdcDesc+" - "+ex.name+" - "+ex.description;Gack.sendGack(errMsg);};Gack.MaxJSErrors=1;Gack.hideJSErrorFromUser=false;Gack.logJSError=function(jsgack){try{var subject="JS Error: "+jsgack.substr(0,100);var entityBody=XBrowser.buildPost({subject:subject,msg:jsgack});if((entityBody!=null)&&(entityBody.indexOf("JS%20Error%3A")!=-1)){XBrowser.postHttpResponse(UserContext.getUrl("/servlet/servlet.GackSender"),function(response){},entityBody);}}catch(e){}};Gack.defineErrorHandling=function(){var count=0;window.onerror=function(msg,url,line){if(count<Gack.MaxJSErrors){Gack.logJSError(msg+" URL: "+url+" Line: "+line+" "+navigator.userAgent);count++;}return Gack.hideJSErrorFromUser;};};
function ListViewport(domId,type,payload,listId,customizable,rowsPerPage,height,width,draggable,vf){if(domId){this.domId=domId;this.listId=listId||domId;this.type=type;this.payload=payload;this.filter=null;this.inlineEditData=null;this.customizable=(typeof(customizable)=="undefined")?true:customizable;this.rowsPerPage=rowsPerPage||null;this.height=height||null;this.width=width||null;this.draggable=draggable;this.vf=vf;this.wrapper=null;this.listViewport=null;this.topNav=null;this.filterLinks=null;this.rolodex=null;this.listBody=null;this.bottomNav=null;this.listSelect=null;this.pageState=null;this.rolodexState=null;this.exception=null;this.buttons=null;this.printLink=null;this.offPageIds=null;this.allowColumnMove=true;this.allowColumnResize=true;this.divisionLabel=null;this.inOverlay=false;this.loading=null;this.saving=null;this.paginator=null;this.grid=null;this.linkTemplates=null;this.retURL=null;this.printURL=null;this.searchBox=null;this.searchContainer=null;this.lastSearchTerm="";this.url=UserContext.getUrl("/_ui/common/list/ListServlet");this.xhr=null;this.rolodexIndex=null;var qs=new QueryString();this.trace=qs.get("trace");this.debug=qs.get("debug");ListViewport.addListViewport(this);var self=this;window.sfdcPage.appendToOnloadQueue(function(){self.init();});window.sfdcPage.appendToOnloadQueue(function(){self.redefineSidebarPin();});window.sfdcPage.appendToOnResizeQueue(function(){self.resize();});}}ListViewport.prototype.getShowRefreshLink=function(){return true;};ListViewport.DEFAULT_COLUMN_WIDTH=125;ListViewport.prototype.resetTimer=function(){this.timepoint(null,true);};ListViewport.prototype.shrinkStore=function(){if(this.grid){this.grid.getStore().filterBy(function(record,id){return this.indexOf(record)==0;});}};ListViewport.prototype.unshrinkStore=function(){if(this.grid){this.grid.getStore().clearFilter();}};ListViewport.prototype.sizeIfNoData=function(){if(this.grid.getStore().getTotalCount()==0){this.grid.getGridEl().query(".x-grid-empty")[0].style.width=this.grid.getColumnModel().getTotalWidth()+"px";}};ListViewport.prototype.timepoint=function(label,reset){if(!this.debug){return;}if(!this.timer||reset){this.timer=new Date();this.times=[];}else{var start=this.timer;this.timer=new Date();var elapsed=this.timer.getTime()-start.getTime();this.times.push({label:label,elapsed:elapsed});}};ListViewport.prototype.dumpObject=function(obj){if(!this.debug){return;}var tab="&nbsp;&nbsp;&nbsp;&nbsp;";for(var item in obj){var str=[];str.push(tab);str.push(item);str.push(": ");str.push(obj[item]);this.times.push(str.join(""));}};ListViewport.prototype.toggle=function(){if(!this.debugContent){return;}if(this.debugContent.style.display=="none"){this.debugContent.style.display="";}else{this.debugContent.style.display="none";}};ListViewport.prototype.outputTimes=function(){if(!this.times){return;}var total=0;var html=[];html.push("==========<br/>");for(var i=0;i<this.times.length;i++){if(typeof(this.times[i].elapsed)=="number"){html.push(this.times[i].elapsed);html.push("ms");var tabnum=8-(this.times[i].elapsed+"").length;for(var j=0;j<tabnum;j++){html.push("&nbsp;");}html.push(this.times[i].label);html.push("<br/>");total+=this.times[i].elapsed;}else{html.push(this.times[i]);html.push("<br/>");}}html.push("----------<br/><b>");html.push(total);html.push("ms");var tabnum=8-(total+"").length;for(var j=0;j<tabnum;j++){html.push("&nbsp;");}html.push("TOTAL TIME FROM REQUEST TO COMPLETION</b>");if(!this.debugDiv){this.debugDiv=document.createElement("div");this.debugDiv.id=this.domId+"_debugDiv";this.debugDiv.style.position="absolute";this.debugDiv.style.top="0px";this.debugDiv.style.left="250px";this.debugDiv.style.border="2px solid red";this.debugDiv.style.margin="3px";this.debugDiv.style.padding="3px";this.debugDiv.style.backgroundColor="white";this.debugDiv.style.fontFamily="Courier New, Courier, monospace";var toggle=document.createElement("input");toggle.type="button";toggle.value="Show/Hide Debug Log";toggle.className="btn";var self=this;toggle.onclick=function(){self.toggle();};this.debugDiv.appendChild(toggle);this.debugContent=document.createElement("div");this.debugDiv.appendChild(this.debugContent);document.body.appendChild(this.debugDiv);}this.debugContent.innerHTML=html.join("");};ListViewport.prototype.init=function(){var self=this;Scontrol.prototype.getSelectedRecordIdsFromForm=function(){return self.grid.getSelectionModel().selections.keys;};if(this.vf){this.reRender=window[this.domId.replace(":","_")+"_reRender"];}this.getReferences();this.initializeLinkTemplates();this.resize();var qs=new QueryString();if(this.pageState.value==""&&this.rolodexState.value==""&&!qs.get("page")&&!qs.get("rolodexIndex")){this.resetTimer();this.loading.show();this.updatePage(this.payload);}else{this.getListData({listid:this.listSelect?this.listSelect.value:this.listId,action:"newfilter",page:this.pageState.value||qs.get("page"),rolodexIndex:this.rolodexState.value||qs.get("rolodexIndex"),rowsPerPage:this.rowsPerPage});}this.wireSearchBox();};ListViewport.prototype.getReferences=function(){this.wrapper=document.getElementById(this.domId+"_wrapper");this.listViewport=document.getElementById(this.domId+"_listViewport");this.topNav=document.getElementById(this.domId+"_topNav");this.filterLinks=document.getElementById(this.domId+"_filterLinks");this.rolodex=document.getElementById(this.domId+"_rolodex");this.listBody=document.getElementById(this.domId+"_listBody");this.bottomNav=document.getElementById(this.domId+"_bottomNav");this.listSelect=document.getElementById(this.domId+"_listSelect");this.pageState=document.getElementById(this.domId+"_pageState");this.rolodexState=document.getElementById(this.domId+"_rolodexState");this.exception=document.getElementById(this.domId+"_exception");this.buttons=document.getElementById(this.domId+"_buttons");this.printLink=document.getElementById(this.domId+"_printLink");this.offPageIds=document.getElementById(this.domId+"_offPageIds");this.divisionLabel=document.getElementById(this.domId+"_divisionLabel");this.searchContainer=document.getElementById(this.domId+"_search");this.loading=new LoadingScreen(this.listBody,LC.getLabel("Global","loading"),this.domId+"_loading");this.saving=new LoadingScreen(this.listBody,LC.getLabel("Buttons","saving"),this.domId+"_saving");};ListViewport.prototype.initializeLinkTemplates=function(){this.linkTemplates={newLink:new Ext.Template('<a id="create-new-view" href="',this.getNewLink(),'">',LC.getLabel("Filter","new"),"</a>").compile(),editLink:new Ext.Template('<a href="',this.getEditLink(),'">',LC.getLabel("Filter","edit"),"</a>").compile(),deleteLink:new Ext.Template("<a onclick=\"return confirm('",LC.getLabel("Filter","DeleteConfirm"),"')\" ",'href="',UserContext.getUrl("/setup/own/deleteredirect.jsp?id={filterId}&delID={filterId}&retURL={delRetURL}&_CONFIRMATIONTOKEN={csrfToken}{dtpParam}"),'">',LC.getLabel("Buttons","del"),"</a>").compile(),refreshLink:new Ext.Template('<a id="{domId}_refresh" href="javascript:{jsref}.refreshList()">',"<b>",LC.getLabel("Filter","refresh"),"</b>","</a>").compile()};};ListViewport.prototype.getNewLink=function(){return UserContext.getUrl("/ui/list/FilterEditPage?ftype={filterType}&retURL={retURL}{dtpParam}");};ListViewport.prototype.getEditLink=function(){return UserContext.getUrl("/ui/list/FilterEditPage?id={filterId}&retURL={retURL}{dtpParam}");};ListViewport.prototype.refreshList=function(){this.grid.getSelectionModel().clearAllSelections();if(this.refreshLink){this.refreshLink.style.backgroundColor="";}this.getListData({page:this.paginator.currentPage,rolodexIndex:this.rolodexIndex});};ListViewport.prototype.search=function(value){if(value!=this.lastSearchTerm){this.lastSearchTerm=value;this.getListData({search:value,rolodexIndex:this.rolodexIndex});}};ListViewport.prototype.getListDataPost=function(args){var qs=new QueryString();var post={action:args.action||"filter",filterId:args.listid||(this.filter?this.filter.id:this.listId),filterType:this.filter?this.filter.type:this.type,page:args.page||1,rowsPerPage:(args.rowsPerPage!=null)?args.rowsPerPage:(this.rowsPerPage||""),search:(args.search!=null)?args.search:"",sort:(args.sort!=null)?args.sort:"",rolodexIndex:(args.rolodexIndex!=null)?args.rolodexIndex:-1,vf:this.vf,retURL:this.retURL!==null?this.retURL:window.location.pathname,isdtp:qs.get("isdtp")};return post;};ListViewport.prototype.getListData=function(args){this.resetTimer();this.loading.show();if(this.xhr){this.xhr.onreadystatechange=function(){};this.xhr.abort();}var args=args||{};var post=this.getListDataPost(args);if(post.action=="newfilter"){if(this.filterLinks){this.filterLinks.innerHTML="&nbsp;";}if(this.rolodex){this.rolodex.style.visibility="hidden";}if(this.buttons){this.buttons.innerHTML="";}document.body.focus();}if(this.trace){post.trace=this.trace;}var self=this;this.xhr=XBrowser.postHttpResponse(this.url,function(response){self.xhrHandler(response.responseText);},XBrowser.buildPost(post));this.timepoint("AJAX request issued");this.dumpObject(post);};ListViewport.prototype.xhrHandler=function(responseText){var ldata;try{ldata=Util.evalAjaxServletOutput(responseText);}catch(e){window.location.reload();}this.updatePage(ldata);};ListViewport.prototype.updatePage=function(ldata){this.timepoint("entering updatePage");if(ldata.exTitle&&ldata.exDesc){this.handleException(ldata);return;}if(this.trace&&ldata.trace){var traceEl=Ext.get("sqltrace");Ext.DomHelper.overwrite(traceEl,ldata.trace);}if(ldata.filter&&ldata.inlineEditData){this.loadFilter(ldata.filter,ldata.inlineEditData);this.timepoint("inline edit data loaded");}this.retURL=ldata.retURL;this.rowsPerPage=ldata.rowsPerPage;if(ldata.csrfToken){this.csrfToken=ldata.csrfToken;}if(ldata.dtpParam){this.dtpParam=ldata.dtpParam;}this.drawListData(ldata.listData,ldata.columnWidths);this.updateFilterLinks();this.timepoint("updated filter links");this.updateButtons(ldata.buttons);this.timepoint("updated buttons");this.updatePrintLink(ldata.printURL);this.timepoint("updated print link");this.updateSortState(ldata.sortState);this.timepoint("updated sort state");this.updateRolodex(ldata.rolodexIndex,ldata.sortState);this.timepoint("updated rolodex");this.updatePaginator(ldata);this.timepoint("updated paginator");this.updateStateFields();this.timepoint("updated state fields");this.updateDivisionLabel(ldata.divisionLabel);this.resize();this.exception.style.display="";this.loading.hide();if(this.reRender&&this.xhr){this.reRender();}this.xhr=null;this.timepoint("handling complete");this.outputTimes();};ListViewport.prototype.handleException=function(ldata){var html=[];html.push("<div class='title'>");html.push(ldata.exTitle);html.push("</div>");html.push("<br/>");html.push(ldata.exDesc);this.exception.innerHTML=html.join("");this.exception.style.display="block";if(this.filterLinks){this.filterLinks.style.display="none";}if(this.buttons){this.buttons.style.display="none";}if(this.printLink){this.printLink.style.visibility="hidden";}if(this.rolodex&&this.rolodex.style.visibility!="hidden"){this.rolodex.style.visibility="hidden";}if(!this.paginator){this.updatePaginator(ldata);}this.paginator.draw(true);this.loading.hide();};ListViewport.prototype.updateDivisionLabel=function(label){if(label&&this.divisionLabel){this.divisionLabel.innerHTML=label;}};ListViewport.prototype.wireSearchBox=function(){if(this.searchContainer){this.searchBox=new Sfdc.html.QuickfindInput({renderTo:Ext.get(this.searchContainer),searchFunction:this.search,clearFunction:this.search.createDelegate(this,[""]),scope:this,emptyText:LC.getLabel("ReportBuilder","quickFindDefaultText"),buffer:300});this.searchBox.on("keydown",function(field,event){if(event.getCharCode()==event.ENTER){event.stopEvent();}});}};ListViewport.prototype.updateButtons=function(buttons){if(this.buttons){if(document.all){buttons.unshift('<span style="display:none" id="',this.domId,'_REMOVE">.</span>');}this.buttons.innerHTML=buttons.join("");if(document.all){document.getElementById(this.domId+"_REMOVE").removeNode(true);}Util.evalScriptsUnderElement(this.buttons);this.buttons.style.display="";}};ListViewport.prototype.updatePrintLink=function(printURL){if(!this.printLink){return;}var pieces=printURL.split("?");var url=[];url.push("javascript:printWin('");url.push(pieces[0]);url.push("/x?");url.push(pieces[1]);url.push("')");this.printLink.href=url.join("");this.printLink.style.visibility="";};ListViewport.prototype.updateStateFields=function(){this.pageState.value=this.paginator.currentPage;this.rolodexState.value=this.rolodexIndex;};ListViewport.prototype.updateFilterLinks=function(){var p={filterType:this.filter.type,filterId:this.filter.id,domId:this.domId,jsref:"ListViewport.instances['"+this.domId+"']",retURL:this.retURL,delRetURL:this.vf?this.retURL:"%2F"+this.filter.entityType,csrfToken:this.csrfToken,dtpParam:this.dtpParam?"&isdtp="+this.dtpParam:""};var links=[];if(this.customizable){if(this.filter.isCreateNewDisplayed){links.push(this.linkTemplates.newLink.apply(p));}if(this.filter.editable){links.push(this.linkTemplates.editLink.apply(p));links.push(this.linkTemplates.deleteLink.apply(p));}}if(this.getShowRefreshLink()){links.push(this.linkTemplates.refreshLink.apply(p));}this.filterLinks.innerHTML=links.join(" | ");this.filterLinks.style.display="";if(this.getShowRefreshLink()){this.refreshLink=document.getElementById(this.domId+"_refresh");}else{this.refreshLink=null;}};ListViewport.prototype.updateSortState=function(state){var view=this.grid.getView();view.sortState=state;var colIndex=this.grid.getColumnModel().findColumnIndex(state.field);if(colIndex!=-1){view.updateSortIcon(colIndex,state.dir);}};ListViewport.prototype.updateRolodex=function(index,state){this.rolodexIndex=index;if(!this.rolodex){return;}var entries=this.rolodex.childNodes;var cm=this.grid.getColumnModel();var colIndex=cm.findColumnIndex(state.field);if(colIndex!=-1&&cm.getColumnById(cm.getColumnId(colIndex)).useRolodex){if(this.rolodex.style.visibility=="hidden"){this.rolodex.style.visibility="";}}else{if(this.rolodex.style.visibility!="hidden"){this.rolodex.style.visibility="hidden";}}for(var i=0;i<entries.length;i++){if(i==index||(index==-1&&i==entries.length-1)){entries[i].firstChild.className="listItemSelected";}else{entries[i].firstChild.className="listItemPad";}}};ListViewport.prototype.updatePaginator=function(ldata){if(!this.paginator){var self=this;this.paginator=new ListPaginator({listDomId:this.domId,containerIds:[this.domId+"_bottomNav"],recordsPerPage:ldata.rowsPerPage,totalRecords:ldata.totalRowCount,capped:ldata.capped,currentPage:ldata.page,hasCheckbox:this.hasCheckbox,handler:function(pageNum){self.getListData({page:pageNum,rolodexIndex:self.rolodexIndex});}});}else{this.paginator.setState({currentPage:ldata.page,recordsPerPage:ldata.rowsPerPage,totalRecords:ldata.totalRowCount,capped:ldata.capped,hasCheckbox:this.hasCheckbox});}};ListViewport.prototype.xhrErrorHandler=function(responseText){};ListViewport.prototype.loadFilter=function(filter,inlineEditData){this.filter=filter;inlineEditData.viewport=this;inlineEditData.shownColumns=filter.shownColumns;this.inlineEditData=this.createNewListInlineEditData(inlineEditData);};ListViewport.prototype.createNewListInlineEditData=function(inlineEditData){return new ListInlineEditData(inlineEditData);};ListViewport.prototype.buildDataStore=function(listData){var idColumn=listData[ListView.ID_COLUMN];var actionColumn=listData[ListView.ACTION_COLUMN];var numRows=idColumn.length;var myData=new Array(numRows);var cols=this.filter.shownColumns;for(var row=0;row<myData.length;row++){myData[row]=[];myData[row].push(idColumn[row]);if(actionColumn[row]!=null){this.hasActions=true;}myData[row].push(actionColumn[row]);for(var col=0;col<cols.length;col++){myData[row].push(listData[cols[col].columnName][row]);}}this.timepoint("datastore prepared");return myData;};ListViewport.prototype.getSelectionModel=function(){return new Sfdc.grid.CheckboxSelectionModel({menuDisabled:true,width:21});};ListViewport.prototype.drawListData=function(listData,columnWidths){this.hasActions=false;var myData=this.buildDataStore(listData);var cols=this.filter.shownColumns;this.hasCheckbox=this.filter.showCheckBox||this.inlineEditData.isMassEditable;var sm=this.getSelectionModel();var myFields=[];var myColumns=[];if(this.hasCheckbox){myColumns.push(sm);}myFields.push({name:ListView.ID_COLUMN});myColumns.push({header:"ID",hidden:true,dataIndex:ListView.ID_COLUMN,id:ListView.ID_COLUMN});myFields.push({name:ListView.ACTION_COLUMN});myColumns.push({header:LC.getLabel("Global","action"),dataIndex:ListView.ACTION_COLUMN,id:ListView.ACTION_COLUMN,width:1,hidden:!this.hasActions,menuDisabled:true,fixed:true,css:"font-weight: bold;",renderer:function(val){return val?val.join(" | "):"";}});var colWidths=columnWidths||[];for(var i=0;i<cols.length;i++){if(!colWidths[i]){colWidths[i]=ListViewport.DEFAULT_COLUMN_WIDTH;}myFields.push({name:cols[i].columnName});myColumns.push(this.buildColumnConfig(cols[i],colWidths[i]));}this.timepoint("fields and columns prepared");if(!this.grid){var listeners=this.getGridListeners();this.grid=new Ext.grid.GridPanel({viewport:this,id:this.filter.id+"_grid",cm:new Ext.grid.ColumnModel(myColumns),sm:sm,store:new Ext.data.SimpleStore({id:0,fields:myFields}),view:new Sfdc.grid.GridView({emptyText:this.getNoResultsText(),sortClasses:["ASC","DESC"],deferEmptyText:false}),listeners:listeners,width:this.listBody.offsetWidth,enableColumnMove:this.allowColumnMove,enableColumnResize:this.allowColumnResize});this.grid.addEvents("cellMouseOver","cellMouseOut");this.timepoint("grid initialized");this.showRPPWarning();}else{if((this.filter.id+"_grid")!=this.grid.id){this.grid.getSelectionModel().clearAllSelections();var store=new Ext.data.SimpleStore({id:0,fields:myFields});var columnModel=new Ext.grid.ColumnModel(myColumns);this.grid.reconfigure(store,columnModel);this.grid.id=this.filter.id+"_grid";this.timepoint("grid reconfigured");}}this.grid.render(this.listBody.id);this.timepoint("grid rendered");if(myData.length>0){this.grid.getStore().loadData([myData[0]]);this.timepoint("first row loaded into grid");}var cm=this.grid.getColumnModel();var actionIndex=cm.getIndexById(ListView.ACTION_COLUMN);this.grid.view.sizeColumnToContent(actionIndex);this.timepoint("action column sized");var cmTotalWidth=cm.getTotalWidth();this.timepoint("cm total width got");var gridInnerWidth=this.grid.getInnerWidth();this.timepoint("grid inner width got");if((cmTotalWidth<gridInnerWidth)&&!columnWidths){this.grid.view.fitColumns();this.timepoint("columns fit");}this.grid.getStore().suspendEvents();this.grid.getStore().loadData(myData);this.grid.getStore().resumeEvents();this.timepoint("all data loaded into grid");this.grid.body.on("mouseover",function(e){this.grid.processEvent("mouseover",e);},this);this.grid.body.on("mouseout",function(e){this.grid.processEvent("mouseout",e);},this);this.timepoint("cell listeners added");if(this.draggable){this.initdd();}};ListViewport.prototype.buildColumnConfig=function(col,columnWidth){var lfc=this.inlineEditData.getColumnById(col.columnName);var id=lfc?lfc.getFieldId():col.columnName;return{header:col.label,width:columnWidth,dataIndex:col.columnName,id:id.replace(/\./g,"_"),menuDisabled:true,isSortable:col.isSortable,useRolodex:col.useRolodex,renderer:function(val){return typeof val=="object"?val[0]:val;}};};ListViewport.prototype.getGridListeners=function(){var listeners={};listeners.columnmove={fn:this.extHandler.columnMove,scope:this};listeners.columnresize={fn:this.extHandler.columnResize,scope:this};listeners.headerclick={fn:this.extHandler.headerClick,scope:this};listeners.celldblclick={fn:this.extHandler.cellDblClick,scope:this};listeners.cellmouseover={fn:this.extHandler.cellMouseOver,scope:this};listeners.cellmouseout={fn:this.extHandler.cellMouseOut,scope:this};return listeners;};ListViewport.prototype.initdd=function(){var self=this;this.drag=new Ext.dd.DragZone(this.grid.getEl(),{containerScroll:true,scroll:false,rowId:"",getDragData:function(e){var t=e.getTarget("div.x-grid3-row");if(t){var firstCol=self.getFilterColumns()[0];var selector=".x-grid3-col-"+firstCol.id;var returnTo=Ext.get(t).select(selector,true).elements[0];var ddel=document.createElement("div");ddel.className="dragElement";var val=self.drag.row.data[firstCol.dataIndex];ddel.innerHTML=(typeof val=="object")?val[0]:val;return{ddel:ddel,rowId:self.drag.row.id,repairXY:returnTo.getXY()};}},getRepairXY:function(){return this.dragData.repairXY;}});this.grid.on("rowmousedown",function(g,index,e){self.drag.row=g.getStore().getAt(index);});};ListViewport.prototype.getHOffset=function(){var hOffset=0;hOffset+=Ext.fly(this.topNav).getHeight();hOffset+=Ext.fly(this.bottomNav).getHeight();hOffset+=Ext.fly(this.listViewport).getBorderWidth("tb");hOffset+=Ext.fly(this.listBody).getBorderWidth("tb");return hOffset;};ListViewport.prototype.getResizeHeight=function(){var hgoal=0;if(this.vf){hgoal=this.height||parent.getHeight(true);}else{if(this.inOverlay){var parent=Ext.fly(this.wrapper).parent();var linkBarHeight=Ext.fly(this.topNav).child("div.linkBar").getHeight();hgoal=parent.getHeight()-linkBarHeight;}else{hgoal=document.documentElement.clientHeight-Ext.fly(this.wrapper).getTop()-10;}}return hgoal;};ListViewport.prototype.resize=function(minHeight){try{this.shrinkStore();}catch(e){}var hOffset=this.getHOffset();var parent=Ext.fly(this.wrapper).parent();var hgoal=this.getResizeHeight();var h=hgoal-hOffset;if(minHeight&&h<minHeight){h=minHeight;}var hpx=h+"px";if(this.grid){this.grid.el.dom.style.display="none";}var wgoal=this.width||parent.getWidth(true);var wpx=wgoal+"px";this.timepoint("resize overhead");this.listBody.style.height=hpx;if(this.width){this.wrapper.style.width=wpx;}this.timepoint("listBody resized");this.exception.style.height=hpx;if(this.width){this.exception.style.width=wpx;}this.timepoint("exception resized");if(this.loading.transparantElement){this.loading.transparantElement.style.height=hpx;if(this.width){this.loading.transparantElement.style.width=wpx;}this.timepoint("loading resized");}if(this.grid){this.grid.el.dom.style.display="";this.grid.suspendEvents();this.timepoint("suspended events");this.grid.setHeight(h);this.timepoint("grid height resized");var border=(UserContext&&UserContext.uiSkin==UiSkin.ALOHA.apiValue)?Ext.fly(this.listBody).getBorderWidth("lr"):Ext.fly(this.listViewport).getBorderWidth("lr");var w=wgoal-border;this.grid.setWidth(w);this.timepoint("grid width resized");this.grid.resumeEvents();this.timepoint("resumed events");this.unshrinkStore();this.sizeIfNoData();}};ListViewport.prototype.redefineSidebarPin=function(){var self=this;if(Sidebar.prototype.theSidebar){Sidebar.prototype.theSidebar.pin=function(){Sidebar.prototype.pin.apply(Sidebar.prototype.theSidebar);self.resize();};}};ListViewport.prototype.beforeSave=function(){this.saving.show();};ListViewport.prototype.afterSave=function(saved,column){if(saved&&saved.length>0){if(this.refreshLink){this.refreshLink.style.backgroundColor="#FFE324";}var value=column.getDisplayValue();if(value===""){value="&nbsp;";}var fieldId=column.getFieldId();var composite=new Ext.CompositeElement();for(var i=0;i<saved.length;i++){var id=saved[i];var cell=Ext.get(getElementByIdCS(saved[i]+"_"+fieldId));if(cell){composite.add(cell.parent());cell.update(value);var record=this.grid.getStore().getById(saved[i]);if(record&&record.data[column.columnName]){record.data[column.columnName]=value;}}}var color=this.grid.getSelectionModel().getCount()>0?"#dfe8f6":"#ffffff";composite.highlight("#ffffcc",{endColor:color,duration:2.5,concurrent:true});}this.saving.hide();};ListViewport.prototype.getFilterColumns=function(){return this.grid.getColumnModel().getColumnsBy(function(c,i){return(c.id!="checkbox"&&c.id!=ListView.ID_COLUMN&&c.id!=ListView.ACTION_COLUMN);});};ListViewport.prototype.extHandler={columnMove:function(oldIndex,newIndex){if(this.filter.id!==Udd.EMPTY_KEY){var colObjs=this.getFilterColumns();var cols=[];for(var i=0;i<colObjs.length;i++){cols.push(colObjs[i].dataIndex);}var post={action:"reorderColumns",filterId:this.filter.id,cols:cols};if(this.customizable){XBrowser.postHttpResponse(this.url,function(response){},XBrowser.buildPost(post));}}var view=this.grid.getView();view.updateSortIcon(this.grid.getColumnModel().findColumnIndex(view.sortState.field),view.sortState.dir);},columnResize:function(colIndex,newsize){if(this.filter.id!==Udd.EMPTY_KEY){var colObjs=this.getFilterColumns();var widths=[];for(var i=0;i<colObjs.length;i++){widths.push(colObjs[i].width);}var post={action:"setColumnWidths",filterId:this.filter.id,widths:widths};XBrowser.postHttpResponse(this.url,function(response){},XBrowser.buildPost(post));this.sizeIfNoData();}},cellDblClick:function(grid,rowIndex,columnIndex,event){if(this.inlineEditData.isEditable){var colId=grid.getColumnModel().getDataIndex(columnIndex);var column=this.inlineEditData.getColumnById(colId);if(column&&column.state==InlineEditState.EDIT){var sm=this.grid.getSelectionModel();if(sm.getCount()==0||sm.selectRow(rowIndex,this.inlineEditData.isMassEditable)){var row=this.grid.getStore().getAt(rowIndex);var rowId=row.get(ListView.ID_COLUMN);var initialValue=row.get(column.columnName);this.inlineEditData.openColumn(rowId,colId,typeof initialValue=="object"?initialValue[1]:null);}}}},cellMouseOver:function(grid,rowIndex,columnIndex,event){if(this.inlineEditData.isEditable){var column=this.inlineEditData.getColumnById(grid.getColumnModel().getDataIndex(columnIndex));if(column){var css=column.state.cssClass;Ext.fly(this.grid.getView().getCell(rowIndex,columnIndex)).replaceClass(css,css+"On");}}},cellMouseOut:function(grid,rowIndex,columnIndex,event){if(this.inlineEditData.isEditable){var column=this.inlineEditData.getColumnById(grid.getColumnModel().getDataIndex(columnIndex));if(column){var css=column.state.cssClass;Ext.fly(this.grid.getView().getCell(rowIndex,columnIndex)).replaceClass(css+"On",css);}}},headerClick:function(grid,columnIndex){var cm=grid.getColumnModel();var column=cm.getColumnById(cm.getColumnId(columnIndex));var view=grid.getView();if(!column.isSortable||view.headersDisabled){return;}var field=column.dataIndex;if(field){if(view.sortState.field==field&&view.sortState.dir=="ASC"){this.getListData({sort:"-"+field,page:this.paginator.currentPage,rolodexIndex:this.rolodexIndex});view.updateSortIcon(columnIndex,"DESC");view.sortState.dir="DESC";}else{this.getListData({sort:field,page:this.paginator.currentPage,rolodexIndex:(view.sortState.field==field)?this.rolodexIndex:-1});view.updateSortIcon(columnIndex,"ASC");view.sortState={field:field,dir:"ASC"};}}}};ListViewport.prototype.verify=function(errorMessage){if(this.grid.getSelectionModel().selections.length>0){return true;}else{alert(errorMessage);return false;}};ListViewport.prototype.showRPPWarning=function(){if(this.vf||this.rowsPerPage<=100||UserContext.userPreferences.getBoolean("HideRPPWarning")){return;}if(!ListViewport.dialog){var self=this;ListViewport.dialog=new SimpleDialog("RPPWarning");ListViewport.dialog.displayX=true;ListViewport.dialog.setWidth(520);ListViewport.dialog.extraClass="RPPDialog";ListViewport.dialog.setTitle(LC.getLabel("RPPDialog","title"));ListViewport.dialog.createContent=function(){var content=document.getElementById(this.getContentId());var html=[];html.push("<h2 id='");html.push(ListViewport.dialog.id);html.push("Header'>");html.push(ListViewport.dialog.header);html.push("</h2>");html.push("<div id='");html.push(ListViewport.dialog.id);html.push("Inner'>");html.push("<div class='message warningM4'><table cellspacing='0' cellpadding='0' border='0' class='messageTable'><tr><td>");html.push("<img title='Warning' class='msgIcon' src='/s.gif' alt='");html.push(LC.getLabel("Icon","WARNING"));html.push("'/></td>");html.push("<td class='headerCell'><h4>");html.push(LC.getLabel("RPPDialog","yourRPP",self.rowsPerPage));html.push("</h4></td></tr>");html.push("<tr><td></td><td><div>");html.push(LC.getLabel("RPPDialog","message"));html.push("</div>");html.push("</td></tr></table></div>");html.push("<div class='radioDiv'>");html.push("<div class='radio'><input type='radio' name='RPPRadio' id='RPPChange' checked='checked'><label for='RPPChange'>");html.push(LC.getLabel("RPPDialog","change"));html.push("</label>");html.push("<select class='RPPSelect' name='RPPSelect' id='RPPSelect'>");var opts=[10,25,50,100];for(var i=0;i<opts.length;i++){html.push("<option value='");html.push(opts[i]);html.push("'");if(opts[i]==100){html.push(" selected");}html.push(">");html.push(opts[i]);html.push("</option>");}html.push("</select></div>");html.push("<div class='radio'><input type='radio' name='RPPRadio' id='RPPNoChange'><label for='RPPNoChange'>");html.push(LC.getLabel("RPPDialog","nochange"));html.push("</label></div>");html.push("</div>");html.push("<div class='buttons'>");html.push("<input class='btn' type='button' value='");html.push(LC.getLabel("Buttons","save"));html.push("' id='RPPSaveButton'><input class='btn' type='button' value='");html.push(LC.getLabel("Buttons","cancel"));html.push("' id='RPPCancelButton'>");html.push("</div>");html.push("</div>");content.innerHTML=html.join("");document.getElementById("RPPChange").onclick=function(){document.getElementById("RPPSelect").disabled="";};document.getElementById("RPPNoChange").onclick=function(){document.getElementById("RPPSelect").disabled="true";};document.getElementById("RPPCancelButton").onclick=function(){ListViewport.dialog.hide();};document.getElementById("RPPSaveButton").onclick=function(){if(document.getElementById("RPPNoChange").checked){UserContext.userPreferences.setBoolean("HideRPPWarning",true);}else{self.getListData({rowsPerPage:document.getElementById("RPPSelect").value,rolodexIndex:self.rolodexIndex});}ListViewport.dialog.hide();};ListViewport.dialog.show();};ListViewport.dialog.register();}};ListViewport.prototype.getNoResultsText=function(){return LC.getLabel("List","none");};ListViewport.instances={};ListViewport.addListViewport=function(what){ListViewport.instances[what.domId]=what;};
AutoCompleteInputElement=function(elementId,servletURI,minSuggestLen,requestParams,matchBlanks,acName,lkId,shouldCaptureKeyStroke){this.id=elementId;this.element=document.getElementById(elementId);if(!(this.id&&this.element)){return;}this.matchBlanks=matchBlanks;this.lkId=lkId;if(acName){this.id=acName;}AutoCompleteInputElement.instanceRefs[this.id]=this;this.servletURI=servletURI;if(minSuggestLen>=0){this.minSuggestLen=minSuggestLen;}else{this.minSuggestLen=0;}this.cache={};this.triedQueries={};this.selected=-1;this.requestParams=requestParams;this.lastInput=null;this.enabled=true;this.disableOnEsc=false;this.shouldCaptureKeyStroke=typeof shouldCaptureKeyStroke==="undefined"?true:shouldCaptureKeyStroke;this.displayHeader=true;var self=this;addEvent(this.element,"keyup",function(e){self.handleInput(e);});addEvent(this.element,"keydown",function(e){self.handleNav(e);});var blurCallback=function(){self.focused=false;setTimeout(function(){self.clearSuggestions();},1000);};addEvent(this.element,"blur",blurCallback);addEvent(this.element,"focus",function(){self.focused=true;});};AutoCompleteInputElement.BOX_ID="_autoCompleteBoxId";AutoCompleteInputElement.BOX_CSS_CLASS="autoCompleteBoxScrolling";AutoCompleteInputElement.ROW_ID="_autoCompleteRowId_";AutoCompleteInputElement.ROW_CSS_CLASS="autoCompleteRow";AutoCompleteInputElement.ROW_CSS_CLASS_SELECTED="autoCompleteSelectedRow";AutoCompleteInputElement.ROW_CSS_CLASS_MOUSE_OVER="autoCompleteHoverRow";AutoCompleteInputElement.TITLE_ROW_CSS_CLASS="autoCompleteSectionRow";AutoCompleteInputElement.MAX_SUGGESTIONS=10;AutoCompleteInputElement.ROW_HEIGHT=1.5;AutoCompleteInputElement.ROW_HEIGHT_UNITS="em";AutoCompleteInputElement.regexChars=/([\/.*+?|()[\]{}\\^$])/g;AutoCompleteInputElement.instanceRefs={};AutoCompleteInputElement.prototype.positionACBox=function(checkVisible){if((!this.element)||(!this.acBox)){return;}if(checkVisible&&(!this.isACBoxVisible())){return;}var x=getObjX(this.element);var y=getObjY(this.element)+this.element.offsetHeight;this.acBox.setStyle("left",x+"px");this.acBox.setStyle("top",y+"px");var width=this.element.clientWidth;this.acBox.setStyle("width",width+"px");if(typeof Ext==="object"){var e=Ext.get("massEdit");if(e!==null){this.acBox.setStyle("zIndex",parseFloat(e.getStyle("z-index"),10)+10);}}};AutoCompleteInputElement.prototype.updateWidth=function(){var minWidth=this.element.clientWidth;var requiredWidth=-1;if(this.acBox.div.childNodes){this.acBox.div.childNodes[0].getClientRects();requiredWidth=this.acBox.div.childNodes[0].clientWidth;}if(minWidth>requiredWidth){this.acBox.setStyle("width",minWidth+"px");}else{this.acBox.setStyle("width",requiredWidth+"px");}};AutoCompleteInputElement.prototype.clearACBox=function(){if(!this.isACBoxVisible()){return;}this.acBox.setStyle("display","none");this.scrolling=false;this.acBox.setStyle("height","auto");this.deselect();};AutoCompleteInputElement.prototype.isACBoxVisible=function(){return(this.acBox&&(this.acBox.getStyle("display")!="none"));};AutoCompleteInputElement.prototype.updateACBox=function(suggestions,selectedObject){if(!this.element){return;}if((!suggestions)||(suggestions.length==0)){if(this.acBox){this.clearACBox();}return;}if(!this.acBox){this.initACBox();}var html=[];html.push("<table width='100%' cellpadding='0' cellspacing='0' border='0'>");if(this.displayHeader){html.push('<tr><td><div class="'+AutoCompleteInputElement.TITLE_ROW_CSS_CLASS+'">'+LC.getLabel("Sidebar_Search","result_source")+"</div></td></tr> ");}for(var i=0;i<suggestions.length;i++){var record=suggestions[i];if(!record||(!record.name)){continue;}html.push("<tr><td>");html.push("<div ");html.push('onmouseover="');html.push("AutoCompleteInputElement.mouseOver('"+this.id+"', "+i+')"');html.push('onmouseout="');html.push("AutoCompleteInputElement.mouseOut('"+this.id+"', "+i+')"');html.push('onclick="');html.push("AutoCompleteInputElement.click('"+this.id+"', "+i+')"');if(this.compareSuggestions(selectedObject,record)){html.push("class='"+AutoCompleteInputElement.ROW_CSS_CLASS_SELECTED+"' ");this.select(i);}else{html.push("class='"+AutoCompleteInputElement.ROW_CSS_CLASS+"' ");}html.push("id='"+AutoCompleteInputElement.getRowIdStatic(this.id,i)+"'>");html.push(this.getSuggestionHtml(record));html.push("</div>");html.push("</td></tr>");}html.push("</table>");this.acBox.div.innerHTML=html.join("");this.positionACBox();if(suggestions.length>AutoCompleteInputElement.MAX_SUGGESTIONS){this.acBox.setStyle("height",(AutoCompleteInputElement.MAX_SUGGESTIONS*AutoCompleteInputElement.ROW_HEIGHT)+AutoCompleteInputElement.ROW_HEIGHT_UNITS);this.scrolling=true;}else{this.acBox.setStyle("height","auto");this.scrolling=false;}this.acBox.setStyle("display","block");this.scrollDiv();this.updateWidth();};AutoCompleteInputElement.prototype.select=function(row){if(this.selected==row){return;}if(this.selected>=0){var rowRef=this.getRow(this.selected);if(rowRef){rowRef.className=AutoCompleteInputElement.ROW_CSS_CLASS;}}this.selected=row;var rowRef=this.getRow(this.selected);if(rowRef){rowRef.className=AutoCompleteInputElement.ROW_CSS_CLASS_SELECTED;}};AutoCompleteInputElement.prototype.selectPrev=function(){if(!this.hasValidSelection()){return;}var newsel=this.selected-1;if(newsel<0){this.deselect();return;}this.select(newsel);this.scrollDiv();};AutoCompleteInputElement.prototype.selectNext=function(){if(!this.hasValidSelection()){if(this.isACBoxVisible()){this.select(0);}return;}if(this.selected+1==this.curSuggestions.length){return;}var newsel=(this.selected+1)%this.curSuggestions.length;this.select(newsel);this.scrollDiv();};AutoCompleteInputElement.prototype.scrollDiv=function(){if((!this.hasValidSelection())||(!this.scrolling)){return;}var scrollh=(this.acBox.div.scrollHeight*((this.selected+1)/this.curSuggestions.length))-(this.acBox.div.clientHeight*0.5);this.acBox.div.scrollTop=scrollh;};AutoCompleteInputElement.prototype.deselect=function(){return this.select(-1);};AutoCompleteInputElement.prototype.hasValidSelection=function(){return(this.element&&(this.selected>=0)&&this.curSuggestions&&this.curSuggestions.length&&(this.selected<this.curSuggestions.length)&&this.isACBoxVisible());};AutoCompleteInputElement.prototype.initACBox=function(){if(!this.element){return;}this.acBox=document.createElement("div");this.acBox.id=this.id+AutoCompleteInputElement.BOX_ID;this.acBox.className=AutoCompleteInputElement.BOX_CSS_CLASS;document.body.appendChild(this.acBox);this.acBox=new iframeShim(this.acBox);if(!AutoCompleteInputElement.hasResizeHandler){addEvent(window,"resize",AutoCompleteInputElement.resizeHandler);AutoCompleteInputElement.hasResizeHandler=true;}};AutoCompleteInputElement.prototype.complete=function(){if(!this.element){return false;}if(!this.hasValidSelection()){return false;}var selectedEntry=this.curSuggestions[this.selected];this.setAppliedFlag(true);this.innerComplete(selectedEntry);this.clearACBox();this.resizeTextArea();return true;};AutoCompleteInputElement.prototype.innerComplete=function(suggestionEntry){if((!this.element)||(!suggestionEntry)||(suggestionEntry.length==0)){return;}this.element.value=suggestionEntry.name;if(suggestionEntry.lookupPickJs){eval(suggestionEntry.lookupPickJs);}};AutoCompleteInputElement.prototype.setAppliedFlag=function(flag){var acApplied=flag?"1":"0";if(this.acAppliedField){this.acAppliedField.value=acApplied;return;}var editform=document.getElementById(EditPageConstants.pEDIT_PAGE);if(editform){var fieldId=this.id+AbstractAutoCompleteServlet.AUTOCOMPLETE_USED_SUFFIX;field=document.createElement("input");field.type="hidden";field.id=fieldId;field.name=fieldId;field.value=acApplied;editform.appendChild(field);this.acAppliedField=field;}};AutoCompleteInputElement.prototype.getRow=function(number){return document.getElementById(AutoCompleteInputElement.getRowIdStatic(this.id,number));};AutoCompleteInputElement.prototype.disableAC=function(){if(this.enabled){this.enabled=false;this.clearSuggestions();}};AutoCompleteInputElement.prototype.enableAC=function(){if(!this.enabled){this.enabled=true;this.displaySuggestions(true);}};AutoCompleteInputElement.prototype.retrieveFromServlet=function(query){if((!query)||(query.length<this.minSuggestLen)){return false;}if(this.triedQueries[this.getCacheKey(query)]){return false;}this.triedQueries[this.getCacheKey(query)]=true;var qs=new QueryString();qs.add(AbstractAutoCompleteServlet.pINPUT,query);qs.add("time",new Date().getTime());if(this.requestParams){for(var i in this.requestParams){qs.add(i,this.requestParams[i]);}}if(this.lkId&&sfdcPage.getReferredDomIds){qs.add(MRUAutoCompleteServlet.DEPDATA_PARAM,dpdLkUtil.serialize(sfdcPage.getReferredDomIds(this.lkId)));}var self=this;var url=this.servletURI+qs.toString();XBrowser.getHttpResponse(url,function(request){var resp=request.responseText;if(resp){var tmpResp=self.parseResponse(resp);if(tmpResp&&tmpResp[AbstractAutoCompleteServlet.SUGGESTIONS]){self.saveToCache(query,tmpResp[AbstractAutoCompleteServlet.SUGGESTIONS]);self.displaySuggestions(true);}}});return true;};AutoCompleteInputElement.prototype.parseResponse=function(resp){return Util.evalAjaxServletOutput(resp);};AutoCompleteInputElement.prototype.displaySuggestions=function(isHttpResponse){if((!this.element)||(!this.focused)||(!this.enabled)||(!this.additionalDisplayConditionsValid())){return;}var input=trim(this.element.value);if(isHttpResponse||(input!=this.lastInput)||(!this.isACBoxVisible())){this.setAppliedFlag(false);this.lastInput=input;var selectedObject=null;if(input==""){this.clearSuggestions();return;}if(this.hasValidSelection()){selectedObject=this.curSuggestions[this.selected];}this.curSuggestions=this.getSuggestions(input);this.updateACBox(this.curSuggestions,selectedObject);}};AutoCompleteInputElement.prototype.clearSuggestions=function(){if(!this.element){return;}this.curSuggestions=null;this.clearACBox();};AutoCompleteInputElement.prototype.getSuggestions=function(input){var input=this.findInput(input);if(!(this.element&&(input.length>=this.minSuggestLen))){return[];}var superSet=this.checkCacheOrRetrieve(input);if(!superSet){return[];}var resultSet=[];for(var i=0;i<superSet.length;i++){var suggestion=superSet[i];if(this.isValidSuggestion(input,suggestion)){resultSet.push(suggestion);}}return resultSet;};AutoCompleteInputElement.prototype.getCacheKey=function(query){return"dummy";};AutoCompleteInputElement.prototype.saveToCache=function(query,results){this.cache[this.getCacheKey(query)]=results;};AutoCompleteInputElement.prototype.clearCache=function(){this.cache={};this.triedQueries={};};AutoCompleteInputElement.prototype.checkCacheOrRetrieve=function(input){var cacheKey=this.getCacheKey(input);if(!this.cache[cacheKey]){this.retrieveFromServlet(input);}return this.cache[cacheKey];};AutoCompleteInputElement.prototype.handleInput=function(event){if(this.inKeyIME){this.inKeyIME=false;if(event.keyCode==KEY_ENTER){this.displaySuggestions();}}else{if(!AutoCompleteInputElement.isNav(event)){this.displaySuggestions();}}};AutoCompleteInputElement.prototype.handleNav=function(event){if(AutoCompleteInputElement.isNav(event)){if(event.keyCode==KEY_ESC){this.clearSuggestions();if(this.disableOnEsc){this.disableAC();}AutoCompleteInputElement.captureKeystroke(event);}else{if(event.keyCode==KEY_ARROW_U){this.selectPrev();}else{if(event.keyCode==KEY_ARROW_D){this.selectNext();}else{if(event.keyCode==KEY_TAB){this.complete();if(typeof this.onAfterTabDown==="function"){this.onAfterTabDown(event);}}else{if(event.keyCode==KEY_ENTER){this.handleEnter(event);}}}}}}else{if(event.keyCode==KEY_PROCESS){this.inKeyIME=true;}}this.resizeTextArea();};AutoCompleteInputElement.prototype.handleEnter=function(event){if(this.complete()&&this.shouldCaptureKeyStroke){AutoCompleteInputElement.captureKeystroke(event);}};AutoCompleteInputElement.getRowIdStatic=function(id,number){return""+id+AutoCompleteInputElement.ROW_ID+number;};AutoCompleteInputElement.getInstance=function(id){return(AutoCompleteInputElement.instanceRefs[id]);};AutoCompleteInputElement.mouseOver=function(id,rowNumber){var inst=AutoCompleteInputElement.getInstance(id);if(!(inst&&rowNumber>=0)){return;}if(rowNumber==inst.selected){return;}var rowId=AutoCompleteInputElement.getRowIdStatic(id,rowNumber);var row=document.getElementById(rowId);row.className=AutoCompleteInputElement.ROW_CSS_CLASS_MOUSE_OVER;};AutoCompleteInputElement.mouseOut=function(id,rowNumber){var inst=AutoCompleteInputElement.getInstance(id);if(!(inst&&rowNumber>=0)){return;}if(rowNumber==inst.selected){return;}var rowId=AutoCompleteInputElement.getRowIdStatic(id,rowNumber);var row=document.getElementById(rowId);row.className=AutoCompleteInputElement.ROW_CSS_CLASS;};AutoCompleteInputElement.click=function(id,rowNumber){var inst=AutoCompleteInputElement.getInstance(id);inst.select(rowNumber);inst.complete();};AutoCompleteInputElement.matches=function(substring,string){if(!substring||!string){return false;}substring=AutoCompleteInputElement.normalize(substring);string=AutoCompleteInputElement.normalize(string);if(substring.length>string.length){return false;}return(string.indexOf(substring)===0);};AutoCompleteInputElement.normalize=function(string){return trim(string.toLowerCase());};AutoCompleteInputElement.isNav=function(event){if(!event||!event.keyCode){return false;}return((event.keyCode==KEY_ARROW_D)||(event.keyCode==KEY_ARROW_U)||(event.keyCode==KEY_ESC)||(event.keyCode==KEY_TAB)||(event.keyCode==KEY_ENTER));};AutoCompleteInputElement.blurHandler=function(id){var inst=AutoCompleteInputElement.getInstance(id);if(inst&&inst.isACBoxVisible()){inst.clearSuggestions();}};AutoCompleteInputElement.captureKeystroke=function(event){if(XBrowser.userAgent.isIE){event.returnValue=false;event.cancelBubble=false;}else{event.preventDefault();event.stopPropagation();}};AutoCompleteInputElement.resizeHandler=function(){for(var id in AutoCompleteInputElement.instanceRefs){AutoCompleteInputElement.instanceRefs[id].positionACBox(true);}};AutoCompleteInputElement.prototype.isValidSuggestion=function(input,suggestion){var inputPat=this.getRegexForInput(input);var matches=suggestion.name.match(inputPat);return matches;};AutoCompleteInputElement.escapeRegex=function(string){if((!string)||(string.length==0)){return string;}return string.replace(AutoCompleteInputElement.regexChars,"\\$1");};AutoCompleteInputElement.prototype.getRegexForInput=function(input){var normInput=AutoCompleteInputElement.normalize(input);if(!AutoCompleteInputElement.regexCache[normInput]){if(!this.matchBlanks){AutoCompleteInputElement.regexCache[normInput]=new RegExp(["(^)(",AutoCompleteInputElement.escapeRegex(input),")"].join(""),"gi");}else{AutoCompleteInputElement.regexCache[normInput]=new RegExp(["(\\b|^|\\W)(",AutoCompleteInputElement.escapeRegex(input),")"].join(""),"gi");}}return AutoCompleteInputElement.regexCache[normInput];};AutoCompleteInputElement.regexCache={};AutoCompleteInputElement.prototype.getSuggestionHtml=function(suggestion){var ret=[];var inputStr=escapeHTML(this.findInput(this.lastInput));var name=escapeHTML(suggestion.name);var re=this.getRegexForInput(inputStr);name=name.replace(re,'$1<strong class="autocompleteMatch">$2</strong>');ret.push("&nbsp;");ret.push(name);return ret.join("");};AutoCompleteInputElement.prototype.findInput=function(input){return ltrim(input);};AutoCompleteInputElement.prototype.setResizer=function(callback){this.resizeCallback=callback;};AutoCompleteInputElement.prototype.resizeTextArea=function(){if(this.resizeCallback&&this.resizeCallback()){this.positionACBox();}};AutoCompleteInputElement.prototype.additionalDisplayConditionsValid=function(){return true;};AutoCompleteInputElement.prototype.compareSuggestions=function(a,b){return a&&b&&a.lookupPickID&&b.lookupPickID&&b.lookupPickID==a.lookupPickID;};
function LookupSearchPage(){SearchPage.call(this);}LookupSearchPage.prototype=new SearchPage();
function ProductSearchPage(){}ProductSearchPage.prototype=new SearchPage();ProductSearchPage.prototype.filterResults=function(actionUrl,currentUrl,listUrl,listQS,listId,numFilters){if(!window.sfdcPage.hook_shouldProceedWithAction()){return;}var identifier=this.createIdentifier();this.processAction(listId,null,identifier);var newUrl=listUrl;var elements=document.getElementsByName(SearchRelatedList.pSEARCH);var searchQuery;for(var ind=0;ind<elements.length;ind++){if(elements[ind].id==SearchRelatedList.pSEARCH){searchQuery=elements[ind].value;break;}}if(searchQuery!=""){newUrl=newUrl+"&"+SearchRelatedList.pSEARCH+"="+this.encodeForSearch(searchQuery);}var hasFilters=false;for(var ind=0;ind<numFilters;ind++){var columnParam=listId+FilterSelectionElement.pCOLUMN+ind;var operatorParam=listId+FilterSelectionElement.pOPERATOR+ind;var valueParam=listId+FilterSelectionElement.pFILTER_VALUE+ind;var columnField=document.getElementById(columnParam).value;var operatorField=document.getElementById(operatorParam).value;var valueField=document.getElementById(valueParam).value;if(columnField!=""&&operatorField!=""){newUrl=newUrl+"&"+columnParam+"="+this.encodeForSearch(columnField);newUrl=newUrl+"&"+operatorParam+"="+this.encodeForSearch(operatorField);newUrl=newUrl+"&"+valueParam+"="+this.encodeForSearch(valueField);hasFilters=true;}}if(hasFilters){newUrl=newUrl+"&"+SearchRelatedList.FILTER_FIELDS_PARAM+"=1";}newUrl=this.addActionIdentifier(newUrl,identifier);this.callRelatedListActionAndSaveHistory(actionUrl,currentUrl,newUrl,listQS,listId);};ProductSearchPage.prototype.evalScripts=function(rlElement){var scriptElements=rlElement.getElementsByTagName("script");for(var ind=0;ind<scriptElements.length;ind++){var jsExpression=scriptElements[ind].innerHTML;eval(jsExpression);}};ProductSearchPage.prototype.handleKeyPress=function(event,listId,element){var keynum=this.getKeyNumForEvent(event);if(keynum&&keynum==KEY_ENTER){var enterButton=document.getElementById(SearchRelatedList.FILTER_FIELDS_SAVE_PREFIX+listId);if(enterButton){element.blur();enterButton.click();}}return false;};ProductSearchPage.prototype.verifyChecked=function(form,element_name,errorMessage){var shouldSubmit=verifyChecked(form,element_name,errorMessage);if(shouldSubmit){form.submit();}return shouldSubmit;};ProductSearchPage.prototype.selectionCancel=function(form){var inputElement=document.createElement("input");inputElement.type="hidden";inputElement.name="cancel";inputElement.value="Cancel";form.appendChild(inputElement);form.submit();};ProductSearchPage.prototype.hook_postRelatedListActionUpdate=function(listUrl){var filterOnloadExpression=" if(window."+FilterSelectionElement.ON_LOAD_CRITERIA+"){ "+FilterSelectionElement.ON_LOAD_CRITERIA+"(); }";eval(filterOnloadExpression);};ProductSearchPage.prototype.isTagBrowser=function(dataElement){return false;};
function SelectionSearchPage(){}SelectionSearchPage.prototype=new SearchPage();SelectionSearchPage.prototype.hook_shouldProceedWithAction=function(){var elems=document.getElementsByName(ListView.CHECKBOX_ID);if(!elems){return;}var counter=0;for(i=0;i<elems.length;++i){if(elems[i].checked){counter++;}}if(counter>0){return window.confirm(LC.getLabel("List","checkboxWarning"));}else{return true;}};SelectionSearchPage.prototype.hook_postRelatedListActionUpdate=function(listUrl){var hiddenSaveUrl=document.getElementsByName(EditPageConstants.pSAVE_NEW_URL);if(!hiddenSaveUrl||!hiddenSaveUrl[0]){return;}hiddenSaveUrl[0].value=listUrl;var filterOnloadExpression=" if(window."+FilterSelectionElement.ON_LOAD_CRITERIA+"){ "+FilterSelectionElement.ON_LOAD_CRITERIA+"(); }";eval(filterOnloadExpression);};SelectionSearchPage.prototype.verifyChecked=function(form,element_name,errorMessage){var shouldSubmit=verifyChecked(form,element_name,errorMessage);if(shouldSubmit&&window.confirm(LC.getLabel("DeactivatedUserTagCleanupPage","cleanConfirmation"))){form.submit();}return shouldSubmit;};SelectionSearchPage.prototype.selectionCancel=function(form){window.location=UserContext.getUrl(TagConstants.TAG_SEARCH_RESULTS_URL);};SelectionSearchPage.prototype.evalScripts=function(rlElement){var scriptElements=rlElement.getElementsByTagName("script");for(var ind=0;ind<scriptElements.length;ind++){var jsExpression=scriptElements[ind].innerHTML;eval(jsExpression);}};SelectionSearchPage.prototype.isTagBrowser=function(dataElement){return false;};
function TagSearchPage(csrfToken){this.menuButtonOpenId=null;this.activeCancelRenameButton=null;this.csrfToken=csrfToken;}TagSearchPage.prototype=new SearchPage();TagSearchPage.prototype.setTagLinkReturnsResults=function(value){this.tagLinkReturnResults=value;};TagSearchPage.prototype.setMenuButtonOpen=function(parentDiv){var existingElementId=this.menuButtonOpenId;this.onLinkOver(parentDiv);this.menuButtonOpenId=parentDiv.id;if(existingElementId){var element=document.getElementById(existingElementId);if(element){this.onLinkOut(element);}}};TagSearchPage.prototype.setMenuButtonClosed=function(){var existingElementId=this.menuButtonOpenId;this.menuButtonOpenId=null;if(existingElementId){var element=document.getElementById(existingElementId);if(element){this.onLinkOut(element);}}};TagSearchPage.prototype.tagLinkAction=function(actionUrl,tagLink,tagLinkId,thisLink){this.removeError();var noneLabel=LC.getLabel("ManageTags","noneSelected");if(this.hasTagsInEdit()){var found=false;for(var i=0;i<this.currentTags.length;i++){var curTag=this.currentTags[i];var curTagId=this.currentTagsIds[i];if(curTag==tagLink&&curTagId==tagLinkId){this.currentTags.splice(i,1);this.currentTagsIds.splice(i,1);found=true;break;}}if(!found){this.currentTags.push(tagLink);this.currentTagsIds.push(tagLinkId);}}else{this.currentTags=[tagLink];this.currentTagsIds=[tagLinkId];}this.updateCurrentTags();window.location=this.addAdditionalParams(actionUrl,true);};TagSearchPage.prototype.updateCurrentTags=function(newSelectedTags,newSelectedTagIds){if(newSelectedTags&&newSelectedTagIds){this.currentTags=newSelectedTags;this.currentTagsIds=newSelectedTagIds;}var changeTagsArea=document.getElementById(TagConstants.CHANGE_TAGS_NAMES);var changeTagsIdsArea=document.getElementById(TagConstants.CHANGE_TAGS_IDS);if(changeTagsArea&&changeTagsIdsArea){if(this.hasTagsInEdit()){changeTagsArea.innerHTML=this.currentTags.join(", ");changeTagsIdsArea.innerHTML=this.currentTagsIds.join(", ");}else{changeTagsArea.innerHTML=LC.getLabel("ManageTags","noneSelected");changeTagsIdsArea.innerHTML=LC.getLabel("ManageTags","noneSelected");}}};TagSearchPage.prototype.swtichScopeMode=function(targetUrl){window.location=targetUrl;};TagSearchPage.prototype.inlineEditAction=function(tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,isDelete,updateElementId,errorDiv,fallbackUpdateValue){if(!this.hook_shouldProceedWithAction()){return;}var updateString;var inputElement;if(isDelete){updateString="delete";}else{inputElement=document.getElementById(updateElementId);updateString=inputElement?inputElement.value:fallbackUpdateValue;}if(!updateString){this.displayError(LC.getLabel("ManageTags","errorMissingName"),false,errorDiv);if(inputElement){inputElement.className=inputElement.className+" "+EditElement.ERROR_CLASS;}return false;}else{if(/[,\.\\\/\'"!@#\$%\^&\*\(\)\+=\{\}:;<>\|\[\]]/.exec(updateString)){this.displayError(LC.getLabel("ManageTags","errorOnRename"),false,errorDiv);if(inputElement){inputElement.className=inputElement.className+" "+EditElement.ERROR_CLASS;}return false;}else{if((TagAutoComplete.normalize(updateString).length===0)){this.displayError(LC.getLabel("TagHeader","tag_whitespace_error"),false,errorDiv);if(inputElement){inputElement.className=inputElement.className+" "+EditElement.ERROR_CLASS;}return false;}}}if(!isDelete){var queryString=new QueryString("");queryString.add("t",new Date().getTime());queryString.add(TagConstants.TAG_UPDATE_STRING,updateString);queryString.add(TagConstants.pTAG_SCOPE_MODE,tagScopeMode);queryString.add(TagConstants.TAG_ID_LIST,tagId);var loc=UserContext.getUrl(TagConstants.TAG_MERGE_CHECK)+queryString.toString();var self=this;var handleRenameResponse=function(response){var response=Util.evalAjaxServletOutput(response.responseText);var renameTagId=response.tagId;if(renameTagId&&window.confirm(LC.getLabel("ManageTags","renameWarning",updateString))){self.inner_inlineEditAction(updateString,tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,isDelete,updateElementId,errorDiv,renameTagId);}else{if(!renameTagId){self.inner_inlineEditAction(updateString,tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,isDelete,updateElementId,errorDiv);}}};var handleRenameError=function(err){if(self.cancelCalls[TagConstants.BROWSER_LIST_ID]){self.cancelCalls[TagConstants.BROWSER_LIST_ID]();}self.displayError(LC.getLabel("TagHeader","server_error_edit"));};XBrowser.getHttpResponse(loc,handleRenameResponse,handleRenameError);}else{this.inner_inlineEditAction(updateString,tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,isDelete,updateElementId,errorDiv);}};TagSearchPage.prototype.inner_inlineEditAction=function(updateString,tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,isDelete,updateElementId,errorDiv,renameTagId){var postQs=new QueryString("");postQs.add(TagConstants.TAG_UPDATE_STRING,updateString);postQs.add(TagConstants.IS_DELETE,isDelete?"1":"0");postQs.add(TagConstants.pTAG_SCOPE_MODE,tagScopeMode);postQs.add(TagConstants.TAG_ID_LIST,tagId);if(this.csrfToken){postQs.add(CSRFConstants.CSRF_TOKEN,this.csrfToken);}var identifier=this.createIdentifier();this.processAction(listId,description,identifier,true);if(this.activeCancelRenameButton){this.activeCancelRenameButton.click();this.activeCancelRenameButton=null;}var listUrl=this.addActionIdentifier(listUrl,identifier);listUrl=this.addAdditionalParams(listUrl);if(renameTagId){listUrl=listUrl.replace(new RegExp(tagId,"g"),renameTagId);}var self=this;var handleError=function(err){if(self.cancelCalls[TagConstants.BROWSER_LIST_ID]){self.cancelCalls[TagConstants.BROWSER_LIST_ID]();}self.displayError(LC.getLabel("TagHeader","server_error_edit"));};var handleResponse=function(request){var xmlDoc=request.responseXML;if(!xmlDoc||(XBrowser.userAgent.isIE&&!xmlDoc.xml)){if(request.status==200){window.location.reload();}else{if(self.cancelCalls[TagConstants.BROWSER_LIST_ID]){self.cancelCalls[TagConstants.BROWSER_LIST_ID]();}self.displayError(LC.getLabel("TagHeader","unknown_error"));return;}}var saved=xmlDoc.getElementsByTagName("ok")[0];if(saved){self.removeError();if(!self.hasTagsInEdit()){callRelatedListAction(null,listUrl,listQS,listId,true,function(){if(isDelete){self.notifySuccess(LC.getLabel("ManageTags","successDelete",tagValue));}else{self.notifySuccess(LC.getLabel("ManageTags","successRename",tagValue,updateString));}});TagMenuButton.flushCache();}else{window.location=self.createInlinePageReloadUrl(listUrl,isDelete,tagValue,updateString);}}else{var error=xmlDoc.getElementsByTagName("error")[0];var needReload=xmlDoc.getElementsByTagName("reload")[0];if(needReload&&error){callRelatedListAction(null,listUrl,listQS,listId,true,function(){self.displayError(error.firstChild.nodeValue,true);});TagMenuButton.flushCache();if(self.hasTagsInEdit()){var resultSection=document.getElementById(TagConstants.TAG_RESULTS_ID);if(resultSection){resultSection.innerHTML="";}}}else{if(self.cancelCalls[TagConstants.BROWSER_LIST_ID]){self.cancelCalls[TagConstants.BROWSER_LIST_ID]();}if(error){self.displayError(error.firstChild.nodeValue,true);}else{self.displayError(LC.getLabel("TagHeader","unknown_error"));}}}};var loc=UserContext.getUrl(TagConstants.EDIT_TAGS_PAGE)+"?t="+new Date().getTime();var queryString=postQs.toString();XBrowser.postHttpResponse(loc,handleResponse,queryString.substring(1,queryString.length),handleError);};TagSearchPage.prototype.createInlinePageReloadUrl=function(listUrl,isDelete,tagValue,updateString){if(listUrl){var parts=listUrl.split("?");var qs=(parts.length>1)?parts[1]:"";var listQs=new QueryString(qs);listQs.remove(SearchRelatedList.SEARCH_ACTION_IDENTIFIER_PARAM);listQs.remove(TagConstants.TAG_SET_HAS_RECORDS);listQs.remove("rId");listQs.add(TagConstants.TAG_VALUE_FOR_UPDATE,tagValue);if(!isDelete){listQs.add(TagConstants.TAG_UPDATE_STRING,updateString);}var newListQs=listQs.toString();return parts[0]+newListQs;}return listUrl;};TagSearchPage.prototype.inlineDeleteAction=function(tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode){this.inlineEditAction(tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,true,null);};TagSearchPage.prototype.inlineRenameAction=function(elementId,tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode){var element=document.getElementById(elementId+MenuButtonElement.BUTTON);if(element){var tagBrowser=document.getElementById(XBrowser.userAgent.isIE?TagConstants.BROWSER_TAG_TABLE_ID:TagConstants.BROWSER_LIST_ID);if(tagBrowser){var tagBrowserCover=document.createElement("div");tagBrowser.style.position="relative";tagBrowser.appendChild(tagBrowserCover);tagBrowserCover.style.height=tagBrowser.clientHeight+"px";tagBrowserCover.style.width=tagBrowser.clientWidth+"px";tagBrowserCover.className="waitingHeaderSearchDiv";}var divElement=document.createElement("div");divElement.style.position="absolute";divElement.style.display="none";element.parentNode.parentNode.appendChild(divElement);var initialTop=0,initialLeft=0;initialTop=element.offsetParent.offsetTop;initialLeft=element.offsetParent.offsetLeft;divElement.style.top=initialTop+20;divElement.style.left=initialLeft+16;var inputField=document.createElement("input");inputField.type="text";inputField.name="tagRename"+elementId;inputField.id=inputField.name;inputField.maxLength="100";inputField.size="30";inputField.className="tagRename";inputField.value=tagValue;divElement.appendChild(inputField);divElement.appendChild(document.createElement("br"));var self=this;var errorSpan=document.createElement("span");errorSpan.className="errorMsg";var errorDiv=document.createElement("div");errorDiv.style.display="none";errorDiv.className="tagRenameMenuError";errorDiv.appendChild(errorSpan);var cancelButton=document.createElement("input");cancelButton.title=LC.getLabel("Global","cancel");cancelButton.value=cancelButton.title;cancelButton.className="btn";cancelButton.type="button";cancelButton.onclick=function(){element.parentNode.parentNode.removeChild(divElement);if(tagBrowser){tagBrowser.removeChild(tagBrowserCover);tagBrowserCover=null;}divElement=null;self.onLinkOut(element.parentNode);};var saveButton=document.createElement("input");saveButton.title=LC.getLabel("Global","save");saveButton.value=saveButton.title;saveButton.className="btn";divElement.className="tagRenameMenu";saveButton.type="button";saveButton.onclick=function(){self.activeCancelRenameButton=cancelButton;self.inlineEditAction(tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,false,inputField.id,errorDiv);};divElement.appendChild(saveButton);divElement.appendChild(cancelButton);divElement.appendChild(errorDiv);divElement.style.display="block";inputField.onfocus=function(){setTimeout(function(){self.onLinkOver(element.parentNode);},0);};inputField.focus();inputField.onkeypress=function(e){var keynum=self.getKeyNumForEvent(e);if(keynum&&keynum==KEY_ESC){cancelButton.click();}else{if(keynum&&keynum==KEY_ENTER){saveButton.click();}}};}else{if(UserContext.isAccessibleMode){var newName=window.prompt(LC.getLabel("ManageTags","accessibleRenamePrompt"),tagValue);if(newName){this.inlineEditAction(tagValue,tagId,listUrl,listQS,listId,description,tagScopeMode,false,null,null,newName);}}}};TagSearchPage.prototype.clearVariablesOnActionLoad=function(){if(this.cancelCalls){this.cancelCalls=new Object();}};TagSearchPage.prototype.hook_updatedStateOnLoad=function(listUrl,listId){if(listId&&listId==TagConstants.BROWSER_LIST_ID){var parts=listUrl.split("?");var qs=(parts.length>1)?parts[1]:"";var listQs=new QueryString(qs);}};TagSearchPage.prototype.addAdditionalParams=function(listUrl,nonInlineAction){if(listUrl){var parts=listUrl.split("?");var qs=(parts.length>1)?parts[1]:"";var listQs=new QueryString(qs);listQs.add(TagConstants.TAG_ID_LIST,this.hasTagsInEdit()?(this.currentTagsIds.join(",")):"");var tagSearchField=document.getElementById(TagConstants.SAVED_TAG_SEARCH);if(tagSearchField&&tagSearchField.innerHTML&&tagSearchField.innerHTML.length>0){var searchString=tagSearchField.innerHTML;listQs.add(TagConstants.TAG_SEARCH_FIELD,this.processTagSearchString(searchString));}var tagResults=document.getElementById(TagConstants.TAG_RESULTS_ID);if(!nonInlineAction&&tagResults&&tagResults.childNodes.length>0){listQs.add(TagConstants.TAG_SET_HAS_RECORDS,"1");}else{if(!nonInlineAction){listQs.add(TagConstants.TAG_SET_HAS_RECORDS,"0");}}var newListQs=listQs.toString();if(this.currentTags&&this.currentTagsIds){this.currentTags=null;this.currentTagsIds=null;}return parts[0]+newListQs;}this.removeError();return listUrl;};TagSearchPage.prototype.hasTagsInEdit=function(){if(!this.currentTags||!this.currentTagsIds){var changeTagsArea=document.getElementById(TagConstants.CHANGE_TAGS_NAMES);var changeTagsIdsArea=document.getElementById(TagConstants.CHANGE_TAGS_IDS);var noneLabel=LC.getLabel("ManageTags","noneSelected");if(changeTagsIdsArea&&changeTagsIdsArea.innerHTML!=noneLabel&&changeTagsArea&&changeTagsArea.innerHTML!=noneLabel){this.currentTags=changeTagsArea.innerHTML.split(", ");this.currentTagsIds=changeTagsIdsArea.innerHTML.split(", ");}else{this.currentTags=[];this.currentTagsIds=[];}}return(this.currentTags&&this.currentTags.length>0&&this.currentTagsIds&&this.currentTagsIds.length>0);};TagSearchPage.prototype.getHeightForLoadingElementTag=function(dataElement){var borderOffset=-2;return dataElement.scrollHeight+borderOffset+"px";};TagSearchPage.prototype.getWidthForLoadingElementTag=function(dataElement){var borderOffset=-2;return dataElement.scrollWidth+borderOffset+"px";};TagSearchPage.prototype.isTagBrowser=function(dataElement){return dataElement.childNodes[0]&&dataElement.childNodes[0].id==TagConstants.BROWSER_TAG_TABLE_ID;};TagSearchPage.prototype.wrapTagBrowserSearch=function(actionUrl,currentUrl,listUrl,listQS,listId,description,hasExistingStirng){this.removeError();var tagSearchField=document.getElementById(TagConstants.TAG_SEARCH_FIELD);if(tagSearchField){var parts=listUrl.split("?");var qs=(parts.length>1)?parts[1]:"";var listQs=new QueryString(qs);var searchString=this.processTagSearchString(tagSearchField.value);listQs.add(TagConstants.TAG_SEARCH_FIELD,searchString);var savedTagSearchField=document.getElementById(TagConstants.SAVED_TAG_SEARCH);if(savedTagSearchField&&!hasExistingStirng){savedTagSearchField.innerHTML=searchString;}if(hasExistingStirng||(searchString&&searchString.length>0)){listQs.add("lsc",TagConstants.ROLODEX_SEARCH_VALUE);}else{if(!searchString||searchString.length==0){listQs.add("lsc","-1");}}var newListQs=listQs.toString();this.wrapDhtmlWaitingRequest(actionUrl,currentUrl,parts[0]+newListQs,listQS,listId,description,true);}else{this.wrapDhtmlWaitingRequest(actionUrl,currentUrl,listUrl,listQS,listId,description,true);}};TagSearchPage.prototype.processTagSearchString=function(searchString){if(searchString){searchString=searchString.replace(/'/g,'"');searchString=searchString.replace(/\+/g," ");}return searchString;};TagSearchPage.prototype.submitTagBrowserAction=function(event,buttonId){if(buttonId){var button=document.getElementById(buttonId);if(button){var keynum=this.getKeyNumForEvent(event);if(keynum&&keynum==KEY_ENTER){var editField=document.getElementById(TagConstants.TAG_EDIT_FIELD);if(editField){editField.blur();}button.click();button.blur();}}}};TagSearchPage.prototype.getControlHeadersForCover=function(listSection){if(listSection&&listSection.id==TagConstants.BROWSER_LIST_ID){var headers=new Array();headers[0]=getElementsByClassName(TagConstants.BROWSER_SEARCH_HEADER_CLASS,listSection,"div")[0];headers[1]=getElementsByClassName("withFilter",listSection,"div")[0];if(XBrowser.userAgent.isIE){headers[2]=getElementsByClassName("withFilter",listSection,"table")[0];}else{headers[2]=getElementsByClassName("bNext",listSection,"div")[0];}return headers;}else{return getElementsByClassName("pbHeader",listSection,"div");}};TagSearchPage.prototype.displayError=function(msg,skipErrorPrefix,errorElement){var errorDiv=errorElement?errorElement:document.getElementById(TagConstants.ERROR_DIV_ID);if(errorDiv){if(errorDiv.lastChild){errorDiv.lastChild.innerHTML=(skipErrorPrefix?"":(LC.getLabel("Global","error")+": "))+msg;}if(errorDiv.style.display=="none"){if(errorElement){errorDiv.style.display="block";}else{Animation.rollIn(errorDiv);}}}};TagSearchPage.prototype.removeError=function(errorElement){var errorDiv=errorElement?errorElement:document.getElementById(TagConstants.ERROR_DIV_ID);if(errorDiv&&errorDiv.style.display!="none"){Animation.rollOut(errorDiv);}};TagSearchPage.prototype.fixRolodexPadding=function(){var rolodex=document.getElementById(TagConstants.TAG_ROLODEX_ID);if(!rolodex||!XBrowser.userAgent.isFirefox){return;}var letters=rolodex.childNodes.length-4;if(letters>0){rolodex.style.paddingRight=(letters*2)+"px";}};TagSearchPage.prototype.notifySuccess=function(msg){var elem=document.getElementById(TagConstants.NOTIFY_MSG_ID);if(!elem||!elem.parentNode){return;}var parentDiv=elem.parentNode;if(msg){elem.innerHTML=msg;if(parentDiv.style.display=="none"){parentDiv.style.display="block";setTimeout(function(){Animation.rollOut(parentDiv);},5000);}return;}parentDiv.style.display="none";};TagSearchPage.prototype.onLinkOver=function(element){if(element.parentNode.className.indexOf("hover")<0&&this.menuButtonOpenId!=element.id){this.existingClass=element.parentNode.className;element.parentNode.className=element.parentNode.className+" hover";}};TagSearchPage.prototype.onLinkOut=function(element){if(this.menuButtonOpenId!=element.id){element.parentNode.className=this.existingClass;}};TagSearchPage.prototype.addUnloadClearState=function(){if(XBrowser.userAgent.isIE){if(this.dhtmlHistory){this.dhtmlHistory.iframe=null;this.dhtmlHistory.parentObject=null;this.dhtmlHistory.listener=null;this.dhtmlHistory.historyStorage=null;}this.dhtmlHistory=null;this.openComponent=null;this.historyCounter=null;this.historyPrefix=null;this.historyStorage=null;this.cancelCalls=null;this.actionIdStorage=null;this.duelingBoxRef=null;this.tagLinkReturnResults=null;this.currentTags=null;this.currentTagIds=null;this.menuButtonOpenId=null;this.ignoreClose=null;}};
LookupAutoCompleteInputElement=function(elementId,servletURI,minSuggestLen,requestParams,matchBlanks,lkId,shouldCaptureKeyStroke){var multiLookupPicker=getElementByIdCS(elementId+MultiLookupInputElement.MULTI_LOOKUP_SELECT_SUFFIX);if(multiLookupPicker&&LookupAutoCompleteInputElement.isMultiLookup(elementId)){var curSupported=LookupAutoCompleteInputElement.supportedLookups[elementId];this.inputElement=getElementByIdCS(elementId);this.lookupTypes={};this.activeLookup=null;var curLookupType=multiLookupPicker.options[multiLookupPicker.selectedIndex].value;for(var type in curSupported){var rpClone=LookupAutoCompleteInputElement.cloneRequestParams(requestParams);var i=0;for(var param in {acEntity:true,aclkent:true,aclkfield:true}){var val=curSupported[type][i];if(val){rpClone[param]=val;}i++;}var ac=new AutoCompleteInputElement(elementId,servletURI,minSuggestLen,rpClone,matchBlanks,elementId+type,lkId,shouldCaptureKeyStroke);if((this.activeLookup===null)&&curLookupType&&(curLookupType==type)){this.activeLookup=ac;}else{ac.disableAC();}this.lookupTypes[type]=ac;}this.inputElement.autocomplete=this.activeLookup?"off":"on";}else{this.activeLookup=new AutoCompleteInputElement(elementId,servletURI,minSuggestLen,requestParams,matchBlanks,null,lkId,shouldCaptureKeyStroke);}LookupAutoCompleteInputElement.instances[elementId]=this;};LookupAutoCompleteInputElement.prototype.addOnAfterTabDownListener=function(cb){if(this.lookupTypes){for(type in this.lookupTypes){LookupAutoCompleteInputElement.addOnAfterTabDown(LookupTypes[type],cb);}}else{LookupAutoCompleteInputElement.addOnAfterTabDown(this.activeLookup,cb);}};LookupAutoCompleteInputElement.addOnAfterTabDown=function(ac,cb){var oldOnAfterTabDown=ac.onAfterTabDown;if(typeof ac.onAfterTabDown!=="function"){ac.onAfterTabDown=cb;}else{ac.onAfterTabDown=function(){oldOnAfterTabDown();cb();};}};LookupAutoCompleteInputElement.prototype.clearSuggestions=function(){if(this.activeLookup.isACBoxVisible()){this.activeLookup.clearSuggestions();}};LookupAutoCompleteInputElement.prototype.clearCache=function(){if(this.activeLookup.clearCache){this.activeLookup.clearCache();}};LookupAutoCompleteInputElement.prototype.setLookupType=function(lookupType){var newLookup=this.lookupTypes[lookupType];if(this.activeLookup===newLookup){return;}if(this.activeLookup){if(!newLookup){this.inputElement.autocomplete="on";}this.activeLookup.disableAC();}if(newLookup){if(!this.activeLookup){this.inputElement.autocomplete="off";}newLookup.enableAC();}this.activeLookup=newLookup;};LookupAutoCompleteInputElement.supportedLookups={};LookupAutoCompleteInputElement.instances={};LookupAutoCompleteInputElement.registerSupportedEntities=function(id,supportedLookups){var supported={};for(var lookupName in supportedLookups){supported[lookupName]=supportedLookups[lookupName];}LookupAutoCompleteInputElement.supportedLookups[id]=supported;};LookupAutoCompleteInputElement.isMultiLookup=function(id){return LookupAutoCompleteInputElement.supportedLookups[id]!=null;};LookupAutoCompleteInputElement.cloneRequestParams=function(rp){var ret={};for(var i in rp){ret[i]=rp[i];}return ret;};LookupAutoCompleteInputElement.handleLookupTypeChange=function(basename,clearSelect){var lookupTypeField=getElementByIdCS(basename+EditElement.pTYPE_SUFFIX);var multiLookupPicker=getElementByIdCS(basename+MultiLookupInputElement.MULTI_LOOKUP_SELECT_SUFFIX);var lookupIdField=getElementByIdCS(basename+EditElement.pID_SUFFIX);var lookupModifiedField=getElementByIdCS(basename+EditElement.pMOD_SUFFIX);var newType=multiLookupPicker.options[multiLookupPicker.selectedIndex].value;lookupTypeField.value=newType;if(clearSelect){lookupIdField.options.length=0;}else{lookupIdField.value="";}lookupModifiedField.value="1";if(LookupAutoCompleteInputElement.isMultiLookup(basename)){var inst=LookupAutoCompleteInputElement.instances[basename];if(inst){inst.setLookupType(newType);}}};
function TagAutoComplete(elem,tagMode,callback){var qs=new QueryString("");qs.add(TagConstants.pTAG_SCOPE_MODE,tagMode);var servlet=UserContext.getUrl(TagConstants.LOOKUP_TAGS_PAGE)+qs.toString();AutoCompleteInputElement.apply(this,[elem.id,servlet,1,{},true]);this.recordHeight=18;this.keyPressCallback=callback;this.disableOnEsc=true;this.displayHeader=false;}TagAutoComplete.prototype=new AutoCompleteInputElement();TagAutoComplete.prototype.parseResponse=function(resp){var results=resp.split(", ");results.sort(function(a,b){var aNorm=a.toLowerCase();var bNorm=b.toLowerCase();if(aNorm==bNorm){return 0;}return(aNorm>bNorm)?1:-1;});var newresults=[];for(var i=0;i<results.length;i++){newresults.push(new Suggestion(results[i]));}var container=[];container[AbstractAutoCompleteServlet.SUGGESTIONS]=newresults;return container;};TagAutoComplete.prototype.findInput=function(input){if(!input){return input;}var values=input.split(",");return ltrim(values[values.length-1]);};TagAutoComplete.prototype.innerComplete=function(text){var values=this.element.value.split(",");if(values.length<=1){values=[text.name];}else{values[values.length-1]=" "+text.name;}this.element.value=values.join(",")+", ";};AutoCompleteInputElement.prototype.additionalDisplayConditionsValid=function(){return true;};TagAutoComplete.prototype.checkCursorAtEnd=function(){if(!this.element){return false;}var afterCaret;if(XBrowser.userAgent.isIE){var selRange=document.selection.createRange().duplicate();if(selRange.text&&(selRange.text.length>0)){return false;}var textRange=selRange.duplicate();textRange.moveToElementText(this.element);try{selRange.setEndPoint("EndToEnd",textRange);afterCaret=selRange.text;}catch(e){return true;}}else{if(this.element.selectionStart!=this.element.selectionEnd){return false;}afterCaret=this.element.value.substring(this.element.selectionStart);}return TagAutoComplete.EMPTY.exec(afterCaret);};function Suggestion(name){this.name=name;}TagAutoComplete.BOX_ID="_autoCompleteBoxId";TagAutoComplete.ROW_ID="_autoCompleteRowId";TagAutoComplete.BOX_CSS_CLASS="autoCompleteBox";TagAutoComplete.MAX_SUGGESTIONS=15;TagAutoComplete.FRAME_ID="_autoCompleteFrameId";TagAutoComplete.EMPTY=/^\s*$/;TagAutoComplete.normalize=function(tag){return tag.replace(/\s|-|_/g,"").toLowerCase();};TagAutoComplete.prototype.compareSuggestions=function(a,b){return a&&b&&a.name&&b.name&&a.name==b.name;};TagAutoComplete.prototype.handleEnter=function(event){if(this.complete()){AutoCompleteInputElement.captureKeystroke(event);}else{if(this.keyPressCallback){this.clearSuggestions();this.keyPressCallback(event);}}};
SidebarSearchAutoCompleteElement=function(elementId,servletURI,minSuggestLen,requestParams,matchBlanks,picklistId,searchFormId){AutoCompleteInputElement.apply(this,[elementId,servletURI,minSuggestLen,requestParams,matchBlanks]);this.autoSelectFirstSuggestion=false;this.picklistId=picklistId;this.picklist=document.getElementById(picklistId);this.searchForm=document.getElementById(searchFormId);};SidebarSearchAutoCompleteElement.prototype=new AutoCompleteInputElement();SidebarSearchAutoCompleteElement.redirectFlag="redirectedWithAutocomplete";SidebarSearchAutoCompleteElement.prototype.isValidSuggestion=function(input,suggestion){var inputPat=this.getRegexForInput(input);var matches=suggestion.name.match(inputPat);if(!this.picklist){return matches;}var keyprefix=this.getPicklistKeyprefix();if(keyprefix==SearchRelatedList.pENTITY_ALL){return matches;}return(matches&&suggestion.mruIds&&SidebarSearchAutoCompleteElement.startsWith(suggestion.mruIds[0],keyprefix));};SidebarSearchAutoCompleteElement.prototype.getPicklistKeyprefix=function(){if(!this.picklist){return null;}return this.picklist.options[this.picklist.selectedIndex].value;};SidebarSearchAutoCompleteElement.prototype.innerComplete=function(suggestionEntry){if((!this.element)||(!suggestionEntry)||(!suggestionEntry.name)||(!suggestionEntry.mruIds)||(suggestionEntry.mruIds.length==0)){return;}this.element.value=suggestionEntry.name;if(suggestionEntry.mruIds.length>1){if(this.picklist){var keyprefix=suggestionEntry.mruIds[0].substring(0,3);this.picklist.value=keyprefix;}if(this.searchForm){this.searchForm.submit();}}else{this.navigateToRecord(suggestionEntry);}};SidebarSearchAutoCompleteElement.prototype.navigateToRecord=function(suggestion){if(!suggestion.detailURL){return;}var root=QueryString.getURI(suggestion.detailURL);var qs=QueryString.createQueryString(suggestion.detailURL);var val=this.getPicklistKeyprefix();if(val){qs.add(this.picklistId,val);}qs.add(SidebarSearchAutoCompleteElement.redirectFlag,1);navigateToUrl(root+qs.toString());};SidebarSearchAutoCompleteElement.prototype.getSuggestionHtml=function(suggestion){var ret=[];var inputStr=escapeHTML(this.lastInput);var name=escapeHTML(suggestion.name);var re=this.getRegexForInput(inputStr);name=name.replace(re,'$1<strong class="autocompleteMatch">$2</strong>');ret.push(suggestion.mruIcon);ret.push("&nbsp;");ret.push(name);return ret.join("");};SidebarSearchAutoCompleteElement.startsWith=function(string,substring){if(!substring||!string){return false;}return((substring.length<=string.length)&&(string.indexOf(substring)===0));};AutoCompleteInputElement.prototype.compareSuggestions=function(a,b){return a&&b&&a.detailURL&&b.detailURL&&a.detailURL==b.detailURL;};
function ProductSelectionSearchPage(){}ProductSelectionSearchPage.prototype=new ProductSearchPage();ProductSelectionSearchPage.prototype.hook_shouldProceedWithAction=function(){var elems=document.getElementsByName(ListView.CHECKBOX_ID);if(!elems){return;}var counter=0;for(i=0;i<elems.length;++i){if(elems[i].checked){counter++;}}if(counter>0){return window.confirm(LC.getLabel("List","checkboxWarning"));}else{return true;}};ProductSelectionSearchPage.prototype.hook_postRelatedListActionUpdate=function(listUrl){var hiddenSaveUrl=document.getElementsByName(EditPageConstants.pSAVE_NEW_URL);if(!hiddenSaveUrl||!hiddenSaveUrl[0]){return;}hiddenSaveUrl[0].value=listUrl;var filterOnloadExpression=" if(window."+FilterSelectionElement.ON_LOAD_CRITERIA+"){ "+FilterSelectionElement.ON_LOAD_CRITERIA+"(); }";eval(filterOnloadExpression);};
var TagHeader=function(){};TagHeader.MAX_TAG_LIST_CHARS=80;TagHeader.LINE_HEIGHT=1.3;TagHeader.LINE_HEIGHT_UNITS="em";TagHeader.RESIZE_THRESHOLD=3;TagHeader.init=function(id,desktopParam,csrfToken){this.id=id;this.desktopParam=desktopParam;this.csrfToken=csrfToken;this.editTagsText=document.getElementById(TagConstants.TAG_EDIT_TEXT_ID);if(this.editTagsText==null){Gack.logJSError("Tag header dom elements did not get properly set up by the server.");return;}this.dropDown=document.getElementById(TagConstants.TAG_DROP_DOWN_ID);this.dropDownContents=document.getElementById(TagConstants.TAG_DROP_DOWN_CONTENTS_ID);this.tagEditArea=document.getElementById(TagMode.PERSONAL+TagConstants.EDIT_AREA_ID);this.pubTagEditArea=document.getElementById(TagMode.PUBLIC+TagConstants.EDIT_AREA_ID);this.tagDisplayList=document.getElementById(TagMode.PERSONAL+TagConstants.TAG_DISPLAY_LIST);this.pubTagDisplayList=document.getElementById(TagMode.PUBLIC+TagConstants.TAG_DISPLAY_LIST);this.tagEditList=document.getElementById(TagMode.PERSONAL+TagConstants.TAG_EDIT_LIST);this.pubTagEditList=document.getElementById(TagMode.PUBLIC+TagConstants.TAG_EDIT_LIST);this.hiddenTagList=document.getElementById(TagMode.PERSONAL+TagConstants.HIDDEN_TAG_LIST);this.hiddenTagIdList=document.getElementById(TagMode.PERSONAL+TagConstants.HIDDEN_TAG_ID_LIST);this.hiddenPubTagList=document.getElementById(TagMode.PUBLIC+TagConstants.HIDDEN_TAG_LIST);this.hiddenPubTagIdList=document.getElementById(TagMode.PUBLIC+TagConstants.HIDDEN_TAG_ID_LIST);this.tags=this.getTags(this.hiddenTagList);this.tagIds=this.getTags(this.hiddenTagIdList);this.pubTags=this.getTags(this.hiddenPubTagList);this.pubTagIds=this.getTags(this.hiddenPubTagIdList);this.display();this.tagHeader=document.getElementById(TagConstants.TAG_HEADER);this.tagHeader.style.display="block";this.loading=new LoadingScreen(this.dropDown,LC.getLabel("TagHeader","saving"));if(this.tagEditArea){this.tagEditArea.textLines=1;}if(this.pubTagEditArea){this.pubTagEditArea.textLines=1;}this.editTags=document.getElementById(TagConstants.TAG_EDIT_ID);this.tagSaveBtn=document.getElementById(TagConstants.TAG_SAVE_ID);this.tagCancelBtn=document.getElementById(TagConstants.TAG_CANCEL_ID);var self=this;addEvent(this.editTags,"click",function(){self.openDropDown();},false);addEvent(this.tagSaveBtn,"click",function(){self.save();},false);addEvent(this.tagCancelBtn,"click",function(){self.cancel();},false);if(this.tagEditArea!=null&&!UserContext.isAccessibleMode){this.autoCompleter=new TagAutoComplete(this.tagEditArea,TagMode.PERSONAL,function(e){self.keyPress(e);});this.autoCompleter.setResizer(function(){return self.checkAndResize(self.tagEditArea);});}if(this.pubTagEditArea!=null&&!UserContext.isAccessibleMode){this.pubAutoCompleter=new TagAutoComplete(this.pubTagEditArea,TagMode.PUBLIC,function(e){self.keyPress(e);});this.pubAutoCompleter.setResizer(function(){return self.checkAndResize(self.pubTagEditArea);});}};TagHeader.display=function(){var charCount=0;charCount=this.setupDisplayList(this.tagDisplayList,this.tags,this.tagIds,TagMode.PERSONAL,charCount);this.setupDisplayList(this.pubTagDisplayList,this.pubTags,this.pubTagIds,TagMode.PUBLIC,charCount);if(this.tags.length==0&&this.pubTags.length==0){this.editTagsText.innerHTML=LC.getLabel("TagHeader","add_tags");this.editTagsText.setAttribute("title",LC.getLabel("TagHeader","add_tags"));}else{this.editTagsText.innerHTML=LC.getLabel("TagHeader","edit_tags");this.editTagsText.setAttribute("title",LC.getLabel("TagHeader","edit_tags"));}};TagHeader.setupDisplayList=function(displayList,tags,tagIds,tagMode,charCount){if(displayList==null){return charCount;}displayList.innerHTML="";if(tags.length==0){document.getElementById(tagMode+TagConstants.TAG_DISPLAY_CONTAINER).style.display="none";}else{document.getElementById(tagMode+TagConstants.TAG_DISPLAY_CONTAINER).style.display="inline";var tagsLeft=tags.length;for(var i=0;i<tags.length;i++){if((charCount+tags[i].length)>TagHeader.MAX_TAG_LIST_CHARS){continue;}if(tagsLeft<tags.length){displayList.appendChild(document.createTextNode(", "));}TagHeader.addTagLink(displayList,tags[i],tagIds[i],tagMode);charCount+=tags[i].length;tagsLeft--;}if(tagsLeft==tags.length){TagHeader.addTagLink(displayList,tags[0],tagIds[0],tagMode);tagsLeft--;}if(tagsLeft>0){var node=document.createElement("span");node.innerHTML=" "+LC.getLabel("TagHeader","tag_list_more",tagsLeft);node.title=tags.slice(tags.length-tagsLeft,tags.length).join(", ");displayList.appendChild(node);}}return charCount;};TagHeader.addTagLink=function(element,tag,tagId,tagMode){var tagLink=document.createElement("a");var qs=new QueryString("");qs.add(TagConstants.TAG_ID_LIST,tagId);if(tag&&tag.length>1){qs.add(TagConstants.TAG_SEARCH_FIELD,tag);qs.add("lsc",TagConstants.ROLODEX_SEARCH_VALUE);}var url=UserContext.getUrl(TagConstants.TAG_SEARCH_RESULTS_URL)+qs.toString();if(this.desktopParam){url="javascript:srcUp('"+url+this.desktopParam+"');";}tagLink.href=url;tagLink.setAttribute("title",LC.getLabel("TagHeader","tag_list_tag_tip",tag));tagLink.innerHTML=tag;element.appendChild(tagLink);return tagLink;};TagHeader.openDropDown=function(){var self=this;this.newTags=new Array().concat(this.tags);this.newPublicTags=new Array().concat(this.pubTags);this.updateEditArea();this.dropDownStartHeight=XBrowser.getActualHeight(self.tagHeader);self.tagHeader.style.display="none";self.dropDown.style.display="block";self.resetAndResize();Animation.animateResizeHeight(self.dropDown,self.dropDownStartHeight,-1,function(){self.dropDownContents.style.visibility="visible";if(self.autoCompleter){self.autoCompleter.positionACBox();}if(self.pubAutoCompleter){self.pubAutoCompleter.positionACBox();}var editArea=self.tagEditArea?self.tagEditArea:self.pubTagEditArea;editArea.focus();TagHeader.moveCursorToEndIE(editArea);});if(Sidebar.prototype.theSidebar){Sidebar.prototype.theSidebar.sizeToBody();Sidebar.prototype.theSidebar.sizeBodyToSidebarNoCheck();}};TagHeader.hideDropDown=function(){var self=this;self.dropDownContents.style.visibility="hidden";Animation.animateResizeHeight(self.dropDown,XBrowser.getActualHeight(self.dropDown),self.dropDownStartHeight,function(){self.tagHeader.style.display="block";self.dropDown.style.display="none";self.removeError();});if(Sidebar.prototype.theSidebar){Sidebar.prototype.theSidebar.sizeToBody();Sidebar.prototype.theSidebar.sizeBodyToSidebarNoCheck();}};TagHeader.cancel=function(){this.hideDropDown();this.setTags();};TagHeader.save=function(){if(this.tagEditArea){var userTags=this.newTags.concat(this.getTags(this.tagEditArea));}if(this.pubTagEditArea){var publicTags=this.newPublicTags.concat(this.getTags(this.pubTagEditArea));}var loc=UserContext.getUrl(TagConstants.SAVE_TAGS_PAGE);var self=this;var handleResponse=function(request){var xmlDoc=request.responseXML;if(!xmlDoc||(XBrowser.userAgent.isIE&&!xmlDoc.xml)){if(request.status==200){window.location=window.location;}else{self.loading.hide();self.displayError(self.generateError(LC.getLabel("TagHeader","unknown_error")));return;}}var ok=xmlDoc.getElementsByTagName("ok")[0];if(ok){if(XBrowser.userAgent.isFirefox){xmlDoc.normalize();}var tagNames=ok.getElementsByTagName(TagConstants.TAG_NAMES_ELEM)[0];var newTags=(tagNames.firstChild&&tagNames.firstChild.nodeValue)?tagNames.firstChild.nodeValue:"";self.tags=eval("new Array("+newTags+")");var tagIds=ok.getElementsByTagName(TagConstants.TAG_IDS_ELEM)[0];var newTagIds=(tagIds.firstChild&&tagIds.firstChild.nodeValue)?tagIds.firstChild.nodeValue:"";self.tagIds=eval("new Array("+newTagIds+")");var tagNames=ok.getElementsByTagName(TagConstants.PUBLIC_TAG_NAMES_ELEM)[0];var newTags=(tagNames.firstChild&&tagNames.firstChild.nodeValue)?tagNames.firstChild.nodeValue:"";self.pubTags=eval("new Array("+newTags+")");var tagIds=ok.getElementsByTagName(TagConstants.PUBLIC_TAG_IDS_ELEM)[0];var newTagIds=(tagIds.firstChild&&tagIds.firstChild.nodeValue)?tagIds.firstChild.nodeValue:"";self.pubTagIds=eval("new Array("+newTagIds+")");self.setTags();self.display();self.hideDropDown();self.loading.hide();TagMenuButton.flushCache();}else{var errors=xmlDoc.getElementsByTagName("saveerror");if(errors){for(var i=0;i<errors.length;i++){var error=errors[i];var mode=error.getElementsByTagName("tagmode");mode=mode&&mode[0]?mode[0].firstChild.nodeValue:"";var errorMessage=error.getElementsByTagName("errormessage")[0];errorMessage=errorMessage?errorMessage.firstChild.nodeValue:self.generateError(LC.getLabel("TagHeader","unknown_error"));self.displayError(errorMessage,mode);}}else{self.displayError(self.generateError(LC.getLabel("TagHeader","unknown_error")));}self.loading.hide();}};var handleError=function(err){self.loading.hide();self.displayError(self.generateError(LC.getLabel("TagHeader","server_error")));};this.removeError();this.loading.show();var qs=new QueryString("");qs.add("id",this.id);if(userTags){qs.add("tags",userTags.join(", "));}if(publicTags){qs.add("pTags",publicTags.join(", "));}if(this.csrfToken){qs.add(CSRFConstants.CSRF_TOKEN,this.csrfToken);}var queryString=qs.toString();XBrowser.postHttpResponse(loc,handleResponse,queryString.substring(1,queryString.length),handleError);};TagHeader.displayError=function(error,mode){if(this.tagEditArea&&mode==TagMode.PERSONAL){this.tagEditArea.className=EditElement.ERROR_CLASS;}else{if(this.pubTagEditArea&&mode==TagMode.PUBLIC){this.pubTagEditArea.className=EditElement.ERROR_CLASS;}}var tagEditError=document.getElementById(mode+TagConstants.TAG_EDIT_ERROR_ID);tagEditError.innerHTML=error;tagEditError.style.display=mode?"inline":"block";if(!mode){this.resetAndResize();}};TagHeader.removeError=function(){if(this.tagEditArea){this.tagEditArea.className="";}if(this.pubTagEditArea){this.pubTagEditArea.className="";}this.removeErrorMessage("");this.removeErrorMessage(TagMode.PERSONAL);this.removeErrorMessage(TagMode.PUBLIC);};TagHeader.removeErrorMessage=function(mode){var tagEditError=document.getElementById(mode+TagConstants.TAG_EDIT_ERROR_ID);if(tagEditError){tagEditError.innerHTML="";tagEditError.style.display="none";}};TagHeader.generateError=function(msg){return LC.getLabel("Global","colonSeparatedWords",LC.getLabel("Global","error"),msg);};TagHeader.keyPress=function(e){e=(e)?e:((event)?event:null);if(e){if(e.keyCode==KEY_ENTER){this.save();AutoCompleteInputElement.captureKeystroke(e);}else{if(e.keyCode==KEY_ESC){this.cancel();AutoCompleteInputElement.captureKeystroke(e);}}}};TagHeader.resetAndResize=function(){if(this.tagEditArea!=null){this.tagEditArea.style.height=TagHeader.LINE_HEIGHT+TagHeader.LINE_HEIGHT_UNITS;this.tagEditArea.textLines=1;this.checkAndResize(this.tagEditArea);}if(this.pubTagEditArea!=null){this.pubTagEditArea.style.height=TagHeader.LINE_HEIGHT+TagHeader.LINE_HEIGHT_UNITS;this.pubTagEditArea.textLines=1;this.checkAndResize(this.pubTagEditArea);}};TagHeader.checkAndResize=function(editArea){var ret=false;while((editArea.scrollHeight-editArea.clientHeight)>TagHeader.RESIZE_THRESHOLD){editArea.textLines++;editArea.style.height=(editArea.textLines*TagHeader.LINE_HEIGHT)+TagHeader.LINE_HEIGHT_UNITS;editArea.rows=editArea.textLines;ret=true;}return ret;};TagHeader.setTags=function(){this.updateHiddenTags(this.tags,this.hiddenTagList);this.updateHiddenTags(this.tagIds,this.hiddenTagIdList);this.updateHiddenTags(this.pubTags,this.hiddenPubTagList);this.updateHiddenTags(this.pubTagIds,this.hiddenPubTagIdList);};TagHeader.remove=function(mode,tag){if(mode==TagMode.PERSONAL){this.newTags.splice(tag,1);}else{if(mode==TagMode.PUBLIC){this.newPublicTags.splice(tag,1);}}this.updateEditArea(true);};TagHeader.updateEditArea=function(keepEdits){if(this.tagEditArea!=null){this.updateEditAreaItems(this.newTags,TagMode.PERSONAL,this.tagEditList);if(!keepEdits){this.tagEditArea.value="";}}if(this.pubTagEditArea!=null){this.updateEditAreaItems(this.newPublicTags,TagMode.PUBLIC,this.pubTagEditList);if(!keepEdits){this.pubTagEditArea.value="";}}};TagHeader.updateEditAreaItems=function(tags,mode,editList){if(tags.length==0){editList.innerHTML=LC.getLabel("TagHeader","no_tags");}else{var content="";for(var i=0;i<tags.length;i++){if(tags[i]){if(content.length>0){content+=", ";}content+="<span class='tag'>"+tags[i]+" [ <span class='tagRemove' onclick='javascript:TagHeader.remove(\""+mode+'", '+i+")' title='"+LC.getLabel("TagHeader","remove_tag",tags[i])+"'>X</span> ]</span>";}}editList.innerHTML=content;}};TagHeader.updateHiddenTags=function(tags,element){if(element!=null){var content=tags.join(", ");element.value=content;}};TagHeader.getTags=function(element){if(element!=null){var tagList=element.value.split(",");var trimmedList=[];for(var i=0;i<tagList.length;i++){var t=trim(tagList[i]);if(t.length>0){trimmedList.push(t);}}return trimmedList;}else{return new Array();}};TagHeader.moveCursorToEndIE=function(element){if(XBrowser.userAgent.isIE){var tr=document.selection.createRange().duplicate();tr.moveToElementText(element);tr.setEndPoint("StartToEnd",tr);tr.select();}};
