
var defaultProductResourceMap={
"Vdr.Favorites.NotSignedIn":"<b>We're sorry...</b><br>You need to register before using My Favorites. You can either<strong>sign in</strong>to a previously saved profile,or click<strong>My Account</strong>to create your own user profile now.","Vdr.ModelSave.NotSignedIn":"In order to save your model for later use,you need to create a profile.<br><br>Do you want to go to the profile creation page?","MSG_AUTHENTICATION":"<b>We're sorry...</b><br>You need to authenticate yourself before using My Favorites. Please<strong>sign in</strong>using your profile.","Vdr.Favorites.NoFavoriteItems":"There are currently no saved items in My Favorites.","Vdr.Favorites.NoFavoriteOutfits":"There are currently no saved outfits in My Favorites.","Vdr.Favorites.AddToFavoritesFromExternalSuccess":"This item/room has been saved to My Favorites.","Vdr.Favorites.confirmDeleteItem":"Are you sure you want to delete this item from your favorites?","Vdr.Favorites.confirmDeleteOutfit":"Are you sure you want to delete this outfit from your favorites?","Vdr.Category.Empty":"No items are available in this category","Questionnaire.Field.SigninName.Label":"USERNAME","Questionnaire.Field.Password.Label":"PASSWORD","Questionnaire.Field.RetypePassword.Label":"RETYPE PASSWORD","Questionnaire.Field.RememberMe.Label":"","Questionnaire.Field.HintQuestion.Label":"HINT QUESTION","Questionnaire.Field.HintAnswer.Label":"HINT ANSWER","Questionnaire.Field.Email.Label":"E-MAIL ADDRESS","Questionnaire.Field.PCode.Label":"ZIP CODE","Questionnaire.Field.NewsletterRetailer.Label":"","Questionnaire.Field.NewsLetter.Label":"","Questionnaire.ErrorMessage.InvalidField":"Please review the answers beside the red stars below: ","Questionnaire.ErrorMessage.InvalidLength":"Your answer must be between @minLength@ and @maxLength@ character(s).","Questionnaire.ErrorMessage.InvalidMinLength":"Your answer must be at least @minLength@ character(s)long.","Questionnaire.ErrorMessage.InvalidMaxLength":"Your answer must be at most @maxLength@ character(s)long.","Questionnaire.ErrorMessage.Required":"Your answer is required.","Questionnaire.ErrorMessage.InvalidCharacters":"Your answer contains invalid characters.","Questionnaire.ErrorMessage.InvalidEmail":"Your answer is not a valid e-mail address.","Questionnaire.ErrorMessage.InvalidNumeric":"Your answer is not a valid numeric value.","Questionnaire.ErrorMessage.InvalidRange":"Please type a number between [$('@measurementSystem@'=='METRIC'?parseInt(@minValue@)*parseInt(@imperialToMetricConversionConstant@):@minValue@)$] and [$('@measurementSystem@'=='METRIC'?parseInt(@maxValue@)*parseInt(@imperialToMetricConversionConstant@):@maxValue@)$] @units@.","Questionnaire.ErrorMessage.InvalidMinRange":"Please type a number greater than @minValue@.","Questionnaire.ErrorMessage.InvalidMaxRange":"Please type a number less than @maxValue@.","Questionnaire.ErrorMessage.PasswordDontMatch":"Your passwords do not match.","Questionnaire.ErrorMessage.BustOrBraRequired":"Please,provide either your bust measurement or bra size.","Questionnaire.ErrorMessage.BmiReajusted":"We readjusted your weight to meet our minimum BMI(Body Mass Index).","Questionnaire.Field.PleaseSelectOne":"Please select one","Profile.Delete.Confirmation":"Are you sure you wish to delete your profile?","Profile.Create.Confirmaton":"Your profile was created successfully.","Signin.ForgotPassword.UsernameRequired":"In order to reset your password,please enter your username first.","Signin.RememberMeCookie.RemoveAtSignout":"Do you wish to be remembered next time you visit a My Virtual Model affiliated site?","History.RemovedItems.Explanation":"One or many items were removed and put in the History list.","ECard.confirmation":"Your message is on its way!","HelpTechnicalSupport.confirmation":"Your message is on its way.<br><br>We will answer as soon as possible.","missingAnswersMobilityCase":"Your model was automatically updated to use this site. Please update your model.","Model.removeIncompatibleItems":"Some items no longer compatible with your model have been removed.","cookiesNotSupported":"Sorry,You must enable cookies before using this service. Please,set your Security and Privacy preferences to Medium(Default settings).","Fit.Rating.Loading":"Calculating Fit Rating... Please wait","MyContent.Delete.Confirmation":"Are you sure you wish to delete this content?","MyContent.ContentDeleted":"Your content has been successfully deleted.","MyContent.Context.LimitPerImageReached":"Sorry,you've already reached the limit of context per image","MyContent.Upload.Unsupported":"Sorry,this media file is not supported."
,"IDTP-01023":"This username is already registered. Please type in a different username.","IDTP-02003":"Invalid username and password combination. Please,try again.<br><br>Note: Make sure to use the same capitalization as saved in your profile."
,"FS-01006":"User authentication failed. Please,try again.<br><br>Note: Make sure to use the same capitalization as saved in your profile.","IDTP-01021":"User authentication failed. Please,try again.<br><br>Note: Make sure to use the same capitalization as saved in your profile.","BUSINESS DELEGATE.UnexpectedError":"Sorry...<br><br>An unexpected error has occured. Please try again later.","couldNotFindMappingForExternalTryOn":"Sorry...<br><br>The selected item is not found.","noGarmentFoundError":"Sorry...<br><br>The selected item is not found.","MFP-01003":"This outfit already exists in your favorites","MFP-01002":"This item already exists in your favorites","fileSizeTooBig":"The media you attempted to upload is too big. Please resize or compress your file to a maximum of 1 Megabyte","invalidImageFormat":"Unsupported file format. Please use a compatible file format as JPEG,PNG","userNotSignedIn":"You need to be signed in with your My Virtual ID to use this feature.","noEnoughFreeSpace":"You have used all your available free space for your account. Please remove un-needed media or content,and start again","requestInvalid":"Unable to process this request. Please try again later."
,"ModelQuestionnaireUnitSuffixMap":{"IMPERIAL":{"major":"feet","minor":"inches"},"IMPERIALSTONES":{"major":"feet","minor":"inches"},"METRIC":{"major":"m","minor":"cm"}}
,"FudgeFactorAnswers":[4900,4901,4902],"AgeGroupAnswers":[2512,2511],"EyeShapeAnswers":[2212,2211],"NoseShapeAnswers":[2802,2801],"LipShapeAnswers":[2901,2902]
,"WomenEthnicAnswers":[1451,1455,1454,1450,1453,1452],"WomenBodyShapeAnswers":[2813,2812,2811],"WomenBustCupAnswers":{"811":"small-medium","812":"medium-large"},"WomenWaistShapeAnswers":{"512":"undefined","511":"well-defined"},"WomenHairColorAnswers":[2012,2016,2013,2015,2011,2014],"WomenHairStyleAnswers":[2115,2112,2111,2127,2128,2124,2123,2122,2120,2119,2118,2116],"WomenHairStyle_F_40Answers":[2115,2114,2112,2111,2124,2123,2122,2121,2120,2119,2118,2116],"WomenHeightAnswers":{"IMPERIAL":{"3529":"4' 10&quot;or less","3511":"4' 11&quot;","3512":"5'","3513":"5' 1&quot;","3514":"5' 2&quot;","3515":"5' 3&quot;","3516":"5' 4&quot;","3517":"5' 5&quot;","3518":"5' 6&quot;","3519":"5' 7&quot;","3520":"5' 8&quot;","3521":"5' 9&quot;","3522":"5' 10&quot;","3523":"5' 11&quot;","3524":"6'","3525":"6' 1&quot;","3526":"6' 2&quot;","3527":"6' 3&quot;","3528":"6' 4&quot;and up"},"IMPERIALSTONES":{"3529":"4' 10&quot;or less","3511":"4' 11&quot;","3512":"5'","3513":"5' 1&quot;","3514":"5' 2&quot;","3515":"5' 3&quot;","3516":"5' 4&quot;","3517":"5' 5&quot;","3518":"5' 6&quot;","3519":"5' 7&quot;","3520":"5' 8&quot;","3521":"5' 9&quot;","3522":"5' 10&quot;","3523":"5' 11&quot;","3524":"6'","3525":"6' 1&quot;","3526":"6' 2&quot;","3527":"6' 3&quot;","3528":"6' 4&quot;and up"},"METRIC":{"3529":"1,47 m or less","3511":"1,49 or 1,51 m","3512":"1,53 m","3513":"1,55 m","3514":"1,57 m","3515":"1,59 or 1,61 m","3516":"1,63 m","3517":"1,65 m","3518":"1,67 or 1,69 m","3519":"1,71 m","3520":"1,73 m","3521":"1,75 m","3522":"1,77 or 1,79 m","3523":"1,81 m","3524":"1,83 m","3525":"1,85 m","3526":"1,87 or 1,89 m","3527":"1,91 m","3528":"1,93 m or more"}}
,"MenEthnicAnswers":[1451,1450,1453,1452],"MenBeardStyleAnswers":[3001,3002,3003,3004],"MenBeardColorAnswers":[3102,3106,3103,3105,3101,3104],"MenSideViewShapeAnswers":[4311,4312],"MenBuildAnswers":{"5101":"Regular","5102":"Muscular"},"MenShoulderWidthAnswers":{"311":"Narrower","312":"Broader"},"MenHairColorAnswers":[2012,2016,2013,2015,2011,2014],"MenHairStyleAnswers":[2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,2142],"MenHairStyle_M_30Answers":[2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,2142],"MenHeightAnswers":{"IMPERIAL":{"3529":"4' 10&quot;or less","3511":"4' 11&quot;","3512":"5'","3513":"5' 1&quot;","3514":"5' 2&quot;","3515":"5' 3&quot;","3516":"5' 4&quot;","3517":"5' 5&quot;","3518":"5' 6&quot;","3519":"5' 7&quot;","3520":"5' 8&quot;","3521":"5' 9&quot;","3522":"5' 10&quot;","3523":"5' 11&quot;","3524":"6'","3525":"6' 1&quot;","3526":"6' 2&quot;","3527":"6' 3&quot;","3528":"6' 4&quot;and up"},"IMPERIALSTONES":{"3529":"4' 10&quot;or less","3511":"4' 11&quot;","3512":"5'","3513":"5' 1&quot;","3514":"5' 2&quot;","3515":"5' 3&quot;","3516":"5' 4&quot;","3517":"5' 5&quot;","3518":"5' 6&quot;","3519":"5' 7&quot;","3520":"5' 8&quot;","3521":"5' 9&quot;","3522":"5' 10&quot;","3523":"5' 11&quot;","3524":"6'","3525":"6' 1&quot;","3526":"6' 2&quot;","3527":"6' 3&quot;","3528":"6' 4&quot;and up"},"METRIC":{"3529":"1,47 m or less","3511":"1,49 or 1,51 m","3512":"1,53 m","3513":"1,55 m","3514":"1,57 m","3515":"1,59 or 1,61 m","3516":"1,63 m","3517":"1,65 m","3518":"1,67 or 1,69 m","3519":"1,71 m","3520":"1,73 m","3521":"1,75 m","3522":"1,77 or 1,79 m","3523":"1,81 m","3524":"1,83 m","3525":"1,85 m","3526":"1,87 or 1,89 m","3527":"1,91 m","3528":"1,93 m or more"}}
,"WomenBraSizeAnswers":{"IMPERIAL":{"30.0":"30AA","30.1":"30A","32.0":"32AA","32.1":"32A","32.2":"32B","32.3":"32C","34.1":"34A","34.2":"34B","34.3":"34C","34.4":"34D","34.5":"34DD","36.1":"36A","36.2":"36B","36.3":"36C","36.4":"36D","36.5":"36DD","36.6":"36E","36.7":"36F","36.8":"36H","38.2":"38B","38.3":"38C","38.4":"38D","38.5":"38DD","38.6":"38E","38.7":"38F","38.8":"38G","38.9":"38H","40.2":"40B","40.2":"40B","40.3":"40C","40.4":"40D","40.5":"40DD","40.6":"40E","40.7":"40F","40.8":"40G","40.9":"40H","40.10":"40I","42.2":"42B","42.3":"42C","42.4":"42D","42.5":"42DD","42.6":"42E","42.7":"42F","42.8":"42G","42.9":"42H","42.10":"42I","44.2":"44B","44.3":"44C","44.4":"44D","44.5":"44DD","44.6":"44E","44.7":"44F","44.8":"44G","44.9":"44H","44.10":"44I","46.2":"46B","46.3":"46C","46.4":"46D","46.5":"46DD","46.6":"46E","46.7":"46F","46.8":"46G","46.9":"46H","46.10":"46I","48.2":"48B","48.3":"48C","48.4":"48D","48.5":"48DD","48.6":"48E","48.7":"48F","48.8":"48G","48.9":"48H","48.10":"48I","50.2":"50B","50.3":"50C","50.4":"50D","50.5":"50DD","50.6":"50E","50.7":"50F","50.8":"50G","50.9":"50H","50.10":"50I","52.2":"52B","52.3":"52C","52.4":"52D","52.5":"52DD","52.6":"52E","52.7":"52F","52.8":"52G","52.9":"52H","52.10":"52I"},"IMPERIALSTONES":{"30.0":"30AA","30.1":"30A","32.0":"32AA","32.1":"32A","32.2":"32B","32.3":"32C","34.1":"34A","34.2":"34B","34.3":"34C","34.4":"34D","34.5":"34DD","36.1":"36A","36.2":"36B","36.3":"36C","36.4":"36D","36.5":"36DD","36.6":"36E","36.7":"36F","36.8":"36H","38.2":"38B","38.3":"38C","38.4":"38D","38.5":"38DD","38.6":"38E","38.7":"38F","38.8":"38G","38.9":"38H","40.2":"40B","40.2":"40B","40.3":"40C","40.4":"40D","40.5":"40DD","40.6":"40E","40.7":"40F","40.8":"40G","40.9":"40H","40.10":"40I","42.2":"42B","42.3":"42C","42.4":"42D","42.5":"42DD","42.6":"42E","42.7":"42F","42.8":"42G","42.9":"42H","42.10":"42I","44.2":"44B","44.3":"44C","44.4":"44D","44.5":"44DD","44.6":"44E","44.7":"44F","44.8":"44G","44.9":"44H","44.10":"44I","46.2":"46B","46.3":"46C","46.4":"46D","46.5":"46DD","46.6":"46E","46.7":"46F","46.8":"46G","46.9":"46H","46.10":"46I","48.2":"48B","48.3":"48C","48.4":"48D","48.5":"48DD","48.6":"48E","48.7":"48F","48.8":"48G","48.9":"48H","48.10":"48I","50.2":"50B","50.3":"50C","50.4":"50D","50.5":"50DD","50.6":"50E","50.7":"50F","50.8":"50G","50.9":"50H","50.10":"50I","52.2":"52B","52.3":"52C","52.4":"52D","52.5":"52DD","52.6":"52E","52.7":"52F","52.8":"52G","52.9":"52H","52.10":"52I"},"METRIC":{"30.0":"65AA","30.1":"65A","32.0":"70AA","32.1":"70A","32.2":"70B","32.3":"70C","34.1":"75A","34.2":"75B","34.3":"75C","34.4":"75D","34.5":"75DD","36.1":"80A","36.2":"80B","36.3":"80C","36.4":"80D","36.5":"80DD","36.6":"80E","36.7":"80F","36.8":"80H","38.2":"85B","38.3":"85C","38.4":"85D","38.5":"85DD","38.6":"85E","38.7":"85F","38.8":"85G","38.9":"85H","40.2":"90B","40.2":"90B","40.3":"90C","40.4":"90D","40.5":"90DD","40.6":"90E","40.7":"90F","40.8":"90G","40.9":"90H","40.10":"90I","42.2":"95B","42.3":"95C","42.4":"95D","42.5":"95DD","42.6":"95E","42.7":"95F","42.8":"95G","42.9":"95H","42.10":"95I","44.2":"100B","44.3":"100C","44.4":"100D","44.5":"100DD","44.6":"100E","44.7":"100F","44.8":"100G","44.9":"100H","44.10":"100I","46.2":"105B","46.3":"105C","46.4":"105D","46.5":"105DD","46.6":"105E","46.7":"105F","46.8":"105G","46.9":"105H","46.10":"105I","48.2":"110B","48.3":"110C","48.4":"110D","48.5":"110DD","48.6":"110E","48.7":"110F","48.8":"110G","48.9":"110H","48.10":"110I","50.2":"115B","50.3":"115C","50.4":"115D","50.5":"115DD","50.6":"115E","50.7":"115F","50.8":"115G","50.9":"115H","50.10":"115I","52.2":"120B","52.3":"120C","52.4":"120D","52.5":"120DD","52.6":"120E","52.7":"120F","52.8":"120G","52.9":"120H","52.10":"120I"},"fr_FR":{"30.0":"80AA","30.1":"80A","32.0":"85AA","32.1":"85A","32.2":"85B","32.3":"85C","34.1":"90A","34.2":"90B","34.3":"90C","34.4":"90D","34.5":"90DD","36.1":"95A","36.2":"95B","36.3":"95C","36.4":"95D","36.5":"95DD","36.6":"95E","36.7":"95F","36.8":"95H","38.2":"100B","38.3":"100C","38.4":"100D","38.5":"100DD","38.6":"100E","38.7":"100F","38.8":"100G","38.9":"100H","40.2":"105B","40.2":"105B","40.3":"105C","40.4":"105D","40.5":"105DD","40.6":"105E","40.7":"105F","40.8":"105G","40.9":"105H","40.10":"105I","42.2":"110B","42.3":"110C","42.4":"110D","42.5":"110DD","42.6":"110E","42.7":"110F","42.8":"110G","42.9":"110H","42.10":"110I","44.2":"115B","44.3":"115C","44.4":"115D","44.5":"115DD","44.6":"115E","44.7":"115F","44.8":"115G","44.9":"115H","44.10":"115I","46.2":"46B","46.3":"46C","46.4":"46D","46.5":"46DD","46.6":"46E","46.7":"46F","46.8":"46G","46.9":"46H","46.10":"46I","48.2":"120B","48.3":"120C","48.4":"120D","48.5":"120DD","48.6":"120E","48.7":"120F","48.8":"120G","48.9":"120H","48.10":"120I","50.2":"125B","50.3":"125C","50.4":"125D","50.5":"125DD","50.6":"125E","50.7":"125F","50.8":"125G","50.9":"125H","50.10":"125I","52.2":"130B","52.3":"130C","52.4":"130D","52.5":"130DD","52.6":"130E","52.7":"130F","52.8":"130G","52.9":"130H","52.10":"130I"}}
,"WomenBreastShapeAnswers":{1:"Shallow",2:"Average",3:"Full"}
,"MeasurementSuffix":{"IMPERIAL":"inches","IMPERIALSTONES":"inches","METRIC":"cm"}
,"WeightSuffix":{"IMPERIAL":"pounds","IMPERIALSTONES":"stones|pounds","METRIC":"kg"}
,"BirthYearSuffix":{"IMPERIAL":"years","IMPERIALSTONES":"years","METRIC":"years"}
,"HintQuestions":{"712":"Favorite animal?","711":"Mother's maiden name?","719":"Favorite movie?","718":"Childhood hero?","717":"Make of first car/bike?","716":"Favorite teacher?","715":"Best friend's name?","714":"Place of birth?","713":"Favorite restaurant?"}
,"WorkspaceProperties":{"fatalErrorCodes":"FS-01001,MVM-00001,MVM-01001,FS-01015","isDisplaySplash":true,"libServerUrl":""}
,"ControllerSelection":{"Items":"ItemCacheController","ModelAppearance":"ModelAppearanceController","ModelQuestionnaire":"ModelQuestionnaireController","Model":"ModelController","OnMyModel":"OnMyModelController","ModelMap":"ModelMapController","Catalog":"CatalogDropdownController","CatalogFilter":"FilterController","CatalogCategory":"CatalogCategoryController","RoomConfig":"RoomConfigController","Favorites":"FavoritesController","ModelView":"ModelViewController","RemovedItemHistory":"RemovedItemHistoryController","FitQuestionnaire":"FitQuestionnaireController","SigninQuestionnaire":"SigninQuestionnaireController","ProfileQuestionnaire":"ProfileQuestionnaireController","ECard":"ECardController","FitTag":"FitRatingController","FitDetails":"FitRatingController","Help":"HelpController","Remote":"RemoteController","StorageSolutions":"StorageSolutionsController","Media":"MediaController","FaceMapping":"FaceMappingController","Tracer":"TracerController","ColorShift":"ColorShiftController","ColorAdjust":"ColorAdjustController","MoveResize":"MoveResizeController","MyContent":"MyContentController","Crop":"CropController","DragDrop":"DragDropController","Overlay":"OverlayController","Tracker":"TrackerController","CameraControl":"CameraController","UnitTest":"UnitTestController"}
,"ClassDependency":{"CatalogDropdownController":"CatalogController","CatalogStickController":"CatalogController","FilterPopupController":"FilterController","RoomConfigController":"ConfigController","RemovedItemHistoryController":"HistoryController","FitQuestionnaireController":"QuestionnaireController","ProfileQuestionnaireController":"QuestionnaireController","SigninQuestionnaireController":"QuestionnaireController","ModelQuestionnaireController":"QuestionnaireController","ECardController":"QuestionnaireController","HelpController":"QuestionnaireController","MyContentController":"MediaController,DragDropController","FaceMappingController":"WizardController","OverlayController":"WizardController","VisualSearchController":"ViewportController"}
,"ControllerInitOrder":[
"Items","Remote","ModelAppearance","ModelQuestionnaire","Model"
]
,"ModelProperties":{"viewId":1,"viewCount":{"0":6},"compositorAlgorithm":"1","compositorQuality":"090","compositorMapVersion":"2","isZoomFeatureEnabled":false,"defaultBackgroundImageArray":[],"layoutId":0,"isRestoreWornGarmentsFromCookie":false,"defaultImageSource":"SMALL_IMAGE","imageWidth":450,"imageHeight":360,"largeImageWidth":900,"largeImageHeight":720,"layoutIdArray":[0],"isAutomaticBestView":false,"zoomFactor":2,"alternateItemAutoTryon":true,"compositorBrightness":"","compositorContrast":"","compositorGamma":"","isFadedImageChange":false,"defaultType":"","drMode":"","isDisplayMouseOverCallout":true,"isDisplayMouseDownCallout":true}
,"ModelViewProperties":{}
,"ModelMapProperties":{"multiplePolygonColors":["cyan","red","blue","yellow","green","cyan","red","blue","yellow","green","cyan","red","blue","yellow","green","cyan","red","blue","yellow","green"]}
,"CatalogProperties":{"elementId":"CatalogPanel","categoryElementId":"sectionSelectAnItemCategories","isDisplayOutfits":true,"isDisplayItems":true,"isOpenDefaultCategoryAtStartup":false,"isRemoveIncompatibleItems":true,"thumbnailPrefix":"","thumbnailSuffix":""}
,"CatalogCategoryProperties":{"rootCategoryId":""}
,"OnMyModelProperties":{"thumbnailPrefix":"","thumbnailSuffix":"","swatchUrl":"","isRemoveIncompatibleItems":false,"isGetCommonColors":true,"buyOutfitUrlTemplate":"/buyoutfit?sid=[$Workspace.query.sid$][FOR_EACH(OnMyModel.wornGarmentMap)$&param1=@CLIENT_DATA/0/PARAM1@&param2=@CLIENT_DATA/0/PARAM2@&param3=@CLIENT_DATA/0/PARAM3@$FOR_EACH(OnMyModel.wornGarmentMap)]"}
,"FavoritesProperties":{"thumbnailPrefix":"","thumbnailSuffix":"","outfitThumbnailWidth":"280","outfitThumbnailHeight":"224","isRemoveIncompatibleItems":false}
,"ModelQuestionnaireProperties":{
"defaultAnswersMap":{"F":{"Ethnic":"1450","FudgeFactor":"4901","BodyShape":"2811","NoseShape":"2801","WeightNum":"144","BustCup":"812","LipShape":"2902","HairStyle_F_40":"2123","WaistShape":"511","VMName":"Default Women Model","HairColor":"2015","AgeGroup":"2512","EyeShape":"2211","Height":"3518"},"M":{"HairStyle_M_30":"2132","BeardColor":"3105","EyeShape":"2211","Ethnic":"1450","Build":"5101","NoseShape":"2802","WeightNum":"205","LipShape":"2901","Height":"3521","ShoulderWidth":"311","SideViewShape":"4312","VMName":"Default Men Model","FudgeFactor":"4902","HairColor":"2015","BeardStyle":"3002","AgeGroup":"2511"}}
,"appearanceAdjustment":{"F":{"REG":{"WeightNum":"166","Height":"3519","FudgeFactor":"4901"},"XR":{"WeightNum":"220","Height":"3519","FudgeFactor":"4901"}},"M":{"REG":{"WeightNum":"166","Height":"3519","FudgeFactor":"4901"},"XR":{"WeightNum":"220","Height":"3519","FudgeFactor":"4901"}}}
,"categoryBasedAppearance":{"F":{},"M":{}},"isRestoreAppearanceFromCookie":false,"heightMappedBMIArray":{"3529":"147","3511":"151","3512":"153","3513":"155","3514":"157","3515":"159","3516":"163","3517":"165","3518":"167","3519":"169","3520":"173","3521":"175","3522":"177","3523":"181","3524":"183","3525":"185","3526":"187","3527":"191","3528":"193"},"MIN_BMI_VALUE":18}
,"ModelAppearanceProperties":{"isEnabled":false,"specialCategoryIDArray":{}}
,"MyContentProperties":{"maxContextPerImage":5
}
,"FitQuestionnaireProperties":{"defaultAnswersMap":{"F":{"BustNum":"","ThighNum":"","HipsNum":"","TorsoNum":"","BraSize":""
,"WaistNum":"","InseamNum":"","HeightNum":"","BirthyearNum":"","CupSize":""},"M":{"NeckNum":"","ThighNum":"","ChestNum":"","WaistbandNum":"","InseamNum":"","SleeveLengthNum":"","HeightNum":"","BirthyearNum":"","SeatNum":""}},"isAutomaticModelUpdate":true}
,"ProfileQuestionnaireProperties":{"retailerNewsletterRegisterUrl":"/server?action=register&email=@Email@","retailerNewsletterUnregisterUrl":"/server?action=unregister&email=@Email@","defaultAnswersMap":{"SigninName":"","HintQuestion":"","Password":"","HintAnswer":"","Email":"","NewsletterRetailer":"false","NewsLetter":"false","PCODE":"","RememberMe":"true","RetypePassword":""}}
,"SigninQuestionnaireProperties":{"onForgotPasswordSuccessful":"Anim.openSingle('sectionSaveOptions');Anim.openAndClose('ProfileQuestionnairePanel');"}
,"ECardProperties":{"mailServerSenderAdress":"noreply@mvm.com","defaultAnswersMap":{"senderName":"Product User","senderEmail":"product@mvm.com","recipientEmail1":"mbeauchemin@mvm.com","recipientEmail2":"","recipientEmail3":"","subject":"MVMSE Product ECard","message":"Wow this is  really great!Take a look at me wohoo!!!![$ typeof(ModelQuestionnaire)!='undefined'&&ModelQuestionnaire.getAnswersMap()!=undefined?\"I'm \"+ModelQuestionnaire.getAnswersMap()[\"VMName\"]:'' $]","confirmationMessage":"Your model has been sent to your friend. Thank you. [$ typeof(ModelQuestionnaire)!='undefined'&&ModelQuestionnaire.getAnswersMap()!=undefined?\"I'm \"+ModelQuestionnaire.getAnswersMap()[\"VMName\"]:'' $]"},"pickupLink":""}
,"HelpProperties":{"defaultAnswersMap":{"HelpSenderEmail":"","HelpMessage":""}}
,"FitTagProperties":{"isEnabled":true,"isDisplayOnExternalFitDetails":false}
,"FitDetailsProperties":{"isEnabled":false,"isDisplayOnExternalFitDetails":true}
,"StateProperties":{"keyPrefix":{"default":"[$Workspace.retailerCode$].[$Workspace.population$].[$Workspace.skin$].","appearance":"[$Workspace.retailerCode$].[$Workspace.population$]."}}
,"Workspace.messageProperties":{"calloutAttributes":{"templateId":"calloutTemplate","popupImageTopRight":"/images/pop_more_info_top_right.gif","popupImageTopLeft":"/images/pop_more_info_top_left.gif","popupImageBottomLeft":"/images/pop_more_info_bottom_left.gif","popupImageBottomRight":"/images/pop_more_info_bottom_right.gif"},"messageAttributes":{"message": "Default message for messages!","templateId":"messageTemplate","containerSpace":"pageLayout","top":0,"left":0,"width":240,"height":210,"duration":0,"isForcedTopLeft":false,"isClosableOnClick":true,"popupBackground":"/images/pop_standard_message.gif"},"customAttributes":{"modelInfoPopup":{"templateId":"CalloutTemplate"}}}
,"Workspace.sessionProperties":{}
,"FaceMappingProperties":{
"stepControllers":[
"Crop","Tracer","MoveResize"
,"ColorAdjust"
]
,"stepCalls":[
"FaceMapping.stepStart()","FaceMapping.stepCrop()","FaceMapping.stepTracer()","FaceMapping.stepMoveResize()"
,"FaceMapping.stepColorAdjust()","FaceMapping.stepPreview()","FaceMapping.stepPublish()"
]}
,"OverlayProperties":{"stepControllers":[],"stepCalls":[
"Overlay.stepStart()","Overlay.stepPublish()"
]}
,"CameraControlProperties":{}
,"TIMEOUT_URL":"/errors/timeout.html"}
var globalResourceMap=undefined;var environmentConfigMap=undefined;
var Model=undefined;var ModelView=undefined;var ModelAppearance=undefined;var Catalog=undefined;var CatalogFilter=undefined;var CatalogCategory=undefined;var OnMyModel=undefined;var MyHome=undefined;var RoomConfig=undefined;var Favorites=undefined;var ModelQuestionnaire=undefined;var FitQuestionnaire=undefined;var ProfileQuestionnaire=undefined;var SigninQuestionnaire=undefined;var FitTag=undefined;var FitDetails=undefined;var Scene7=undefined;var ItemHistory=undefined;var RemovedItemHistory=undefined;var StorageSolutions=undefined;var ECard=undefined;var Help=undefined;var Tracer=undefined;var MoveResize=undefined;var Crop=undefined;var ColorShift=undefined;var ColorAdjust=undefined;var Media=undefined;var MyContent=undefined;var FaceMapping=undefined;var DragDrop=undefined;var Overlay=undefined;var Tracker=undefined;var CameraControl=undefined;var UnitTest=undefined;/*
* Library functions used in the application where a naming convention is involved. If the naming convention 
* changes,modifications can be made at only one place in the client layer
*/
/*
* Constructs a geometryKey from a geometryName and a transformation matrix of 16 floats
* @paramStringThe name of the geometry
* @paramArrayAn array of float representing a 
*/
function constructGeometryKey(name,transform){
var key="";var tempValueString="";var nbAfterDot=0;
key+=name;
for(index in transform){
tempValueString=""+(Math.round(transform[index] * 1000))/ 1000.00;
if(tempValueString.indexOf(".")>-1){
nbAfterDot=tempValueString.substring(tempValueString.indexOf(".")).length-1;
if(nbAfterDot>1){tempValueString=tempValueString.substring(0,tempValueString.indexOf(".")+3);}else if(nbAfterDot==1){tempValueString=tempValueString.substring(0,tempValueString.indexOf(".")+2)+"0";}}else{tempValueString+=".00"}
key+="_"+tempValueString;}
return key;}
function constructGeometryName(itemId,colourId,state){
state=state==undefined||state==null?"" : state;
if(state==""){return itemId+"_"+colourId;}
else{return itemId+"_"+colourId+"_"+state;}}
function convertMapToArray(pMap){var newArray=new Array();
for(var anItem in pMap){newArray[newArray.length]=[anItem,decodeURIComponent(pMap[anItem])];}
return newArray;}
function replaceString(pSourceString,pLookupString,pReplaceString){
var splittedString=pSourceString.split(pLookupString);var finalString="";
for(var i=0;i<splittedString.length;i++){
finalString+=splittedString[i];
if(i<splittedString.length-1){finalString+=pReplaceString;}}
return finalString;}
function getLineBreaks(pString){var lineBreaksCount=1;var length=pString.length;for(var i=0;i<length;i++){if(pString.charAt(i)=="\r"){lineBreaksCount++;}}
return lineBreaksCount;}
function getPatchedUrl(url,prefix,suffix){
var finalUrl="";
if(url.indexOf(".gif")>-1){finalUrl=prefix+url.split(".gif")[0]+suffix+".gif";}else if(url.indexOf(".jpg")>-1){finalUrl=prefix+url.split(".jpg")[0]+suffix+".jpg";}else if(url.indexOf(".png")>-1){finalUrl=prefix+url.split(".png")[0]+suffix+".png";}else{finalUrl=prefix+url+suffix;}
return finalUrl;}
function getQuery(){
var url=location.href;var tmpArray=new Array();var query=new Object();
if(url.indexOf("?")>0){tmpArray=url.split("?")[1].split("&");
for(var i=0;i<tmpArray.length;i++){eval("query."+tmpArray[i].split("=")[0]+"=tmpArray[i].split('=')[1]");}}
return query;}
function formatColorCode(pColorCode){var colorLength=pColorCode.length;var prefix="";
for(i=colorLength;i<6;i++){prefix+="0";}
return prefix+pColorCode;}
function formatFloat(number,places){var shift=1;var j;for(j=0;j<places;j++)
shift=(shift * 10);number=Math.round(number * shift);number=number/shift;return number;}
function setNumberDecimals(number,nbDecimals,decimalSign){
if(isNaN(number)){number=0;}
nbDecimals=nbDecimals||2;decimalSign=decimalSign||".";var strNumber=""+number;
var decimalIndex=strNumber.indexOf(decimalSign);
if(decimalIndex==-1){strNumber+=decimalSign;for(i=0,j=nbDecimals;i<j;i++){strNumber+="0";}
return strNumber;}
var currentDecimalsNb=strNumber.length-(decimalIndex+1);
if(currentDecimalsNb==nbDecimals){return strNumber;}
if(currentDecimalsNb<nbDecimals){for(i=currentDecimalsNb,j=nbDecimals;i<j;i++){strNumber+="0";}
return strNumber;}
var extraDecimals=currentDecimalsNb-nbDecimals;return strNumber.substring(0,(strNumber.length-extraDecimals));}
function meas_type(strInput){var measType1=/(^[ ]*\d+(([ ]+\d+(\.\d+)?\/\d+(\.\d+)?)|(\.\d+([ ]+\d+(\.\d+)?\/\d+(\.\d+)?)?))?[ ]*$)/;var measType2=/(^[ ]*\d+\/\d+[ ]*$)/;var measType3=/(^[ ]*\.\d+([ ]+\d+(\.\d+)?\/\d+(\.\d+)?)?)[ ]*$/;var measType4=/(^[ ]*$)/;var measType5=/(^[ ]*\d+(\.\d+)?[ ]*['][ ]*((\d+(([ ]+\d+(\.\d+)?\/\d+(\.\d+)?)|(\.\d+([ ]+\d+(\.\d+)?\/\d+(\.\d+)?)?))?)|(\.\d+([ ]+\d+(\.\d+)?\/\d+(\.\d+)?)?)|((\d+(\.\d+)?\/\d+(\.\d+)?)?))[ ]*$)/;
if(measType1.test(strInput))
return(1);else if(measType2.test(strInput))
return(1);else if(measType3.test(strInput))
return(1);else if(measType4.test(strInput))
return(1);else if(measType5.test(strInput))
return(2);else
return(-1);}
function fractToStr(fractStr){var parseArray
parseArray=fractStr.split("/");
if(parseFloat(parseArray[1])!=0)
return(parseFloat(parseArray[0])/parseFloat(parseArray[1]));else{return(-1);}}
function convertFractToDecimal(strInput){
var parseStr;var parseArray;var fractVal;var returnVal;var i;
switch(meas_type(strInput)){case 1:
parseStr=new String(trim(strInput));parseArray=parseStr.split(/[ ]+/);
for(i=0;i<parseArray.length;i++){parseArray[i]=trim(parseArray[i]);}
if(parseArray.length==1){if(parseArray[0]!=""){var fractParse;fractParse=parseArray[0].split("/");if(fractParse.length==1){return formatFloat(parseFloat(parseArray[0]),3);}else{fractVal=fractToStr(parseArray[0]);if(fractVal!=-1){return formatFloat(fractVal,3);}else{return(NaN);}}}else{return "";}}
else{fractVal=fractToStr(parseArray[1]);if(fractVal!=-1){return formatFloat((parseFloat(parseArray[0])+fractVal),3);}else{return(NaN);}}
break;case 2:
var feetStr;var parseArray2
parseStr=new String(trim(strInput));parseArray=parseStr.split("'");
for(i=0;i<parseArray.length;i++){parseArray[i]=trim(parseArray[i]);}
feetStr=parseFloat(parseArray[0])* 12;parseArray2=parseArray[1].split(/[ ]+/);
for(i=0;i<parseArray2.length;i++){parseArray2[i]=trim(parseArray2[i]);}
if(parseArray2.length==1){var fractParse;fractParse=parseArray2[0].split("/");if(fractParse.length==1){returnVal=formatFloat((feetStr+parseFloat(parseArray2[0])),3);return returnVal;}else{fractVal=fractToStr(parseArray2[0]);if(fractVal!=-1){return formatFloat((feetStr+fractVal),3);}else{return(NaN);}}}
else{fractVal=fractToStr(parseArray2[1]);if(fractVal!=-1){returnVal=formatFloat((feetStr+parseFloat(parseArray2[0])+fractVal),3);return returnVal;}else{return(NaN);}}
break;case-1:
return(NaN);break;}
return(NaN);}
function encodeToUnicode(pText){
var pText=escape(pText);var finaldata="";var i=0;
while(i<pText.length){if(pText.substring(i,i+2)=="%u"){finaldata+="&#"+parseInt(pText.substring(i+2,i+6),16)+";";i=i+5;}else if(pText.substring(i,i+6)=="%0D%0A"){finaldata+="<br>";i=i+5;}else if(pText.substring(i,i+1)=="%"){finaldata+=unescape(pText.substring(i,i+3));i=i+2;}else{finaldata+=pText.charAt(i);}
i=i+1;}
return finaldata;}
function isEmail(myEmail){
return myEmail.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)!=undefined;}
function trim(strText){
strText=strText+"";
while(strText.substring(0,1)==' ')
strText=strText.substring(1,strText.length);
while(strText.substring(strText.length-1,strText.length)==' ')
strText=strText.substring(0,strText.length-1);
return strText;}
function defaultIfEmpty(value,defaultValue){
if(value==undefined||value==null||value==""){value=defaultValue;}
return value;}
function getAbsLeft(pObject){var pObject_Left=pObject.offsetLeft;while(pObject.offsetParent!=null){pObject_Left+=(pObject.offsetParent.offsetLeft-pObject.offsetParent.scrollLeft);pObject=pObject.offsetParent;}
var windowScrollLeft=0
if(typeof(window.pageYOffset)=='number'){windowScrollLeft=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){windowScrollLeft=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){windowScrollLeft=document.documentElement.scrollLeft;}
return pObject_Left+windowScrollLeft;}
function getAbsTop(pObject){var pObject_Top=pObject.offsetTop;while(pObject.offsetParent!=null){pObject_Top+=(pObject.offsetParent.offsetTop-pObject.offsetParent.scrollTop);pObject=pObject.offsetParent;}
var windowScrollTop=0;if(typeof(window.pageYOffset)=='number'){windowScrollTop=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){windowScrollTop=document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){windowScrollTop=document.documentElement.scrollTop;}
return pObject_Top+windowScrollTop;}
function getLeft(pObject){return parseInt(pObject.offsetLeft);}
function getTop(pObject){return parseInt(pObject.offsetTop);}
function getWidth(pObject){var returnValue=0;
if(pObject!=0&&pObject!=undefined){if(pObject.clientWidth!=undefined&&pObject.clientWidth!=0){returnValue=parseInt(pObject.clientWidth);}
else if(pObject.style.width&&pObject.style.width!=""&&pObject.style.width!=0){returnValue=parseInt(pObject.style.width);}
else if(pObject.offsetWidth&&pObject.offsetWidth!=0){returnValue=parseInt(pObject.offsetWidth);}}
return returnValue;}
function getHeight(pObject){var returnValue=0;
if(pObject!=0&&pObject!=undefined){if(pObject.clientHeight!=undefined&&pObject.clientHeight!=0){returnValue=parseInt(pObject.clientHeight);}
else if(pObject.style.height&&pObject.style.height!=""&&pObject.style.height!=0){returnValue=parseInt(pObject.style.height);}
else if(pObject.offsetHeight&&pObject.offsetHeight!=0){returnValue=parseInt(pObject.offsetHeight);}}
return returnValue;}
function setLeft(pObject,pLeft){if(pObject!=0&&pObject!=undefined){pObject.style.left=pLeft+"px";}}
function setTop(pObject,pTop){if(pObject!=0&&pObject!=undefined){pObject.style.top=pTop+"px";}}
function setAbsLeft(pObject,pLeft){if(pObject!=0&&pObject!=undefined){pObject.style.pixelLeft=pLeft+"px";}}
function setAbsTop(pObject,pTop){if(pObject!=0&&pObject!=undefined){pObject.style.pixelTop=pTop+"px";}}
function setWidth(pObject,pWidth){if(pObject!=0&&pObject!=undefined){pObject.style.width=(pWidth>-1?pWidth:0)+"px";}}
function setHeight(pObject,pHeight){if(pObject!=0&&pObject!=undefined){pObject.style.height=(pHeight>-1?pHeight:0)+"px";}}
function getWindowWidth(){return document.body.clientWidth-5;}
function getWindowHeight(){return document.documentElement.clientHeight-5;}
function isDefined(pObject){return(pObject!=undefined&&pObject!=0&&pObject!=""?true : false);}
function setErrorImage(pImgElement,pImagePath){
var currentSrc=pImgElement.src;
var indexInCurrentSrc=currentSrc.lastIndexOf(pImagePath);var differentEnd=((pImagePath.length<=currentSrc.length)&&(indexInCurrentSrc==-1||indexInCurrentSrc!=(currentSrc.length-pImagePath.length)));
if(differentEnd){pImgElement.src=pImagePath;}}
function getElementBoundingBox(element){
return new Array(
getAbsLeft(element),getAbsTop(element),getAbsLeft(element)+getWidth(element),getAbsTop(element)+getHeight(element))}
function addItemToList(pArray,pSelectElement){
pSelectElement.options[pSelectElement.options.length]=new Option(pArray[0],pArray[1]);}
function getElementColumns(itemElementWidth,containerElement){
var columns=1;
if(containerElement!=undefined){var containerWidth=parseInt(containerElement.style.width);
columns=Math.floor(itemElementWidth/containerWidth);}
return columns;}function getMouseState(pEvent){
var pX=0;
var  pY=0;
var mouseState=new Object();mouseState.left=0;mouseState.top=0;mouseState.button=0;
var windowScrollTop=0;if(typeof(window.pageYOffset)=='number'){windowScrollTop=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){windowScrollTop=document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){windowScrollTop=document.documentElement.scrollTop;}
var windowScrollLeft=0
if(typeof(window.pageYOffset)=='number'){windowScrollLeft=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){windowScrollLeft=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){windowScrollLeft=document.documentElement.scrollLeft;}
if(pEvent.pageX!=undefined){mouseState.left=pEvent.pageX+windowScrollLeft;mouseState.top=pEvent.pageY+windowScrollTop;}else{mouseState.left=pEvent.clientX+windowScrollLeft;mouseState.top=pEvent.clientY+windowScrollTop;}
if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){mouseState.button=pEvent.which;}else{mouseState.button=pEvent.button;}}
return mouseState;}
function loopUntil(condition,onComplete,frequency,loopCount){
frequency=(frequency!=undefined?frequency : 500);loopCount=(loopCount!=undefined?loopCount : 0);
if(loopCount>100){
log.error("loopUntil timeout when trying to run: "+condition);}else{
var isConditionMet=false;
try{if(eval(condition)==true){isConditionMet=true;}}catch(e){}
if(isConditionMet){eval(unescape(onComplete));}else{setTimeout("loopUntil(\""+condition+"\",\""+onComplete+"\","+frequency+","+(loopCount++)+")",frequency);}}}
function FieldObject(){}
FieldObject.prototype.FIELD_VALID=0;FieldObject.prototype.FIELD_ERROR_REQUIRED=100;FieldObject.prototype.FIELD_ERROR_INVALID_RANGE=101;FieldObject.prototype.FIELD_ERROR_INVALID_CHARACTERS=102;FieldObject.prototype.FIELD_ERROR_INVALID_EMAIL=103;FieldObject.prototype.FIELD_ERROR_INVALID_LENGTH=104;FieldObject.prototype.FIELD_ERROR_INVALID_NUMERIC=105;FieldObject.prototype.FIELD_ERROR_PASSWORD_DONT_MATCH=106;FieldObject.prototype.FIELD_ERROR_BUST_OR_BRA_REQUIRED=107;FieldObject.prototype.FIELD_DEPENDENCY_NOT_FILLED=108;
FieldObject.prototype.id="FieldObject";FieldObject.prototype.name="";FieldObject.prototype.elementId="";FieldObject.prototype.state=0;FieldObject.prototype.initialValue="";FieldObject.prototype.value="";FieldObject.prototype.normalClass="";FieldObject.prototype.errorClass="";FieldObject.prototype.referenceController=undefined;FieldObject.prototype.isFieldChanged=false;FieldObject.prototype.isRequired=true;FieldObject.prototype.isEnabled=true;FieldObject.prototype.filledFieldDependency="";FieldObject.prototype.htmlContent="";
FieldObject.prototype.init=function(referenceController){
this.referenceController=referenceController;
var element=document.getElementById(this.elementId);
if(element!=undefined){this.getConfigFromElement(element);}else{log.error("element '"+this.elementId+"' was not found for field '"+this.id+"'",this);}}
FieldObject.prototype.getConfigFromElement=function(element){
this.name=(element.getAttribute("name")!=undefined?element.getAttribute("name"): this.elementId);this.initialValue=(element.getAttribute("value")!=undefined?element.getAttribute("value"): this.value);this.value=(element.getAttribute("value")!=undefined?element.getAttribute("value"): this.value);this.normalClass=(element.getAttribute("normalClass")!=undefined?element.getAttribute("normalClass"): this.normalClass);this.errorClass=(element.getAttribute("errorClass")!=undefined?element.getAttribute("errorClass"): this.errorClass);this.state=(element.getAttribute("state")!=undefined?element.getAttribute("state"): this.state);this.isRequired=(element.getAttribute("required")!=undefined?(element.getAttribute("required")=="false"?false : true): this.isRequired);this.isEnabled=(element.getAttribute("enabled")!=undefined?(element.getAttribute("enabled")=="false"?false : true): this.isEnabled);
this.filledFieldDependency=(element.getAttribute("filledFieldDependency")!=undefined?element.getAttribute("filledFieldDependency"): this.filledFieldDependency);}
FieldObject.prototype.generate=function(isForced){(isForced!=undefined?isForced : false);
var element=document.getElementById(this.elementId);var newHtmlContent=this.getFieldHTML();
if(element!=undefined&&(this.htmlContent!=newHtmlContent||isForced)){this.htmlContent=newHtmlContent;element.innerHTML=this.htmlContent;}}
FieldObject.prototype.initFieldsList=function(fieldAnswers,referenceController,questionPrefix){
var fieldElement=undefined;var fieldElementId=undefined;var fieldType=undefined;
var fieldObjectMap=new Array();
for(var fieldId in fieldAnswers){
fieldElementId=questionPrefix+"_"+fieldId;fieldElement=document.getElementById(fieldElementId);
if(fieldElement!=undefined){
fieldType=(fieldElement.getAttribute("fieldType")!=undefined?fieldElement.getAttribute("fieldType"): "text");
if(fieldType=="text"){fieldObjectMap[fieldId]=new FieldObjectText(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="numeric"){fieldObjectMap[fieldId]=new FieldObjectNumeric(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="weight"){fieldObjectMap[fieldId]=new FieldObjectWeight(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="height"){fieldObjectMap[fieldId]=new FieldObjectHeight(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="imageList"){fieldObjectMap[fieldId]=new FieldObjectImageList(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="combo"){fieldObjectMap[fieldId]=new FieldObjectCombo(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="email"){fieldObjectMap[fieldId]=new FieldObjectEmail(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="year"){fieldObjectMap[fieldId]=new FieldObjectYear(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="checkbox"){fieldObjectMap[fieldId]=new FieldObjectCheckbox(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}else if(fieldType=="password"){fieldObjectMap[fieldId]=new FieldObjectPassword(referenceController.id+".fieldObjectMap['"+fieldId+"']",fieldElementId);}
if(fieldObjectMap[fieldId]!=undefined){
fieldObjectMap[fieldId].init(referenceController);
if(fieldAnswers!=undefined){fieldObjectMap[fieldId].setInitialValue(fieldAnswers[fieldId]);}
fieldObjectMap[fieldId].generate();}}else{log.info("WARNING: "+referenceController.id+"'s Field ["+fieldElementId+"] definition in template not found",this);}}
return fieldObjectMap;}
FieldObject.prototype.isAllFieldsValid=function(fieldObjectMap){
var result=true;
for(var fieldName in fieldObjectMap){
fieldObjectMap[fieldName].state=fieldObjectMap[fieldName].isValid();
if(fieldObjectMap[fieldName].state!=this.FIELD_VALID){result=false;}}
return result;}
FieldObject.prototype.updateFields=function(fieldObjectMap){
for(var fieldName in fieldObjectMap){this.updateField(fieldObjectMap[fieldName]);}}
FieldObject.prototype.updateField=function(fieldObject){
fieldObject.isFieldChanged=true;fieldObject.state=fieldObject.isValid();fieldObject.generate();}
FieldObject.prototype.setInitialValue=function(value){
value=value+"";
this.initialValue=value;this.isFieldChanged=false;this.value=value;}
FieldObject.prototype.setValue=function(value,isForced){(isForced!=undefined?isForced : false);
value=value+"";
if(this.value!=value){
this.value=value;
var newState=this.isValid();
this.state=newState
this.generate(isForced);
this.onFieldChange();}}
FieldObject.prototype.getValue=function(){
return encodeToUnicode(this.value);}
FieldObject.prototype.isChanged=function(){
return(this.isFieldChanged||this.value!=this.initialValue);}
FieldObject.prototype.parseTokens=function(text){
var stringArray=new Array;var finalString="";
stringArray=text.split("|");
for(var i=0;i<stringArray.length;i++){if(stringArray[i].indexOf("[")==0){stringArray[i]=eval("this."+stringArray[i].substring(1,stringArray[i].length-1));}
finalString+=stringArray[i];}
return finalString;}
FieldObject.prototype.onFieldChange=function(){
if(this.referenceController!=undefined){this.referenceController.onFieldChange(this);}}
FieldObject.prototype.onFieldFocus=function(){
if(this.referenceController!=undefined){this.referenceController.onFieldFocus(this);}}
FieldObject.prototype.onFieldBlur=function(){
this.updateField(this);
if(this.referenceController!=undefined){this.referenceController.onFieldBlur(this);}}
FieldObject.prototype.focus=function(){
var fieldElement=document.getElementById(this.name+"_field");
if(fieldElement!=undefined){fieldElement.focus();}}
FieldObject.prototype.setAllFieldsUnitSystem=function(fieldObjectMap,unitSystem,referenceController){
for(var fieldId in fieldObjectMap){fieldObjectMap[fieldId].setUnitSystem(unitSystem);}}
FieldObject.prototype.getAllFieldsAnswersMap=function(fieldObjectMap){
var map=new Array();
for(var fieldId in fieldObjectMap){map[fieldObjectMap[fieldId].name]=fieldObjectMap[fieldId].getValue();}
return map;}
FieldObject.prototype.setAllFieldsAnswers=function(fieldObjectMap,dataMap){
for(var fieldId in fieldObjectMap){
if(dataMap[fieldObjectMap[fieldId].name]!=undefined){fieldObjectMap[fieldId].setInitialValue(dataMap[fieldObjectMap[fieldId].name]);fieldObjectMap[fieldId].generate();}}}
FieldObject.prototype.setAllFieldsUnchanged=function(fieldObjectMap){
for(var fieldId in fieldObjectMap){fieldObjectMap[fieldId].isFieldChanged=false;}}
FieldObject.prototype.getFieldAttributesMap=function(){
var newMap=new Array();
for(var attribute in this){
if(typeof(this[attribute])=="string"||typeof(this[attribute])=="number"){newMap[attribute]=this[attribute];}}
return newMap;}
FieldObject.prototype.getErrorMessage=function(){
var errorMessage="";var state=this.state;
if(state==this.FIELD_ERROR_REQUIRED){errorMessage=resource.get("Questionnaire.ErrorMessage.Required");}else if(state==this.FIELD_ERROR_INVALID_CHARACTERS){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidCharacters");}else if(state==this.FIELD_ERROR_INVALID_EMAIL){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidEmail");}else if(state==this.FIELD_ERROR_INVALID_NUMERIC){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidNumeric");}else if(state==this.FIELD_ERROR_INVALID_RANGE){if(this.minValue>-1&&this.maxValue>-1){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidRange");}else if(this.minValue>-1&&this.maxValue==-1){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidMinRange");}else if(this.minValue==-1&&this.maxValue>-1){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidMaxRange");}}else if(state==this.FIELD_ERROR_PASSWORD_DONT_MATCH){errorMessage=resource.get("Questionnaire.ErrorMessage.PasswordDontMatch");}else if(state==this.FIELD_ERROR_BUST_OR_BRA_REQUIRED){errorMessage=resource.get("Questionnaire.ErrorMessage.BustOrBraRequired");}else if(state==this.FIELD_ERROR_INVALID_LENGTH){if(this.minLength>-1&&this.maxLength>-1){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidLength");}else if(this.minLength>-1&&this.maxLength==-1){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidMinLength");}else if(this.minLength==-1&&this.maxLength>-1){errorMessage=resource.get("Questionnaire.ErrorMessage.InvalidMaxLength");}else if(this.minLength==-1&&this.maxLength==-1){errorMessage=resource.get("Questionnaire.ErrorMessage.Required");}}else if(state==this.FIELD_DEPENDENCY_NOT_FILLED){errorMessage=resource.get("Questionnaire.ErrorMessage.BustOrBraRequired");}
errorMessage=ParserUtils.parseHtml(errorMessage,this.getFieldAttributesMap());
return errorMessage;}
FieldObject.prototype.enable=function(){
this.isEnabled=true;this.generate();}
FieldObject.prototype.disable=function(){
this.isEnabled=false;this.generate();}
FieldObject.prototype.getFieldHTML=function(){return "";}
FieldObject.prototype.isValid=function(){
var fieldValid=this.FIELD_VALID;
if(this.referenceController!=undefined&&this.referenceController.fieldObjectMap!=undefined&&this.filledFieldDependency!=""&&this.value==""&&this.referenceController.fieldObjectMap[this.filledFieldDependency].getValue()==""){
fieldValid=this.FIELD_DEPENDENCY_NOT_FILLED;}
return fieldValid;}
FieldObject.prototype.setUnitSystem=function(unitSystem){}
var FieldUtils=new FieldObject();
function FieldObjectCheckbox(id,elementId){jsClass.extend(this,[FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectCheckbox.prototype.id="FieldObjectCheckbox";
FieldObjectCheckbox.prototype.getFieldHTML=function(){
var displayCode="";
displayCode+=
"<input name='"+this.name+"_field' "+
"type='checkbox' "+(this.getValue()=="true"?"CHECKED":"")+" "+
"onclick=\""+this.id+".setValue((this.checked?'true':'false'));\" "+
"></input>";
return displayCode;}
FieldObjectCheckbox.prototype.getValue=function(){
return(this.value=="true"?"true" : "false");}
function FieldObjectCombo(id,elementId){jsClass.extend(this,[FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectCombo.prototype.id="FieldObjectCombo";FieldObjectCombo.prototype.answerArray=new Array();FieldObjectCombo.prototype.measurementSystem="IMPERIAL";
FieldObjectCombo.prototype.getConfigFromElement=function(element){
this.super_FieldObject_getConfigFromElement(element);
this.answerArray=(element.getAttribute("answersVar")!=undefined?resource.get(element.getAttribute("answersVar")): this.answerArray);}
FieldObjectCombo.prototype.getFieldHTML=function(){
var displayCode="";var answerArray=this.answerArray;
if(answerArray[this.measurementSystem]!=undefined){answerArray=answerArray[this.measurementSystem]}
if(this.isEnabled){
var containerElement=document.getElementById(this.elementId);
displayCode+=
"<select name='"+this.name+"_field' "+
"class='"+(this.state==this.FIELD_VALID||!this.isChanged()?this.normalClass : this.errorClass)+"' "+
"style='width:"+parseInt(containerElement.style.width)+"px;height:"+parseInt(containerElement.style.height)+"px;'"+
"onblur=\""+this.id+".setValue(this.value);"+this.id+".onFieldBlur()\" "+
"onfocus=\""+this.id+".onFieldFocus()\" "+
">";
if(this.value==""){displayCode+=
"<option value='' SELECTED"+
">"+resource.get("Questionnaire.Field.PleaseSelectOne")+"</option>";}
for(answer in answerArray){stateClass=this.value==answer?this.selectedClass : this.normalClass;displayCode+=
"<option value='"+answer+"'"+(this.value==answer?" SELECTED" : "")+
">"+answerArray[answer]+"</option>";}
displayCode+="</select>";
}else{
for(answer in answerArray){if(this.value==answer){displayCode+="<span class='"+this.normalClass+"'>"+answerArray[answer]+"</span>";}}}
return displayCode;}
FieldObjectCombo.prototype.setUnitSystem=function(unitSystem){
this.measurementSystem=unitSystem;this.generate();}
FieldObjectCombo.prototype.isValid=function(){
var fieldValid=this.super_FieldObject_isValid();var fieldValue=this.getValue();
if(this.isRequired&&fieldValue==""){fieldValid=this.FIELD_ERROR_REQUIRED;}
return fieldValid;}
function FieldObjectEmail(id,elementId){jsClass.extend(this,[FieldObjectText,FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectEmail.prototype.id="FieldObjectEmail";
FieldObjectEmail.prototype.isValid=function(){
var fieldValid=this.super_FieldObject_isValid();var fieldValue=this.value;
fieldValid=this.super_FieldObjectText_isValid();
if(this.isRequired&&!isEmail(fieldValue)){fieldValid=this.FIELD_ERROR_INVALID_EMAIL;}
return fieldValid;}
function FieldObjectHeight(id,elementId){jsClass.extend(this,[FieldObjectNumeric,FieldObject]);
this.id=id;this.elementId=elementId;
this.suffixMap=resource.get("ModelQuestionnaireUnitSuffixMap");}
FieldObjectHeight.prototype.MAJOR_FIELD=1;FieldObjectHeight.prototype.MINOR_FIELD=2;
FieldObjectHeight.prototype.id="FieldObjectHeight";FieldObjectHeight.prototype.majorValue=0;FieldObjectHeight.prototype.minorValue=0;FieldObjectHeight.prototype.suffixMap=undefined;
FieldObjectHeight.prototype.generate=function(isForced){
var element=document.getElementById(this.elementId);
if(this.htmlContent==""){this.htmlContent=this.getFieldHTML();element.innerHTML=this.htmlContent;
}else{var majorMinorValues=this.getDisplayedMajorMinorValues();
document.getElementById(this.name+"_field").value=(majorMinorValues["major"]!=0?majorMinorValues["major"] : "");document.getElementById(this.name+"_minorfield").value=(majorMinorValues["minor"]!=0?majorMinorValues["minor"] : "");document.getElementById(this.name+"_field").className=(this.state!=this.FIELD_VALID&&this.isChanged()?this.errorClass : this.normalClass);document.getElementById(this.name+"_minorfield").className=(this.state!=this.FIELD_VALID&&this.isChanged()?this.errorClass : this.normalClass);document.getElementById(this.name+"_fieldMajor").innerHTML=this.suffixMap[this.measurementSystem]["major"];document.getElementById(this.name+"_fieldMinor").innerHTML=this.suffixMap[this.measurementSystem]["minor"];}}
FieldObjectHeight.prototype.getFieldHTML=function(){
var majorMinorValues=this.getDisplayedMajorMinorValues();
var displayCode="";
displayCode+=
"<input id='"+this.name+"_field'"+
" type='text'"+
" size='1'"+
" style='position:absolute;left:0px;top:0px;'"+
" maxlength='1'"+
" class='"+(this.state!=this.FIELD_VALID&&this.isChanged()?this.errorClass : this.normalClass)+"'"+
" onBlur=\""+this.id+".onFieldBlur()\""+
" onFocus=\""+this.id+".onFieldFocus()\""+
" value='"+(majorMinorValues["major"]!=0?majorMinorValues["major"] : "")+"'"+
"></input>";
displayCode+="<div id='"+this.name+"_fieldMajor' style='left:30px;top:1px;width:60px;height:15px;'>"+this.suffixMap[this.measurementSystem]["major"]+"</div>";
displayCode+=
"<input id='"+this.name+"_minorfield'"+
" type='text'"+
" style='position:absolute;left:60px;top:0px;'"+
" size='2'"+
" maxlength='3'"+
" class='"+(this.state!=this.FIELD_VALID&&this.isChanged()?this.errorClass : this.normalClass)+"'"+
" onBlur=\""+this.id+".onFieldBlur();\""+
" onFocus=\""+this.id+".onFieldFocus();\""+
" value='"+(majorMinorValues["minor"]!=0?majorMinorValues["minor"] : "")+"'"+
"></input>";
displayCode+="<div id='"+this.name+"_fieldMinor' style='left:95px;top:1px;width:60px;height:15px;'>"+this.suffixMap[this.measurementSystem]["minor"]+"</div>";
return displayCode;}
FieldObjectHeight.prototype.onFieldBlur=function(){
this.setValue(document.getElementById(this.name+"_minorfield").value,document.getElementById(this.name+"_field").value);this.super_FieldObject_onFieldBlur();}
FieldObjectHeight.prototype.setValue=function(minorValue,majorValue){
var value=0;
minorValue=(minorValue.match(/[0-9\.\,]/)?parseFloat(minorValue): 0);majorValue=(majorValue.match(/[0-9\.\,]/)?parseFloat(majorValue): 0);
if(this.measurementSystem==this.UNIT_SYSTEM_METRIC){this.value=Math.round(((majorValue * 100)+minorValue)* this.metricToImperialConversionConstant);}else{this.value=Math.round((majorValue * 12)+minorValue);}
this.state=this.isValid();this.onFieldChange();}
FieldObjectHeight.prototype.getDisplayedMajorMinorValues=function(){
var values=new Array();
if(this.value!=undefined&&this.value!=""){
if(this.measurementSystem==this.UNIT_SYSTEM_IMPERIAL||this.mesurementSystem==this.UNIT_SYSTEM_IMPERIAL_STONES){values["major"]=Math.floor(parseFloat(this.value)/ 12);values["minor"]=Math.floor(parseFloat(this.value)-(values["major"] * 12));}else if(this.measurementSystem==this.UNIT_SYSTEM_METRIC){var value=this.value * this.imperialToMetricConversionConstant;values["major"]=Math.floor(parseFloat(value)/ 100);values["minor"]=Math.round(parseFloat(value-(values["major"] * 100)));}
}else{
this.value="";values["minor"]=0;values["major"]=0;}
return values}
function FieldObjectImageList(id,elementId){jsClass.extend(this,[FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectImageList.prototype.id="FieldObjectImageList";FieldObjectImageList.prototype.answerArray=new Array();FieldObjectImageList.prototype.itemWidth=20;FieldObjectImageList.prototype.itemHeight=20;FieldObjectImageList.prototype.itemsPerColumn=6;FieldObjectImageList.prototype.highlightClass="";FieldObjectImageList.prototype.selectedClass="";FieldObjectImageList.prototype.imageTokenSrc="@fieldName@_@answerId@.gif";
FieldObjectImageList.prototype.getConfigFromElement=function(element){
this.super_FieldObject_getConfigFromElement(element);
this.answerArray=(element.getAttribute("answersVar")!=undefined?resource.get(element.getAttribute("answersVar")): this.answerArray);this.itemWidth=(element.getAttribute("itemWidth")!=undefined?parseInt(element.getAttribute("itemWidth")): this.itemWidth);this.itemHeight=(element.getAttribute("itemHeight")!=undefined?parseInt(element.getAttribute("itemHeight")): this.itemHeight);this.itemsPerColumn=(element.getAttribute("itemsPerColumn")!=undefined?parseInt(element.getAttribute("itemsPerColumn")): this.itemsPerColumn);this.highlightClass=(element.getAttribute("highlightClass")!=undefined?element.getAttribute("highlightClass"): this.highlightClass);this.selectedClass=(element.getAttribute("selectedClass")!=undefined?element.getAttribute("selectedClass"): this.selectedClass);this.imageTokenSrc=(element.getAttribute("imageTokenSrc")!=undefined?element.getAttribute("imageTokenSrc"): this.imageTokenSrc);}
FieldObjectImageList.prototype.getFieldHTML=function(){
var displayCode="";var stateClass="";var imageSrc="";
for(i=0;i<this.answerArray.length;i++){
stateClass=this.value==this.answerArray[i]?this.selectedClass : this.normalClass;imageSrc=replaceString(this.imageTokenSrc,"@answerId@",this.answerArray[i]);imageSrc=replaceString(imageSrc,"@fieldName@",this.elementId);
displayCode+=
"<img src='"+imageSrc+"'"+
" onclick=\""+this.id+".setValue("+this.answerArray[i]+");"+this.id+".onFieldFocus()\""+
"style='position:relative;display:inline'"+
" class='"+stateClass+"'"+
(this.value!=this.answerArray[i]?" onmouseover='this.className=\""+this.highlightClass+"\"'" : "")+
" onmouseout='this.className=\""+stateClass+"\"'"+
"/>";}
return displayCode;}
function FieldObjectNumeric(id,elementId){jsClass.extend(this,[FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectNumeric.prototype.UNIT_SYSTEM_IMPERIAL="IMPERIAL";FieldObjectNumeric.prototype.UNIT_SYSTEM_METRIC="METRIC";FieldObjectNumeric.prototype.UNIT_SYSTEM_IMPERIAL_STONES="IMPERIALSTONES";
FieldObjectNumeric.prototype.id="FieldObjectNumeric";FieldObjectNumeric.prototype.minValue=-1;FieldObjectNumeric.prototype.maxValue=-1;FieldObjectNumeric.prototype.minLength=-1;FieldObjectNumeric.prototype.maxLength=-1;FieldObjectNumeric.prototype.size=10;FieldObjectNumeric.prototype.format="";FieldObjectNumeric.prototype.measurementSystem="IMPERIAL";FieldObjectNumeric.prototype.units=undefined;FieldObjectNumeric.prototype.suffix=undefined;FieldObjectNumeric.prototype.metricToImperialConversionConstant=0.393700787;FieldObjectNumeric.prototype.imperialToMetricConversionConstant=2.54;
FieldObjectNumeric.prototype.getConfigFromElement=function(element){
this.super_FieldObject_getConfigFromElement(element);
this.minValue=(element.getAttribute("minValue")!=undefined?element.getAttribute("minValue"): this.minValue);this.maxValue=(element.getAttribute("maxValue")!=undefined?element.getAttribute("maxValue"): this.maxValue);this.minLength=(element.getAttribute("minLength")!=undefined?parseInt(element.getAttribute("minLength")): this.minLength);this.maxLength=(element.getAttribute("maxLength")!=undefined?parseInt(element.getAttribute("maxLength")): this.maxLength);this.format=(element.getAttribute("format")!=undefined?element.getAttribute("format"): this.format);this.size=(element.getAttribute("size")!=undefined?parseInt(element.getAttribute("size")): this.size);this.suffix=(element.getAttribute("suffixVar")!=undefined?resource.get(element.getAttribute("suffixVar")): this.suffix);this.units=(this.suffix!=undefined&&this.suffix[this.measurementSystem]!=undefined?this.suffix[this.measurementSystem] : "");}
FieldObjectNumeric.prototype.getFieldHTML=function(){
var displayCode="";
displayCode+=
"<table border='0' cellspacing='0' cellpadding='0'><tr><td>"+
"<input name='"+this.name+"_field' "+
"style='position:relative;' "+
"type='text' "+
"size='"+this.size+"' "+(this.maxLength!=-1?"maxlength='"+this.maxLength+"' " : "")+
"class='"+(this.state==this.FIELD_VALID||!this.isChanged()?this.normalClass : this.errorClass)+"' "+
"onblur=\""+this.id+".setValue(this.value);"+this.id+".onFieldBlur()\" "+
"onfocus=\""+this.id+".onFieldFocus()\" ";
if(this.value!=""){displayCode+="value='"+(this.measurementSystem==this.UNIT_SYSTEM_METRIC?Math.round(this.value * this.imperialToMetricConversionConstant): Math.round(this.value))+"' ";}
displayCode+="></input></td>";
if(this.units!=undefined){displayCode+="<td>&nbsp;&nbsp;</td><td>"+this.units+"</td>";}
displayCode+="</tr></table>";
return displayCode;}
FieldObjectNumeric.prototype.getValue=function(){
return convertFractToDecimal(this.value)+"";}
FieldObjectNumeric.prototype.setValue=function(value){
if(this.value!=value){
var element=document.getElementById(this.elementId);if(element!=undefined){
value=(value.match(/[0-9\.\,]/)?parseFloat(value): 0);
if(parseFloat(value)==value){value=Math.round(value*10)/10;}
this.value=(this.measurementSystem==this.UNIT_SYSTEM_METRIC?value * this.metricToImperialConversionConstant : value);this.state=this.isValid();this.onFieldChange();}}}
FieldObjectNumeric.prototype.isValid=function(){
var fieldValid=this.super_FieldObject_isValid();var fieldValue=this.getValue();
if(this.minLength!=-1&&fieldValue.length==0){
if(this.isRequired){fieldValid=this.FIELD_ERROR_REQUIRED;}
}else if((this.minLength!=-1&&parseInt(fieldValue).length<this.minLength)||(this.maxLength!=-1&&parseInt(fieldValue).length>this.maxLength)){
fieldValid=this.FIELD_ERROR_INVALID_LENGTH;}else{
var numericValue=convertFractToDecimal(fieldValue);
if(isNaN(numericValue)){fieldValid=this.FIELD_ERROR_INVALID_NUMERIC;}
else if((this.minValue!=-1&&parseInt(numericValue)<parseInt(this.minValue))||(this.maxValue!=-1&&parseInt(numericValue)>parseInt(this.maxValue))){fieldValid=this.FIELD_ERROR_INVALID_RANGE;}}
return fieldValid;}
FieldObjectNumeric.prototype.setUnitSystem=function(unitSystem){
this.measurementSystem=unitSystem;this.units=(this.suffix!=undefined&&this.suffix[this.measurementSystem]!=undefined?this.suffix[this.measurementSystem] : "");this.generate();}
function FieldObjectPassword(id,elementId){jsClass.extend(this,[FieldObjectText,FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectPassword.prototype.matchWithField=undefined;
FieldObjectPassword.prototype.getConfigFromElement=function(element){
this.super_FieldObjectText_getConfigFromElement(element);
this.matchWithField=(element.getAttribute("matchWithField")!=undefined?element.getAttribute("matchWithField"): this.matchWithField);}
FieldObjectPassword.prototype.getFieldHTML=function(){
var displayCode="";var containerElement=document.getElementById(this.elementId);
displayCode+=
"<input name='"+this.name+"_field' "+
"type='password' "+
"style='width:"+parseInt(containerElement.style.width)+"px;'"+(this.maxLength!=-1?"maxlength='"+this.maxLength+"' " : "")+
"class='"+(this.state==this.FIELD_VALID||!this.isChanged()?this.normalClass : this.errorClass)+"' "+
"onblur=\""+this.id+".setValue(this.value);"+this.id+".onFieldBlur()\" "+
"onfocus=\""+this.id+".onFieldFocus()\" ";
if(this.value!=""){displayCode+="value='"+this.value+"' ";}
displayCode+="></input>";
return displayCode;}
FieldObjectPassword.prototype.isValid=function(){
var fieldValid=this.super_FieldObjectText_isValid();
if(this.matchWithField!=undefined){
if(this.referenceController!=undefined&&
this.referenceController.fieldObjectMap!=undefined&&
this.referenceController.fieldObjectMap[this.matchWithField]!=undefined){
if(this.getValue()!=this.referenceController.fieldObjectMap[this.matchWithField].getValue()){fieldValid=this.FIELD_ERROR_PASSWORD_DONT_MATCH;}}}
return fieldValid;}
function FieldObjectSlider(id,elementId){jsClass.extend(this,[FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectSlider.prototype.id="FieldObjectSlider";FieldObjectSlider.prototype.elementId="";FieldObjectSlider.prototype.ctrlPosition=0;FieldObjectSlider.prototype.sliderLength=100;FieldObjectSlider.prototype.ctrlWidth=10;FieldObjectSlider.prototype.maxValue=100;FieldObjectSlider.prototype.minValue=0;FieldObjectSlider.prototype.gridSize=10;FieldObjectSlider.prototype.ctrlImageUrlHorizontal="../../images/sliderCtrlHorizontal.gif";FieldObjectSlider.prototype.barImageUrlHorizontal="../../images/sliderBackHorizontal.jpg";FieldObjectSlider.prototype.ctrlImageUrlVertical="../../images/sliderCtrlVertical.gif";FieldObjectSlider.prototype.barImageUrlVertical="../../images/sliderBackVertical.jpg";FieldObjectSlider.prototype.maxOffset=undefined;FieldObjectSlider.prototype.minOffset=undefined;FieldObjectSlider.prototype.orientation="HORIZONTAL";FieldObjectSlider.prototype.onDragFunc=undefined;FieldObjectSlider.prototype.onDropFunc=undefined;FieldObjectSlider.prototype.onPickFunc=undefined;
FieldObjectSlider.prototype.init=function(){
this.getConfigFromElement(document.getElementById(this.elementId));
this.maxOffset=this.sliderLength-(this.ctrlWidth);this.minOffset=0;
if(document.getElementById(this.id+"sliderCtrl")==undefined){
this.generate(true);
DragDrop.doDrag(this.id+"sliderCtrl",{"containerElementId":this.elementId,"onPick":this.id+".onPick()","onDrag":this.id+".onDrag()","onDrop":this.id+".onDrop()"});}
if(this.value!=undefined){this.setValue(this.value,true);}}
FieldObjectSlider.prototype.getConfigFromElement=function(element){
this.maxValue=(element.getAttribute("maxValue")!=undefined?element.getAttribute("maxValue"): this.maxValue);this.minValue=(element.getAttribute("minValue")!=undefined?element.getAttribute("minValue"): this.minValue);this.gridSize=(element.getAttribute("gridSize")!=undefined?element.getAttribute("gridSize"): this.gridSize);
if(parseInt(element.style.height)>parseInt(element.style.width)){this.sliderLength=parseInt(element.style.height);this.orientation="VERTICAL"}else{this.sliderLength=parseInt(element.style.width);this.orientation="HORIZONTAL";}
this.onDragFunc=(element.getAttribute("onDragFunc")!=undefined?element.getAttribute("onDragFunc"): function(){});this.onDropFunc=(element.getAttribute("onDropFunc")!=undefined?element.getAttribute("onDropFunc"): function(){});this.onPickFunc=(element.getAttribute("onPickFunc")!=undefined?element.getAttribute("onPickFunc"): function(){});
this.value=(element.getAttribute("value")!=undefined?element.getAttribute("value"): this.value);}
FieldObjectSlider.prototype.getFieldHTML=function(){
var displayCode="";
if(this.orientation=="HORIZONTAL"){displayCode='<div id="'+this.id+'sliderBar" style="position:absolute;background-position: 10 0;top:0px;left:0px;height:15px;width:'+this.sliderLength+'px;background-repeat:repeat-x;background-image:URL(\''+this.barImageUrlHorizontal+'\');" class="sliderBack">';displayCode+='</div><div id="'+this.id+'sliderCtrl" varName="'+this.id+'" style="position:absolute;left:0px;top:0px;width:11px;height:20px;" class="sliderCtrl">';displayCode+='<img src="'+this.ctrlImageUrlHorizontal+'"></img></div>';}else{displayCode='<div id="'+this.id+'sliderBar" style="position:absolute;background-position: 0 10;top:0px;left:0px;height:'+this.sliderLength+'px;width:15px;background-repeat:repeat-y;background-image:URL(\''+this.barImageUrlVertical+'\');" class="sliderBack">';displayCode+='</div><div id="'+this.id+'sliderCtrl" varName="'+this.id+'" style="position:absolute;left:0px;top:0px;width:11px;height:20px;" class="sliderCtrl">';displayCode+='<img src="'+this.ctrlImageUrlVertical+'"></img></div>';}
return displayCode;}
FieldObjectSlider.prototype.disable=function(){
this.isEnabled=false;
}
FieldObjectSlider.prototype.enable=function(){
this.isEnabled=true;
}
FieldObjectSlider.prototype.getValue=function(){
return(this.getValueFromPosition());}
FieldObjectSlider.prototype.setValue=function(value,isForcedPosition){
isForcedPosition=isForcedPosition!=undefined?isForcedPosition : false;
this.value=value;document.getElementById(this.elementId).value=this.value;
if(isForcedPosition){this.updateCtrlPosition();}
}
FieldObjectSlider.prototype.isValid=function(){
var fieldValid=this.super_FieldObject_isValid();var fieldValue=this.getValue();
if(this.isRequired&&fieldValue==""){fieldValid=this.FIELD_ERROR_REQUIRED;}
return fieldValid;}
FieldObjectSlider.prototype.updateCtrlPosition=function(){
var oldPosition=this.ctrlPosition;this.ctrlPosition=this.getPositionFromValue();
var diff=parseInt(this.ctrlPosition)-parseInt(oldPosition);
var ctrlElement=document.getElementById(this.id+"sliderCtrl");
if(this.orientation=="HORIZONTAL"){
ctrlElement.style.left=parseInt(this.ctrlPosition)+"px";}else{
ctrlElement.style.top=parseInt(this.ctrlPosition)+"px";}}
FieldObjectSlider.prototype.getValueFromPosition=function(){
return parseInt(((parseInt(this.ctrlPosition)/(parseInt(this.sliderLength)-parseInt(this.ctrlWidth)))*(parseInt(this.maxValue)-parseInt(this.minValue)))+parseInt(this.minValue));}
FieldObjectSlider.prototype.getPositionFromValue=function(){
return((parseInt(this.value)-parseInt(this.minValue))/(parseInt(this.maxValue)-parseInt(this.minValue)))*(parseInt(this.sliderLength)-parseInt(this.ctrlWidth));}
FieldObjectSlider.prototype.onDrag=function(){
if(this.orientation=="HORIZONTAL"){this.ctrlPosition=parseInt(document.getElementById(this.id+"sliderCtrl").style.left);}else{this.ctrlPosition=parseInt(document.getElementById(this.id+"sliderCtrl").style.top);}
this.value=this.getValueFromPosition();
document.getElementById(this.elementId).value=this.value;
if(this.onDragFunc){eval(this.onDragFunc);}}
FieldObjectSlider.prototype.onDrop=function(){
if(this.onDropFunc){eval(this.onDropFunc);}}
FieldObjectSlider.prototype.onPick=function(){
if(this.onPickFunc){eval(this.onPickFunc);}}
function FieldObjectText(id,elementId){jsClass.extend(this,[FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectText.prototype.id="FieldObjectText";FieldObjectText.prototype.minValue=0;FieldObjectText.prototype.maxValue=-1;FieldObjectText.prototype.minLength=1;FieldObjectText.prototype.maxLength=-1;FieldObjectText.prototype.size=10;FieldObjectText.prototype.format="alphanumeric";FieldObjectText.prototype.isMultiline=false;
FieldObjectText.prototype.getConfigFromElement=function(element){
this.super_FieldObject_getConfigFromElement(element);
this.minValue=(element.getAttribute("minValue")!=undefined?element.getAttribute("minValue"): this.minValue);this.maxValue=(element.getAttribute("maxValue")!=undefined?element.getAttribute("maxValue"): this.maxValue);this.minLength=(element.getAttribute("minLength")!=undefined?parseInt(element.getAttribute("minLength")): this.minLength);this.maxLength=(element.getAttribute("maxLength")!=undefined?parseInt(element.getAttribute("maxLength")): this.maxLength);this.format=(element.getAttribute("format")!=undefined?element.getAttribute("format"): this.format);this.size=(element.getAttribute("size")!=undefined?parseInt(element.getAttribute("size")): this.size);this.isMultiline=(element.getAttribute("isMultiline")!=undefined&&element.getAttribute("isMultiline")=="true"?true : false);}
FieldObjectText.prototype.getFieldHTML=function(){
var displayCode="";var containerElement=document.getElementById(this.elementId);
if(this.isEnabled){
this.value=ParserUtils.parseHtml(this.value);
if(this.isMultiline){displayCode=
"<textarea name='"+this.name+"_field' "+
"style='width:"+parseInt(containerElement.style.width)+"px;height:"+parseInt(containerElement.style.height)+"px;'"+(this.maxLength!=-1?"maxlength='"+this.maxLength+"' " : "")+
"class='"+(this.state==this.FIELD_VALID||!this.isChanged()?this.normalClass : this.errorClass)+"' "+
"onblur=\""+this.id+".setValue(this.value);"+this.id+".onFieldBlur()\" "+
"onfocus=\""+this.id+".onFieldFocus()\" "+
">"+(this.value!=""?this.value : "")+
"</textarea>";
}else{displayCode=
"<input name='"+this.name+"_field' "+
"type='text' "+
"style='width:"+parseInt(containerElement.style.width)+"px;height:"+parseInt(containerElement.style.height)+"px;'"+(this.maxLength!=-1?"maxlength='"+this.maxLength+"' " : "")+
"class='"+(this.state==this.FIELD_VALID||!this.isChanged()?this.normalClass : this.errorClass)+"' "+
"onblur=\""+this.id+".setValue(this.value);"+this.id+".onFieldBlur()\" "+
"onfocus=\""+this.id+".onFieldFocus()\" "+(this.value!=""?"value='"+this.value+"' " : "")+
"></input>";}
}else{displayCode="<span>"+this.value+"</span>";}
return displayCode;}
FieldObjectText.prototype.isValid=function(){
var fieldValid=this.super_FieldObject_isValid();var fieldValue=this.value;
if(this.isRequired==true||(this.isRequired==false&&fieldValue.length>0)){
if((this.minLength!=-1&&fieldValue.length<this.minLength)||(this.maxLength!=-1&&fieldValue.length>this.maxLength)){fieldValid=this.FIELD_ERROR_INVALID_LENGTH;}
if(this.format=="alphanumeric"&&trim(fieldValue).match(/([a-zA-Z0-9àâäèéêëîïôœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ\-\_\ \.\-\@\!\?\(\)\[\]\n\r]*)/)[0]!=fieldValue){fieldValid=this.FIELD_ERROR_INVALID_CHARACTERS;}
if(this.isRequired==true&&fieldValue.length==0){fieldValid=this.FIELD_ERROR_REQUIRED;}}
return fieldValid;}
function FieldObjectWeight(id,elementId){jsClass.extend(this,[FieldObjectNumeric,FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectWeight.prototype.id="FieldObjectWeight";FieldObjectWeight.prototype.metricToImperialConversionConstant=2.20462262;FieldObjectWeight.prototype.imperialToMetricConversionConstant=0.45359237;FieldObjectWeight.prototype.poundsToStonesConversionConstant=14.0;
FieldObjectWeight.prototype.minorValue=0;FieldObjectWeight.prototype.majorValue=0;
FieldObjectWeight.prototype.getFieldHTML=function(){
this.updateInternalMajorMinor();
if(this.measurementSystem==this.UNIT_SYSTEM_IMPERIAL_STONES){
this.setValue(this.value);
var minorPrefix=this.units.substring(this.units.indexOf("|"));var majorPrefix=this.units.substring(0,this.units.indexOf("|"));
var displayCode="";
displayCode+=
"<table border='0' cellspacing='0' cellpadding='0'><tr><td>"+
"<input name='"+this.name+"_major_field' "+
"style='position:relative;' "+
"type='text' "+
"size='3' "+(this.maxLength!=-1?"maxlength='"+this.maxLength+"' " : "")+
"class='"+(this.state==this.FIELD_VALID||!this.isChanged()?this.normalClass : this.errorClass)+"' "+
"onblur=\""+this.id+".setValue(this.value,'major');"+this.id+".onFieldBlur()\" "+
"onfocus=\""+this.id+".onFieldFocus()\" ";
if(this.value!=""){displayCode+="value='"+this.majorValue+"' ";}
displayCode+="></input>"+ majorPrefix+"</td>";
displayCode+="<td><input name='"+this.name+"_minor_field' "+
"style='position:relative;' "+
"type='text' "+
"size='3' "+(this.maxLength!=-1?"maxlength='"+this.maxLength+"' " : "")+
"class='"+(this.state==this.FIELD_VALID||!this.isChanged()?this.normalClass : this.errorClass)+"' "+
"onblur=\""+this.id+".setValue(this.value,'minor');"+this.id+".onFieldBlur()\" "+
"onfocus=\""+this.id+".onFieldFocus()\" ";
if(this.value!=""){displayCode+="value='"+this.minorValue+"' ";}
displayCode+="></input></td>";
if(this.units!=undefined){displayCode+="<td>&nbsp;&nbsp;</td><td>"+ minorPrefix+"</td>";}
displayCode+="</tr></table>";
return displayCode;}else{
return this.super_FieldObjectNumeric_getFieldHTML();}}
FieldObjectWeight.prototype.getValue=function(){
return convertFractToDecimal(this.value)+"";}
FieldObjectWeight.prototype.updateInternalMajorMinor=function(){
this.majorValue=parseInt((this.value / 14.0));this.minorValue=parseInt(this.value % 14.0);}
FieldObjectWeight.prototype.setValue=function(value,pOption){
if(pOption=="major"&&this.majorValue!=value){
this.majorValue=value;this.value=(this.majorValue!=""?parseInt(this.majorValue * 14): 0)+(this.minorValue!=""?parseInt(this.minorValue): 0);
this.updateInternalMajorMinor();
this.state=this.isValid();this.onFieldChange();}else if(pOption=="minor"&&this.minorValue!=value){
this.minorValue=value;this.value=(this.majorValue!=""?parseInt(this.majorValue * 14): 0)+(this.minorValue!=""?parseInt(this.minorValue): 0);
this.updateInternalMajorMinor();
this.state=this.isValid();this.onFieldChange();}else if(pOption==undefined&&this.value!=value){
var element=document.getElementById(this.elementId);if(element!=undefined){
value=(value.match(/[0-9\.\,]/)?parseFloat(value): 0);
if(parseFloat(value)==value){value=Math.round(value*10)/10;}
this.value=(this.measurementSystem==this.UNIT_SYSTEM_METRIC?value * this.metricToImperialConversionConstant : value);
this.updateInternalMajorMinor();
this.state=this.isValid();this.onFieldChange();}}}
function FieldObjectYear(id,elementId){jsClass.extend(this,[FieldObjectNumeric,FieldObject]);
this.id=id;this.elementId=elementId;}
FieldObjectYear.prototype.id="FieldObjectYear";FieldObjectYear.measurementSystem="";
FieldObjectYear.prototype.setUnitSystem=function(unitSystem){}
function Camera(id){
this.id=id;}
Camera.prototype.id="Camera";Camera.prototype.isInitialized=false;Camera.prototype.action=undefined;Camera.prototype.state=undefined;Camera.prototype.focusGeometry=undefined;Camera.prototype.focusGarmentId=undefined;Camera.prototype.boundingBox=undefined;Camera.prototype.lighting=undefined;Camera.prototype.transitionPoint=undefined;
/*
* Initializes the camera object
*/
Camera.prototype.init=function(){
this.boundingBox=undefined;this.action=undefined;this.lighting=undefined;this.isInitialized=true;}
/*
* Set this camera with the value of the camera passed in parameters
* @paramCameraThe camera object to use to get parameters
*/
Camera.prototype.setCameraFrom=function(newCamera){
if(newCamera.state!=undefined){this.state=MapUtils.putAll(this.state,newCamera.state);}
if(newCamera.action!=undefined){this.action=MapUtils.putAll(this.action,newCamera.action);}
if(newCamera.boundingBox!=undefined){this.boundingBox=MapUtils.putAll(this.boundingBox,newCamera.boundingBox);}
if(newCamera.focusGeometry!=undefined){this.focusGeometry=MapUtils.putAll(this.focusGeometry,newCamera.focusGeometry);}
if(newCamera.focusGarmentId!=undefined){this.focusGarmentId=newCamera.focusGarmentId;}}
/*
* Set the focus geometry for that camera. Used with orbit actions
* @paramStringgeometryNameName of the geometry that we will focus on
* @paramArraytransformAn array of 12 floats representing the transformation matrix for that geometry
*/
Camera.prototype.setFocusGeometry=function(name,transform,garmentId){
this.focusGeometry={"name":name,"transform":MapUtils.getClone(transform)}
if(garmentId!=undefined){this.focusGarmentId=garmentId;}}
/*
* Set the lighting preset for that camera
* @paramStringlightNameName of the light that will be used
*/
Camera.prototype.setLighting=function(name){
this.lighting=name;}
/*
* Set the bounding box for that camera.
* @paramMapboundingBoxA bounding box structure.
*/
Camera.prototype.setBoundingBox=function(boundingBox){
this.boundingBox=MapUtils.getClone(boundingBox);}
/*
* Set the bounding box for that camera.
* @paramMapboundingBoxA bounding box structure.
*/
Camera.prototype.setTransitionPoint=function(transitionPoint){
this.transitionPoint=MapUtils.getClone(transitionPoint);}
/*
* Sets the camera to do an orbit action on the model based on the current focused geometry
* @param float The angle by which to orbit on the plane based on the current camera state
* @param float The ratio by which to advance or move backward
*/
Camera.prototype.setPlaneOrbitAction=function(angle,ratio){
this.action={"name" : "orbit","angle" : angle,"ratio" : ratio}}
/*
* Sets the camera to do a focus action on the model based on the current focused geometry
* @param Float The amount of the object that is viewed compared to the context
* @param Array(3)A point in space used as the center of the scene
*/
Camera.prototype.setFocusAction=function(factor){
this.action={"name" : "focus","factor" : factor}}
/*
* Sets the camera to do a focus action on the model based on the current focused geometry
* @param MapA map representing the new state of the camera.
*/
Camera.prototype.setCameraAction=function(newState){
this.action={"name" : "setCamera","camera" : MapUtils.getClone(newState)}}
/*
* Returns a string representing the camera state and action in the format of a MPS REST interface
*/
Camera.prototype.getMPSString=function(){var random=(Math.random()*10000)+"";random=random.substring(0,random.indexOf("."));
return this.getMPSStateString()+"&"+this.getMPSActionString()+"&"+this.getMPSBoundingBoxString()+"&l="+this.lighting+"&x="+Model.world+"&rand="+random;}
/*
* Returns a string representing the camera state in the format of a MPS REST interface
*/
Camera.prototype.getMPSStateString=function(){
var mpsStateString="";
if(this.state!=undefined){
mpsStateString+=
"c="+this.state["position"][0]+";"+this.state["position"][1]+";"+this.state["position"][2]+";"+
this.state["rotation"][0]+";"+this.state["rotation"][1]+";"+this.state["rotation"][2]+";"+
this.state["fov"];
return mpsStateString;}else{return "";}}
/*
* Returns a string representing the camera action in the format of a MPS REST interface
*/
Camera.prototype.getMPSActionString=function(){
var mpsActionString="";
if(this.action!=undefined){
if(this.action["name"]=="focus"){
mpsActionString+="a=f";
mpsActionString+="&f.g="+this.getMPSFocusGeometryString();mpsActionString+="&f.f="+this.action["factor"];
if(this.useTransitionPoint){mpsActionString+="&f.p="+this.getMPSTransitionPointString();}
}else if(this.action["name"]=="orbit"){
mpsActionString+="a=o";
mpsActionString+="&o.g="+this.getMPSFocusGeometryString();mpsActionString+="&o.a="+this.action["angle"];mpsActionString+="&o.r="+this.action["ratio"];}else if (this.action["name"]=="setCamera"){
mpsActionString+="a=p";
mpsActionString+="&p.c="+this.action["camera"]["position"][0]+";"+this.action["camera"]["position"][1]+";"+this.action["camera"]["position"][2]+";"+
this.action["camera"]["rotation"][0]+";"+this.action["camera"]["rotation"][1]+";"+this.action["camera"]["rotation"][2]+";" +
this.action["camera"]["fov"];}
return mpsActionString;}else{return "a=0";}}
/*
* Returns a string representing the focus geometry in the format of a MPS REST interface
*/
Camera.prototype.getMPSFocusGeometryString=function(){
var mpsGeoString="";
if(this.focusGeometry!=undefined){
mpsGeoString+=this.focusGeometry["name"];
for(var i=0;i<16;i++){if(i!=3&&i!=7&&i!=11&&i!=15)
mpsGeoString+=";"+(Math.round(this.focusGeometry["transform"][i] * 1000.0))/ 1000.0;mpsGeoString=mpsGeoString.replace("NaN","0");}
return mpsGeoString;}else{return "";}}
/*
* Returns a string representing the camera's bounding box in the format of a MPS REST interface
*/
Camera.prototype.getMPSBoundingBoxString=function(){
var mpsbbString="";
if(this.boundingBox!=undefined){
mpsbbString+="b="+this.boundingBox["minX"]+";"+this.boundingBox["minY"]+";"+this.boundingBox["minZ"]+";";mpsbbString+=this.boundingBox["maxX"]+";"+this.boundingBox["maxY"]+";"+this.boundingBox["maxZ"];
return mpsbbString;}else{return "";}}
/*
* Returns a string representing the camera state in the format of a MPS REST interface
*/
Camera.prototype.getMPSTransitionPointString=function(){
var mpstpString="";
if(this.focusGeometry!=undefined){
mpstpString+=this.transitionPoint[0]+";"+this.transitionPoint[1]+";"+this.transitionPoint[2];
return mpstpString;}else{return "";}}
function Controller(instanceId,className){
this.id=instanceId;this.className=className;}
Controller.prototype.id="Controller";Controller.prototype.isInstance=false;
Controller.prototype.instanceInit=function(){
try{if(typeof(eval(this.className))=="function"){this.transformInstance();}
}catch(e){Workspace.importLib("/js/"+this.className+".js",this.id+".instanceTransform()");}}
Controller.prototype.instanceTransform=function(){
if(typeof(eval(this.className))=="function"){eval(this.id+"=new "+this.className+"('"+this.id+"');"+this.id+".init()");this.isInstance=true;}else{log.debug("Could not transform instance "+this.id+" into class "+this.className,this);}}
function CookieController(id){
this.id=id;this.checkCookieSupport();this.updateCookies();}
CookieController.prototype.id="CookieController";CookieController.prototype.data=new Array();CookieController.prototype.domain=".mvm.com"
CookieController.prototype.cookie=undefined;CookieController.prototype.thread=undefined;CookieController.prototype.isCookieSupported=false;CookieController.prototype.isPermanentCookieSupported=false;CookieController.prototype.isSessionCookieSupported=false;CookieController.prototype.checkTime=500;
CookieController.prototype.loadCookies=function(){
var cookieData="";var iCount=0;
this.cookie=document.cookie+"";this.data=new Array();var cookies=this.cookie.split(";");var cookie=undefined;
for(var cookieIndex in cookies){cookie=cookies[cookieIndex].split("=");this.data[trim(cookie[0])]=decodeURIComponent(cookie.slice(1,cookie.length).join("="));}}
CookieController.prototype.updateCookies=function(){
if(this.cookie+""!=document.cookie+""){
this.loadCookies();
if(typeof(Workspace)!="undefined"&&typeof(Workspace.events)!="undefined"){Workspace.events.throwEvent(Workspace.events.EVENT_COOKIE_CHANGED,this);}}
this.thread=setTimeout(this.id+".updateCookies()",this.checkTime);}
CookieController.prototype.checkCookieSupport=function(){
var isPermanentCookieSupported=false;var isSessionCookieSupported=false;
this.setAttribute("_cookieTestPermanent","test");this.setAttribute("_cookieTestSession","test",true);
this.loadCookies();
this.isPermanentCookieSupported=(this.getAttribute("_cookieTestPermanent")=="test"?true : false);this.isSessionCookieSupported=(this.getAttribute("_cookieTestSession")=="test"?true : false);
this.deleteCookie("_cookieTestPermanent");this.deleteCookie("_cookieTestSession");
this.isCookieSupported=(this.isPermanentCookieSupported&&this.isPermanentCookieSupported?true : false);}
CookieController.prototype.refresh=function(){
this.loadCookies();}
CookieController.prototype.writeCookie=function(key,value,expires,domain){
domain=(domain!=undefined?domain : this.domain);
if(key!="rememberMe"&&key!="rememberMeCookie"){value=encodeURIComponent(value);}
this.deleteCookie(key);
document.cookie=
key+"="+
value+";"+
"path=/;"+(domain!=""?"domain="+domain+";" : "")+(expires==undefined?"expires="+new Date(2050,01,01).toGMTString(): expires);
this.loadCookies();}
CookieController.prototype.setAttribute=function(key,value,isForSessionOnly){
this.data[key]=value;this.writeCookie(key,value,(isForSessionOnly!=undefined&&isForSessionOnly==true?"" : undefined));}
CookieController.prototype.deleteCookie=function(key){
document.cookie=key+"=;expires="+new Date(1900,01,01).toGMTString()+";domain="+this.domain+";path=/";this.loadCookies();}
CookieController.prototype.getAttribute=function(key){
return this.data[key];}
var CookieUtils=new CookieController("CookieUtils");
function DataExchangeTunnel(pId){
this.id=pId;
this.activeConnectionArray=new Array();this.groupConnectionMap=new Array();this.timeoutTrackerMap=new Array();this.standbyConnectionList=new Array();}
DataExchangeTunnel.prototype.id="DataExchangeTunnel";DataExchangeTunnel.prototype.isInitialized=false;DataExchangeTunnel.prototype.activeConnectionArray=undefined;DataExchangeTunnel.prototype.groupConnectionMap=undefined;DataExchangeTunnel.prototype.connectionSerialCount=0;DataExchangeTunnel.prototype.serverURL="/";DataExchangeTunnel.prototype.isDebugActive=true;DataExchangeTunnel.prototype.debugResponse=false;DataExchangeTunnel.prototype.timeoutTrackerMap=undefined;
DataExchangeTunnel.prototype.STATUS_CREATED="|created";DataExchangeTunnel.prototype.STATUS_OPENED="|opened";DataExchangeTunnel.prototype.STATUS_WAITING="|waiting";DataExchangeTunnel.prototype.STATUS_VALID_RESPONSE="|valid response";DataExchangeTunnel.prototype.STATUS_INVALID_RESPONSE="|INVALID response";DataExchangeTunnel.prototype.STATUS_ERROR="|error";DataExchangeTunnel.prototype.STATUS_CLOSED="|closed";DataExchangeTunnel.prototype.STATUS_TIMEOUT="|timeout";
DataExchangeTunnel.prototype.RESPONSE_FORMAT_ARRAY=0;DataExchangeTunnel.prototype.RESPONSE_FORMAT_XML=1;DataExchangeTunnel.prototype.RESPONSE_FORMAT_TEXT=2;
DataExchangeTunnel.prototype.ERROR_INVALID_RESPONSE="invalidResponse";DataExchangeTunnel.prototype.ERROR_TIMEOUT="timeout";
DataExchangeTunnel.prototype.init=function(){
Workspace.events.addListener(Workspace.events.EVENT_SESSION_RECOVERED,this);this.isInitialized=true;}
DataExchangeTunnel.prototype.onStateChange=function(){
var connection=undefined;var estimatedActiveConnectionCount=0;
for(var index in det.activeConnectionArray){
connection=det.activeConnectionArray[index];if(connection!=undefined&&connection.active==true){
if(connection.httpRequest.readyState==4){connection.active=false;det.processResponse(connection);
if(connection.group!=undefined){det.processGroupedConnection(connection);}
}else{estimatedActiveConnectionCount++;}}}
if(estimatedActiveConnectionCount==0){
if(det.activeConnectionArray.length>10){det.activeConnectionArray=det.activeConnectionArray.slice(det.activeConnectionArray.length-10,det.activeConnectionArray.length);}
Workspace.events.throwEvent(Workspace.events.EVENT_SERVER_ALL_REQUESTS_COMPLETED,this);}}
DataExchangeTunnel.prototype.processResponse=function(connection){
var responseMap=new Array();var responseText=connection.httpRequest.responseText;
connection.timeReceived=new Date();
if(connection.timeoutThread!=undefined){clearTimeout(connection.timeoutThread);}
if(this.isDebugActive&&typeof(log)!="undefined"){log.debug("(RESPONSE)"+connection.id+"("+(connection.timeReceived.getTime()-connection.timeSent.getTime())/1000+"s "+" "+(Math.floor(responseText.length/1024*100))/100+"KB)-"+connection.serverUrl+(this.debugResponse?"\n\r\t"+(responseText.length>1000?responseText.substring(0,1000)+"..." : responseText): ""),this);}
if(connection.responseFormat==this.RESPONSE_FORMAT_TEXT){
connection.status+=this.STATUS_VALID_RESPONSE;responseMap["textResponse"]=responseText;
}else if(connection.httpRequest.status==200){
if(connection.responseFormat==this.RESPONSE_FORMAT_ARRAY){
if(responseText.indexOf("[")==0){responseMap=eval(responseText)[0];
}else if(responseText.length==0){responseMap=new Array();
}else{connection.status+=this.STATUS_INVALID_RESPONSE;responseMap=undefined;}
}else if(connection.responseFormat==this.RESPONSE_FORMAT_XML){
if(connection.httpRequest.responseXML!=undefined){connection.status+=this.STATUS_VALID_RESPONSE;responseMap=xmlParser.convertXmlToMap(connection.httpRequest.responseXML.documentElement);}else{connection.status+=this.STATUS_INVALID_RESPONSE;responseMap=undefined;}}
}else{connection.status+=this.STATUS_INVALID_RESPONSE;responseMap=undefined;connection.error=this.ERROR_INVALID_RESPONSE;}
if(responseMap==undefined||(responseMap["errorCode"]!=undefined&&responseMap["errorCode"]==Workspace.ERROR_SESSION_TIMEOUT)){
connection.status+=this.STATUS_INVALID_RESPONSE;
if(typeof(Workspace)!="undefined"){if(responseMap!=undefined&&responseMap["errorCode"]==Workspace.ERROR_SESSION_TIMEOUT){
this.standbyConnectionList.push(connection);Workspace.recoverServerSession();}else{Workspace.message.displayMessage(resource.get("requestInvalid"));log.error("Invalid response: ["+connection.responseText+"]",this);}}
responseMap=undefined;
}else{
connection.response=responseMap;
if(connection.onCompleteScript!=undefined){eval(connection.onCompleteScript);}
Workspace.events.throwEvent(
Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,connection);}
connection.httpRequest=null;
connection.status+=this.STATUS_CLOSED;}
DataExchangeTunnel.prototype.sendRequest=function(attributes){
if(!this.isInitialized){this.init();}
var newConnection=this.createConnection(attributes);
this.activeConnectionArray[this.activeConnectionArray.length]=newConnection;
if(newConnection.group==undefined){this._send(newConnection);}else{this.addGroupedConnection(newConnection);}}
DataExchangeTunnel.prototype.addGroupedConnection=function(connection){
var groupId=connection.group;
this.groupConnectionMap[groupId]=(this.groupConnectionMap[groupId]!=undefined?this.groupConnectionMap[groupId] : new Array());
this.groupConnectionMap[groupId].push(connection);
if(this.groupConnectionMap[groupId].length==1){this._send(connection);}}
DataExchangeTunnel.prototype.processGroupedConnection=function(connection){
var groupId=connection.group;
if(this.groupConnectionMap[groupId][0]==connection){this.groupConnectionMap[groupId].shift();}
if(this.groupConnectionMap[groupId]!=undefined&&this.groupConnectionMap[groupId].length>0){this._send(this.groupConnectionMap[groupId][0]);}}
DataExchangeTunnel.prototype._send=function(connection){
var todayDate=new Date();
connection.httpRequest.onreadystatechange=this.onStateChange;
if(this.isDebugActive&&typeof(log)!="undefined"){var callingControllerId=(connection.callingController!=undefined&&connection.callingController.id!=undefined?connection.callingController.id : "");log.debug("(REQUEST)"+connection.id+"-["+callingControllerId+"] "+connection.serverUrl+"?"+connection.query,this);}
Workspace.events.throwEvent(
Workspace.events.EVENT_SERVER_REQUEST_SENT,connection);
if(connection.timeout!=undefined){connection.timeoutThread=setTimeout(this.id+".handleConnectionTimeout('"+connection.id+"')",connection.timeout);}
if(connection.method=="POST"){
connection.timeSent=new Date();
connection.httpRequest.open(
"POST",connection.serverUrl,!connection.isSynchronized);
connection.query=(connection.query==undefined?"" : connection.query);
connection.httpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");connection.httpRequest.setRequestHeader("Content-Length",connection.query.length);connection.httpRequest.setRequestHeader("If-Modified-Since",new Date(todayDate.getYear(),todayDate.getMonth(),todayDate.getDate()+1).toString());
connection.httpRequest.send(connection.query);}else{
connection.timeSent=new Date();
connection.httpRequest.open(
"GET",connection.serverUrl+(connection.query!=""?(connection.query.indexOf("?")!=0?"?" : "")+connection.query : ""),!connection.isSynchronized);
connection.httpRequest.setRequestHeader("If-Modified-Since",new Date(todayDate.getYear(),todayDate.getMonth(),todayDate.getDate()+1).toString());
connection.httpRequest.send(null);}
connection.status+=det.STATUS_OPENED;}
DataExchangeTunnel.prototype.handleConnectionTimeout=function(connectionId){
var index=0;while(det.activeConnectionArray[index].id!=connectionId){index++;}
var connection=det.activeConnectionArray[index]
if(connection.id==connectionId){
connection.status+=this.STATUS_TIMEOUT;connection.httpRequest.abort();connection.httpRequest=null;connection.error=this.ERROR_TIMEOUT;
if(connection.onCompleteScript!=undefined){eval(connection.onCompleteScript);}
log.error("Connection timeout: "+connection.serverUrl,this);
Workspace.events.throwEvent(
Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,connection);}}
DataExchangeTunnel.prototype.getHTTPObject=function(){
var xmlhttp;
/*@cc_on
@if(@_jscript_version>=5)
try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(E){xmlhttp=false;}}
@else
xmlhttp=false;@end @*/
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}
catch(e){log.error("AJAX Not supported on this browser/OS");xmlhttp=false;}}
return xmlhttp;}
DataExchangeTunnel.prototype.createConnection=function(attributes){
var newConnection=new Object();
var requestParams="";var parametersMap=new Array();
if(attributes["parameters"]!=undefined&&attributes["parameters"][0]!=undefined){
for(var i=0;i<attributes["parameters"].length;i++){requestParams+=(requestParams==""?"":"&")+attributes["parameters"][i][0]+"="+attributes["parameters"][i][1];parametersMap[attributes["parameters"][i][0]]=attributes["parameters"][i][1];}
}else if(attributes["parameters"]!=undefined&&attributes["parameters"]!=""){requestParams=attributes["parameters"];}
newConnection.action=(attributes["action"]!=undefined?attributes["action"] : "");newConnection.timeSent=undefined;newConnection.timeReceived=undefined;newConnection.serverUrl=(attributes["serverUrl"]!=undefined?attributes["serverUrl"] : this.serverURL);newConnection.active=true;newConnection.httpRequest=this.getHTTPObject();newConnection.id="connection"+(this.connectionSerialCount++);newConnection.query=(attributes["query"]!=undefined?attributes["query"] : requestParams);newConnection.method=(attributes["method"]!=undefined?attributes["method"] : "POST");newConnection.status=this.STATUS_CREATED;newConnection.callingController=(attributes["callingController"]!=undefined?attributes["callingController"] : undefined);newConnection.responseFormat=(attributes["responseFormat"]!=undefined?attributes["responseFormat"] : this.RESPONSE_FORMAT_ARRAY);newConnection.response=new Array();newConnection.parametersMap=(attributes["parametersMap"]!=undefined?attributes["parametersMap"] : parametersMap);newConnection.onCompleteScript=(attributes["onCompleteScript"]!=undefined?attributes["onCompleteScript"] : undefined);newConnection.info=(attributes["info"]!=undefined?attributes["info"] : undefined);newConnection.group=(attributes["group"]!=undefined?attributes["group"] : undefined);newConnection.isSynchronized=(attributes["isSynchronized"]!=undefined?attributes["isSynchronized"] : false);newConnection.timeout=(attributes["timeout"]!=undefined?attributes["timeout"] : undefined);newConnection.timeoutThread=undefined;newConnection.error=undefined;
return newConnection;}
DataExchangeTunnel.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==Workspace.events.EVENT_SESSION_RECOVERED){
for(var i=0;i<this.standbyConnectionList.length;i++){this.sendRequest(this.standbyConnectionList[i]);}
this.standbyConnectionList=new Array();}}
var det=new DataExchangeTunnel("det");
function EventController(){}
EventController.prototype.EVENT_SERVER_RESPONSE_RECEIVED="EVENT_SERVER_RESPONSE_RECEIVED";EventController.prototype.EVENT_SERVER_REQUEST_SENT="EVENT_SERVER_REQUEST_SENT";EventController.prototype.EVENT_SERVER_ALL_REQUESTS_COMPLETED="EVENT_SERVER_ALL_REQUESTS_COMPLETED";EventController.prototype.EVENT_INITIALIZED="EVENT_INITIALIZED";EventController.prototype.EVENT_INIT_FAILURE="EVENT_INIT_FAILURE";EventController.prototype.EVENT_SKIN_LOADED="EVENT_SKIN_LOADED";EventController.prototype.EVENT_PAGE_LOADED="EVENT_PAGE_LOADED";EventController.prototype.EVENT_CONTROLLER_INITIALIZED="EVENT_CONTROLLER_INITIALIZED";EventController.prototype.EVENT_RESOURCES_LOADED="EVENT_RESOURCES_LOADED";EventController.prototype.EVENT_MODEL_ATTRIBUTES_CHANGED="EVENT_MODEL_ATTRIBUTES_CHANGED";EventController.prototype.EVENT_FIT_CREATED="EVENT_FIT_CREATED";EventController.prototype.EVENT_FIT_ATTRIBUTES_CHANGED="EVENT_FIT_ATTRIBUTES_CHANGED";EventController.prototype.EVENT_MODEL_INITIALIZED="EVENT_MODEL_INITIALIZED";EventController.prototype.EVENT_MODEL_IMAGE_RECEIVED="EVENT_MODEL_IMAGE_RECEIVED";EventController.prototype.EVENT_MODEL_IMAGE_CHANGED="EVENT_MODEL_IMAGE_CHANGED";EventController.prototype.EVENT_MODEL_IMAGE_LOADING="EVENT_MODEL_IMAGE_LOADING";EventController.prototype.EVENT_MODEL_ONMOUSEOVER="EVENT_MODEL_ONMOUSEOVER";EventController.prototype.EVENT_MODEL_ONMOUSECLICK="EVENT_MODEL_ONMOUSECLICK";EventController.prototype.EVENT_MODEL_ONMOUSEDOWN="EVENT_MODEL_ONMOUSEDOWN";EventController.prototype.EVENT_MODEL_LAYOUT_CHANGED="EVENT_MODEL_LAYOUT_CHANGED";EventController.prototype.EVENT_USER_STATE_CHANGE="EVENT_USER_STATE_CHANGE";EventController.prototype.EVENT_USER_SIGNIN="EVENT_USER_SIGNIN";EventController.prototype.EVENT_USER_SIGNOUT="EVENT_USER_SIGNOUT";EventController.prototype.EVENT_USER_AUTHENTICATED="EVENT_USER_AUTHENTICATED";EventController.prototype.EVENT_ONMYMODEL_ITEM_SELECTED="EVENT_ONMYMODEL_ITEM_SELECTED";EventController.prototype.EVENT_ONMYMODEL_CHANGED="EVENT_ONMYMODEL_CHANGED";EventController.prototype.EVENT_MODEL_MAP_LOADED="EVENT_MODEL_MAP_LOADED";EventController.prototype.EVENT_MODEL_CONTENT_CHANGED="EVENT_MODEL_CONTENT_CHANGED";EventController.prototype.EVENT_PROFILE_CREATED="EVENT_PROFILE_CREATED";EventController.prototype.EVENT_PROFILE_MODIFIED="EVENT_PROFILE_MODIFIED";EventController.prototype.EVENT_PROFILE_UPDATED="EVENT_PROFILE_UPDATED";EventController.prototype.EVENT_PROFILE_DELETED="EVENT_PROFILE_DELETED";EventController.prototype.EVENT_BODYSET_CHANGED="EVENT_BODYSET_CHANGED";EventController.prototype.EVENT_COOKIE_CHANGED="EVENT_COOKIE_CHANGED";EventController.prototype.EVENT_CATALOG_CATEGORY_CHANGED="EVENT_CATALOG_CATEGORY_CHANGED";EventController.prototype.EVENT_CATEGORY_TREE_UPDATED="EVENT_CATEGORY_TREE_UPDATED";EventController.prototype.EVENT_MODEL_ITEM_TRYON="EVENT_MODEL_ITEM_TRYON";EventController.prototype.EVENT_MODEL_ITEM_REMOVE="EVENT_MODEL_ITEM_REMOVE";EventController.prototype.EVENT_IFRAME_EXPAND="EVENT_IFRAME_EXPAND";EventController.prototype.EVENT_IFRAME_COLLAPSE="EVENT_IFRAME_COLLAPSE";EventController.prototype.EVENT_UPLOAD_STARTED="EVENT_UPLOAD_STARTED";EventController.prototype.EVENT_UPLOAD_COMPLETED="EVENT_UPLOAD_COMPLETED";EventController.prototype.EVENT_INSTANCE_SELECTION_START="EVENT_INSTANCE_SELECTION_START";EventController.prototype.EVENT_CAMERA_CHANGED="EVENT_CAMERA_CHANGED";EventController.prototype.EVENT_PRODUCT_PAGE_CALL="EVENT_PRODUCT_PAGE_CALL";EventController.prototype.EVENT_SESSION_RECOVERED="EVENT_SESSION_RECOVERED";EventController.prototype.EVENT_FACEMAPPING_START="EVENT_FACEMAPPING_START";EventController.prototype.EVENT_FACEMAPPING_END="EVENT_FACEMAPPING_END";EventController.prototype.EVENT_CONTENT_CREATED="EVENT_CONTENT_CREATED";EventController.prototype.EVENT_CONTENT_DELETED="EVENT_CONTENT_DELETED";
EventController.prototype.id="EventController";EventController.prototype.eventListenersMap=new Array();EventController.prototype.eventScriptMap=new Array();EventController.prototype.isLogging=true;
EventController.prototype.throwEvent=function(eventKey,attributes){
if(this.isLogging){log.debug("Event "+eventKey+" thrown",this);}
var listenersArray=this.eventListenersMap[eventKey];var scriptsArray=this.eventScriptMap[eventKey];
if(listenersArray!=undefined){
for(var controllerId in listenersArray){if(listenersArray[controllerId]!=undefined){listenersArray[controllerId].catchEvent(eventKey,attributes);}}}
if(scriptsArray!=undefined){
for(var index in scriptsArray){if(scriptsArray[index]!=undefined){eval(scriptsArray[index]["jsCode"]);if(scriptsArray[index]["isOneTimeOnly"]){scriptsArray[index]=undefined;}}}}
if(typeof(catchAllEvent)!="undefined"){catchAllEvent(eventKey,attributes);}}
EventController.prototype.addListener=function(eventKey,controllerObject){
if(eventKey!=undefined&&eventKey!=""&&controllerObject!=undefined){
if(this.eventListenersMap[eventKey]==undefined){this.eventListenersMap[eventKey]=new Array();}
this.eventListenersMap[eventKey][controllerObject.id]=controllerObject;}
return this.eventListenersMap[eventKey].length-1;}
EventController.prototype.isEventListener=function(eventKey,controllerObject){
return this.eventListenersMap[eventKey][controllerObject.id]!=undefined?true : false;}
EventController.prototype.addEventScript=function(eventKey,jsCode,isOneTimeOnly){
if(eventKey!=undefined&&eventKey!=""&&jsCode!=undefined&&jsCode!=""){var scriptsArray=(this.eventScriptMap[eventKey]!=undefined?this.eventScriptMap[eventKey] : new Array());
scriptsArray[scriptsArray.length]={"jsCode":jsCode,"isOneTimeOnly":(isOneTimeOnly==undefined?false : isOneTimeOnly)}
this.eventScriptMap[eventKey]=scriptsArray;}
return this.eventScriptMap[eventKey].length-1;}
function JSClass(){}
JSClass.prototype.extend=function(object,superClassArray){
var superClass=undefined;
if(superClassArray[0]!=undefined){
for(var i=0;i<superClassArray.length;i++){
superClass=superClassArray[i];
if(superClass!=undefined&&superClass.prototype!=undefined){
for(var attribute in superClass.prototype){
if(eval("object."+attribute+"==undefined")){eval("object."+attribute+"=superClass.prototype."+attribute);}
if(superClass.prototype.id==undefined||superClass.prototype.id==""){log.error("superClass ID is not defined or empty for object ["+object.id+"]");}
eval("object.super_"+superClass.prototype.id+"_"+attribute+"=superClass.prototype."+attribute);}}else{log.error("extend(): Class undefined("+superClass.toString()+")");}}}else{log.error("extend(): Expected parameter superClassArray{Array}");}}
JSClass.prototype.cast=function(/*Instance*/ object,/*Class*/ castClass){
for(var attribute in superClass.prototype){
if(eval("object."+attribute+"==undefined")){eval("object."+attribute+"=superClass.prototype."+attribute);}}}
JSClass.prototype.implementsLoggeable=function(/*Instance*/ object){
if(getQuery().log=="debug"){
var logCodeLine="";var functionCodeArray=new Array();
for(var attribute in object){
logCodeLine="log.debug(\" ~ \"+this.id+\"."+attribute+"(\"+jsClass.getArgumentList(arguments)+\")\");";
if(typeof(object[attribute])=="function"){
functionCodeArray=object[attribute].toString().split("{");functionCodeArray[1]=logCodeLine+functionCodeArray[1];
eval("object[attribute]="+functionCodeArray.join("{"));}}}}
JSClass.prototype.implementsProfiling=function(/*Instance*/ object){
var functionCode="";
if(getQuery().log=="debug"){
for(var attribute in object){
if(typeof(object[attribute])=="function"){
functionCode=object[attribute].toString();functionCode=functionCode.replace(/(.*)\{(.*)/,"$1{\nProfiler.methodIn(this.id+'."+attribute+"');\n$2");functionCode=functionCode.substring(0,functionCode.length-1)+"Profiler.methodOut(this.id+'."+attribute+"');"+"}";
eval("object[attribute]="+functionCode);log.debug("Attached profiler to "+(object.id!=undefined?object.id : "[Object]")+"."+attribute);}}}}
JSClass.prototype.getArgumentList=function(methodArguments){
var argumentsString="";
for(var i=0;i<methodArguments.length;i++){
if(methodArguments[i]!=""){if(typeof(methodArguments[i])=="object"&&methodArguments[i].id!=undefined&&methodArguments[i].id!=""){argument="("+typeof(methodArguments[i])+")"+methodArguments[i].id}else{try{argument=MapUtils.toJSON(methodArguments[i]);if(argument.length>100){argument=argument.substring(0,100)+"...";}}catch(e){argument="[Parse error] Cause : "+e.message;}}
argumentsString+=argument;
if(i<methodArguments.length-1){argumentsString+=","}}}
return argumentsString}
var jsClass=new JSClass();
function LogControllerAbstract(instanceId){}
LogControllerAbstract.prototype.init=function(){}
LogControllerAbstract.prototype.info=function(text,reference){}
LogControllerAbstract.prototype.error=function(text,reference){}
LogControllerAbstract.prototype.debug=function(text,reference){}
var log=new LogControllerAbstract("log");
function Map(array){
this.array=(array!=undefined?array : new Array());}
Map.prototype.array=undefined;
Map.prototype.get=function(key,map){
if(key!=undefined){return this.getMapValue(key,(map!=undefined?map : this.array));}else{log.error("get()called with undefined key",this);}}
Map.prototype.getIndex=function(index,map){
map=(map!=undefined?map : this.array)
var iCount=0;var returnValue=undefined;
for(var key in map){
if(iCount==index){returnValue=map[key];break;}
iCount++;}
return returnValue;}
Map.prototype.getKeyAtIndex=function(index,map){
map=(map!=undefined?map : this.array)
var iCount=0;var returnValue=undefined;
for(var key in map){
if(iCount==index){returnValue=key;break;}
iCount++;}
return returnValue;}
Map.prototype.getCount=function(map){
var iCount=0;
for(var key in map){iCount++;}
return iCount;}
Map.prototype.put=function(key,value,map){
this.array=this.setMapValue(key,value,(map!=undefined?map : this.array));}
Map.prototype.getMapValue=function(multiLevelKey,map,separator){
map=(map!=undefined?map : this.array);
var returnValue=map[multiLevelKey];
if(returnValue==undefined){
try{returnValue=eval("map[\""+multiLevelKey.replace(new RegExp("\/","g"),"\"][\"")+"\"]");}catch(e){returnValue=undefined;}}
return returnValue;}
Map.prototype.setMapValue=function(multiLevelKey,value,map,separator){
separator=(separator!=undefined?separator : "/");
var isSet=false;var keyArray=multiLevelKey.split("/");
for(var key in map){
if(isSet){break;}
if(keyArray[0]==key){
if(keyArray.length>1){
map[key]=this.setMapValue(
keyArray.slice(1,keyArray.length).join("/"),value,map[key],separator);}else{map[key]=value;isSet=true;}}}
return map;}
Map.prototype.removeDuplicatesFromArray=function(array){
var tmpMap=new Array();var finalArray=new Array();
if(array!=undefined&&array.length!=undefined){
for(i=0;i<array.length;i++){tmpMap[array[i]]=array[i];}
for(index in tmpMap){finalArray[finalArray.length]=tmpMap[index];}}
return finalArray;}
Map.prototype.removeIndexFromArray=function(index,array){
var newArray=new Array();
for(var i in array){if(i!=index){newArray[newArray.length]=array[i];}}
return newArray;}
Map.prototype.toString=function(map,keyValueSeparator,pairSeparator){
map=(map==undefined?this.array : map);keyValueSeparator=(keyValueSeparator!=undefined?keyValueSeparator : ":");pairSeparator=(pairSeparator!=undefined?pairSeparator : ",");
var serializedString="";
for(var key in map){
if(serializedString!=""){serializedString+=pairSeparator;}
serializedString+=key+keyValueSeparator+map[key];}
return serializedString;}
Map.prototype.toJSON=function(object){
var JSONString="";
if(typeof(object)=="undefined"){JSONString+="undefined";
}else if(typeof(object)=="string"){JSONString+="\""+object+"\"";
}else if(typeof(object)=="number"||typeof(object)=="boolean"){JSONString+=object;
}else if(object[0]!=undefined){JSONString+="["
for(var index in object){if(typeof(object[index])!="undefined"&&typeof(object[index])!="function"){JSONString+=(index>0?",":"")+this.toJSON(object[index]);}}
JSONString+="]"
}else if(typeof(object)=="object"){JSONString+="{"
for(var key in object){if(typeof(object[key])!="undefined"&&typeof(object[key])!="function"){JSONString+=(JSONString!="{"?",":"")+"\""+key+"\":"+this.toJSON(object[key]);}}
JSONString+="}";}
return JSONString;}
Map.prototype.getClone=function(map){
var cloneMap=new Array();
for(var key in map){
if(typeof(map[key])=="object"){cloneMap[key]=this.getClone(map[key]);}else{cloneMap[key]=map[key];}}
return cloneMap}
Map.prototype.isEmpty=function(map){
map=(map!=undefined?map : this.array);
var isEmpty=true;
for(index in map){isEmpty=false;break;}
return isEmpty;}
Map.prototype.flatten=function(map,flattenedMap,keyPrefix){
flattenedMap=(flattenedMap==undefined?new Array(): flattenedMap);
for(var key in map){
if(typeof(map[key])=="object"||typeof(map[key])=="array"){flattenedMap=this.flatten(map[key],flattenedMap,(keyPrefix!=undefined?keyPrefix+"/" : "")+key);}else{flattenedMap[(keyPrefix!=undefined?keyPrefix+"/" : "")+key]=map[key];}}
return flattenedMap;}
Map.prototype.putAll=function(firstMap,secondMap){
secondMap=(secondMap!=undefined?secondMap : this.array);
var mergedMap=new Array();
for(key in firstMap){mergedMap[key]=firstMap[key];}
for(key in secondMap){mergedMap[key]=secondMap[key];}
return mergedMap;}
Map.prototype.getMapFromString=function(string,pairSeperator,keyValueSeparator){
var map=new Array();var keyValueArray=undefined;var key="";var value="";
pairSeperator=(pairSeperator!=undefined?pairSeperator : ",");keyValueSeparator=(keyValueSeparator!=undefined?keyValueSeparator : "=");
pairArray=string.split(pairSeperator);
for(var i=0;i<pairArray.length;i++){
keyValueArray=pairArray[i].split(keyValueSeparator);
if(keyValueArray[0]!=undefined&&keyValueArray[0]!=""&&keyValueArray[1]!=undefined){map[keyValueArray[0]]=keyValueArray[1];}}
return map;}
Map.prototype.toArray=function(map){
map=(map!=undefined?map : this.array);var resultArray=new Array();
for(var key in map){resultArray[resultArray.length]=[key,map[key]];}
return resultArray;}
Map.prototype.toMap=function(array){
var newMap=new Array();
for(var index in array){
newMap[array[index]]=index;}
return newMap;}
Map.prototype.isMapEquals=function(map1,map2,keyValidationArray){
var isEqual=(map1==undefined||map2==undefined?false : true);
if(isEqual&&keyValidationArray!=undefined){
for(var index in keyValidationArray){if(map1[keyValidationArray[index]]!=map2[keyValidationArray[index]]){isEqual=false;break;}}
}else{if(isEqual){for(var key in map1){if(map1[key]!=map2[key]){isEqual=false;break;}}}
if(isEqual){for(var key in map2){if(map2[key]!=map1[key]){isEqual=false;break;}}}}
return isEqual;}
Map.prototype.isArrayContentEquals=function(array1,array2){
var result=true;var map2=MapUtils.toMap(array2);
if(array1.length!=array2.length){result=false;}else{for(var index in array1){
if(map2[array1[index]]==undefined){result=false;break;}}}
return result;}
var MapUtils=new Map();
function RemoteController(id){
this.id=id;}
RemoteController.prototype.id="RemoteController";RemoteController.prototype.communicationUrl="";RemoteController.prototype.communicationFrameElement=undefined;
RemoteController.prototype.init=function(){
Workspace.events.addListener(Workspace.events.EVENT_PAGE_LOADED,this);Workspace.events.addListener(Workspace.events.EVENT_COOKIE_CHANGED,this);
if(this.communicationFrameElement==undefined){this.communicationFrameElement=document.createElement("IFRAME");this.communicationFrameElement.id=this.id+"CommunicationFrame";this.communicationFrameElement.style.display="none";
document.body.appendChild(this.communicationFrameElement);}
Workspace.events.throwEvent(Workspace.events.EVENT_CONTROLLER_INITIALIZED,this);}
RemoteController.prototype.registerRemote=function(url){
this.communicationUrl=url;}
RemoteController.prototype.getRemoteAction=function(){
if(document.cookie.indexOf("mvmRemoteAction")>-1){
CookieUtils.refresh();
var remoteAction=CookieUtils.getAttribute("mvmRemoteAction");
CookieUtils.deleteCookie("mvmRemoteAction");
return remoteAction;}else{return undefined;}}
RemoteController.prototype.handleRemoteAction=function(){
var remoteAction=this.getRemoteAction()
if(remoteAction!=undefined){
try{
eval(decodeURIComponent(remoteAction));}catch(e){log.error("could not execute remote action: "+remoteAction+" Cause : "+e.message);}}}
RemoteController.prototype.throwEvent=function(eventKey){
Workspace.events.throwEvent(eventKey,"");}
RemoteController.prototype.get=function(jsObject){
this.call("alert("+ParserUtils.serializeObject(jsObject)+")");}
RemoteController.prototype.call=function(action){
this.communicationFrameElement.src=this.communicationUrl+"?action="+encodeURIComponent(action);}
RemoteController.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==Workspace.events.EVENT_COOKIE_CHANGED||eventKey==Workspace.events.EVENT_PAGE_LOADED){
if(document.cookie.indexOf("mvmRemoteAction")>-1){this.handleRemoteAction();}}}
function ResourceController(id){
this.id=id;}
ResourceController.id="ResourceController";ResourceController._defaultMap=undefined;ResourceController._environmentMap=undefined;ResourceController._skinMap=undefined;ResourceController.environmentResourceName="";ResourceController.skinResourceName="";
ResourceController.prototype.init=function(){
Workspace.events.addListener(Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,this);
this._defaultMap=(typeof(defaultProductResourceMap)!="undefined"?defaultProductResourceMap : new Array());this.loadProperties();}
ResourceController.prototype.get=function(key,defaultValue){
var value=undefined;
value=MapUtils.get(key,this._skinMap,undefined);if(value==undefined){
value=MapUtils.get(key,this._environmentMap,undefined);if(value==undefined){
value=MapUtils.get(key,this._defaultMap,undefined);}}
if(value!=undefined){return value;}else{return(defaultValue!=undefined?defaultValue : "");}}
ResourceController.prototype.loadProperties=function(){
if(environmentConfigMap!=undefined&&globalResourceMap!=undefined){
this._environmentMap=environmentConfigMap;this._skinMap=globalResourceMap;
Workspace.events.throwEvent(Workspace.events.EVENT_RESOURCES_LOADED,this);
}else{if(environmentConfigMap==undefined){this.environmentResourceUrl="/environment/"+Workspace.retailerCode+".js";this.sendRequest(this.environmentResourceUrl,[]);}else{this._environmentMap=environmentConfigMap;}
if(globalResourceMap==undefined){this.skinResourceUrl="/pages/"+Workspace.skin+"/properties.js";this.sendRequest(this.skinResourceUrl,[]);}else{this._skinMap=globalResourceMap;}}}
ResourceController.prototype.applyProperties=function(prefixKey,object){
var attributeValue=undefined;
for(attribute in object){
if(typeof(object[attribute])!="function"){attributeValue=this.get(object.id+"Properties/"+attribute,"UNDEFINED_PROPERTY");if(attributeValue!="UNDEFINED_PROPERTY"){object[attribute]=attributeValue;}}}
for(var key in Workspace.query){
if(key.indexOf(object.id+"_")==0){try{
value=decodeURIComponent(Workspace.query[key]);value=value.replace(/\$/g,"\"");value=value.replace(/\(/g,"{");value=value.replace(/\)/g,"}");value=value.replace(/\+/g,":");
if(value.indexOf("{")==0){value="["+value+"]";eval(key.replace("_",".")+"=eval("+value+")[0]");
}else{eval(key.replace("_",".")+"=eval("+value+")");}
}catch(e){log.error("Failed url property override for "+key,this);}}}}
ResourceController.prototype.sendRequest=function(url,params){
det.sendRequest({method:"GET",serverUrl:url,responseFormat:det.RESPONSE_FORMAT_TEXT,callingController:this});}
ResourceController.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED&&attributes!=undefined&&attributes.response!=undefined&&attributes.callingController==this){
if(attributes.serverUrl==this.environmentResourceUrl){
if(attributes.response["textResponse"].indexOf("environmentConfigMap")>-1){eval(attributes.response["textResponse"]);
}else{log.info("No ENVIRONMENT resource file was found");environmentConfigMap=new Array();}
this._environmentMap=environmentConfigMap;
}else if(attributes.serverUrl==this.skinResourceUrl){
if(attributes.response["textResponse"].indexOf("globalResourceMap")>-1){eval(attributes.response["textResponse"]);
}else{log.info("No SKIN resource file was found");globalResourceMap=new Array();}
this._skinMap=globalResourceMap;}
if(this._environmentMap!=undefined&&this._skinMap!=undefined){Workspace.events.throwEvent(Workspace.events.EVENT_RESOURCES_LOADED,this);}}}
var resource=new ResourceController("resource");
function SessionController(id){
this.id=id;}
SessionController.prototype.id="SessionController";SessionController.prototype.handlerUrl=undefined;SessionController.prototype.clientSessionTime=14400;SessionController.prototype.serverSessionTime=1800;SessionController.prototype.timeBeforeWarningTimemout=60;
SessionController.prototype.keepAliveCallThread=undefined;SessionController.prototype.keepAliveCheckThread=undefined;SessionController.prototype.keepAliveCallFrequency=100000;SessionController.prototype.keepAliveCheckFrequency=20000;SessionController.prototype.sessionTimeoutMessageBox=undefined;SessionController.prototype.requestTimestamp=undefined;SessionController.prototype.clientSessionTimestamp=undefined;SessionController.prototype.isLoggingEnabled=true;
SessionController.prototype.init=function(){
resource.applyProperties(this.id+"Properties",this);
Workspace.events.addListener(Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,this);
this.handlerUrl=Workspace.serverContext;}
SessionController.prototype.callKeepAlive=function(){
det.sendRequest({action:"keepAlive",serverUrl:this.handlerUrl+"/action/keepAlive",
method:"POST",callingController:this});
}
SessionController.prototype.enableKeepAlive=function(){
if(this.keepAliveCallThread==undefined){this.clientSessionTimestamp=new Date();this.keepAliveCallThread=setTimeout(this.id+".callKeepAlive();",this.keepAliveCallFrequency);this.keepAliveCheckThread=setTimeout(this.id+".checkSession();",this.keepAliveCheckFrequency);}}
SessionController.prototype.disableKeepAlive=function(){
if(this.keepAliveCallThread!=undefined){
clearTimeout(this.keepAliveCallThread);clearTimeout(this.keepAliveCheckThread);this.keepAliveCallThread=undefined;this.keepAliveCheckThread=undefined;}}
SessionController.prototype.checkSession=function(){
var clientTime=(new Date())-this.clientSessionTimestamp;
if(this.isLoggingEnabled==true){log.debug("keepAlive: * idle Time: "+clientTime / 1000+
"-clientSessionTime: "+this.clientSessionTime+
"-serverSessionTime: "+this.serverSessionTime+
"-timeBeforeWarningTimeout: "+this.timeBeforeWarningTimemout+
"-keepAliveCallFrequency: "+this.keepAliveCallFrequency / 1000,this);}
if(clientTime>=(this.clientSessionTime-this.timeBeforeWarningTimemout)* 1000){if(this.sessionTimeoutMessageBox==undefined){this.sessionTimeoutMessageBox=Workspace.message.displayMessage({"message":"You session will expire in "+this.timeBeforeWarningTimemout+" seconds.<BR>Click ok if you want to continue using the application.","templateId":"messageConfirmationTemplate","duration":0,"jsActionYes":this.id+".restartKeepAliveThread();Workspace.message.hide('"+"messageObject"+Workspace.message.messageObjectCount+"');"+this.id+".sessionTimeoutMessageBox=undefined","jsActionNo":this.id+".callTimeoutPage('');Workspace.message.hide('"+"messageObject"+Workspace.message.messageObjectCount+"');"+this.id+".sessionTimeoutMessageBox=undefined","isClosableOnClick":false});}}
if(clientTime>=this.clientSessionTime * 1000){
this.callTimeoutPage("Session expired from inactivity");}
if(this.keepAliveCheckThread!=undefined){this.keepAliveCheckThread=setTimeout(this.id+".checkSession();",this.keepAliveCheckFrequency);}}
SessionController.prototype.callTimeoutPage=function(contextualText){
this.disableKeepAlive();
if(typeof(log)!="undefined"&&log.errorLevel>=log.LEVEL_ERROR){log.error("Called timeout page(bypassed in log mode)",this);Workspace.message.displayMessage(contextualText);}else{Workspace.callUrl(resource.get("TIMEOUT_URL"));}}
SessionController.prototype.restartKeepAliveThread=function(){
this.disableKeepAlive();this.enableKeepAlive();}
SessionController.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED){
if(attributes!=undefined&&attributes.response!=undefined){
if(attributes.response["keepAliveSession"]!=undefined){
this.serverSessionTime=parseInt(attributes.response["keepAliveSession"]["maxInactiveInterval"]);this.keepAliveCallFrequency=this.serverSessionTime * 0.75 * 1000;
if(this.keepAliveCallThread!=undefined){clearTimeout(this.keepAliveCallThread);this.keepAliveCallThread=setTimeout(this.id+".callKeepAlive();",this.keepAliveCallFrequency);}
}else{
if(this.keepAliveCallThread!=undefined&&attributes.serverUrl!=undefined){if(attributes.serverUrl.indexOf(Workspace.serverContext)>-1){this.restartKeepAliveThread();}}
}}}}
function StateController(id){
this.id=id;}
StateController.prototype.keyPrefix=undefined;
StateController.prototype.init=function(){
resource.applyProperties(this.id+"Properties",this);}
StateController.prototype.set=function(key,value){
var keyPrefix="";
if(this.keyPrefix!=undefined){keyPrefix=ParserUtils.parseHtml(this.keyPrefix[key]!=undefined?this.keyPrefix[key] : this.keyPrefix["default"]);}
CookieUtils.setAttribute(keyPrefix+key,value,true);}
StateController.prototype.get=function(key){
var keyPrefix="";
if(this.keyPrefix!=undefined){keyPrefix=ParserUtils.parseHtml(this.keyPrefix[key]!=undefined?this.keyPrefix[key] : this.keyPrefix["default"]);}
return CookieUtils.getAttribute(keyPrefix+key);}
var State=new StateController("State");
function StringParser(id){
this.id=id;}
StringParser.prototype.id="StringParser";StringParser.prototype.templateCache=new Array();StringParser.prototype.serializerAttributes={keyValueSeparator:":",pairSeparator:",",arrayOpeningSeparator:"[",arrayClosingSeparator:"]",mapOpeningSeparator:"{",mapClosingSeparator:"}",stringOpeningSeparator:"\"",stringClosingSeparator:"\"",isShowArrayIndex:false,isIndentByLevel:false,isParseControllers:false,isParseFunctions:false,maxRecursionLevel:5}
StringParser.prototype.externalTemplateAttribute=undefined;StringParser.prototype.waitingList=new Array();StringParser.prototype.counter=0;StringParser.prototype.index=0;StringParser.prototype.key="";
StringParser.prototype.applyTemplate=function(templateElementId,containerElementId,attributes,onComplete){
if(this.getTemplateHtml(templateElementId)==undefined){
if(this.waitingList[templateElementId]==undefined){this.waitingList[templateElementId]=new Array();}
this.waitingList[templateElementId].push({"functionName":"applyTemplate","containerElementId":containerElementId,"attributes":attributes,"onComplete":onComplete});
this.loadTemplate(templateElementId);
}else{var onCompleteScript=(onComplete!=undefined?"<script>"+onComplete+"</script>" : "");this.setContainerHtml(containerElementId,this.parseHtml(this.templateCache[templateElementId]+onCompleteScript,attributes));}}
StringParser.prototype.preloadTemplate=function(templateElementId,onComplete){
if(this.templateCache[templateElementId]==undefined){
if(this.waitingList[templateElementId]==undefined){this.waitingList[templateElementId]=new Array();}
this.waitingList[templateElementId].push({"functionName":"preloadTemplate","onComplete":onComplete});
this.loadTemplate(templateElementId,onComplete);}else if(onComplete!=undefined){eval(onComplete);}}
StringParser.prototype.onTemplateLoaded=function(templateElementId){
if(this.waitingList[templateElementId]!=undefined){
for(var index in this.waitingList[templateElementId]){
var requestInfo=this.waitingList[templateElementId][index];
if(requestInfo["functionName"]=="applyTemplate"){this.applyTemplate(templateElementId,requestInfo["containerElementId"],requestInfo["attributes"],requestInfo["onComplete"]);}else if(requestInfo["functionName"]=="preloadTemplate"){if(requestInfo["onComplete"]!=undefined){eval(requestInfo["onComplete"]);}
}}
this.waitingList[templateElementId]=new Array();}}
StringParser.prototype.loadTemplate=function(templateElementId,onComplete){
var templateUrl=Workspace.templatePath+"/"+templateElementId+".html";
if(typeof(Workspace)!="undefined"&&Workspace.events!=undefined&&!Workspace.events.isEventListener(Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,this)){Workspace.events.addListener(Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,this);}
log.debug("importing template : "+templateUrl,this);
this.sendRequest(templateUrl,{"templateId":templateElementId,"onComplete":onComplete});}
StringParser.prototype.getTemplateHtml=function(templateElementId){
if(this.templateCache[templateElementId]!=undefined){return this.templateCache[templateElementId];
}else if(document.getElementById(templateElementId)!=undefined){this.templateCache[templateElementId]=this.cleanupHtml(document.getElementById(templateElementId).innerHTML).replace(/<!--TEMPLATE|TEMPLATE-->/g,"");return this.templateCache[templateElementId];}else{return undefined;}}
StringParser.prototype.setContainerHtml=function(containerElementId,html){
var element=document.getElementById(containerElementId);
if(element!=undefined){
if(element.value==undefined){element.innerHTML=html;}else{element.value=html;}
this.evalScriptTags(html);}else{log.error("setContainerHtml: Container element '"+containerElementId+"' is not found",this);}}
StringParser.prototype.cleanupHtml=function(html){
return html.replace(/[\n\r\t]/g," ");}
StringParser.prototype.appendContainerHtml=function(containerElementId,html){
var element=document.getElementById(containerElementId);
if(element!=undefined){
html=this.cleanupHtml(html);
if(element.value==undefined){element.innerHTML+=html;}else{element.value+=html;}
this.evalScriptTags(html);}else{log.error("setContainerHtml: Container element '"+containerElementId+"' is not found",this);}}
StringParser.prototype.evalScriptTags=function(html){
var scriptTagsArray=html.match(/<script>([^\<]*)<\/script>/g);
if(scriptTagsArray!=undefined&&scriptTagsArray.length>0){
for(var i=0;i<scriptTagsArray.length;i++){eval(scriptTagsArray[i].match(/<script>(.*)<\/script>/)[1]);}}}
StringParser.prototype.parseTemplate=function(templateElementId,attributes){
return this.parseHtml(this.getTemplateHtml(templateElementId),attributes);}
StringParser.prototype.parseHtml=function(html,attributes){
return this.parseHtmlScriptSnippets(this.parseTokens(this.parseStatements(html,attributes),attributes));}
StringParser.prototype.parseTokens=function(html,attributes){
var tokenArray=html.match(/@([^@]*)@/g);var completedTokenReplaceMap=new Array();var value=undefined;
if(tokenArray!=undefined){
for(var i=0;i<tokenArray.length;i++){
if(completedTokenReplaceMap[tokenArray[i]]==undefined){completedTokenReplaceMap[tokenArray[i]]=true;
value=MapUtils.getMapValue(tokenArray[i].match(/@(.*)@/)[1],attributes);
if(value!=undefined){html=html.replace(new RegExp(tokenArray[i],"g"),value);}}}}
return html;}
StringParser.prototype.parseHtmlScriptSnippets=function(html){
while(html.match(/\[\$([^\$]*)\$\]/m)){html=html.replace(/\[\$([^\$]*)\$\]/m,eval(html.match(/\[\$([^\$]*)\$\]/m)[1]));}
while(html.match(/\[\!([^\!]*)\!\]/m)){
eval(html.match(/\[\!([^\!]*)\!\]/m)[1]);
html=html.replace(/\[\!([^\!]*)\!\]/m,"");}
return html;}
StringParser.prototype.parseStatements=function(html,attributes){
var tmpString=undefined;var regExp=undefined;
var matchExpression=html.match(/\[([A-Z_]+\(.*\))(.*)\$\1\]/g);if(matchExpression!=undefined){
var tmpString="";for(var i=0;i<matchExpression.length;i++){
tmpString=matchExpression[i];
regExp=tmpString.match(/\[([^\(][A-Z\_]*)\(([^\$]*)\)\$(.*)\$\1\(\2\)\]/);
html=html.substr(0,html.indexOf(tmpString))+this.executeInstruction(regExp[1],this.parseTokens(regExp[2],attributes),regExp[3],attributes)+html.substr(html.indexOf(tmpString)+tmpString.length);}}
return html;}
StringParser.prototype.executeInstruction=function(instruction,parameters,content,attributes){
var newContent="";
if(attributes!=undefined){if(attributes["FOR_EACH_INDEX"]!=undefined){attributes["PARENT_FOR_EACH_INDEX"]=attributes["FOR_EACH_INDEX"];}
if(attributes["FOR_EACH_KEY"]!=undefined){attributes["PARENT_FOR_EACH_KEY"]=attributes["FOR_EACH_KEY"];}}
if(instruction.toUpperCase()=="FOR_EACH"){
var array=undefined;
try{array=MapUtils.get(parameters,attributes);
if(array==undefined){try{array=eval(parameters);}catch(e){array=undefined;}}}catch(e){log.error("Could not execute template instruction: "+instruction+"("+parameters+")",this);}
if(array!=undefined){
array=MapUtils.getClone(array);
var forEachAttributes=undefined;var iCount=0;
for(var key in array){
if(typeof(array[key])!="object"&&typeof(array[key])!="array"){forEachAttributes=new Array();forEachAttributes["FOR_EACH_VALUE"]=array[key];}else{forEachAttributes=array[key];}
forEachAttributes["PARENT_FOR_EACH_INDEX"]=(attributes!=undefined&&attributes["PARENT_FOR_EACH_INDEX"]!=undefined?attributes["PARENT_FOR_EACH_INDEX"] : undefined);forEachAttributes["PARENT_FOR_EACH_KEY"]=(attributes!=undefined&&attributes["PARENT_FOR_EACH_KEY"]!=undefined?attributes["PARENT_FOR_EACH_KEY"] : undefined);forEachAttributes["FOR_EACH_INDEX"]=iCount;forEachAttributes["FOR_EACH_KEY"]=key;
this.index=iCount;this.key=key;
newContent+=this.parseHtml(content,forEachAttributes);iCount++;}}
}else if(instruction.toUpperCase()=="LOOP"){
var count=0;var loopAttributes=new Array();
if(MapUtils.get(parameters,attributes)!=undefined){count=parseInt(MapUtils.get(parameters,attributes));}else{try{count=parseInt(eval(parameters));}catch(e){}}
for(var i=0;i<count;i++){newContent+=this.parseHtml(content,{"LOOP_INDEX":i,"LOOP_MAX":count});}
}else if(instruction.toUpperCase()=="IF"){
var isConditionMet=false;newContent="";
try{isConditionMet=(eval(this.parseTokens(parameters,attributes))==true);}catch(e){}
if(isConditionMet){newContent=this.parseHtml(content,attributes);}
}else if(instruction.toUpperCase()=="IF_DEFINED"){
var isConditionMet=false;newContent="";
try{isConditionMet=(MapUtils.get(parameters,attributes)!=undefined);}catch(e){}
if(isConditionMet){newContent=this.parseHtml(content,attributes);}
}else if(instruction.toUpperCase()=="IF_NOT_DEFINED"){
var isConditionMet=false;newContent="";
try{isConditionMet=(MapUtils.get(parameters,attributes)==undefined);}catch(e){}
if(isConditionMet){newContent=this.parseHtml(content,attributes);}
}else if(instruction.toUpperCase()=="WITH"){
var object=undefined;newContent="";
try{object=eval(this.parseTokens(parameters,attributes));}catch(e){}
if(object!=undefined){newContent=this.parseHtml(content,MapUtils.putAll(attributes,MapUtils.flatten(object)));}
}else if(instruction.toUpperCase()=="INSERT_TEMPLATE"){
newContent=this.parseTemplate(parameters);}
return newContent;}
StringParser.prototype.serializeObject=function(object,attributes,level){
attributes=(attributes!=undefined?attributes : this.serializerAttributes);
if(level==undefined){level=0;}
var returnValue="";var objectToSerialize=undefined;
var spaces="";for(var sCount=0;sCount<level;sCount++){spaces+="   ";}
if(level<attributes["maxRecursionLevel"]){
if(typeof(object)=="undefined"||typeof(object)=="null"||typeof(object)=="unknown"||object==undefined||object==null){returnValue="null";
}else if(typeof(object)=="string"){returnValue=attributes["stringOpeningSeparator"]+object+attributes["stringClosingSeparator"];
}else if(typeof(object)=="number"){returnValue=object;
}else if(typeof(object)=="boolean"){returnValue=(object?"true" : "false");
}else if(typeof(object)=="function"){returnValue="[Function]";
}else if(typeof(object)=="object"){
if(object.length!=undefined&&object[0]!=undefined){
returnValue+=attributes["arrayOpeningSeparator"];
for(var index in object){
if(typeof(object[index])!="unknown"&&(attributes["isParseFunctions"]||(!attributes["isParseFunctions"]&&typeof(object[index])!="function"))){
if(level>0&&object[index]!=undefined&&object[index].id!=undefined&&!attributes["isParseControllers"]){objectToSerialize="<"+object[index].id+">";}else{objectToSerialize=object[index];}
returnValue+=(index>0?attributes["pairSeparator"] : "")+(attributes["isIndentByLevel"]?spaces : "")+(attributes["isShowArrayIndex"]==true?+index+attributes["keyValueSeparator"] : "")+
this.serializeObject(objectToSerialize,attributes,parseInt(level+1));}}
returnValue+=attributes["arrayClosingSeparator"];
}else{
returnValue+=attributes["mapOpeningSeparator"];
var mapIndex=0;
try{for(index in object){
if(typeof(object[index])!="unknown"&&(attributes["isParseFunctions"]||(!attributes["isParseFunctions"]&&typeof(object[index])!="function"))){
if(level>0&&object[index]!=undefined&&object[index].id!=undefined&&!attributes["isParseControllers"]){objectToSerialize="<"+object[index].id+">";}else{objectToSerialize=object[index];}
if(mapIndex>0){returnValue+=attributes["pairSeparator"];}
returnValue+=(attributes["isIndentByLevel"]?spaces : "")+index+attributes["keyValueSeparator"]+this.serializeObject(objectToSerialize,attributes,parseInt(level+1));mapIndex++;}}}catch(e){returnValue+="[could not parse object]";}
returnValue+=attributes["mapClosingSeparator"];}
}else{returnValue="<"+typeof(object)+">";}
}else{returnValue="[Maximum recursion level reached]";}
return returnValue;}
StringParser.prototype.sendRequest=function(action,infoMap){
det.sendRequest({method:"GET",responseFormat:det.RESPONSE_FORMAT_TEXT,serverUrl:action,action:action,info:infoMap,callingController:this});}
StringParser.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED&&attributes.callingController==this){if(attributes!=undefined&&attributes.response!=undefined){
if(attributes.responseFormat==det.RESPONSE_FORMAT_TEXT){
if(attributes.info["templateId"]!=undefined){
this.templateCache[attributes.info["templateId"]]=this.cleanupHtml(attributes.response["textResponse"]);/*
if(attributes.info["onComplete"]!=undefined){eval(attributes.info["onComplete"]);}
*/
this.onTemplateLoaded(attributes.info["templateId"]);}}}}}
ParserUtils=new StringParser("ParserUtils");
var TemplateVar="";
function TrackerController(id){
this.id=id;}
TrackerController.prototype.id="TrackerController";TrackerController.prototype.trackerElementListList=undefined;TrackerController.prototype.trackerCount=2;TrackerController.prototype.trackerIndex=0;TrackerController.prototype.events=undefined;
TrackerController.prototype.init=function(){
resource.applyProperties(this.id+"Properties",this);
for(var eventId in this.events){Workspace.events.addListener(eventId,this);}
this.trackerElementList=new Array();for(var i=0;i<3;i++){this.trackerElementList[i]=document.createElement("img");this.trackerElementList[i].id=this.id+"Image"+i;this.trackerElementList[i].display="none";this.trackerElementList[i].src="/images/spacer.gif";}
Workspace.events.throwEvent(Workspace.events.EVENT_CONTROLLER_INITIALIZED,this);}
TrackerController.prototype.call=function(eventKey,attributes){
var trackerUrl="";
if(this.events[eventKey]!=undefined){
for(var index in this.events[eventKey]){
if(this.events[eventKey][index].indexOf("js:")==0){
eval(this.events[eventKey][index].substring(3));
}else if(this.events[eventKey][index].indexOf("url:")==0){
trackerUrl=ParserUtils.parseHtml(this.events[eventKey][index].substring(4),attributes);
this.trackerElementList[this.trackerIndex].src=trackerUrl;
this.trackerIndex++;if(this.trackerIndex>this.trackerCount){this.trackerIndex=0;}}}}}
TrackerController.prototype.customCall=function(trackerUrl){
this.trackerElementList[this.trackerIndex].src=trackerUrl;log.debug("["+eventKey+"] called url: "+trackerUrl,this);
this.trackerIndex++;if(this.trackerIndex>this.trackerCount){this.trackerIndex=0;}}
TrackerController.prototype.catchEvent=function(eventKey,attributes){
this.call(eventKey,attributes);}
function UserController(pId,parentClass){
this.id=pId;this.parentClass=parentClass;
return this;}
UserController.prototype.id="UserController";UserController.prototype.handlerUrl="";UserController.prototype.parentClass=undefined;UserController.prototype.username="";UserController.prototype.userId=undefined;UserController.prototype.isSignedIn=false;UserController.prototype.isAuthenticated=false;UserController.prototype.isRememberMeSettingActive=false;UserController.prototype.elementId="authenticateDialog";UserController.prototype.usernameElementId="authenticateUsername";UserController.prototype.passwordElementId="authenticatePassword";UserController.prototype.defaultLocale="en-us";UserController.prototype.lastSigninType=undefined;
UserController.prototype.init=function(){
this.handlerUrl=Workspace.serverContext+"/action/identity";
Workspace.events.addListener(Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,this);Workspace.events.addListener(Workspace.events.EVENT_PAGE_LOADED,this);}
UserController.prototype.updateState=function(/*ArrayMap*/ dataMap){
if(dataMap!=undefined){
var previousState_isSignedIn=(this.isSignedIn?true : false);var previousState_isAuthenticated=(this.isAuthenticated?true : false);
if(dataMap["profileInfo"]!=undefined){
this.userId=dataMap["profileInfo"]["signInID"];
if(CookieUtils.getAttribute("rememberMeCookie")!=undefined){
rememberMeCookie=CookieUtils.getAttribute("rememberMeCookie").split("&");
for(var settingIndex in rememberMeCookie){if(rememberMeCookie[settingIndex].indexOf("=")>0){if(rememberMeCookie[settingIndex].split("=")[0].indexOf("_active")>-1){this.isRememberMeSettingActive=(rememberMeCookie[settingIndex].split("=")[1]=="1"?true : false);}}}}
this.username=dataMap["profileInfo"]["loginName"];
this.setRememberMeCookie(this.isRememberMeSettingActive);}else{
if(CookieUtils.getAttribute("rememberMeCookie")!=undefined){
rememberMeCookie=CookieUtils.getAttribute("rememberMeCookie").split("&");
for(var settingIndex in rememberMeCookie){
if(rememberMeCookie[settingIndex].indexOf("=")>0){
if(rememberMeCookie[settingIndex].split("=")[0].indexOf(Workspace.population+"_id")>-1){this.userId=rememberMeCookie[settingIndex].split("=")[1];}else if(rememberMeCookie[settingIndex].split("=")[0].indexOf(Workspace.population+"_active")>-1){
this.isRememberMeSettingActive=(rememberMeCookie[settingIndex].split("=")[1]=="1"?true : false);}else if(rememberMeCookie[settingIndex].split("=")[0].indexOf(Workspace.population+"_username")>-1){this.username=rememberMeCookie[settingIndex].split("=")[1];}}}}}
if(dataMap["isSignedIn"]!=undefined){this.isSignedIn=(dataMap["isSignedIn"]=="true"?true : false);}
if(dataMap["isAuthenticated"]!=undefined){this.isAuthenticated=(dataMap["isAuthenticated"]=="true"?true : false);}
if(this.isRememberMeSettingActive&&this.isSignedIn&&!this.isAuthenticated){this.lastSigninType="autoSignin";}
if(previousState_isSignedIn!=this.isSignedIn||previousState_isAuthenticated!=this.isAuthenticated){Workspace.events.throwEvent(Workspace.events.EVENT_USER_STATE_CHANGE,this);}
if(!previousState_isSignedIn&&this.isSignedIn){Workspace.events.throwEvent(Workspace.events.EVENT_USER_SIGNIN,this);
}else if(!previousState_isAuthenticated&&this.isAuthenticated){Workspace.events.throwEvent(Workspace.events.EVENT_USER_AUTHENTICATED,this);}
if(previousState_isSignedIn&&!this.isSignedIn){Workspace.events.throwEvent(Workspace.events.EVENT_USER_SIGNOUT,this);}
if(dataMap["mobilityCase"]!=undefined&&resource.get(dataMap["mobilityCase"])!=undefined&&State.get("mobilityMessageDisplayed")==undefined){
State.set("mobilityMessageDisplayed","1");Workspace.message.displayMessage(resource.get(dataMap["mobilityCase"]));}}}
UserController.prototype.displayAuthentication=function(){
if(document.getElementById(this.usernameElementId)!=undefined){document.getElementById(this.usernameElementId).innerHTML=this.username;}
if(document.getElementById(this.elementId)!=undefined){Anim.openSingle(this.elementId);}}
UserController.prototype.submitAuthentication=function(){
var password="";
if(document.getElementById(this.passwordElementId)!=undefined){
password=document.getElementById(this.passwordElementId).value;
if(password!=""){this.lastSigninType="signInPassword";this.sendRequest("signInPassword",[["SigninName",this.username],["Password",password],["lastSigninType",this.lastSigninType]]);}else if(password.length==0){
Workspace.message.displayMessage("Please specify a password");}}}
UserController.prototype.signout=function(isClearCookies){
if(isClearCookies){this.setRememberMeCookie(false);CookieUtils.deleteCookie("userCredentials");}
this.lastSigninType="signOut";this.sendRequest("signOut",undefined);}
UserController.prototype.signin=function(attributes){
var action="";
if(attributes["SigninName"]!=""&&attributes["Password"]!=""){action="signInPassword";
}else if(attributes["SigninName"]!=""&&attributes["Email"]!=""&&attributes["HintAnswer"]!=""){action="signInAnswer";}
this.lastSigninType=action;attributes[attributes.length]={"lastSigninType":action};this.sendRequest(action,MapUtils.toArray(attributes));}
UserController.prototype.setRememberMeCookie=function(isActive){
var rememberMeCookie=undefined;
if(CookieUtils.getAttribute("rememberMeCookie")!=undefined){rememberMeCookie=CookieUtils.getAttribute("rememberMeCookie").split("&");}else{rememberMeCookie=new Array();rememberMeCookie[rememberMeCookie.length]="";}
this.isRememberMeSettingActive=isActive;
var isUpdated=false;
for(var settingIndex in rememberMeCookie){
if(rememberMeCookie[settingIndex].indexOf("=")>0){
if(rememberMeCookie[settingIndex].split("=")[0]==Workspace.population+"_id"){rememberMeCookie[settingIndex]=Workspace.population+"_id="+this.userId;isUpdated=true;}else if(rememberMeCookie[settingIndex].split("=")[0]==Workspace.population+"_active"){rememberMeCookie[settingIndex]=Workspace.population+"_active="+(isActive?"1":"0");isUpdated=true;}else if(rememberMeCookie[settingIndex].split("=")[0]==Workspace.population+"_username"){rememberMeCookie[settingIndex]=Workspace.population+"_username="+this.username;isUpdated=true;}}}
if(!isUpdated){rememberMeCookie[rememberMeCookie.length]=Workspace.population+"_id="+this.userId;rememberMeCookie[rememberMeCookie.length]=Workspace.population+"_active="+(isActive?"1":"0");rememberMeCookie[rememberMeCookie.length]=Workspace.population+"_username="+this.username;}
CookieUtils.setAttribute("rememberMeCookie",rememberMeCookie.join("&"));
CookieUtils.setAttribute("rememberMe","&id="+this.userId+"&active="+(isActive?"1":"0"));}
UserController.prototype.getBrowserLocale=function(){
var locale=this.defaultLocale;
if(navigator.userLanguage!=undefined){locale=navigator.userLanguage.toLowerCase();
}else if(navigator.userAgent.match(/[\;](..\-..)[\;|]/)){locale=RegExp.$1.toLowerCase();}
return locale;}
UserController.prototype.sendRequest=function(pActionType,pParams,handlerUrl){
handlerUrl=(handlerUrl!=undefined?handlerUrl : this.handlerUrl);
var requestParams=new Array();requestParams[requestParams.length]=["actionType",pActionType];
if(pParams!=undefined){requestParams=requestParams.concat(pParams);}
det.sendRequest({serverUrl:Workspace.serverContext+"/action/"+pActionType,action:pActionType,parameters:requestParams,callingController:this});}
UserController.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED){
if(attributes.response!=undefined&&attributes.response["isSignedIn"]!=undefined&&attributes.response["isAuthenticated"]!=undefined){
if(!this.isAuthenticated&&attributes.response["isAuthenticated"]=="true"){Anim.reset("authenticateDialog");}
if(attributes.response["profileInfo"]!=undefined){this.userId=attributes.response["profileInfo"]["signInID"];this.username=attributes.response["profileInfo"]["loginName"];}
if(attributes.response["errorMessage"]!=undefined){Workspace.message.displayMessage(attributes.response["errorMessage"]);}
if(attributes.action=="signInAnswer"){this.lastSigninType="forgotPassword";}
if(Workspace.isControllersInitialized){this.updateState(attributes.response);}
}else if(attributes.callingController==this&&attributes.response["errorCode"]=="FS-19000"){Workspace.message.displayMessage(resource.get("IDTP-02003"));}}}
function WorkspaceController(id){
this.id=id;this.getEnvironmentSettings();
if(typeof(EventController)!="undefined"){this.events=new EventController(this.id+".events");
this.events.addListener(this.events.EVENT_SERVER_RESPONSE_RECEIVED,this);this.events.addListener(this.events.EVENT_SERVER_REQUEST_SENT,this);this.events.addListener(this.events.EVENT_SERVER_ALL_REQUESTS_COMPLETED,this);this.events.addListener(this.events.EVENT_MODEL_IMAGE_LOADING,this);this.events.addListener(this.events.EVENT_MODEL_IMAGE_CHANGED,this);this.events.addListener(this.events.EVENT_RESOURCES_LOADED,this);this.events.addListener(this.events.EVENT_INITIALIZED,this);this.events.addListener(this.events.EVENT_CONTROLLER_INITIALIZED,this);this.events.addListener(this.events.EVENT_COOKIE_CHANGED,this);}
if(typeof(UserController)!="undefined"){this.user=new UserController(this.id+".user",this);}
if(typeof(MessageController)!="undefined"){this.message=new MessageController(this.id+".message",this);}
if(typeof(SessionController)!="undefined"){this.session=new SessionController(this.id+".session",this);}
return this;}
WorkspaceController.prototype.isInitialized=false;WorkspaceController.prototype.isSkinLoaded=false;WorkspaceController.prototype.isSessionInitialized=false;WorkspaceController.prototype.isControllersInitialized=false;WorkspaceController.prototype.isRecoveringSession=false;WorkspaceController.prototype.isDisplaySplash=false;WorkspaceController.prototype.viewData=new Array();WorkspaceController.prototype.user=undefined;WorkspaceController.prototype.message=undefined;WorkspaceController.prototype.session=undefined;WorkspaceController.prototype.events=undefined;WorkspaceController.prototype.serverContext="";WorkspaceController.prototype.retailerCode="";WorkspaceController.prototype.population="";WorkspaceController.prototype.skin="";WorkspaceController.prototype.skinPath=undefined;WorkspaceController.prototype.templatePath=undefined;WorkspaceController.prototype.skinUrl="";WorkspaceController.prototype.cssUrl="";WorkspaceController.prototype.splashUrl="";WorkspaceController.prototype.libUrl="";WorkspaceController.prototype.query=undefined;WorkspaceController.prototype.waitElementId="waitElement";WorkspaceController.prototype.importHTMLToElementId="pageContainer";WorkspaceController.prototype.importReferenceController=undefined;WorkspaceController.prototype.fatalErrorCodes="";WorkspaceController.prototype.lastOpenedPopup=undefined;WorkspaceController.prototype.width=0;WorkspaceController.prototype.height=0;WorkspaceController.prototype.lastVisitedSiteInfo=undefined;WorkspaceController.prototype.initializedControllersMap=undefined;WorkspaceController.prototype.controllerInitOrder=undefined;WorkspaceController.prototype.controllerClassMap=undefined;WorkspaceController.prototype.controllerClassDependency=undefined;WorkspaceController.prototype.initThread=undefined;WorkspaceController.prototype.postSessionRecoverAction=undefined;WorkspaceController.prototype.isNewSession=true;WorkspaceController.prototype.libServerUrl="";WorkspaceController.prototype.rendererType="CS";
WorkspaceController.prototype.ERROR_SESSION_TIMEOUT="SESSION_TIME_OUT.SessionTimeOut";
WorkspaceController.prototype.onLoad=function(){
log.info("onLoad event caught",this);
this.width=parseInt(document.body.clientWidth);this.height=parseInt((document.body.clientHeight>0?document.body.clientHeight : document.documentElement.clientHeight));
resource.init();}
WorkspaceController.prototype.init=function(){
Workspace.session.init();
if(this.query.log=="debug"){this.importClass("LogController","log.init()");}
if(navigator.userAgent.indexOf("MSIE 6")>-1){document.execCommand("BackgroundImageCache",false,true)}
resource.applyProperties(this.id+"Properties",this);
this.initializedControllersMap=new Array();
State.init();
if(this.user!=undefined){this.user.init();}
if(typeof(Items)!="undefined"){Items.init();}
this.message.init();
this.lastVisitedSiteInfo=CookieUtils.getAttribute("lastVisitedSiteInfo");CookieUtils.setAttribute("lastVisitedSiteInfo",window.location.href);
log.info("Workspace is initialized",this);
if(this.isDisplaySplash&&State.get("splashDisplayed")==undefined&&(this.query.param1==undefined||this.query.param1=="")&&this.query.pop==undefined&&this.user.isSignedIn==false){this.loadSplash();}else{
if(!CookieUtils.isCookieSupported){this.message.displayMessage({message:resource.get("cookiesNotSupported")});}
this.importLib(this.libUrl);this.initServerSession();}}
WorkspaceController.prototype.initCompleted=function(attributes){
attributes=(attributes!=undefined?attributes : new Array());
this.session.enableKeepAlive();
if(!this.isSessionInitialized){
this.viewData=attributes.response;this.isSessionInitialized=true;
this.events.throwEvent(this.events.EVENT_INITIALIZED,this);this.loadSkin();
}else{this.isRecoveringSession=false;this.events.throwEvent(this.events.EVENT_SESSION_RECOVERED,this);}}
WorkspaceController.prototype.initServerSession=function(){
log.debug("Initializing server session",this);
var params=new Array();
params[params.length]=["actionType","init"];
if(this.query.sid!=undefined){params[params.length]=["sid",this.query.sid];}
if(this.query.param1!=undefined){params[params.length]=["param1",this.query.param1];}
if(this.query.param2!=undefined){params[params.length]=["param2",this.query.param2];}
if(this.query.param3!=undefined){params[params.length]=["param3",this.query.param3];}
var startupDefaultType=(this.query.DEFAULT_TYPE!=undefined?this.query.DEFAULT_TYPE : resource.get("ModelProperties/defaultType"));if(startupDefaultType!=""&&startupDefaultType!=State.get("startupDefaultType")){params[params.length]=["DEFAULT_TYPE",startupDefaultType];State.set("startupDefaultType",startupDefaultType);}
if(resource.get("ModelProperties/drMode")!=""&&resource.get("ModelProperties/drMode")!=undefined){params[params.length]=["drMode",resource.get("ModelProperties/drMode")];}
if(this.query.c!=undefined){
params[params.length]=["c",this.query.c];params[params.length]=["p",this.query.p];
det.sendRequest({action:"init",serverUrl:this.serverContext+"/action/init",parameters:params,method:"POST",callingController:this});}
else{
params[params.length]=["pop",this.population];params[params.length]=["roc",this.retailerCode];
det.sendRequest({action:"init",serverUrl:this.serverContext+"/action/init",parameters:params,method:"POST",callingController:this});}}
WorkspaceController.prototype.recoverServerSession=function(){
if(!this.isRecoveringSession){this.isRecoveringSession=true;
log.debug("Initializing server session",this);
CookieUtils.deleteCookie("pcid");CookieUtils.deleteCookie("JSESSIONID");
var params=new Array();params[params.length]=["actionType","init"];params[params.length]=["roc",this.retailerCode];params[params.length]=["pop",this.population];
if(State.get("startupDefaultType")!=undefined){params[params.length]=["DEFAULT_TYPE",State.get("startupDefaultType")];}
if(typeof(Model)!="undefined"){params[params.length]=["layoutId",Model.layoutId];params[params.length]=["viewId",Model.viewId];}
det.sendRequest({action:"init",serverUrl:this.serverContext+"/action/init",parameters:params,method:"POST",callingController:this});}}
WorkspaceController.prototype.getEnvironmentSettings=function(){
this.query=getQuery();
if(this.query.serverContext!=undefined){this.serverContext=this.query.serverContext;}else if(typeof(SERVER_CONTEXT)!="undefined"){this.serverContext=SERVER_CONTEXT;}
if(this.query.roc!=undefined){this.retailerCode=this.query.roc;}else if(typeof(RETAILER_CODE)!="undefined"){this.retailerCode=RETAILER_CODE;}
if(this.query.pop!=undefined){this.population=this.query.pop;}else if(this.query.p!=undefined){
this.population=this.query.p;}else if(typeof(DOMAIN)!="undefined"){this.population=DOMAIN;}
if(this.query.skin!=undefined){this.skin=this.query.skin;}else if(typeof(SKIN)!="undefined"){this.skin=SKIN;}else{this.skin=this.retailerCode;}
if(this.skinPath==undefined){this.skinPath="/pages/"+this.skin;}
if(this.templatePath==undefined){this.templatePath=this.skinPath+"/templates";}
this.skinUrl=this.skinPath+"/layout.html"+(this.query.log!=undefined?"?rnd="+Math.random(): "");this.cssUrl=this.skinPath+"/default.css";this.splashUrl=this.skinPath+"/splash.html"+(this.query.log!=undefined?"?rnd="+Math.random(): "");this.libUrl=this.skinPath+"/skin.js"+(this.query.log!=undefined?"?rnd="+Math.random(): "");}
WorkspaceController.prototype.initControllers=function(){
this.events.throwEvent(this.events.EVENT_SKIN_LOADED,this);
this.user.updateState(this.viewData);
this.controllerInitOrder=resource.get("ControllerInitOrder");this.controllerClassMap=resource.get("ControllerSelection");this.controllerClassDependency=resource.get("ClassDependency");
this.initController(0);}
WorkspaceController.prototype.initController=function(index){
if(this.controllerInitOrder.length>index){
this.activateController(
this.controllerInitOrder[index],this.controllerClassMap[this.controllerInitOrder[index]],escape(this.id+".initController("+parseInt(index+1)+")"));
}}
WorkspaceController.prototype.isControllerInitialized=function(controllerId){
return(this.initializedControllersMap[controllerId]!=undefined?true : false);}
WorkspaceController.prototype.showPanel=function(controllerId,onComplete){
log.debug("displaying controller "+controllerId+" panel");
this.activateController(
controllerId,this.controllerClassMap[controllerId],escape(controllerId+".show();"+(onComplete!=undefined?onComplete+";" : "")));}
WorkspaceController.prototype.activateController=function(controllerId,className,onInitCompleted){
className=(className!=undefined?className : this.controllerClassMap[controllerId]);
if(className!=undefined){
if(this.isControllerInstanciated(controllerId)&&onInitCompleted!=undefined){eval(unescape(onInitCompleted));
}else{
if(this.isClassLoaded(className)){
this.createController(
controllerId,className,escape(this.id+".activateController(\""+controllerId+"\",\""+className+"\",\""+(onInitCompleted)+"\")"));
}else{
this.importClass(
this.getClassDependency(className),escape(this.id+".activateController(\""+controllerId+"\",\""+className+"\",\""+(onInitCompleted)+"\")"));}}}else{log.error("Could not find class reference for controller: "+controllerId,this);eval(unescape(onInitCompleted));}}
WorkspaceController.prototype.isControllerInstanciated=function(controllerId){
var isControllerInstanciated=false;
try{if(typeof(eval(controllerId))=="object"){isControllerInstanciated=true;}}catch(e){}
return isControllerInstanciated;}
WorkspaceController.prototype.isClassLoaded=function(className){
var classNameArray=this.getClassDependency(className).split(",");
var isClassInScope=true;
for(var index in classNameArray){
try{if(!typeof(eval(classNameArray[index]))=="function"){isClassInScope=false;}
}catch(e){isClassInScope=false;}
if(!isClassInScope){break;}}
return isClassInScope;}
WorkspaceController.prototype.getClassDependency=function(className){
return className+(this.controllerClassDependency[className]!=undefined?","+this.controllerClassDependency[className] : "");}
WorkspaceController.prototype.createController=function(controllerId,className,onComplete){
log.debug("instanciating controller "+controllerId+" using class "+className,this);
var isActivatedSuccessfully=false;
eval(controllerId+"=new "+className+"('"+controllerId+"')");eval(controllerId+".init()");isActivatedSuccessfully=true;
if(isActivatedSuccessfully&&onComplete!=undefined){eval(unescape(onComplete));}}
WorkspaceController.prototype.controllerInitCompleted=function(){
this.isControllersInitialized=true;this.enableUserEvents();
this.isInitialized=true;
this.events.throwEvent(this.events.EVENT_PAGE_LOADED,this);}
WorkspaceController.prototype.enableUserEvents=function(){
if(document.getElementById("eventBlocker")!=undefined){log.info("Activating mouse events on page",this);document.getElementById("eventBlocker").style.display="none";}}
WorkspaceController.prototype.disableUserEvents=function(){
if(document.getElementById("eventBlocker")!=undefined){log.info("Deactivating mouse events on page",this);document.getElementById("eventBlocker").style.display="block";}}
WorkspaceController.prototype.importClass=function(classNames,onComplete){
var classIndex=-1;var classToLoad=undefined;var classNameArray=classNames.split(",");
while(classIndex<classNameArray.length&&classToLoad==undefined){
try{if(!typeof(eval(classNameArray[classIndex]))=="function"){classToLoad=classNameArray[classIndex];}}catch(e){classToLoad=classNameArray[classIndex];}
classIndex++;}
if(classToLoad!=undefined){
log.debug("importing class "+classToLoad,this);this.importLib("/js/"+(this.query.log=="debug"?"debug/" : "")+classToLoad+".js");
loopUntil("typeof("+classToLoad+")=='function'",escape(this.id+".importClass('"+classNames+"','"+onComplete+"')"),1);
}else{eval(unescape(onComplete));}}
WorkspaceController.prototype.importLib=function(libFilename,onComplete){
var headElement=document.getElementsByTagName("HEAD")[0];
var scriptElement=document.createElement("script");scriptElement.setAttribute("type","text/javascript");
scriptElement.setAttribute("src",this.libServerUrl+libFilename);
headElement.appendChild(scriptElement);
if(onComplete!=undefined){setTimeout(onComplete,500);}}
WorkspaceController.prototype.callUrl=function(url){
this.showWait();window.location.href=url;}
WorkspaceController.prototype.callUri=function(uri){
this.showWait();window.location.href=this.serverContext+uri;}
WorkspaceController.prototype.callUrlInParent=function(url){
if(window.opener!=undefined&&typeof(window.opener.location)!="unknown"){window.opener.location.href=url;window.opener.focus();
}else if(parent!=undefined&&typeof(parent.location)!="unknown"){parent.location.href=url
}else{this.callUrlInPopup(url);}}
WorkspaceController.prototype.callUrlIgnoreResponse=function(url){
var callingImg=new Image();callingImg.src=url;}
WorkspaceController.prototype.callUrlInPopup=function(url,title,windowAttributes){
this.lastOpenedPopup=window.open(url,title,windowAttributes);}
WorkspaceController.prototype.showWait=function(){
Anim.show(this.waitElementId);/*
var element=document.getElementById(this.waitElementId);
if(element!=undefined){Anim.setOpacity(element,0);element.style.display="block";Anim.fadeIn(this.waitElementId);}*/}
WorkspaceController.prototype.hideWait=function(){
Anim.hide(this.waitElementId);/*
var element=document.getElementById(this.waitElementId);
if(element!=undefined){Anim.hide(this.waitElementId);
}
*/}
WorkspaceController.prototype.showDiscreetWait=function(){
Anim.show("discreetLoading");window.status="Loading...";}
/*
* Hides the discreet loading
*/
WorkspaceController.prototype.hideDiscreetWait=function(){
Anim.hide("discreetLoading");window.status="";}
WorkspaceController.prototype.importHTML=function(sourceUrl,elementId,referenceController){
this.importHTMLToElementId=(elementId!=undefined?elementId : "pageContainer");this.importReferenceController=referenceController;
det.sendRequest({serverUrl:sourceUrl,method:"GET",responseFormat:det.RESPONSE_FORMAT_TEXT,callingController:this});}
WorkspaceController.prototype.loadSplash=function(){
this.setCSSFile(this.cssUrl);
log.debug("Loading splash page from: "+this.splashUrl,this);this.importHTML(this.splashUrl);this.enableUserEvents()
State.set("splashDisplayed","true");}
WorkspaceController.prototype.loadSkin=function(){
if(document.getElementById("pageLayout")==undefined){log.debug("Loading skin from: "+this.skinUrl,this);this.importHTML(this.skinUrl);}else{this.isSkinLoaded=true;
if(this.isSessionInitialized&&!this.isControllersInitialized){setTimeout(this.id+".initControllers()",1);}}
State.set("splashDisplayed","true");}
WorkspaceController.prototype.appendHTML=function(htmlSource,containerElementId){
ParserUtils.appendContainerHtml(containerElementId,htmlSource);log.info("HTML appended to "+containerElementId,this);}
WorkspaceController.prototype.setCSSFile=function(cssFilename){
var headElement=document.getElementsByTagName("HEAD")[0];
var linkElement=document.createElement("link");linkElement.setAttribute("rel","stylesheet");linkElement.setAttribute("type","text/css");linkElement.setAttribute("href",cssFilename);
headElement.appendChild(linkElement);}
WorkspaceController.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==this.events.EVENT_SERVER_RESPONSE_RECEIVED){
if(attributes!=undefined&&attributes.response!=undefined){
if(attributes.response["rendererType"]!=undefined){this.rendererType=attributes.response["rendererType"]}
if(attributes.response["message"]!=undefined&&attributes.response["message"]!=""){this.message.displayMessage(attributes.response["message"]);}
if(attributes.response["errorCode"]!=undefined&&attributes.response["errorCode"]!=""){
log.error("SERVER EXCEPTION: "+attributes.response["errorCode"]+" : "+attributes.response["errorMsg"],this);
if(this.fatalErrorCodes.indexOf(attributes.response["errorCode"])>-1&&!attributes.action=="init"){this.session.callTimeoutPage(attributes.response["errorCode"]);}else if(resource.get(attributes.response["errorCode"])!=""){this.message.displayMessage({"message":resource.get(attributes.response["errorCode"]),"messageObjectId":"generalMessage"});}}
if(attributes.action=="init"){
if(attributes.response["errorCode"]==undefined){this.initCompleted(attributes);}else if(this.fatalErrorCodes.indexOf(attributes.response["errorCode"])>-1){this.events.throwEvent(this.events.EVENT_INIT_FAILURE,this);}}
if(attributes.callingController==this&&attributes.response!=undefined&&attributes.responseFormat==det.RESPONSE_FORMAT_TEXT){
this.appendHTML(attributes.response["textResponse"],this.importHTMLToElementId);
if(attributes.serverUrl.indexOf(this.skinUrl)==0){
if(this.isSessionInitialized&&!this.isControllersInitialized){this.isSkinLoaded=true;setTimeout(this.id+".initControllers()",1);}}}
}
}else if(eventKey==this.events.EVENT_RESOURCES_LOADED){this.init();
}else if(eventKey==this.events.EVENT_MODEL_IMAGE_LOADING||eventKey==this.events.EVENT_INITIALIZED){this.showWait();
}else if(eventKey==this.events.EVENT_MODEL_IMAGE_CHANGED){this.hideWait();
}else if(eventKey==this.events.EVENT_SERVER_REQUEST_SENT){this.showDiscreetWait();
}else if(eventKey==this.events.EVENT_SERVER_ALL_REQUESTS_COMPLETED){this.hideDiscreetWait();
}else if(eventKey==this.events.EVENT_CONTROLLER_INITIALIZED){
this.initializedControllersMap[attributes.id]=eval(attributes.id);
if(!this.isControllersInitialized){
var isAllInitialized=true;for(var index in this.controllerInitOrder){if(this.initializedControllersMap[this.controllerInitOrder[index]]==undefined){isAllInitialized=false;break;}}
if(isAllInitialized){this.controllerInitCompleted();}}
}else if(eventKey==this.events.EVENT_COOKIE_CHANGED){if(CookieUtils.getAttribute("errorCode")==this.ERROR_SESSION_TIMEOUT){this.recoverServerSession();CookieUtils.deleteCookie("errorCode");}}}
var Workspace=new WorkspaceController("Workspace");
window.onload=function(){
Workspace.onLoad();}
function XmlParser(id){
this.id=id;}
XmlParser.prototype.id="XmlParser";XmlParser.prototype.usearray=true;
XmlParser.prototype.convertXmlToMap=function(xmlDocument){
var xmlArray={};
if(xmlDocument!=undefined){xmlArray[xmlDocument.nodeName]=this.parseElement(xmlDocument);}
return xmlArray;}
XmlParser.prototype.parseElement=function(element){
if(element.nodeType==7){return;}
if(element.nodeType==3||element.nodeType==4){var bool=element.nodeValue.match(/[^\x00-\x20]/);
if(bool==null){return;    }
return element.nodeValue;}
var retval;var cnt={};
if(element.attributes&&element.attributes.length){retval={};for(var i=0;i<element.attributes.length;i++){var key=element.attributes[i].nodeName;if(typeof(key)!="string"){
continue;}
var val=element.attributes[i].nodeValue;if(!val){
continue;}
if(typeof(cnt[key])=="undefined"){cnt[key]=0;}
cnt[key]++;
this.addNode(retval,key,cnt[key],val);}}
if(element.childNodes&&element.childNodes.length){var textonly=true;if(retval)textonly=false;       
for(var i=0;i<element.childNodes.length&&textonly;i++){var ntype=element.childNodes[i].nodeType;if(ntype==3||ntype==4){continue;}
textonly=false;}
if(textonly){if(!retval){
retval="";}
for(var i=0;i<element.childNodes.length;i++){retval+=element.childNodes[i].nodeValue;}}else{if(!retval){retval={};}
for(var i=0;i<element.childNodes.length;i++){
var key=element.childNodes[i].nodeName;if(typeof(key)!="string"){continue;}
var val=this.parseElement(element.childNodes[i]);if(!val){continue;}
if(typeof(cnt[key])=="undefined"){cnt[key]=0;}
cnt[key]++;
this.addNode(retval,key,cnt[key],val);}}}
return retval;};
XmlParser.prototype.addNode=function(hash,key,cnts,val){
if(this.usearray==true){             
if(cnts==1)hash[key]=[];hash[key][hash[key].length]=val;     }else if(this.usearray==false){     
if(cnts==1)hash[key]=val;      }else if(this.usearray==null){if(cnts==1){                     
hash[key]=val;}else if(cnts==2){              
hash[key]=[ hash[key],val ];}else{                               
hash[key][hash[key].length]=val;}}else if(this.usearray[key]){if(cnts==1)hash[key]=[];hash[key][hash[key].length]=val;     }else{if(cnts==1)hash[key]=val;      }};
var xmlParser=new XmlParser("xmlParser");
function AnimationController(id){
this.id=id;this.groupMap=new Array();
return this;}
AnimationController.prototype.CYCLE_TIME=300;AnimationController.prototype.STATE_HOVER_ON="on";AnimationController.prototype.STATE_HOVER_OFF="off";AnimationController.prototype.STATE_ALTERNATE_ON="open";AnimationController.prototype.STATE_ALTERNATE_OFF="closed";AnimationController.prototype._cssAttributes=undefined;AnimationController.prototype._cssText=undefined;
AnimationController.prototype.id="AnimationController";AnimationController.prototype.groupMap=undefined;
AnimationController.prototype.getElementCSSAttributes=function(elementId){
if(this._cssText==undefined){
this._cssText="";
for(var i=0;i<document.styleSheets.length;i++){this._cssText+=document.styleSheets[i].cssText}}
var attributes=new Array();
if(this._cssText.indexOf(elementId)>-1){
var cssText=new RegExp("#"+elementId+"\\s\\{([^\\}]*)\\}","g").exec(this._cssText.replace(/[\n\r]/g,""))[1];
if(cssText!=undefined){var cssAttributes=cssText.match(/[A-Za-z]+\:\s?[^\;\t]*/g);var attributeInfo=undefined;
for(var i=0;i<cssAttributes.length;i++){attributeInfo=cssAttributes[i].match(/([^\:]*)\:\s?(.*)/);attributes[attributeInfo[1].toLowerCase()]=attributeInfo[2];}}}
var element=document.getElementById(elementId);if(element!=undefined){element._cssAttributes=attributes;}
return attributes;}
AnimationController.prototype._define=function(element){
element.isDefined=true;
var cssAttributes=this.getElementCSSAttributes(element.id);
element.onComplete=(element.getAttribute("onAnimationComplete")!=undefined?element.getAttribute("onAnimationComplete"):undefined);
element.oClass=element.className;element.tClass=element.getAttribute("tClass");
element.oZIndex=element.style.zIndex;
element.tZIndex=(cssAttributes["tZIndex"]!=undefined?cssAttributes["tZIndex"] 
:(element.style.tZIndex!=undefined?element.style.tZIndex : element.getAttribute("tZIndex")));
if(element.style.position!="relative"&&isNaN(parseInt(element.style.left))&&!isNaN(parseInt(element.offsetLeft))){element.oLeft=parseInt(element.offsetLeft);}else if(!isNaN(parseInt(element.style.left))){element.oLeft=parseInt(element.style.left);}else{element.oLeft=0;}
if(element.style.position!="relative"&&isNaN(parseInt(element.style.top))&&!isNaN(parseInt(element.offsetTop))){element.oTop=parseInt(element.offsetTop);}else if(!isNaN(parseInt(element.style.top))){element.oTop=parseInt(element.style.top);}else{element.oTop=0;}
element.oWidth=parseInt(cssAttributes["width"]!=undefined?cssAttributes["width"]
: getWidth(element));
element.oHeight=parseInt(cssAttributes["height"]!=undefined?cssAttributes["height"]
: getHeight(element));
element.tLeft=parseInt(cssAttributes["tleft"]!=undefined?cssAttributes["tleft"]
:(element.getAttribute("tLeft")!=undefined?element.getAttribute("tLeft"): element.oLeft));
element.tTop=parseInt(cssAttributes["ttop"]!=undefined?cssAttributes["ttop"]
:(element.getAttribute("tTop")!=undefined?element.getAttribute("tTop"): element.oTop));
element.tWidth=parseInt(cssAttributes["twidth"]!=undefined?cssAttributes["twidth"]
:(element.getAttribute("tWidth")!=undefined?element.getAttribute("tWidth"): element.oWidth));
element.tHeight=parseInt(cssAttributes["theight"]!=undefined?cssAttributes["theight"] 
:(element.getAttribute("tHeight")!=undefined?element.getAttribute("tHeight"): element.oHeight));
element.state=this.STATE_ALTERNATE_OFF;
element.groupName=(cssAttributes["groupname"]!=undefined?cssAttributes["groupname"]
:(element.getAttribute("groupName")!=undefined?element.getAttribute("groupName")
:(element.getAttribute("group_name")!=undefined?element.getAttribute("group_name"): undefined)));
this.registerElementIdInGroup(element.id,element.groupName);}
AnimationController.prototype.registerElementIdInGroup=function(elementId,groupName){
if(groupName!=undefined){
if(this.groupMap[groupName]==undefined){this.groupMap[groupName]=new Array();}
this.groupMap[groupName].push(elementId);}}
AnimationController.prototype.openAndClose=function(elementId,isQuickMode){
quickMode=(isQuickMode!=undefined&&isQuickMode==true?true : false);
var element=document.getElementById(elementId);
if(element!=undefined){
if(element.isDefined==undefined){this._define(element);}
this.resetAll(element.groupName,new Array(elementId),quickMode);
if(element.state==this.STATE_ALTERNATE_OFF){this.open(elementId);
}else if(element.state==this.STATE_ALTERNATE_ON){this.reset(elementId);}
}else{log.error("element '"+elementId+"' is undefined",this);}}
AnimationController.prototype.openSingle=function(elementId,isQuickMode){
quickMode=(isQuickMode!=undefined&&isQuickMode==true?true : false);
var element=document.getElementById(elementId);
if(element!=undefined){
if(element.isDefined==undefined){this._define(element);}
this.resetAll(element.groupName,new Array(elementId),quickMode);element.thread=setTimeout(this.id+".open('"+elementId+"',undefined,"+quickMode+")",1);}}
AnimationController.prototype.open=function(elementId,isQuickMode){
quickMode=(isQuickMode!=undefined&&isQuickMode==true?true : false);
var element=document.getElementById(elementId);
if(element!=undefined){
if(element.isDefined==undefined){this._define(element);}
element.state=this.STATE_ALTERNATE_ON;
if(element.tZIndex!=undefined){element.style.zIndex=element.tZIndex;}
if(element.thread!=undefined){clearTimeout(element.thread);}
var onComplete=(element.getAttribute("onOpen")!=undefined?element.getAttribute("onOpen"):(element.getAttribute("onopen")!=undefined?element.getAttribute("onopen"): element.onComplete));
var attributes=new Array();attributes["tLeft"]=element.tLeft;attributes["tTop"]=element.tTop;attributes["tWidth"]=element.tWidth;attributes["tHeight"]=element.tHeight;attributes["tClass"]=element.tClass;attributes["onComplete"]=onComplete;
if(quickMode){attributes["duration"]=0;}
this.animateElement(elementId,attributes);}else{log.error("element '"+elementId+"' is undefined",this);}}
AnimationController.prototype.reset=function(elementId,isQuickMode){
quickMode=(isQuickMode!=undefined&&isQuickMode==true?true : false);
var element=document.getElementById(elementId);
if(element!=undefined){
if(element.isDefined==undefined){this._define(element);}
element.state=this.STATE_ALTERNATE_OFF;element.style.zIndex=element.oZIndex;
var onComplete=(element.getAttribute("onClose")!=undefined?element.getAttribute("onClose"):(element.getAttribute("onclose")!=undefined?element.getAttribute("onclose"): element.onComplete));
var attributes=new Array();attributes["tLeft"]=element.oLeft;attributes["tTop"]=element.oTop;attributes["tWidth"]=element.oWidth;attributes["tHeight"]=element.oHeight;attributes["tClass"]=element.oClass;attributes["onComplete"]=onComplete;
if(quickMode){attributes["duration"]=0;}
this.animateElement(elementId,attributes);}else{log.error("element '"+elementId+"' is undefined",this);}}
AnimationController.prototype.resetAll=function(groupName,pExceptionArray,isQuickMode){
if(groupName!=undefined){
var groupList=this.groupMap[groupName];var exceptionList="|"+(pExceptionArray!=undefined?pExceptionArray : new Array()).join("|")+"|";
if(groupList!=undefined){for(var i=0;i<groupList.length;i++){if(exceptionList.indexOf("|"+groupList[i]+"|")==-1){
tmpAnimatedDiv=document.getElementById(groupList[i]);if(tmpAnimatedDiv.state==this.STATE_ALTERNATE_ON){
this.reset(groupList[i],isQuickMode);}}}}                   }}
AnimationController.prototype.animateElement=function(elementId,attributes){
var element=document.getElementById(elementId);
if(element!=undefined&&attributes!=undefined){
attributes["sLeft"]=(attributes["sLeft"]!=undefined?attributes["sLeft"] :(!isNaN(parseInt(element.style.left))?parseInt(element.style.left): element.oLeft));attributes["sTop"]=(attributes["sTop"]!=undefined?attributes["sTop"] :(!isNaN(parseInt(element.style.top))?parseInt(element.style.top): element.oTop));attributes["sWidth"]=(attributes["sWidth"]!=undefined?attributes["sWidth"] :(!isNaN(parseInt(element.style.width))?parseInt(element.style.width): element.oWidth));attributes["sHeight"]=(attributes["sHeight"]!=undefined?attributes["sHeight"] :(!isNaN(parseInt(element.style.height))?parseInt(element.style.height): element.oHeight));
attributes["sOpacity"]=(attributes["sOpacity"]!=undefined?attributes["sOpacity"] : element.getAttribute("sOpacity")?element.getAttribute("sOpacity"): undefined);attributes["tOpacity"]=(attributes["tOpacity"]!=undefined?attributes["tOpacity"] : element.getAttribute("tOpacity")?element.getAttribute("tOpacity"): undefined);
if(attributes["mLeft"]!=undefined){attributes["tLeft"]=attributes["sLeft"]+attributes["mLeft"];}
if(attributes["mTop"]!=undefined){attributes["tTop"]=attributes["sTop"]+attributes["mTop"];}
this._animate(
elementId,attributes,true);}}
AnimationController.prototype._animate=function(elementId,animAttributes,isStartingCall){
var isTargetReached=true;var element=document.getElementById(elementId);
if(element!=undefined&&(animAttributes!=undefined||element._animationAttributes!=undefined)){
var animAttributes=(animAttributes!=undefined?animAttributes : element._animationAttributes);
if(isStartingCall){
animAttributes["startAnimationTime"]=new Date().getTime();animAttributes["frameIndex"]=0;
if(animAttributes["sOpacity"]!=undefined&&animAttributes["tOpacity"]!=undefined&&animAttributes["sOpacity"]!=animAttributes["tOpacity"]){
animAttributes["cOpacity"]=animAttributes["sOpacity"];this.setOpacity(element,parseInt(animAttributes["cOpacity"]));}
if(animAttributes["sLeft"]!=undefined&&animAttributes["tLeft"]!=undefined&&animAttributes["sLeft"]!=animAttributes["tLeft"]){
animAttributes["cLeft"]=parseInt(animAttributes["sLeft"]);element.style.left=animAttributes["cLeft"]+"px";}
if(animAttributes["sTop"]!=undefined&&animAttributes["tTop"]!=undefined&&animAttributes["sTop"]!=animAttributes["tTop"]){
animAttributes["cTop"]=parseInt(animAttributes["sTop"]);element.style.top=animAttributes["cTop"]+"px";}
if(animAttributes["sWidth"]!=undefined&&animAttributes["tWidth"]!=undefined&&animAttributes["sWidth"]!=animAttributes["tWidth"]){
animAttributes["cWidth"]=parseInt(animAttributes["sWidth"]);element.style.width=animAttributes["cWidth"]+"px";}
if(animAttributes["sHeight"]!=undefined&&animAttributes["tHeight"]!=undefined&&animAttributes["sHeight"]!=animAttributes["tHeight"]){
animAttributes["cHeight"]=parseInt(animAttributes["sHeight"]);element.style.height=animAttributes["cHeight"]+"px";}}
if(animAttributes["duration"]==undefined){animAttributes["duration"]=this.CYCLE_TIME;}
animAttributes["frameIndex"]++;
var averagetimePerFrame=(new Date().getTime()-animAttributes["startAnimationTime"])/ animAttributes["frameIndex"];if(averagetimePerFrame==0){averagetimePerFrame=10;}
var remainingTime=(animAttributes["startAnimationTime"]+animAttributes["duration"])-new Date().getTime();var remainingFrames=remainingTime/averagetimePerFrame;
if(element.thread!=undefined){clearTimeout(element.thread);}
if(animAttributes["cLeft"]!=undefined){var deltaLeft=(animAttributes["tLeft"]-animAttributes["sLeft"])/ remainingFrames;
if((deltaLeft>0&&animAttributes["cLeft"]+deltaLeft<animAttributes["tLeft"])||(deltaLeft<0&&animAttributes["cLeft"]+deltaLeft>animAttributes["tLeft"])){animAttributes["cLeft"]=animAttributes["cLeft"]+deltaLeft;element.style.left=parseInt(animAttributes["cLeft"])+"px";isTargetReached=false;}}
if(animAttributes["cTop"]!=undefined){var deltaTop=(animAttributes["tTop"]-animAttributes["sTop"])/ remainingFrames;
if((deltaTop>0&&animAttributes["cTop"]+deltaTop<animAttributes["tTop"])||(deltaTop<0&&animAttributes["cTop"]+deltaTop>animAttributes["tTop"])){animAttributes["cTop"]=animAttributes["cTop"]+deltaTop;element.style.top=parseInt(animAttributes["cTop"])+"px";isTargetReached=false;}}
if(animAttributes["cWidth"]!=undefined){var deltaWidth=(animAttributes["tWidth"]-animAttributes["sWidth"])/ remainingFrames;
if(animAttributes["cWidth"]+deltaWidth<0){deltaWidth=animAttributes["cWidth"];}
if((deltaWidth>0&&animAttributes["cWidth"]+deltaWidth<animAttributes["tWidth"])||(deltaWidth<0&&animAttributes["cWidth"]+deltaWidth>animAttributes["tWidth"])){animAttributes["cWidth"]=animAttributes["cWidth"]+deltaWidth;element.style.width=parseInt(animAttributes["cWidth"])+"px";isTargetReached=false;}}
if(animAttributes["cHeight"]!=undefined){var deltaHeight=(animAttributes["tHeight"]-animAttributes["sHeight"])/ remainingFrames;
if(animAttributes["cHeight"]+deltaHeight<0){deltaHeight=animAttributes["cHeight"];}
if((deltaHeight>0&&animAttributes["cHeight"]+deltaHeight<animAttributes["tHeight"])||(deltaHeight<0&&animAttributes["cHeight"]+deltaHeight>animAttributes["tHeight"])){animAttributes["cHeight"]=animAttributes["cHeight"]+deltaHeight;element.style.height=parseInt(animAttributes["cHeight"])+"px";isTargetReached=false;}}
if(animAttributes["cOpacity"]!=undefined){
if(animAttributes["sOpacity"]<animAttributes["tOpacity"]){animAttributes["cOpacity"]+=(animAttributes["tOpacity"]-animAttributes["sOpacity"])/ remainingFrames;}else if(animAttributes["sOpacity"]>animAttributes["tOpacity"]){animAttributes["cOpacity"]-=(animAttributes["sOpacity"]-animAttributes["tOpacity"])/ remainingFrames;}
if((animAttributes["sOpacity"]<animAttributes["tOpacity"]&&animAttributes["cOpacity"]<animAttributes["tOpacity"])||(animAttributes["sOpacity"]>animAttributes["tOpacity"]&&animAttributes["cOpacity"]>animAttributes["tOpacity"])){this.setOpacity(element,parseInt(animAttributes["cOpacity"]));isTargetReached=false;}}
element._animationAttributes=animAttributes;
if(remainingFrames>0&&!isTargetReached){element.thread=setTimeout(this.id+"._animate('"+elementId+"')",10);}else{
if(animAttributes["cLeft"]!=undefined){element.style.left=animAttributes["tLeft"]+"px";}
if(animAttributes["cTop"]!=undefined){element.style.top=animAttributes["tTop"]+"px";}
if(animAttributes["cWidth"]!=undefined){element.style.width=animAttributes["tWidth"]+"px";}
if(animAttributes["cHeight"]!=undefined){element.style.height=animAttributes["tHeight"]+"px";}
if(animAttributes["tClass"]!=undefined){element.className=animAttributes["tClass"];}
if(animAttributes["cOpacity"]!=undefined){this.setOpacity(element,animAttributes["tOpacity"]);}
if(animAttributes["onComplete"]!=undefined){eval(animAttributes["onComplete"]);}}}}
AnimationController.prototype.stopElementAnimation=function(elementId){
var element=document.getElementById(elementId);if(element!=undefined&&element.thread!=undefined){clearTimeout(element.thread);element.thread=undefined;}}
AnimationController.prototype.clearGroup=function(groupName){
this.groupMap[groupName]=undefined;}
AnimationController.prototype.registerGroup=function(groupName,elementIdArray){
this.groupMap[groupName]=elementIdArray;}
AnimationController.prototype.setImageState=function(elementId,attribute,value){
var element=document.getElementById(elementId);
if(element!=undefined&&element.getAttribute("src_token")!=undefined){
var tmpArray=element.src.split("/");var fileExtension="."+tmpArray[tmpArray.length-1].split(".")[1];var originalFilename=tmpArray.pop().split(".")[0];var filePrefix=tmpArray.join("/")+"/";var originalSrcArray=originalFilename.split("_");
var tmpArray=element.getAttribute("src_token").split("/");var tokenedSrcArray=tmpArray.pop().split(".")[0].split("_");
for(var i=0;i<tokenedSrcArray.length;i++){if(tokenedSrcArray[i]==attribute){originalSrcArray[i]=value;}}
element.src=filePrefix+originalSrcArray.join("_")+fileExtension;}}
AnimationController.prototype.isOpen=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined&&element.state==this.STATE_ALTERNATE_ON){return true;}else{return false;}}
AnimationController.prototype.scale=function(elementId,centerX,centerY,pRatio){
var element=document.getElementById(elementId);
if(element!=undefined){
if(element.isDefined==undefined){this._define(element);}
var tLeft=parseInt((element.oWidth/2)-(centerX*pRatio));var tTop=parseInt((element.oHeight/2)-(centerY*pRatio));
if(tLeft>0){tLeft=0;}
if(tTop>0){tTop=0;}
if(tLeft<(element.oWidth*(pRatio-1)*-1)){tLeft=element.oWidth*(pRatio-1)*-1;}
if(tTop<(element.oHeight*(pRatio-1)*-1)){tTop=element.oHeight*(pRatio-1)*-1;}
var attributes=new Array();attributes["tLeft"]=tLeft;attributes["tTop"]=tTop;attributes["tWidth"]=element.oWidth*pRatio;attributes["tHeight"]=element.oHeight*pRatio;attributes["duration"]=this.CYCLE_TIME*2;
this.animateElement(elementId,attributes);}}
AnimationController.prototype.showAndHide=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined){
if(element.style.display=="block"){this.hide(elementId);}else{this.show(elementId);}
}else{log.error("element '"+elementId+"' is undefined",this);}}
AnimationController.prototype.show=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined){element.style.display="block";element.state=this.STATE_ALTERNATE_ON;
var onComplete=(element.getAttribute("onOpen")!=undefined?element.getAttribute("onOpen"):(element.getAttribute("onopen")!=undefined?element.getAttribute("onopen"): element.onComplete));
if(onComplete!=undefined){eval(onComplete);}}}
AnimationController.prototype.hide=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined){element.style.display="none";element.state=this.STATE_ALTERNATE_OFF;
var onComplete=(element.getAttribute("onClose")!=undefined?element.getAttribute("onClose"):(element.getAttribute("onclose")!=undefined?element.getAttribute("onclose"): element.onComplete));
if(onComplete!=undefined){eval(onComplete);}}}
AnimationController.prototype.setOpacity=function(obj,opacity){
opacity=(opacity==100)?99.999:opacity;
if(obj!=undefined){
obj.style.filter="alpha(opacity:"+opacity+")";
obj.style.KHTMLOpacity=opacity/100;
obj.style.MozOpacity=opacity/100;
obj.style.opacity=opacity/100;}}
AnimationController.prototype.getOpacity=function(obj){
opacity=0;
if(obj!=undefined){if(obj.style.filter){var filterString=obj.style.filter;opacity=parseInt(filterString.match(/opacity\:([^\)].*)\)/)[1]);}else if(obj.style.KHTMLOpacity){opacity=parseInt(obj.style.KHTMLOpacity)*100;}else if(obj.style.MozOpacity){opacity=parseInt(obj.style.MozOpacity)*100;}else if(obj.style.opacity){opacity=parseInt(obj.style.opacity)*100;}}
return opacity;}
AnimationController.prototype.fade=function(elementId,sOpacity,tOpacity,onComplete,speed){
var attributes=new Array();attributes["sOpacity"]=sOpacity;attributes["tOpacity"]=tOpacity;attributes["duration"]=(speed!=undefined?speed : 300);attributes["onComplete"]=onComplete;
this.animateElement(elementId,attributes);}
AnimationController.prototype.fadeIn=function(elementId,onComplete,speed){
this.fade(elementId,0,100,onComplete,speed);}
AnimationController.prototype.fadeOut=function(elementId,onComplete,speed){
this.fade(elementId,100,0,onComplete,speed);}
AnimationController.prototype.startPulse=function(elementId,minimalOpacity,maximalOpacity,speed){
minimalOpacity=(minimalOpacity!=undefined?minimalOpacity : 30);maximalOpacity=(maximalOpacity!=undefined?maximalOpacity : 100);speed=(speed!=undefined?speed : this.CYCLE_TIME);
var element=document.getElementById(elementId);
if(element!=undefined){
var attributes=new Array();attributes["sOpacity"]=minimalOpacity;attributes["tOpacity"]=maximalOpacity;attributes["duration"]=speed;attributes["onComplete"]=this.id+".startPulse('"+elementId+"',"+maximalOpacity+","+minimalOpacity+","+speed+")";
this.animateElement(elementId,attributes);}}
AnimationController.prototype.stopPulse=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined){
element._onComplete=undefined;
if(element.thread!=undefined){clearTimeout(element.thread);element.thread=undefined;}
this.setOpacity(element,100);}}
AnimationController.prototype.setImage=function(elementId,imageUrl){
var element=document.getElementById(elementId);
if(element!=undefined){element.src=imageUrl;}}
var Anim=new AnimationController("Anim");
function AnimatorClass(id){
this.id=id;this.threadMap=new Array();this.scriptMap=new Array();
return this;}
AnimatorClass.prototype.threadMap=undefined;AnimatorClass.prototype.scriptMap=undefined;
AnimatorClass.prototype.runScriptId=function(scriptId){
if(this.scriptMap[scriptId]!=undefined){this.runScript(this.scriptMap[scriptId]);}}
AnimatorClass.prototype.runScript=function(script){
var jsScript="";var scriptId=script["id"];
this.stop(scriptId);this.register(scriptId,script);
threadArray=new Array();var storyboard=script["storyboard"];
for(timeStamp in storyboard){
jsScript="";for(taskIndex in storyboard[timeStamp]){jsScript+=(jsScript!=""?";" : "")+storyboard[timeStamp][taskIndex];}
threadArray.push(setTimeout(jsScript,timeStamp));}
this.threadMap[scriptId]=threadArray;}
AnimatorClass.prototype.stop=function(scriptId){
var threadArray=this.threadMap[scriptId];if(threadArray!=undefined){for(var index in threadArray){clearTimeout(threadArray[index]);}}
this.threadMap[scriptId]=undefined;}
AnimatorClass.prototype.register=function(scriptId,scriptInfo){
this.scriptMap[scriptId]=scriptInfo;}
var Animator=new AnimatorClass("Animator");function DragDropController(id){
this.id=id;this.init();}
DragDropController.prototype.id="DragDropController";DragDropController.prototype.lastDraggedElementId=undefined;DragDropController.prototype.draggedElementIdList=undefined;DragDropController.prototype.dropZonesMap=undefined;
DragDropController.prototype.init=function(){
this.draggedElementIdList=new Array();this.dropZonesMap=new Array();
document.onmouseup=this._onMouseUp;document.onmousemove=this._onMouseMove;}
DragDropController.prototype._onMouseMove=function(e){
var element=undefined;var elementInfo=undefined;var newLeft=0;var newTop=0;
var mouseEvent=(e?e : event);
for(var elementId in DragDrop.draggedElementIdList){
elementInfo=DragDrop.draggedElementIdList[elementId];
if(elementInfo!=undefined){element=document.getElementById(elementId);
newLeft=(mouseEvent.clientX-elementInfo["left"]);newTop=(mouseEvent.clientY-elementInfo["top"]);
if(element._DDAttributes!=undefined){
if(element._DDAttributes["isVerticalOnly"]==true){newLeft=elementInfo["dragStartLeft"];}
if(element._DDAttributes["isHorizontalOnly"]==true){newTop=elementInfo["dragStartTop"];}
if(element._DDAttributes["isDiagonalX"]==true){newLeft=(newTop-element._DDAttributes["startTop"])+element._DDAttributes["startLeft"];}
if(element._DDAttributes["isDiagonalY"]==true){newTop=(newLeft-element._DDAttributes["startLeft"])+element._DDAttributes["startTop"];}
if(element._DDAttributes["limitX1"]!=undefined){newLeft=(newLeft>=element._DDAttributes["limitX1"]?newLeft : element._DDAttributes["limitX1"]);newLeft=(newLeft+parseInt(element.style.width)<=element._DDAttributes["limitX2"]?newLeft : element._DDAttributes["limitX2"]-parseInt(element.style.width));newTop=(newTop>=element._DDAttributes["limitY1"]?newTop : element._DDAttributes["limitY1"]);newTop=(newTop+parseInt(element.style.height)<=element._DDAttributes["limitY2"]?newTop : element._DDAttributes["limitY2"]-parseInt(element.style.height));}
if(element._DDAttributes["onDrag"]){eval(element._DDAttributes["onDrag"]);}}
var draggedElement=document.getElementById(element._DDAttributes["draggedElementId"]);
draggedElement.style.left=newLeft+"px";draggedElement.style.top=newTop+"px";}}
if(elementId!=undefined){
for(var zoneElementId in DragDrop.dropZonesMap){
zoneElement=document.getElementById(zoneElementId);
if(zoneElement!=undefined&&zoneElement._DDAttributes!=undefined){
if(zoneElement._DDAttributes["onDragOver"]!=undefined&&mouseEvent.clientX>getAbsLeft(zoneElement)&&mouseEvent.clientX<(getAbsLeft(zoneElement)+parseInt(zoneElement.style.width))&&mouseEvent.clientY>getAbsTop(zoneElement)&&mouseEvent.clientY<(getAbsTop(zoneElement)+parseInt(zoneElement.style.height))){
if(zoneElement._DDAttributes["isBeingDraggedOver"]==undefined){zoneElement._DDAttributes["isBeingDraggedOver"]=true;eval(zoneElement._DDAttributes["onDragOver"]);}
}else if(zoneElement._DDAttributes["isBeingDraggedOver"]!=undefined&&zoneElement._DDAttributes["onDragOut"]!=undefined){zoneElement._DDAttributes["isBeingDraggedOver"]=undefined;eval(zoneElement._DDAttributes["onDragOut"]);}}}}}
DragDropController.prototype._onMouseUp=function(e){
var mouseEvent=(e?e : event);
DragDrop.dropAll(mouseEvent);}
DragDropController.prototype.drag=function(mouseEvent,elementId){
var element=document.getElementById(elementId);
if(element!=undefined&&element._DDAttributes!=undefined&&element._DDAttributes["enabled"]){
this._deactivateMouseEvents();
this.lastDraggedElementId=element._DDAttributes["draggedElementId"];var draggedElement=document.getElementById(this.lastDraggedElementId);
if(element._DDAttributes["onPick"]){eval(element._DDAttributes["onPick"]);}
this.draggedElementIdList[elementId]={dragStartLeft:parseInt(draggedElement.offsetLeft),dragStartTop:parseInt(draggedElement.offsetTop),left:(mouseEvent.clientX-parseInt(draggedElement.offsetLeft)),top:(mouseEvent.clientY-parseInt(draggedElement.offsetTop))};}}
DragDropController.prototype._deactivateMouseEvents=function(){
document.ondragstart=function(){return false;};
document.onselectstart=function(){return false;};}
DragDropController.prototype._activateMouseEvents=function(){
document.ondragstart=function(){return true;};
document.onselectstart=function(){return true;};}
DragDropController.prototype.drop=function(mouseEvent,elementId){
var element=document.getElementById(elementId);
if(element!=undefined&&element._DDAttributes!=undefined&&element._DDAttributes["enabled"]){
this._activateMouseEvents();
for(var zoneElementId in DragDrop.dropZonesMap){
zoneElement=document.getElementById(zoneElementId);
if(zoneElement!=undefined&&zoneElement._DDAttributes!=undefined){if(zoneElement._DDAttributes["onDropOver"]!=undefined&&mouseEvent.clientX>getAbsLeft(zoneElement)&&mouseEvent.clientX<(getAbsLeft(zoneElement)+parseInt(zoneElement.style.width))&&mouseEvent.clientY>getAbsTop(zoneElement)&&mouseEvent.clientY<(getAbsTop(zoneElement)+parseInt(zoneElement.style.height))){
if(zoneElement._DDAttributes["onDragOut"]!=undefined){eval(zoneElement._DDAttributes["onDragOut"]);}
eval(zoneElement._DDAttributes["onDropOver"]);}}}
if(element._DDAttributes["onDrop"]){eval(element._DDAttributes["onDrop"]);}
if(element._DDAttributes["isResetOnDrop"]==true){this.resetPosition(elementId);}}
delete this.draggedElementIdList[elementId];}
DragDropController.prototype.dropAll=function(mouseEvent){
for(var elementId in this.draggedElementIdList){this.drop(mouseEvent,elementId);}
this.draggedElementIdList=new Array();}
DragDropController.prototype.resetPosition=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined&&element._DDAttributes!=undefined){Anim.animateElement(elementId,{tLeft:element._DDAttributes["startLeft"],tTop:element._DDAttributes["startTop"]});}}
DragDropController.prototype.setDropZone=function(elementId,attributes){
var element=document.getElementById(elementId);
if(element!=undefined){this.dropZonesMap[elementId]=true;element._DDAttributes=MapUtils.getClone(attributes);}}
DragDropController.prototype.isDraggeableElement=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined){return(element._DDAttributes!=undefined?true : false);}else{return false;}}
DragDropController.prototype.getElementAttributes=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined){return element._DDAttributes}else{return undefined;}}
DragDropController.prototype.doDrag=function(elementId,attributes){
var element=document.getElementById(elementId);var limitElement=undefined;
if(element!=undefined&&element._DDAttributes==undefined){
attributes=(attributes!=undefined?attributes : new Array());
element._DDAttributes=MapUtils.getClone(attributes);
if(attributes["draggedElementId"]==undefined){element._DDAttributes["draggedElementId"]=elementId;}
element._DDAttributes["enabled"]=true;
var draggedElement=document.getElementById(element._DDAttributes["draggedElementId"]);
element._DDAttributes["startLeft"]=parseInt(draggedElement.offsetLeft);element._DDAttributes["startTop"]=parseInt(draggedElement.offsetTop);
if(attributes["limitElementId"]!=undefined){
limitElement=document.getElementById(attributes["limitElementId"]);
if(limitElement!=undefined){element._DDAttributes["limitX1"]=parseInt(limitElement.offsetLeft);element._DDAttributes["limitY1"]=parseInt(limitElement.offsetTop);element._DDAttributes["limitX2"]=parseInt(limitElement.offsetWidth)+element._DDAttributes["limitX1"];element._DDAttributes["limitY2"]=parseInt(limitElement.offsetHeight)+element._DDAttributes["limitY1"];}}
if(attributes["containerElementId"]!=undefined){
limitElement=document.getElementById(attributes["containerElementId"]);
if(limitElement!=undefined){element._DDAttributes["limitX1"]=0;element._DDAttributes["limitY1"]=0;element._DDAttributes["limitX2"]=parseInt(limitElement.offsetWidth);element._DDAttributes["limitY2"]=parseInt(limitElement.offsetHeight);}}
element.onmousedown=function(e){
DragDrop.drag((e?e : event),this.id);return false;}
element.onmouseup=function(e){
DragDrop.drop((e?e : event),this.id);return false;}}}
DragDropController.prototype.enable=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined&&element._DDAttributes!=undefined){element._DDAttributes["enabled"]=true;}}
DragDropController.prototype.disable=function(elementId){
var element=document.getElementById(elementId);
if(element!=undefined&&element._DDAttributes!=undefined){element._DDAttributes["enabled"]=false;}}
var DragDrop=new DragDropController("DragDrop");
function MessageController(id){this.id=id;}
MessageController.prototype.id="MessageController";MessageController.prototype.thrownErrorMessage=(typeof(errorMessage)!="undefined"?errorMessage : "");MessageController.prototype.messageObjectMap=undefined;MessageController.prototype.messageObjectCount=0;MessageController.prototype.calloutAttributes=undefined;MessageController.prototype.messageAttributes=undefined;MessageController.prototype.customAttributes=undefined;MessageController.prototype.defaultTemplate="<div style='border:1px solid black;background-color:white;left:0px;top:0px;width:220px;height:200px;' class='panel'><div style='left:20px;top:30px;width:165px;height:170px;overflow:auto;' class='label'>@message@</div></div>";
MessageController.prototype.X1=0;MessageController.prototype.Y1=1;MessageController.prototype.X2=2;MessageController.prototype.Y2=3;
MessageController.prototype.init=function(){
resource.applyProperties(this.id+"Properties",this);this.messageObjectMap=new Array();
if(this.thrownErrorMessage!=""){this.displayMessage({"message":this.thrownErrorMessage});}}
MessageController.prototype.initMessageObject=function(params){
var id=(params["messageObjectId"]!=undefined?params["messageObjectId"] : "messageObject"+this.messageObjectCount);
var messageObj=new MessageObject(id,this.id);
if(params["elementReference"]!=undefined){messageObj.elementReference=params["elementReference"];}
messageObj.duration=params["duration"];messageObj.width=params["width"];messageObj.height=params["height"];messageObj.isClosableOnClick=params["isClosableOnClick"];messageObj.heightAdjustment=params["heightAdjustment"]==undefined?0 : params["heightAdjustment"];
var position=undefined;
var backUrl=params["popupBackground"]==undefined?Workspace.message.messageAttributes["popupBackground"] : params["popupBackground"];
if(params["isForcedTopLeft"]&&(params["referenceBoundingBox"]==undefined&&params["elementReference"]==undefined)){position={"left":params["left"],"top":params["top"]};
}else if(params["referenceBoundingBox"]!=undefined){
position=this.getBestRelativePopupPosition(
params["referenceBoundingBox"],getElementBoundingBox(document.getElementById(params["containerSpace"])),messageObj.width,messageObj.height,messageObj.heightAdjustment);
if(position["isLeft"]){if(position["isTop"]){backUrl=params["popupImageBottomRight"];}else{backUrl=params["popupImageTopRight"];}}else{if(position["isTop"]){backUrl=params["popupImageBottomLeft"];}else{backUrl=params["popupImageTopLeft"];}}
}else if(params["elementReference"]!=undefined){
position=this.getBestRelativePopupPosition(
getElementBoundingBox(document.getElementById(params["elementReference"])),getElementBoundingBox(document.getElementById(params["containerSpace"])),messageObj.width,messageObj.height,messageObj.heightAdjustment);
if(position["isLeft"]){if(position["isTop"]){backUrl=params["popupImageBottomRight"];}else{backUrl=params["popupImageTopRight"];}}else{if(position["isTop"]){backUrl=params["popupImageBottomLeft"];}else{backUrl=params["popupImageTopLeft"];}}
}else if(document.getElementById(params["containerSpace"])!=undefined){position=this.getBestCenteredPopupPosition(getElementBoundingBox(document.getElementById(params["containerSpace"])));
}else{position={left:(Workspace.width-messageObj.width)/2,top:(Workspace.height-messageObj.height)/2};}
messageObj.background_url=backUrl;messageObj.left=position["left"];messageObj.top=position["top"];
messageObj.init();
this.messageObjectCount=this.messageObjectCount+1;this.messageObjectMap[messageObj.id]=messageObj;
return messageObj;}
MessageController.prototype.clearAll=function(){
for(var messageObjectId in this.messageObjectMap){this.hide(messageObjectId);}}
MessageController.prototype.displayMessage=function(params,type){
if(typeof(params)=="string"){if(params==""){return;}else{var temp=params;params=new Array();params["message"]=temp;}}
if(type!=undefined){if(this.customAttributes[type]!=undefined){params=MapUtils.putAll(this.customAttributes[type],params);}}
params["templateId"]=(params["templateId"]!=undefined?params["templateId"] : this.messageAttributes["templateId"]);params["heightAdjustment"]=0;
var messageWidth=undefined;var messageHeight=undefined;
if(document.getElementById(params["templateId"])!=null){messageWidth=(!isNaN(parseInt(document.getElementById(params["templateId"]).style.width))?parseInt(document.getElementById(params["templateId"]).style.width): this.messageAttributes["width"]);messageHeight=(!isNaN(parseInt(document.getElementById(params["templateId"]).style.height))?parseInt(document.getElementById(params["templateId"]).style.height): this.messageAttributes["height"]);
if(document.getElementById(params["templateId"]).heightAdjustment!=undefined){params["heightAdjustment"]=parseInt(document.getElementById(params["templateId"]).heightAdjustment);}}
else{messageWidth=this.messageAttributes["width"];messageHeight=this.messageAttributes["height"];}
params["left"]=(params["left"]!=undefined?params["left"] : this.messageAttributes["left"]);params["top"]=(params["top"]!=undefined?params["top"] : this.messageAttributes["top"]);params["width"]=(params["width"]!=undefined?params["width"] : messageWidth);params["height"]=(params["height"]!=undefined?params["height"] : messageHeight);params["duration"]=(params["duration"]!=undefined?params["duration"] : this.messageAttributes["duration"]);params["elementReference"]=(params["elementReference"]!=undefined?params["elementReference"] : this.calloutAttributes["elementReference"]);params["containerSpace"]=(params["containerSpace"]!=undefined?params["containerSpace"] : this.messageAttributes["containerSpace"]);params["isClosableOnClick"]=(params["isClosableOnClick"]!=undefined?params["isClosableOnClick"] : this.messageAttributes["isClosableOnClick"]);params["isForcedTopLeft"]=(params["isForcedTopLeft"]!=undefined?params["isForcedTopLeft"] : this.messageAttributes["isForcedTopLeft"]);
params["popupImageTopRight"]=(params["popupImageTopRight"]!=undefined?params["popupImageTopRight"] : this.calloutAttributes["popupImageTopRight"]);params["popupImageTopLeft"]=(params["popupImageTopLeft"]!=undefined?params["popupImageTopLeft"] : this.calloutAttributes["popupImageTopLeft"]);params["popupImageBottomRight"]=(params["popupImageBottomRight"]!=undefined?params["popupImageBottomRight"] : this.calloutAttributes["popupImageBottomRight"]);params["popupImageBottomLeft"]=(params["popupImageBottomLeft"]!=undefined?params["popupImageBottomLeft"] : this.calloutAttributes["popupImageBottomLeft"]);
params=MapUtils.putAll(params,params["attributes"]);params["attributes"]=undefined;
if(params["code"]!=undefined&&resource.get(code)!=""){message=resource.get(code);}else{if(params["message"]==undefined){message=this.messageAttributes["message"];}else{message=params["message"];}}
for(var messageId in this.messageObjectMap){if(messageId==params["messageObjectId"]){this.hide(messageId);break;}}
var newMessage=this.initMessageObject(params);params["messageObjectId"]=newMessage.id;
if(newMessage.elementId!=undefined){
params["message"]=message;params["background_url"]=newMessage.background_url;
newMessage.setContent(params["templateId"]!=undefined?params["templateId"] : this.defaultTemplate,params);/*
if(document.getElementById(params["templateId"])!=undefined){newMessage.setContent(ParserUtils.parseTemplate(params["templateId"],params));}
else{newMessage.setContent(ParserUtils.parseHtml(this.defaultTemplate,params));}
*/
if(typeof(Anim)!="undefined"){Anim.setOpacity(document.getElementById(newMessage.elementId),0);newMessage.container.style.display="block";Anim.fadeIn(newMessage.elementId);newMessage.startThread();newMessage.isVisible=true;}else{document.getElementById(newMessage.elementId).style.display="block";}
return newMessage.id;}}
MessageController.prototype.hide=function(messageBoxId){
if(this.messageObjectMap[messageBoxId]!=undefined){
this.messageObjectMap[messageBoxId].isVisible=false;document.body.removeChild(this.messageObjectMap[messageBoxId].container);clearTimeout(this.messageObjectMap[messageBoxId].thread);delete this.messageObjectMap[messageBoxId];}}
MessageController.prototype.getBestCenteredPopupPosition=function(containerBoundingBox){
var popupWidth=parseInt(this.messageAttributes["width"]);var popupHeight=parseInt(this.messageAttributes["height"]);
var containerLeft=parseInt(containerBoundingBox[this.X1]);var containerTop=parseInt(containerBoundingBox[this.Y1]);var containerWidth=parseInt(containerBoundingBox[this.X2])-parseInt(containerBoundingBox[this.X1]);var containerHeight=parseInt(containerBoundingBox[this.Y2])-parseInt(containerBoundingBox[this.Y1]);
var top=containerTop+(containerHeight / 2)-(popupHeight / 2);var left=containerLeft+(containerWidth / 2)-(popupWidth / 2)
return{"left":left,"top":top};}
MessageController.prototype.getBestRelativePopupPosition=function(boundingBox,containerBoundingBox,popupWidth,popupHeight,heightAdjustment){
var distanceOfReference=0;
var popupLeft=0;var popupTop=0;
/*var popupWidth=parseInt(this.messageAttributes["width"]);var popupHeight=parseInt(this.messageAttributes["height"]);*/
var scrollTop=parseInt(document.documentElement.scrollTop)* 2;var scrollLeft=parseInt(document.documentElement.scrollLeft)* 2;
var pageLayoutOffsetY=0;var pageLayoutOffsetX=0;
var containerLeft=parseInt(containerBoundingBox[this.X1])-pageLayoutOffsetX;var containerTop=parseInt(containerBoundingBox[this.Y1])-pageLayoutOffsetY;var containerWidth=parseInt(containerBoundingBox[this.X2])-containerBoundingBox[this.X1];var containerHeight=parseInt(containerBoundingBox[this.Y2])-containerBoundingBox[this.Y1];
var refLeft=parseInt(boundingBox[this.X1])+containerLeft;var refTop=parseInt(boundingBox[this.Y1])+containerTop;var refWidth=parseInt(boundingBox[this.X2])-boundingBox[this.X1];var refHeight=parseInt(boundingBox[this.Y2])-boundingBox[this.Y1];
var leftPosition=parseInt(refLeft)-parseInt(distanceOfReference)-parseInt(popupWidth)+parseInt(scrollLeft);var rightPosition=parseInt(refLeft)+parseInt(refWidth)+parseInt(distanceOfReference)+parseInt(scrollLeft);
var topPosition=parseInt(refTop)+parseInt(refHeight)-parseInt(popupHeight)+parseInt(scrollTop)-parseInt(heightAdjustment);var bottomPosition=parseInt(refTop)+parseInt(scrollTop)+parseInt(heightAdjustment);
var isLeft=true;var isTop=true;
var positionInfo=new Array();
if(refTop>(containerHeight-refTop-refHeight)){positionInfo["top"]=topPosition;positionInfo["isTop"]=true;}
else{positionInfo["top"]=bottomPosition;positionInfo["isTop"]=false;}
if(refLeft>(containerWidth-refLeft-refWidth)){positionInfo["left"]=leftPosition;positionInfo["isLeft"]=true;}
else{positionInfo["left"]=rightPosition;positionInfo["isLeft"]=false;}
return positionInfo;
/*var distanceOfReference=0;
var popupLeft=0;var popupTop=0;
var containerLeft=containerBoundingBox[this.X1];var containerTop=containerBoundingBox[this.Y1];var containerWidth=containerBoundingBox[this.X2]-containerBoundingBox[this.X1];var containerHeight=containerBoundingBox[this.Y2]-containerBoundingBox[this.Y1];
var refLeft=boundingBox[this.X1]+containerLeft;var refTop=boundingBox[this.Y1]+containerTop;var refWidth=boundingBox[this.X2]-boundingBox[this.X1];var refHeight=boundingBox[this.Y2]-boundingBox[this.Y1];
var leftPosition=refLeft-distanceOfReference-popupWidth;var rightPosition=refLeft+refWidth+distanceOfReference;
var topPosition=refTop+refHeight-popupHeight-heightAdjustment;var bottomPosition=refTop+heightAdjustment;
var isLeft=true;var isTop=true
var positionInfo=new Array();
if(refTop>(containerHeight-refTop-refHeight)){positionInfo["top"]=topPosition;positionInfo["isTop"]=true;}
else{positionInfo["top"]=bottomPosition;positionInfo["isTop"]=false;}
if(refLeft>(containerWidth-refLeft-refWidth)){positionInfo["left"]=leftPosition;positionInfo["isLeft"]=true;}
else{positionInfo["left"]=rightPosition;positionInfo["isLeft"]=false;}
return positionInfo;*/}
MessageController.prototype.isCursorOver=function(messageId,pX,pY){
var returnValue=false;
if(this.messageObjectMap[messageId]!=undefined){
var calloutElement=this.messageObjectMap[messageId].container;
if(calloutElement!=undefined){
var calloutX1=getAbsLeft(calloutElement)-20;var calloutY1=getAbsTop(calloutElement)-20;var calloutX2=calloutX1+parseInt(calloutElement.style.width)+40;var calloutY2=calloutY1+parseInt(calloutElement.style.height)+40;
if(pX>=calloutX1&&pY>=calloutY1&&pX<=calloutX2&&pY<=calloutY2){returnValue=true;}}}
return returnValue;}
function MessageObject(id,parentController){
this.id=id;this.elementId=id;this.parentController=parentController;}
MessageObject.prototype.X1=0;MessageObject.prototype.Y1=1;MessageObject.prototype.X2=2;MessageObject.prototype.Y2=3;
MessageObject.prototype.id="MessageObject";MessageObject.prototype.elementId="";MessageObject.prototype.backgroundElementId="";MessageObject.prototype.contentElementId="";MessageObject.prototype.elementReference="pageLayout";MessageObject.prototype.parentController="Workspace.message";MessageObject.prototype.duration=0;MessageObject.prototype.top=undefined;MessageObject.prototype.left=undefined;MessageObject.prototype.width=undefined;MessageObject.prototype.height=undefined;MessageObject.prototype.background_url="";MessageObject.prototype.popupImageTopLeft=undefined;MessageObject.prototype.popupImageTopRight=undefined;MessageObject.prototype.popupImageBottomLeft=undefined;MessageObject.prototype.popupImageBottomRight=undefined;MessageObject.prototype.imageTopLeft="popupImageTopLeft";MessageObject.prototype.imageTopRight="popupImageTopRight";MessageObject.prototype.imageBottomLeft="popupImageBottomLeft";MessageObject.prototype.imageBottomRight="popupImageBottomRight";MessageObject.prototype.isInitialized=false;MessageObject.prototype.isVisible=false;MessageObject.prototype.isFadeInEffectActive=true;MessageObject.prototype.targetFadePercentage=100;
MessageObject.prototype.thread=undefined;MessageObject.prototype.isClosableOnClick=true;MessageObject.prototype.heightAdjustment=0;
MessageObject.prototype.init=function(){
this.container=this.createContainer(this.left,this.top,this.width,this.height,this.isClosableOnClick);this.isInitialized=true;}
MessageObject.prototype.startThread=function(){
if(this.duration!=0){this.thread=setTimeout(this.parentController+".hide('"+this.id+"')",this.duration);}}
MessageObject.prototype.setContent=function(templateElementId,attributes){
ParserUtils.applyTemplate(templateElementId,this.container.id,attributes);}
MessageObject.prototype.hide=function(){
Workspace.message.hide(this.id);}
MessageObject.prototype.createContainer=function(left,top,width,height,isClosableOnClick){
var newdiv=document.createElement('div');
newdiv.setAttribute('id',this.elementId);
if(isClosableOnClick){newdiv.onclick=new Function("Workspace.message.hide('"+this.elementId+"')");}
newdiv.style.position="absolute";
if(width){newdiv.style.width=width+"px";}
if(height){newdiv.style.height=height+"px";}
if(left){newdiv.style.left=left+"px";}
if(top){newdiv.style.top=top+"px";}
newdiv.style.display="none";document.body.appendChild(newdiv);
return newdiv;}
function WindowController(id,attributes){
this.id=id;this.setAttributes(attributes);
this.init();}
WindowController.prototype.id="WindowController";WindowController.prototype.element=undefined;WindowController.prototype.attributes=undefined;WindowController.prototype.isMinimized=false;WindowController.prototype.isMaximized=false;WindowController.prototype.state="";WindowController.prototype.isVisible=false;WindowController.prototype.isGenerated=false;WindowController.prototype.eventListenerMap=undefined;
WindowController.prototype.WINDOW_NORMAL="WINDOW_NORMAL";WindowController.prototype.WINDOW_MAXIMIZED="WINDOW_MAXIMIZED";WindowController.prototype.WINDOW_MINIMIZED="WINDOW_MINIMIZED";WindowController.prototype.WINDOW_HIDDEN="WINDOW_HIDDEN";
WindowController.prototype.WINDOW_STYLE_DHTML="DHTML";WindowController.prototype.WINDOW_STYLE_POPUP="POPUP";
WindowController.prototype.init=function(isForced){
if(this.attributes["autoShow"]||isForced){
if(this.attributes["controller"]!=""){
if(Workspace.isInitialized){Workspace.activateController(this.attributes["controller"],undefined,this.id+".generate()");}else{loopUntil("Workspace.isInitialized",this.id+".init()");}}else{this.generate();}}}
WindowController.prototype.setAttributes=function(attributes){
this.attributes={"style":this.WINDOW_STYLE_DHTML,"autoShow":false,"left":"","top":"","width":"","height":"","class":"window","isDraggable":true,"isControlBar":true,"templateId":"","content":"","contentUrl":"","frameUrl":"","title":"","initialWindowState":this.WINDOW_NORMAL,"controller":"","redrawOnEvents":new Array()}
this.attributes=MapUtils.putAll(this.attributes,attributes);}
WindowController.prototype.generate=function(){
if(!this.isGenerated){
if(this.attributes["style"]==this.WINDOW_STYLE_DHTML){this._generateDhtmlWindow();}else if(this.attributes["style"]==this.WINDOW_STYLE_POPUP){this._generatePopupWindow();}
this.eventListenerMap=new Array();
if(this.attributes["redrawOnEvents"].length>0){
for(var i=0;i<this.attributes["redrawOnEvents"].length;i++){
this.eventListenerMap[this.attributes["redrawOnEvents"][i]]=this.attributes["redrawOnEvents"][i];Workspace.events.addListener(this.attributes["redrawOnEvents"][i],this);}}
this.isGenerated=true;}}
WindowController.prototype._generateDhtmlWindow=function(){
if(this.element==undefined){
this.element=document.createElement("DIV");this.element.id=this.id+"Window";
if(this.attributes["left"]!=""){this.element.style.left=this.attributes["left"]+"px";}
if(this.attributes["top"]!=""){this.element.style.top=this.attributes["top"]+"px";}
if(this.attributes["width"]!=""){this.element.style.width=this.attributes["width"]+"px";}
if(this.attributes["height"]!=""){this.element.style.height=this.attributes["height"]+"px";}
this.element.className=this.attributes["class"];
document.body.appendChild(this.element);}
this.element.innerHTML=
(this.attributes["isControlBar"]?
"<div class='windowControlBar' id='"+this.id+"ControlBar' ondblclick='"+this.id+".controlBarDoubleClick()'>"+(this.attributes["title"]!=""?"<span class='windowTitle'>"+this.attributes["title"]+"</span>" : "")+"<div onclick='"+this.id+".minimize()' class='windowControlButton'>_</div>"+"<div onclick='"+this.id+".maximize()' class='windowControlButton'>[]</div>"+"<div onclick='"+this.id+".close()' class='windowControlButton'>X</div>"+"</div>"
: "")
+"<div id='"+this.id+"Container' class='windowContainer'></div>";
if(this.attributes["isDraggable"]){DragDrop.doDrag(this.id+"ControlBar",{"draggedElementId":this.id+"Window","onPick":this.id+"._onPick()","onDrop":this.id+"._onDragComplete()"});}
this._generateContent();
this.attributes["left"]=getAbsLeft(this.element);this.attributes["top"]=getAbsTop(this.element);this.attributes["width"]=getWidth(this.element);this.attributes["height"]=getHeight(this.element);}
WindowController.prototype._generatePopupWindow=function(){
this.element=window.open("",this.id+"Window",(this.attributes["width"]!=""?"width="+this.attributes["width"] : "")+(this.attributes["height"]!=""?",height="+this.attributes["height"] : "")+(this.attributes["isControlBar"]?",status=no,menubar=no,toolbar=no,resizable=no" : ",status=yes,menubar=no,toolbar=no,resizable=no")+",scrollbars=1");this.element.focus();
this._generateContent();}
WindowController.prototype._generateContent=function(){
if(this.attributes["content"]!=""){this.setContent(this.attributes["content"]);}
if(this.attributes["templateId"]!=""){this.applyTemplate(this.attributes["templateId"]);}
if(this.attributes["contentUrl"]!=""){this.loadContentFromUrl(this.attributes["contentUrl"]);}
if(this.attributes["frameUrl"]!=""){this.loadUrl(this.attributes["frameUrl"]);}}
WindowController.prototype.setContent=function(content){
if(this.attributes["style"]==this.WINDOW_STYLE_DHTML){document.getElementById(this.id+"Container").innerHTML=content;}else if(this.attributes["style"]==this.WINDOW_STYLE_POPUP){this.element.document.open("text/html","replace");this.element.document.write(content);this.element.document.close();}}
WindowController.prototype.applyTemplate=function(templateId){
if(this.attributes["style"]==this.WINDOW_STYLE_DHTML){ParserUtils.applyTemplate(templateId,this.id+"Container",this.attributes);}else if(this.attributes["style"]==this.WINDOW_STYLE_POPUP){ParserUtils.preloadTemplate(templateId,this.id+".setContent(ParserUtils.parseTemplate('"+templateId+"',undefined))");}}
WindowController.prototype.loadContentFromUrl=function(url){
if(this.attributes["style"]==this.WINDOW_STYLE_DHTML){
if(typeof(Workspace)!="undefined"&&Workspace.events!=undefined&&!Workspace.events.isEventListener(Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,this)){Workspace.events.addListener(Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED,this);}
this._sendRequest(url);}else if(this.attributes["style"]==this.WINDOW_STYLE_POPUP){this.loadUrl(url);}}
WindowController.prototype.loadUrl=function(url){
if(this.attributes["style"]==this.WINDOW_STYLE_DHTML){
log.debug("loading frame url:"+url,this);
if(document.getElementById(this.id+"Iframe")==undefined){this.setContent("<iframe id='"+this.id+"Iframe' style='width:100%;height:100%;' frameborder='0' src='"+url+"'></iframe>");}else{document.getElementById(this.id+"Iframe").src=url;}
}else if(this.attributes["style"]==this.WINDOW_STYLE_POPUP){this.element.location=url;}}
WindowController.prototype._onPick=function(){
this.element.style.zIndex=999;}
WindowController.prototype._onScale=function(){
var scaleElement=document.getElementById(this.id+"Scale");
var newWidth=getAbsLeft(scaleElement)-getAbsLeft(this.element)+20;var newHeight=getAbsTop(scaleElement)-getAbsTop(this.element)+20;
newWidth=(newWidth>140?newWidth : 140);newHeight=(newHeight>20?newHeight : 20);
this.element.style.width=newWidth+"px";this.element.style.height=newHeight+"px";}
WindowController.prototype._onScaleComplete=function(){
var scaleElement=document.getElementById(this.id+"Scale");
this.attributes["width"]=(parseInt(scaleElement.style.left)+20);this.attributes["height"]=(parseInt(scaleElement.style.top)+20);}
WindowController.prototype._onDragComplete=function(){
this.attributes["left"]=getAbsLeft(this.element);this.attributes["top"]=getAbsTop(this.element);}
WindowController.prototype.minimize=function(){
if(this.isMaximized){this.restore();
}else{DragDrop.disable(this.id+"ControlBar");DragDrop.disable(this.id+"Scale");
this.attributes["left"]=getAbsLeft(this.element);this.attributes["top"]=getAbsTop(this.element);
this.isMinimized=true;this.isMaximized=false;
Anim.animateElement(this.id+"Window",{tLeft:0,tTop:600,tWidth:200,tHeight:20});}}
WindowController.prototype.restore=function(){
DragDrop.enable(this.id+"ControlBar");DragDrop.enable(this.id+"Scale");
Anim.animateElement(this.id+"Window",{"tLeft":this.attributes["left"],"tTop":this.attributes["top"],"tWidth":this.attributes["width"],"tHeight":this.attributes["height"]});
this.isMinimized=false;this.isMaximized=false;}
WindowController.prototype.maximize=function(){
if(this.isMinimized){this.restore();
}else{DragDrop.disable(this.id+"ControlBar");DragDrop.disable(this.id+"Scale");
Anim.animateElement(this.id+"Window",{"tLeft":0,"tTop":0,"tWidth":Workspace.width,"tHeight":Workspace.height});
this.isMinimized=false;this.isMaximized=true;}}
WindowController.prototype.controlBarDoubleClick=function(){
if(this.isMinimized||this.isMaximized){this.restore();}else{this.maximize();}}
WindowController.prototype.close=function(){
this.isVisible=false;
if(this.isGenerated&&this.attributes["style"]==this.WINDOW_STYLE_DHTML){
Anim.fadeOut(this.element.id,"document.getElementById('"+this.element.id+"').style.display='none';");}else if(this.isGenerated&&this.attributes["style"]==this.WINDOW_STYLE_POPUP){
this.element.close();this.isGenerated=false;}}
WindowController.prototype.show=function(){
if(!this.isGenerated){this.init(true);}else if(this.attributes["style"]==this.WINDOW_STYLE_DHTML){
this.isVisible=true;this.element.style.display="block";
Anim.fadeIn(this.element.id);}else if(this.attributes["style"]==this.WINDOW_STYLE_POPUP){
this.isVisible=true;this.element.focus();}}
WindowController.prototype._sendRequest=function(action,infoMap){
det.sendRequest({method:"GET",responseFormat:det.RESPONSE_FORMAT_TEXT,serverUrl:action,action:action,info:infoMap,timeout:5000,callingController:this});}
WindowController.prototype.catchEvent=function(eventKey,attributes){
if(eventKey==Workspace.events.EVENT_SERVER_RESPONSE_RECEIVED&&attributes.callingController==this&&attributes!=undefined&&attributes.response!=undefined){
if(attributes.error!=undefined){this.setContent("Request timed out.");}else{this.setContent(attributes.response["textResponse"]);}
}else if(this.isVisible&&this.eventListenerMap[eventKey]!=undefined){this._generateContent();}}
