in an activity with a title or title id."));},0);}return;}opensocial.Container.get().requestCreateActivity(activity,priority,opt_callback);};opensocial.CreateActivityPriority={HIGH:'HIGH',LOW:'LOW'};opensocial.hasPermission=function(permission){return opensocial.Container.get().hasPermission(permission);};opensocial.requestPermission=function(permissions,reason,opt_callback){opensocial.Container.get().requestPermission(permissions,reason,opt_callback);};opensocial.Permission={VIEWER:'viewer'};opensocial.getEnvironment=function(){return opensocial.Container.get().getEnvironment();};opensocial.newDataRequest=function(){return opensocial.Container.get().newDataRequest();};opensocial.newActivity=function(params){return opensocial.Container.get().newActivity(params);};opensocial.newAlbum=function(opt_params){return opensocial.Container.get().newAlbum(opt_params);};opensocial.newMediaItem=function(mimeType,url,opt_params){return opensocial.Container.get().newMediaItem(mimeType,url,opt_params);};opensocial.newMessage=function(body,opt_params){return opensocial.Container.get().newMessage(body,opt_params);};opensocial.EscapeType={HTML_ESCAPE:'htmlEscape',NONE:'none'};opensocial.newIdSpec=function(params){return opensocial.Container.get().newIdSpec(params);};opensocial.newNavigationParameters=function(params){return opensocial.Container.get().newNavigationParameters(params);};opensocial.invalidateCache=function(){opensocial.Container.get().invalidateCache();};Function.prototype.inherits=function(parentCtor){function tempCtor(){}tempCtor.prototype=parentCtor.prototype;this.superClass_=parentCtor.prototype;this.prototype=new tempCtor();this.prototype.constructor=this;};opensocial.Activity=function(params){this.fields_=params;};opensocial.Activity.Field={TITLE_ID:'titleId',TITLE:'title',TEMPLATE_PARAMS:'templateParams',URL:'url',MEDIA_ITEMS:'mediaItems',BODY_ID:'bodyId',BODY:'body',EXTERNAL_ID:'externalId',STREAM_TITLE:'streamTitle',STREAM_URL:'streamUrl',STREAM_SOURCE_URL:'streamSourceUrl',STREAM_FAVICON_URL:'streamFaviconUrl',PRIORITY:'priority',ID:'id',USER_ID:'userId',APP_ID:'appId',POSTED_TIME:'postedTime'};opensocial.Activity.prototype.getId=function(){return this.getField(opensocial.Activity.Field.ID);};opensocial.Activity.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Activity.prototype.setField=function(key,data){return(this.fields_[key]=data);};opensocial.Address=function(opt_params){this.fields_=opt_params||{};};opensocial.Address.Field={TYPE:'type',UNSTRUCTURED_ADDRESS:'unstructuredAddress',PO_BOX:'poBox',STREET_ADDRESS:'streetAddress',EXTENDED_ADDRESS:'extendedAddress',REGION:'region',LOCALITY:'locality',POSTAL_CODE:'postalCode',COUNTRY:'country',LATITUDE:'latitude',LONGITUDE:'longitude'};opensocial.Address.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Album=function(opt_params){this.fields_=opt_params||{};};opensocial.Album.Field={DESCRIPTION:'description',ID:'id',LOCATION:'location',MEDIA_ITEM_COUNT:'mediaITemCount',MEDIA_MIME_TYPE:'MEDIA_MIME_TYPE',MEDIA_TYPE:'MEDIA_TYPE',OWNER_ID:'ownerId',THUMBNAIL_URL:'thumbnailUrl',TITLE:'title'};opensocial.Album.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Album.prototype.setField=function(key,data){return this.fields_[key]=data;};opensocial.BodyType=function(opt_params){this.fields_=opt_params||{};};opensocial.BodyType.Field={BUILD:'build',HEIGHT:'height',WEIGHT:'weight',EYE_COLOR:'eyeColor',HAIR_COLOR:'hairColor'};opensocial.BodyType.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Collection=function(array,opt_offset,opt_totalSize){this.array_=array||[];this.offset_=opt_offset||0;this.totalSize_=opt_totalSize||this.array_.length;};opensocial.Collection.prototype.getById=function(id){for(var i=0;i<this.size();i++){var item=this.array_[i];if(item.getId()===id){return item;}}return null;};opensocial.Collection.prototype.size=function(){return this.array_.length;};opensocial.Collection.prototype.each=function(fn){for(var i=0;i<this.size();i++){fn(this.array_[i]);}};opensocial.Collection.prototype.asArray=function(){return this.array_;};opensocial.Collection.prototype.getTotalSize=function(){return this.totalSize_;};opensocial.Collection.prototype.getOffset=function(){return this.offset_;};opensocial.Container=function(){};opensocial.Container.container_=null;opensocial.Container.setContainer=function(container){opensocial.Container.container_=container;};opensocial.Container.get=function(){return opensocial.Container.container_;};opensocial.Container.prototype.getEnvironment=function(){};opensocial.Container.prototype.requestSendMessage=function(recipients,message,opt_callback,opt_params){gadgets.rpc.call(null,"requestSendMessage",opt_callback,recipients,message,opt_callback,opt_params);};opensocial.Container.prototype.requestShareApp=function(recipients,reason,opt_callback,opt_params){if(opt_callback){window.setTimeout(function(){opt_callback(new opensocial.ResponseItem(null,null,opensocial.ResponseItem.Error.NOT_IMPLEMENTED,null));},0);}};opensocial.Container.prototype.requestCreateActivity=function(activity,priority,opt_callback){if(opt_callback){window.setTimeout(function(){opt_callback(new opensocial.ResponseItem(null,null,opensocial.ResponseItem.Error.NOT_IMPLEMENTED,null));},0);}};opensocial.Container.prototype.hasPermission=function(permission){return false;};opensocial.Container.prototype.requestPermission=function(permissions,reason,opt_callback){if(opt_callback){window.setTimeout(function(){opt_callback(new opensocial.ResponseItem(null,null,opensocial.ResponseItem.Error.NOT_IMPLEMENTED,null));},0);}};opensocial.Container.prototype.requestData=function(dataRequest,callback){};opensocial.Container.prototype.newCreateAlbumRequest=function(idSpec,album){};opensocial.Container.prototype.newCreateMediaItemRequest=function(idSpec,albumId,mediaItem){};opensocial.Container.prototype.newDeleteAlbumRequest=function(idSpec,albumId){};opensocial.Container.prototype.newFetchPersonRequest=function(id,opt_params){};opensocial.Container.prototype.newFetchPeopleRequest=function(idSpec,opt_params){};opensocial.Container.prototype.newFetchPersonAppDataRequest=function(idSpec,keys,opt_params){};opensocial.Container.prototype.newUpdatePersonAppDataRequest=function(key,value){};opensocial.Container.prototype.newRemovePersonAppDataRequest=function(keys){};opensocial.Container.prototype.newUpdateAlbumRequest=function(idSpec,albumId,opt_params){};opensocial.Container.prototype.newUpdateMediaItemRequest=function(idSpec,albumId,mediaItemId,opt_params){};opensocial.Container.prototype.newFetchActivitiesRequest=function(idSpec,opt_params){};opensocial.Container.prototype.newFetchAlbumsRequest=function(idSpec,opt_params){};opensocial.Container.prototype.newFetchMessageCollectionsRequest=function(idSpec,opt_params){};opensocial.Container.prototype.newFetchMessagesRequest=function(idSpec,msgCollId,opt_params){};opensocial.Container.prototype.newCollection=function(array,opt_offset,opt_totalSize){return new opensocial.Collection(array,opt_offset,opt_totalSize);};opensocial.Container.prototype.newPerson=function(opt_params,opt_isOwner,opt_isViewer){return new opensocial.Person(opt_params,opt_isOwner,opt_isViewer);};opensocial.Container.prototype.newActivity=function(opt_params){return new opensocial.Activity(opt_params);};opensocial.Container.prototype.newAlbum=function(opt_params){return new opensocial.Album(opt_params);};opensocial.Container.prototype.newMediaItem=function(mimeType,url,opt_params){return new opensocial.MediaItem(mimeType,url,opt_params);};opensocial.Container.prototype.newMessage=function(body,opt_params){return new opensocial.Message(body,opt_params);};opensocial.Container.prototype.newIdSpec=function(params){return new opensocial.IdSpec(params);};opensocial.Container.prototype.newNavigationParameters=function(params){return new opensocial.NavigationParameters(params);};opensocial.Container.prototype.newResponseItem=function(originalDataRequest,data,opt_errorCode,opt_errorMessage){return new opensocial.ResponseItem(originalDataRequest,data,opt_errorCode,opt_errorMessage);};opensocial.Container.prototype.newDataResponse=function(responseItems,opt_globalError){return new opensocial.DataResponse(responseItems,opt_globalError);};opensocial.Container.prototype.newDataRequest=function(){return new opensocial.DataRequest();};opensocial.Container.prototype.newEnvironment=function(domain,supportedFields){return new opensocial.Environment(domain,supportedFields);};opensocial.Container.prototype.invalidateCache=function(){};opensocial.Container.isArray=function(val){return val instanceof Array;};opensocial.Container.getField=function(fields,key,opt_params){var value=fields[key];return opensocial.Container.escape(value,opt_params,false);};opensocial.Container.escape=function(value,opt_params,opt_escapeObjects){if(opt_params&&opt_params[opensocial.DataRequest.DataRequestFields.ESCAPE_TYPE]==opensocial.EscapeType.NONE){return value;}else{return gadgets.util.escape(value,opt_escapeObjects);}};opensocial.DataRequest=function(){this.requestObjects_=[];};opensocial.DataRequest.prototype.requestObjects_=null;opensocial.DataRequest.prototype.getRequestObjects=function(){return this.requestObjects_;};opensocial.DataRequest.prototype.add=function(request,opt_key){return this.requestObjects_.push({'key':opt_key,'request':request});};opensocial.DataRequest.prototype.send=function(opt_callback){var callback=opt_callback||function(){};opensocial.Container.get().requestData(this,callback);};opensocial.DataRequest.SortOrder={TOP_FRIENDS:'topFriends',NAME:'name'};opensocial.DataRequest.FilterType={ALL:'all',HAS_APP:'hasApp',TOP_FRIENDS:'topFriends',IS_FRIENDS_WITH:'isFriendsWith'};opensocial.DataRequest.PeopleRequestFields={PROFILE_DETAILS:'profileDetail',SORT_ORDER:'sortOrder',FILTER:'filter',FILTER_OPTIONS:'filterOptions',FIRST:'first',MAX:'max',APP_DATA:'appData',ESCAPE_TYPE:'escapeType'};opensocial.DataRequest.prototype.addDefaultParam=function(params,name,defaultValue){params[name]=params[name]||defaultValue;};opensocial.DataRequest.prototype.addDefaultProfileFields=function(params){var fields=opensocial.DataRequest.PeopleRequestFields;var profileFields=params[fields.PROFILE_DETAILS]||[];params[fields.PROFILE_DETAILS]=profileFields.concat([opensocial.Person.Field.ID,opensocial.Person.Field.NAME,opensocial.Person.Field.THUMBNAIL_URL]);};opensocial.DataRequest.prototype.asArray=function(keys){if(opensocial.Container.isArray(keys)){return keys;}else{return[keys];}};opensocial.DataRequest.prototype.newCreateAlbumRequest=function(idSpec,album){return opensocial.Container.get().newCreateAlbumRequest(idSpec,album);};opensocial.DataRequest.prototype.newCreateMediaItemRequest=function(idSpec,albumId,mediaItem){return opensocial.Container.get().newCreateMediaItemRequest(idSpec,albumId,mediaItem)};opensocial.DataRequest.prototype.newDeleteAlbumRequest=function(idSpec,albumId){return opensocial.Container.get().newDeleteAlbumRequest(idSpec,albumId);};opensocial.DataRequest.prototype.newFetchPersonRequest=function(id,opt_params){opt_params=opt_params||{};this.addDefaultProfileFields(opt_params);return opensocial.Container.get().newFetchPersonRequest(id,opt_params);};opensocial.DataRequest.prototype.newFetchPeopleRequest=function(idSpec,opt_params){opt_params=opt_params||{};var fields=opensocial.DataRequest.PeopleRequestFields;this.addDefaultProfileFields(opt_params);this.addDefaultParam(opt_params,fields.SORT_ORDER,opensocial.DataRequest.SortOrder.TOP_FRIENDS);this.addDefaultParam(opt_params,fields.FILTER,opensocial.DataRequest.FilterType.ALL);this.addDefaultParam(opt_params,fields.FIRST,0);this.addDefaultParam(opt_params,fields.MAX,20);return opensocial.Container.get().newFetchPeopleRequest(idSpec,opt_params);};opensocial.DataRequest.AlbumRequestFields={FIRST:'first',MAX:'max'};opensocial.DataRequest.DataRequestFields={ESCAPE_TYPE:'escapeType'};opensocial.DataRequest.prototype.newFetchPersonAppDataRequest=function(idSpec,keys,opt_params){return opensocial.Container.get().newFetchPersonAppDataRequest(idSpec,this.asArray(keys),opt_params);};opensocial.DataRequest.prototype.newUpdateAlbumRequest=function(idSpec,albumId,opt_params){return opensocial.Container.get().newUpdateAlbumRequest(idSpec,albumId,opt_params);};opensocial.DataRequest.prototype.newUpdateMediaItemRequest=function(idSpec,albumId,mediaItemId,opt_params){return opensocial.Container.get().newUpdateMediaItemRequest(idSpec,albumId,mediaItemId,opt_params);};opensocial.DataRequest.prototype.newUpdatePersonAppDataRequest=function(key,value){return opensocial.Container.get().newUpdatePersonAppDataRequest(key,value);};opensocial.DataRequest.prototype.newRemovePersonAppDataRequest=function(keys){return opensocial.Container.get().newRemovePersonAppDataRequest(keys);};opensocial.DataRequest.ActivityRequestFields={APP_ID:'appId',FIRST:'first',MAX:'max'};opensocial.DataRequest.prototype.newFetchActivitiesRequest=function(idSpec,opt_params){opt_params=opt_params||{};var fields=opensocial.DataRequest.ActivityRequestFields;this.addDefaultParam(opt_params,fields.FIRST,0);this.addDefaultParam(opt_params,fields.MAX,20);return opensocial.Container.get().newFetchActivitiesRequest(idSpec,opt_params);};opensocial.DataRequest.prototype.newFetchAlbumsRequest=function(idSpec,opt_params){opt_params=opt_params||{};return opensocial.Container.get().newFetchAlbumsRequest(idSpec,opt_params);};opensocial.DataRequest.prototype.newFetchMessageCollectionsRequest=function(idSpec,opt_params){opt_params=opt_params||{};return opensocial.Container.get().newFetchMessageCollectionsRequest(idSpec,opt_params);};opensocial.DataRequest.prototype.newFetchMessagesRequest=function(idSpec,msgCollId,opt_params){opt_params=opt_params||{};return opensocial.Container.get().newFetchMessagesRequest(idSpec,msgCollId,opt_params);};opensocial.DataResponse=function(responseItems,opt_globalError,opt_errorMessage){this.responseItems_=responseItems;this.globalError_=opt_globalError;this.errorMessage_=opt_errorMessage;};opensocial.DataResponse.prototype.hadError=function(){return!!this.globalError_;};opensocial.DataResponse.prototype.getErrorMessage=function(){return this.errorMessage_;};opensocial.DataResponse.prototype.get=function(key){return this.responseItems_[key];};opensocial.Email=function(opt_params){this.fields_=opt_params||{};};opensocial.Email.Field={TYPE:'type',ADDRESS:'address'};opensocial.Email.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Enum=function(key,displayValue){this.key=key;this.displayValue=displayValue;};opensocial.Enum.prototype.getKey=function(){return gadgets.util.escape(this.key);};opensocial.Enum.prototype.getDisplayValue=function(){return gadgets.util.escape(this.displayValue);};opensocial.Enum.Smoker={NO:'NO',YES:'YES',SOCIALLY:'SOCIALLY',OCCASIONALLY:'OCCASIONALLY',REGULARLY:'REGULARLY',HEAVILY:'HEAVILY',QUITTING:'QUITTING',QUIT:'QUIT'};opensocial.Enum.Drinker={NO:'NO',YES:'YES',SOCIALLY:'SOCIALLY',OCCASIONALLY:'OCCASIONALLY',REGULARLY:'REGULARLY',HEAVILY:'HEAVILY',QUITTING:'QUITTING',QUIT:'QUIT'};opensocial.Enum.Gender={MALE:'MALE',FEMALE:'FEMALE'};opensocial.Enum.LookingFor={DATING:'DATING',FRIENDS:'FRIENDS',RELATIONSHIP:'RELATIONSHIP',NETWORKING:'NETWORKING',ACTIVITY_PARTNERS:'ACTIVITY_PARTNERS',RANDOM:'RANDOM'};opensocial.Enum.Presence={AWAY:'AWAY',CHAT:'CHAT',DND:'DND',OFFLINE:'OFFLINE',ONLINE:'ONLINE',XA:'XA'};opensocial.Environment=function(domain,supportedFields){this.domain=domain;this.supportedFields=supportedFields;};opensocial.Environment.prototype.getDomain=function(){return this.domain;};opensocial.Environment.ObjectType={PERSON:'person',ADDRESS:'address',BODY_TYPE:'bodyType',EMAIL:'email',NAME:'name',ORGANIZATION:'organization',PHONE:'phone',URL:'url',ACTIVITY:'activity',MEDIA_ITEM:'mediaItem',MESSAGE:'message',MESSAGE_TYPE:'messageType',SORT_ORDER:'sortOrder',FILTER_TYPE:'filterType'};opensocial.Environment.prototype.supportsField=function(objectType,fieldName){var supportedObjectFields=this.supportedFields[objectType]||[];return!!supportedObjectFields[fieldName];};opensocial.IdSpec=function(opt_params){this.fields_=opt_params||{};};opensocial.IdSpec.Field={USER_ID:'userId',GROUP_ID:'groupId',NETWORK_DISTANCE:'networkDistance'};opensocial.IdSpec.PersonId={OWNER:'OWNER',VIEWER:'VIEWER'};opensocial.IdSpec.GroupId={SELF:'SELF',FRIENDS:'FRIENDS',ALL:'ALL'};opensocial.IdSpec.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.IdSpec.prototype.setField=function(key,data){return(this.fields_[key]=data);};opensocial.MediaItem=function(mimeType,url,opt_params){this.fields_={};if(opt_params){for(var k in opt_params){if(opt_params.hasOwnProperty(k)){this.fields_[k]=opt_params[k];}}}this.fields_[opensocial.MediaItem.Field.MIME_TYPE]=mimeType;this.fields_[opensocial.MediaItem.Field.URL]=url;};opensocial.MediaItem.Type={IMAGE:'image',VIDEO:'video',AUDIO:'audio'};opensocial.MediaItem.Field={TYPE:'type',MIME_TYPE:'mimeType',URL:'url'};opensocial.MediaItem.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.MediaItem.prototype.setField=function(key,data){return(this.fields_[key]=data);};opensocial.MessageCollection=function(opt_params){this.fields_=opt_params||{};};opensocial.MessageCollection.Field={ID:'id',TITLE:'title',TOTAL:'total',UNREAD:'unread',UPDATED:'updated',URLS:'urls'};opensocial.MessageCollection.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.MessageCollection.prototype.setField=function(key,data){return this.fields_[key]=data;};opensocial.Message=function(body_or_params,opt_params){if(typeof body_or_params=='string'){this.fields_=opt_params||{};this.fields_[opensocial.Message.Field.BODY]=body_or_params;}else{this.fields_=body_or_params||{};}};opensocial.Message.Field={APP_URL:'appUrl',BODY:'body',BODY_ID:'bodyId',COLLECTION_IDS:'collectionIds',ID:'id',PARENT_ID:'parentId',RECIPIENTS:'recipients',SENDER_ID:'senderId',STATUS:'status',TIME_SENT:'timeSent',TITLE:'title',TITLE_ID:'titleId',TYPE:'type',UPDATED:'updated',URLS:'urls'};opensocial.Message.Type={EMAIL:'email',NOTIFICATION:'notification',PRIVATE_MESSAGE:'privateMessage',PUBLIC_MESSAGE:'publicMessage'};opensocial.Message.Status={NEW:'new',DELETED:'deleted',FLAGGED:'flagged'};opensocial.Message.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Message.prototype.setField=function(key,data){return(this.fields_[key]=data);};opensocial.Name=function(opt_params){this.fields_=opt_params||{};};opensocial.Name.Field={FAMILY_NAME:'familyName',GIVEN_NAME:'givenName',ADDITIONAL_NAME:'additionalName',HONORIFIC_PREFIX:'honorificPrefix',HONORIFIC_SUFFIX:'honorificSuffix',UNSTRUCTURED:'unstructured'};opensocial.Name.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.NavigationParameters=function(opt_params){this.fields_=opt_params||{};};opensocial.NavigationParameters.Field={VIEW:'view',OWNER:'owner',PARAMETERS:'parameters'};opensocial.NavigationParameters.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.NavigationParameters.prototype.setField=function(key,data){return(this.fields_[key]=data);};opensocial.NavigationParameters.DestinationType={VIEWER_DESTINATION:"viewerDestination",RECIPIENT_DESTINATION:"recipientDestination"};opensocial.Organization=function(opt_params){this.fields_=opt_params||{};};opensocial.Organization.Field={NAME:'name',TITLE:'title',DESCRIPTION:'description',FIELD:'field',SUB_FIELD:'subField',START_DATE:'startDate',END_DATE:'endDate',SALARY:'salary',ADDRESS:'address',WEBPAGE:'webpage'};opensocial.Organization.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Person=function(opt_params,opt_isOwner,opt_isViewer){this.fields_=opt_params||{};this.isOwner_=opt_isOwner;this.isViewer_=opt_isViewer;};opensocial.Person.Field={ID:'id',NAME:'name',NICKNAME:'nickname',THUMBNAIL_URL:'thumbnailUrl',PROFILE_URL:'profileUrl',CURRENT_LOCATION:'currentLocation',ADDRESSES:'addresses',EMAILS:'emails',PHONE_NUMBERS:'phoneNumbers',ABOUT_ME:'aboutMe',STATUS:'status',PROFILE_SONG:'profileSong',PROFILE_VIDEO:'profileVideo',GENDER:'gender',SEXUAL_ORIENTATION:'sexualOrientation',RELATIONSHIP_STATUS:'relationshipStatus',AGE:'age',DATE_OF_BIRTH:'dateOfBirth',BODY_TYPE:'bodyType',ETHNICITY:'ethnicity',SMOKER:'smoker',DRINKER:'drinker',CHILDREN:'children',PETS:'pets',LIVING_ARRANGEMENT:'livingArrangement',TIME_ZONE:'timeZone',LANGUAGES_SPOKEN:'languagesSpoken',JOBS:'jobs',JOB_INTERESTS:'jobInterests',SCHOOLS:'schools',INTERESTS:'interests',URLS:'urls',MUSIC:'music',MOVIES:'movies',TV_SHOWS:'tvShows',BOOKS:'books',ACTIVITIES:'activities',SPORTS:'sports',HEROES:'heroes',QUOTES:'quotes',CARS:'cars',FOOD:'food',TURN_ONS:'turnOns',TURN_OFFS:'turnOffs',TAGS:'tags',ROMANCE:'romance',SCARED_OF:'scaredOf',HAPPIEST_WHEN:'happiestWhen',FASHION:'fashion',HUMOR:'humor',LOOKING_FOR:'lookingFor',RELIGION:'religion',POLITICAL_VIEWS:'politicalViews',HAS_APP:'hasApp',NETWORK_PRESENCE:'networkPresence'};opensocial.Person.prototype.getId=function(){return this.getField(opensocial.Person.Field.ID);};var ORDERED_NAME_FIELDS_=[opensocial.Name.Field.HONORIFIC_PREFIX,opensocial.Name.Field.GIVEN_NAME,opensocial.Name.Field.FAMILY_NAME,opensocial.Name.Field.HONORIFIC_SUFFIX,opensocial.Name.Field.ADDITIONAL_NAME];opensocial.Person.prototype.getDisplayName=function(){var name=this.getField(opensocial.Person.Field.NAME);if(name){var unstructured=name.getField(opensocial.Name.Field.UNSTRUCTURED);if(unstructured){return unstructured;}var fullName='';for(var i=0;i<ORDERED_NAME_FIELDS_.length;i++){var nameValue=name.getField(ORDERED_NAME_FIELDS_[i]);if(nameValue){fullName+=nameValue+' ';}}return fullName.replace(/^\s+|\s+$/g,'');}return this.getField(opensocial.Person.Field.NICKNAME);};opensocial.Person.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.Person.prototype.getAppData=function(key){};opensocial.Person.prototype.isViewer=function(){return!!this.isViewer_;};opensocial.Person.prototype.isOwner=function(){return!!this.isOwner_;};opensocial.Phone=function(opt_params){this.fields_=opt_params||{};};opensocial.Phone.Field={TYPE:'type',NUMBER:'number'};opensocial.Phone.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};opensocial.ResponseItem=function(originalDataRequest,data,opt_errorCode,opt_errorMessage){this.originalDataRequest_=originalDataRequest;this.data_=data;this.errorCode_=opt_errorCode;this.errorMessage_=opt_errorMessage;};opensocial.ResponseItem.prototype.hadError=function(){return!!this.errorCode_;};opensocial.ResponseItem.Error={NOT_IMPLEMENTED:'notImplemented',UNAUTHORIZED:'unauthorized',FORBIDDEN:'forbidden',BAD_REQUEST:'badRequest',INTERNAL_ERROR:'internalError',LIMIT_EXCEEDED:'limitExceeded'};opensocial.ResponseItem.prototype.getErrorCode=function(){return this.errorCode_;};opensocial.ResponseItem.prototype.getErrorMessage=function(){return this.errorMessage_;};opensocial.ResponseItem.prototype.getOriginalDataRequest=function(){return this.originalDataRequest_;};opensocial.ResponseItem.prototype.getData=function(){return this.data_;};opensocial.Url=function(opt_params){this.fields_=opt_params||{};};opensocial.Url.Field={TYPE:'type',LINK_TEXT:'linkText',ADDRESS:'address'};opensocial.Url.prototype.getField=function(key,opt_params){return opensocial.Container.getField(this.fields_,key,opt_params);};var tamings___=tamings___||[];tamings___.push(function(imports){___.grantRead(opensocial,'CreateActivityPriority');___.grantRead(opensocial,'EscapeType');___.grantRead(opensocial.Activity,'Field');___.grantRead(opensocial.Address,'Field');___.grantRead(opensocial.Album,'Field');___.grantRead(opensocial.BodyType,'Field');___.grantRead(opensocial.DataRequest,'ActivityRequestFields');___.grantRead(opensocial.DataRequest,'DataRequestFields');___.grantRead(opensocial.DataRequest,'FilterType');___.grantRead(opensocial.DataRequest,'Group');___.grantRead(opensocial.DataRequest,'PeopleRequestFields');___.grantRead(opensocial.DataRequest,'SortOrder');___.grantRead(opensocial.Email,'Field');___.grantRead(opensocial.Enum,'Smoker');___.grantRead(opensocial.Enum,'Drinker');___.grantRead(opensocial.Enum,'Gender');___.grantRead(opensocial.Enum,'LookingFor');___.grantRead(opensocial.Enum,'Presence');___.grantRead(opensocial.IdSpec,'Field');___.grantRead(opensocial.IdSpec,'GroupId');___.grantRead(opensocial.IdSpec,'PersonId');___.grantRead(opensocial.MediaItem,'Field');___.grantRead(opensocial.Message,'Field');___.grantRead(opensocial.MessageCollection,'Field');___.grantRead(opensocial.Name,'Field');___.grantRead(opensocial.NavigationParameters,'Field');___.grantRead(opensocial.Organization,'Field');___.grantRead(opensocial.Person,'Field');___.grantRead(opensocial.Phone,'Field');___.grantRead(opensocial.ResponseItem,'Error');___.grantRead(opensocial.Url,'Field');___.grantRead(JsonRpcRequestItem,'rpc');___.grantRead(JsonRpcRequestItem,'processData');___.grantRead(JsonRpcRequestItem,'processResponse');___.grantRead(JsonRpcRequestItem,'errors');___.grantInnocentMethod(JsonPerson.prototype,'getDisplayName');___.grantInnocentMethod(JsonPerson.prototype,'getAppData');caja___.whitelistCtors([[window,'JsonRpcRequestItem',Object],[opensocial,'Activity',Object],[opensocial,'Address',Object],[opensocial,'Album',Object],[opensocial,'BodyType',Object],[opensocial,'Container',Object],[opensocial,'Collection',Object],[opensocial,'DataRequest',Object],[opensocial,'DataResponse',Object],[opensocial,'Email',Object],[opensocial,'Enum',Object],[opensocial,'Environment',Object],[opensocial,'IdSpec',Object],[opensocial,'MediaItem',Object],[opensocial,'Message',Object],[opensocial,'Name',Object],[opensocial,'NavigationParameters',Object],[opensocial,'Organization',Object],[opensocial,'Person',Object],[opensocial,'Phone',Object],[opensocial,'ResponseItem',Object],[opensocial,'Url',Object]]);caja___.whitelistMeths([[opensocial.Activity,'getField'],[opensocial.Activity,'getId'],[opensocial.Activity,'setField'],[opensocial.Address,'getField'],[opensocial.Album,'getField'],[opensocial.BodyType,'getField'],[opensocial.Container,'getEnvironment'],[opensocial.Container,'requestSendMessage'],[opensocial.Container,'requestShareApp'],[opensocial.Container,'requestCreateActivity'],[opensocial.Container,'hasPermission'],[opensocial.Container,'requestPermission'],[opensocial.Container,'requestData'],[opensocial.Container,'newCreateAlbumRequest'],[opensocial.Container,'newCreateMediaItemRequest'],[opensocial.Container,'newDeleteAlbumRequest'],[opensocial.Container,'newFetchPersonRequest'],[opensocial.Container,'newFetchPeopleRequest'],[opensocial.Container,'newFetchPersonAppDataRequest'],[opensocial.Container,'newUpdatePersonAppDataRequest'],[opensocial.Container,'newRemovePersonAppDataRequest'],[opensocial.Container,'newUpdateAlbumRequest'],[opensocial.Container,'newUpdateMediaItemRequest'],[opensocial.Container,'newFetchActivitiesRequest'],[opensocial.Container,'newFetchAlbumsRequest'],[opensocial.Container,'newFetchMessageCollectionsRequest'],[opensocial.Container,'newFetchMessagesRequest'],[opensocial.Container,'newCollection'],[opensocial.Container,'newPerson'],[opensocial.Container,'newActivity'],[opensocial.Container,'newMediaItem'],[opensocial.Container,'newMessage'],[opensocial.Container,'newIdSpec'],[opensocial.Container,'newNavigationParameters'],[opensocial.Container,'newResponseItem'],[opensocial.Container,'newDataResponse'],[opensocial.Container,'newDataRequest'],[opensocial.Container,'newEnvironment'],[opensocial.Container,'invalidateCache'],[opensocial.Collection,'asArray'],[opensocial.Collection,'each'],[opensocial.Collection,'getById'],[opensocial.Collection,'getOffset'],[opensocial.Collection,'getTotalSize'],[opensocial.Collection,'size'],[opensocial.DataRequest,'add'],[opensocial.DataRequest,'newCreateAlbumRequest'],[opensocial.DataRequest,'newCreateMediaItemRequest'],[opensocial.DataRequest,'newDeleteAlbumRequest'],[opensocial.DataRequest,'newFetchActivitiesRequest'],[opensocial.DataRequest,'newFetchAlbumsRequest'],[opensocial.DataRequest,'newFetchPeopleRequest'],[opensocial.DataRequest,'newFetchPersonAppDataRequest'],[opensocial.DataRequest,'newUpdateAlbumRequest'],[opensocial.DataRequest,'newUpdateMediaItemRequest'],[opensocial.DataRequest,'newFetchPersonRequest'],[opensocial.DataRequest,'newRemovePersonAppDataRequest'],[opensocial.DataRequest,'newUpdatePersonAppDataRequest'],[opensocial.DataRequest,'send'],[opensocial.DataResponse,'get'],[opensocial.DataResponse,'getErrorMessage'],[opensocial.DataResponse,'hadError'],[opensocial.Email,'getField'],[opensocial.Enum,'getDisplayValue'],[opensocial.Enum,'getKey'],[opensocial.Environment,'getDomain'],[opensocial.Environment,'supportsField'],[opensocial.IdSpec,'getField'],[opensocial.IdSpec,'setField'],[opensocial.MediaItem,'getField'],[opensocial.MediaItem,'setField'],[opensocial.Message,'getField'],[opensocial.Message,'setField'],[opensocial.Name,'getField'],[opensocial.NavigationParameters,'getField'],[opensocial.NavigationParameters,'setField'],[opensocial.Organization,'getField'],[opensocial.Person,'getDisplayName'],[opensocial.Person,'getField'],[opensocial.Person,'getId'],[opensocial.Person,'isOwner'],[opensocial.Person,'isViewer'],[opensocial.Phone,'getField'],[opensocial.ResponseItem,'getData'],[opensocial.ResponseItem,'getErrorCode'],[opensocial.ResponseItem,'getErrorMessage'],[opensocial.ResponseItem,'getOriginalDataRequest'],[opensocial.ResponseItem,'hadError'],[opensocial.Url,'getField']]);caja___.whitelistFuncs([[opensocial.Container,'setContainer'],[opensocial.Container,'get'],[opensocial.Container,'getField'],[opensocial,'getEnvironment'],[opensocial,'hasPermission'],[opensocial,'newActivity'],[opensocial,'newDataRequest'],[opensocial,'newIdSpec'],[opensocial,'newMediaItem'],[opensocial,'newMessage'],[opensocial,'newNavigationParameters'],[opensocial,'requestCreateActivity'],[opensocial,'requestPermission'],[opensocial,'requestSendMessage'],[opensocial,'requestShareApp']]);});gadgets.rpctx=gadgets.rpctx||{};if(!gadgets.rpctx.wpm){gadgets.rpctx.wpm=function(){var process,ready;var postMessage;var pmSync=false;var pmEventDomain=false;var isForceSecure=false;function testPostMessage(){var hit=false;function receiveMsg(event){if(event.data=="postmessage.test"){hit=true;if(typeof event.origin==="undefined"){pmEventDomain=true;}}}gadgets.util.attachBrowserEvent(window,"message",receiveMsg,false);window.postMessage("postmessage.test","*");if(hit){pmSync=true;}gadgets.util.removeBrowserEvent(window,"message",receiveMsg,false);}function onmessage(packet){var rpc=gadgets.json.parse(packet.data);if(isForceSecure){if(!rpc||!rpc.f){return;}var origRelay=gadgets.rpc.getRelayUrl(rpc.f)||gadgets.util.getUrlParameters()["parent"];var origin=gadgets.rpc.getOrigin(origRelay);if(!pmEventDomain?packet.origin!==origin:packet.domain!==/^.+:\/\/([^:]+).*/.exec(origin)[1]){return;}}process(rpc);}return{getCode:function(){return'wpm';},isParentVerifiable:function(){return true;},init:function(processFn,readyFn){process=processFn;ready=readyFn;testPostMessage();if(!pmSync){postMessage=function(win,msg,origin){win.postMessage(msg,origin);};}else{postMessage=function(win,msg,origin){window.setTimeout(function(){win.postMessage(msg,origin);},0);};}gadgets.util.attachBrowserEvent(window,'message',onmessage,false);ready('..',true);return true;},setup:function(receiverId,token,forceSecure){isForceSecure=forceSecure;if(receiverId==='..'){if(isForceSecure){gadgets.rpc._createRelayIframe(token);}else{gadgets.rpc.call(receiverId,gadgets.rpc.ACK);}}return true;},call:function(targetId,from,rpc){var targetWin=gadgets.rpc._getTargetWin(targetId);var origRelay=gadgets.rpc.getRelayUrl(targetId)||gadgets.util.getUrlParameters()["parent"];var origin=gadgets.rpc.getOrigin(origRelay);if(origin){postMessage(targetWin,gadgets.json.stringify(rpc),origin);}else{gadgets.error("No relay set (used as window.postMessage targetOrigin)"+", cannot send cross-domain message");}return true;},relayOnload:function(receiverId,data){ready(receiverId,true);}};}();}gadgets.rpctx=gadgets.rpctx||{};if(!gadgets.rpctx.frameElement){gadgets.rpctx.frameElement=function(){var FE_G2C_CHANNEL='__g2c_rpc';var FE_C2G_CHANNEL='__c2g_rpc';var process;var ready;function callFrameElement(targetId,from,rpc){try{if(from!=='..'){var fe=window.frameElement;if(typeof fe[FE_G2C_CHANNEL]==='function'){if(typeof fe[FE_G2C_CHANNEL][FE_C2G_CHANNEL]!=='function'){fe[FE_G2C_CHANNEL][FE_C2G_CHANNEL]=function(args){process(gadgets.json.parse(args));};}fe[FE_G2C_CHANNEL](gadgets.json.stringify(rpc));return true;}}else{var frame=document.getElementById(targetId);if(typeof frame[FE_G2C_CHANNEL]==='function'&&typeof frame[FE_G2C_CHANNEL][FE_C2G_CHANNEL]==='function'){frame[FE_G2C_CHANNEL][FE_C2G_CHANNEL](gadgets.json.stringify(rpc));return true;}}}catch(e){}return false;}return{getCode:function(){return'fe';},isParentVerifiable:function(){return false;},init:function(processFn,readyFn){process=processFn;ready=readyFn;return true;},setup:function(receiverId,token){if(receiverId!=='..'){try{var frame=document.getElementById(receiverId);frame[FE_G2C_CHANNEL]=function(args){process(gadgets.json.parse(args));};}catch(e){return false;}}if(receiverId==='..'){ready('..',true);var ackFn=function(){window.setTimeout(function(){gadgets.rpc.call(receiverId,gadgets.rpc.ACK);},500);};gadgets.util.registerOnLoadHandler(ackFn);}return true;},call:function(targetId,from,rpc){return callFrameElement(targetId,from,rpc);}};}();}gadgets.rpctx=gadgets.rpctx||{};if(!gadgets.rpctx.nix){gadgets.rpctx.nix=function(){var NIX_WRAPPER='GRPC____NIXVBS_wrapper';var NIX_GET_WRAPPER='GRPC____NIXVBS_get_wrapper';var NIX_HANDLE_MESSAGE='GRPC____NIXVBS_handle_message';var NIX_CREATE_CHANNEL='GRPC____NIXVBS_create_channel';var MAX_NIX_SEARCHES=10;var NIX_SEARCH_PERIOD=500;var nix_channels={};var isForceSecure={};var ready;var numHandlerSearches=0;function conductHandlerSearch(){var handler=nix_channels['..'];if(handler){return;}if(++numHandlerSearches>MAX_NIX_SEARCHES){gadgets.warn('Nix transport setup failed, falling back...');ready('..',false);return;}if(!handler&&window.opener&&"GetAuthToken"in window.opener){handler=window.opener;if(handler.GetAuthToken()==gadgets.rpc.getAuthToken('..')){var token=gadgets.rpc.getAuthToken('..');handler.CreateChannel(window[NIX_GET_WRAPPER]('..',token),token);nix_channels['..']=handler;window.opener=null;ready('..',true);return;}}window.setTimeout(function(){conductHandlerSearch();},NIX_SEARCH_PERIOD);}function getLocationNoHash(){var loc=window.location.href;var idx=loc.indexOf('#');if(idx==-1){return loc;}return loc.substring(0,idx);}function setupSecureRelayToParent(rpctoken){var childToken=(0x7FFFFFFF*Math.random())|0;var data=[getLocationNoHash(),childToken];gadgets.rpc._createRelayIframe(rpctoken,data);var hash=window.location.href.split('#')[1]||'';function relayTimer(){var newHash=window.location.href.split('#')[1]||'';if(newHash!==hash){clearInterval(relayTimerId);var params=gadgets.util.getUrlParameters(window.location.href);if(params.childtoken==childToken){conductHandlerSearch();return;}ready('..',false);}}var relayTimerId=setInterval(relayTimer,100);}return{getCode:function(){return'nix';},isParentVerifiable:function(opt_receiverId){if(opt_receiverId){return isForceSecure[opt_receiverId];}return false;},init:function(processFn,readyFn){ready=readyFn;if(typeof window[NIX_GET_WRAPPER]!=='unknown'){window[NIX_HANDLE_MESSAGE]=function(data){window.setTimeout(function(){processFn(gadgets.json.parse(data));},0);};window[NIX_CREATE_CHANNEL]=function(name,channel,token){if(gadgets.rpc.getAuthToken(name)===token){nix_channels[name]=channel;ready(name,true);}};var vbscript='Class '+NIX_WRAPPER+'\n '+'Private m_Intended\n'+'Private m_Auth\n'+'Public Sub SetIntendedName(name)\n '+'If isEmpty(m_Intended) Then\n'+'m_Intended = name\n'+'End If\n'+'End Sub\n'+'Public Sub SetAuth(auth)\n '+'If isEmpty(m_Auth) Then\n'+'m_Auth = auth\n'+'End If\n'+'End Sub\n'+'Public Sub SendMessage(data)\n '+NIX_HANDLE_MESSAGE+'(data)\n'+'End Sub\n'+'Public Function GetAuthToken()\n '+'GetAuthToken = m_Auth\n'+'End Function\n'+'Public Sub CreateChannel(channel, auth)\n '+'Call '+NIX_CREATE_CHANNEL+'(m_Intended, channel, auth)\n'+'End Sub\n'+'End Class\n'+'Function '+NIX_GET_WRAPPER+'(name, auth)\n'+'Dim wrap\n'+'Set wrap = New '+NIX_WRAPPER+'\n'+'wrap.SetIntendedName name\n'+'wrap.SetAuth auth\n'+'Set '+NIX_GET_WRAPPER+' = wrap\n'+'End Function';try{window.execScript(vbscript,'vbscript');}catch(e){return false;}}return true;},setup:function(receiverId,token,forcesecure){isForceSecure[receiverId]=!!forcesecure;if(receiverId==='..'){if(forcesecure){setupSecureRelayToParent(token);}else{conductHandlerSearch();}return true;}try{var frame=document.getElementById(receiverId);var wrapper=window[NIX_GET_WRAPPER](receiverId,token);frame.contentWindow.opener=wrapper;}catch(e){return false;}return true;},call:function(targetId,from,rpc){try{if(nix_channels[targetId]){nix_channels[targetId].SendMessage(gadgets.json.stringify(rpc));}}catch(e){return false;}return true;},relayOnload:function(receiverId,data){var src=data[0]+'#childtoken='+data[1];var childIframe=document.getElementById(receiverId);childIframe.src=src;}};}();}gadgets.rpctx=gadgets.rpctx||{};if(!gadgets.rpctx.rmr){gadgets.rpctx.rmr=function(){var RMR_SEARCH_TIMEOUT=500;var RMR_MAX_POLLS=10;var rmr_channels={};var process;var ready;function appendRmrFrame(channelFrame,relayUri,data,opt_frameId){var appendFn=function(){document.body.appendChild(channelFrame);channelFrame.src='about:blank';if(opt_frameId){channelFrame.onload=function(){processRmrData(opt_frameId);};}channelFrame.src=relayUri+'#'+data;};if(document.body){appendFn();}else{gadgets.util.registerOnLoadHandler(function(){appendFn();});}}function setupRmr(frameId){if(typeof rmr_channels[frameId]==="object"){return;}var channelFrame=document.createElement('iframe');var frameStyle=channelFrame.style;frameStyle.position='absolute';frameStyle.top='0px';frameStyle.border='0';frameStyle.opacity='0';frameStyle.width='10px';frameStyle.height='1px';channelFrame.id='rmrtransport-'+frameId;channelFrame.name=channelFrame.id;var relayUri=gadgets.rpc.getRelayUrl(frameId);if(!relayUri){relayUri=gadgets.rpc.getOrigin(gadgets.util.getUrlParameters()["parent"])+'/robots.txt';}rmr_channels[frameId]={frame:channelFrame,receiveWindow:null,relayUri:relayUri,searchCounter:0,width:10,waiting:true,queue:[],sendId:0,recvId:0};if(frameId!=='..'){appendRmrFrame(channelFrame,relayUri,getRmrData(frameId));}conductRmrSearch(frameId);}function conductRmrSearch(frameId){var channelWindow=null;rmr_channels[frameId].searchCounter++;try{var targetWin=gadgets.rpc._getTargetWin(frameId);if(frameId==='..'){channelWindow=targetWin.frames['rmrtransport-'+gadgets.rpc.RPC_ID];}else{channelWindow=targetWin.frames['rmrtransport-..'];}}catch(e){}var status=false;if(channelWindow){status=registerRmrChannel(frameId,channelWindow);}if(!status){if(rmr_channels[frameId].searchCounter>RMR_MAX_POLLS){return;}window.setTimeout(function(){conductRmrSearch(frameId);},RMR_SEARCH_TIMEOUT);}}function callRmr(targetId,serviceName,from,rpc){var handler=null;if(from!=='..'){handler=rmr_channels['..'];}else{handler=rmr_channels[targetId];}if(handler){if(serviceName!==gadgets.rpc.ACK){handler.queue.push(rpc);}if(handler.waiting||(handler.queue.length===0&&!(serviceName===gadgets.rpc.ACK&&rpc&&rpc.ackAlone===true))){return true;}if(handler.queue.length>0){handler.waiting=true;}var url=handler.relayUri+"#"+getRmrData(targetId);try{handler.frame.contentWindow.location=url;var newWidth=handler.width==10?20:10;handler.frame.style.width=newWidth+'px';handler.width=newWidth;}catch(e){return false;}}return true;}function getRmrData(toFrameId){var channel=rmr_channels[toFrameId];var rmrData={id:channel.sendId};if(channel){rmrData.d=Array.prototype.slice.call(channel.queue,0);rmrData.d.push({s:gadgets.rpc.ACK,id:channel.recvId});}return gadgets.json.stringify(rmrData);}function processRmrData(fromFrameId){var channel=rmr_channels[fromFrameId];var data=channel.receiveWindow.location.hash.substring(1);var rpcObj=gadgets.json.parse(decodeURIComponent(data))||{};var rpcArray=rpcObj.d||[];var nonAckReceived=false;var noLongerWaiting=false;var numBypassed=0;var numToBypass=(channel.recvId-rpcObj.id);for(var i=0;i<rpcArray.length;++i){var rpc=rpcArray[i];if(rpc.s===gadgets.rpc.ACK){ready(fromFrameId,true);if(channel.waiting){noLongerWaiting=true;}channel.waiting=false;var newlyAcked=Math.max(0,rpc.id-channel.sendId);channel.queue.splice(0,newlyAcked);channel.sendId=Math.max(channel.sendId,rpc.id||0);continue;}nonAckReceived=true;if(++numBypassed<=numToBypass){continue;}++channel.recvId;process(rpc);}if(nonAckReceived||(noLongerWaiting&&channel.queue.length>0)){var from=(fromFrameId==='..')?gadgets.rpc.RPC_ID:'..';callRmr(fromFrameId,gadgets.rpc.ACK,from,{ackAlone:nonAckReceived});}}function registerRmrChannel(frameId,channelWindow){var channel=rmr_channels[frameId];try{var canAccess=false;canAccess='document'in channelWindow;if(!canAccess){return false;}canAccess=typeof channelWindow['document']=='object';if(!canAccess){return false;}var loc=channelWindow.location.href;if(loc==='about:blank'){return false;}}catch(ex){return false;}channel.receiveWindow=channelWindow;function onresize(){processRmrData(frameId);};if(typeof channelWindow.attachEvent==="undefined"){channelWindow.onresize=onresize;}else{channelWindow.attachEvent("onresize",onresize);}if(frameId==='..'){appendRmrFrame(channel.frame,channel.relayUri,getRmrData(frameId),frameId);}else{processRmrData(frameId);}return true;}return{getCode:function(){return'rmr';},isParentVerifiable:function(){return true;},init:function(processFn,readyFn){process=processFn;ready=readyFn;return true;},setup:function(receiverId,token){try{setupRmr(receiverId);}catch(e){gadgets.warn('Caught exception setting up RMR: '+e);return false;}return true;},call:function(targetId,from,rpc){return callRmr(targetId,rpc.s,from,rpc);}};}();}gadgets.rpctx=gadgets.rpctx||{};if(!gadgets.rpctx.ifpc){gadgets.rpctx.ifpc=function(){var iframePool=[];var callId=0;var ready;function encodeLegacyData(args){var argsEscaped=[];for(var i=0,j=args.length;i<j;++i){argsEscaped.push(encodeURIComponent(gadgets.json.stringify(args[i])));}return argsEscaped.join('&');}function emitInvisibleIframe(src){var iframe;for(var i=iframePool.length-1;i>=0;--i){var ifr=iframePool[i];try{if(ifr&&(ifr.recyclable||ifr.readyState==='complete')){ifr.parentNode.removeChild(ifr);if(window.ActiveXObject){iframePool[i]=ifr=null;iframePool.splice(i,1);}else{ifr.recyclable=false;iframe=ifr;break;}}}catch(e){}}if(!iframe){iframe=document.createElement('iframe');iframe.style.border=iframe.style.width=iframe.style.height='0px';iframe.style.visibility='hidden';iframe.style.position='absolute';iframe.onload=function(){this.recyclable=true;};iframePool.push(iframe);}iframe.src=src;window.setTimeout(function(){document.body.appendChild(iframe);},0);}return{getCode:function(){return'ifpc';},isParentVerifiable:function(){return true;},init:function(processFn,readyFn){ready=readyFn;ready('..',true);return true;},setup:function(receiverId,token){ready(receiverId,true);return true;},call:function(targetId,from,rpc){var relay=gadgets.rpc.getRelayUrl(targetId);++callId;if(!relay){gadgets.warn('No relay file assigned for IFPC');return false;}var src=null;if(rpc.l){var callArgs=rpc.a;src=[relay,'#',encodeLegacyData([from,callId,1,0,encodeLegacyData([from,rpc.s,'','',from].concat(callArgs))])].join('');}else{src=[relay,'#',targetId,'&',from,'@',callId,'&1&0&',encodeURIComponent(gadgets.json.stringify(rpc))].join('');}emitInvisibleIframe(src);return true;}};}();}if(!gadgets.rpc){gadgets.rpc=function(){var CALLBACK_NAME='__cb';var DEFAULT_NAME='';var ACK='__ack';var SETUP_FRAME_TIMEOUT=500;var SETUP_FRAME_MAX_TRIES=10;var services={};var relayUrl={};var useLegacyProtocol={};var authToken={};var callId=0;var callbacks={};var setup={};var sameDomain={};var params={};var receiverTx={};var earlyRpcQueue={};var isChild=(window.top!==window.self);var rpcId=window.name;var securityCallback=function(){};var LOAD_TIMEOUT=0;var FRAME_PHISH=1;var FORGED_MSG=2;var fallbackTransport=(function(){function logFn(name){return function(){gadgets.log("gadgets.rpc."+name+"("+gadgets.json.stringify(Array.prototype.slice.call(arguments))+"): call ignored. [caller: "+document.location+", isChild: "+isChild+"]");};}return{getCode:function(){return"noop";},isParentVerifiable:function(){return true;},init:logFn("init"),setup:logFn("setup"),call:logFn("call")};})();if(gadgets.util){params=gadgets.util.getUrlParameters();}function getTransport(){return typeof window.postMessage==='function'?gadgets.rpctx.wpm:typeof window.postMessage==='object'?gadgets.rpctx.wpm:window.ActiveXObject?gadgets.rpctx.nix:navigator.userAgent.indexOf('WebKit')>0?gadgets.rpctx.rmr:navigator.product==='Gecko'?gadgets.rpctx.frameElement:gadgets.rpctx.ifpc;}function transportReady(receiverId,readySuccess){var tx=transport;if(!readySuccess){tx=fallbackTransport;}receiverTx[receiverId]=tx;var earlyQueue=earlyRpcQueue[receiverId]||[];for(var i=0;i<earlyQueue.length;++i){var rpc=earlyQueue[i];rpc.t=getAuthToken(receiverId);tx.call(receiverId,rpc.f,rpc);}earlyRpcQueue[receiverId]=[];}var mainPageUnloading=false,hookedUnload=false;function hookMainPageUnload(){if(hookedUnload){return;}function onunload(){mainPageUnloading=true;}gadgets.util.attachBrowserEvent(window,'unload',onunload,false);hookedUnload=true;}function relayOnload(targetId,sourceId,token,data,relayWindow){if(!authToken[sourceId]||authToken[sourceId]!==token){gadgets.error("Invalid auth token. "+authToken[sourceId]+" vs "+token);securityCallback(sourceId,FORGED_MSG);}relayWindow.onunload=function(){if(setup[sourceId]&&!mainPageUnloading){securityCallback(sourceId,FRAME_PHISH);gadgets.rpc.removeReceiver(sourceId);}};hookMainPageUnload();data=gadgets.json.parse(decodeURIComponent(data));transport.relayOnload(sourceId,data);}function process(rpc){if(rpc&&typeof rpc.s==='string'&&typeof rpc.f==='string'&&rpc.a instanceof Array){if(authToken[rpc.f]){if(authToken[rpc.f]!==rpc.t){gadgets.error("Invalid auth token. "+authToken[rpc.f]+" vs "+rpc.t);securityCallback(rpc.f,FORGED_MSG);}}if(rpc.s===ACK){window.setTimeout(function(){transportReady(rpc.f,true);},0);return;}if(rpc.c){rpc.callback=function(result){gadgets.rpc.call(rpc.f,CALLBACK_NAME,null,rpc.c,result);};}var result=(services[rpc.s]||services[DEFAULT_NAME]).apply(rpc,rpc.a);if(rpc.c&&typeof result!=='undefined'){gadgets.rpc.call(rpc.f,CALLBACK_NAME,null,rpc.c,result);}}}function getOrigin(url){if(!url){return"";}url=url.toLowerCase();if(url.indexOf("//")==0){url=window.location.protocol+url;}if(url.indexOf("://")==-1){url=window.location.protocol+"//"+url;}var host=url.substring(url.indexOf("://")+3);var slashPos=host.indexOf("/");if(slashPos!=-1){host=host.substring(0,slashPos);}var protocol=url.substring(0,url.indexOf("://"));var portStr="";var portPos=host.indexOf(":");if(portPos!=-1){var port=host.substring(portPos+1);host=host.substring(0,portPos);if((protocol==="http"&&port!=="80")||(protocol==="https"&&port!=="443")){portStr=":"+port;}}return protocol+"://"+host+portStr;}function getTargetWin(id){if(typeof id==="undefined"||id===".."){return window.parent;}id=String(id);var target=window.frames[id];if(target){return target;}target=document.getElementById(id);if(target&&target.contentWindow){return target.contentWindow;}return null;}var transport=getTransport();services[DEFAULT_NAME]=function(){gadgets.warn('Unknown RPC service: '+this.s);};services[CALLBACK_NAME]=function(callbackId,result){var callback=callbacks[callbackId];if(callback){delete callbacks[callbackId];callback(result);}};function setupFrame(frameId,token,forcesecure){if(setup[frameId]===true){return;}if(typeof setup[frameId]==='undefined'){setup[frameId]=0;}var tgtFrame=document.getElementById(frameId);if(frameId==='..'||tgtFrame!=null){if(transport.setup(frameId,token,forcesecure)===true){setup[frameId]=true;return;}}if(setup[frameId]!==true&&setup[frameId]++<SETUP_FRAME_MAX_TRIES){window.setTimeout(function(){setupFrame(frameId,token,forcesecure)},SETUP_FRAME_TIMEOUT);}else{receiverTx[frameId]=fallbackTransport;setup[frameId]=true;}}function callSameDomain(target,rpc){if(typeof sameDomain[target]==='undefined'){sameDomain[target]=false;var targetRelay=gadgets.rpc.getRelayUrl(target);if(getOrigin(targetRelay)!==getOrigin(window.location.href)){return false;}var targetEl=getTargetWin(target);try{sameDomain[target]=targetEl.gadgets.rpc.receiveSameDomain;}catch(e){gadgets.error("Same domain call failed: parent= incorrectly set.");}}if(typeof sameDomain[target]==='function'){sameDomain[target](rpc);return true;}return false;}function setRelayUrl(targetId,url,opt_useLegacy){if(!/http(s)?:\/\/.+/.test(url)){if(url.indexOf("//")==0){url=window.location.protocol+url;}else if(url.charAt(0)=='/'){url=window.location.protocol+"//"+window.location.host+url;}else if(url.indexOf("://")==-1){url=window.location.protocol+"//"+url;}}relayUrl[targetId]=url;useLegacyProtocol[targetId]=!!opt_useLegacy;}function getAuthToken(targetId){return authToken[targetId];}function setAuthToken(targetId,token,forcesecure){token=token||"";authToken[targetId]=String(token);setupFrame(targetId,token,forcesecure);}function setupContainerGadgetContext(rpctoken,opt_forcesecure){function init(config){var configRpc=config?config.rpc:{};var parentRelayUrl=configRpc.parentRelayUrl;if(parentRelayUrl.substring(0,7)!=='http://'&&parentRelayUrl.substring(0,8)!=='https://'&&parentRelayUrl.substring(0,2)!=='//'){if(typeof params.parent==="string"&&params.parent!==""){if(parentRelayUrl.substring(0,1)!=='/'){var lastSlash=params.parent.lastIndexOf('/');parentRelayUrl=params.parent.substring(0,lastSlash+1)+parentRelayUrl;}else{parentRelayUrl=getOrigin(params.parent)+parentRelayUrl;}}}var useLegacy=!!configRpc.useLegacyProtocol;setRelayUrl('..',parentRelayUrl,useLegacy);if(useLegacy){transport=gadgets.rpctx.ifpc;transport.init(process,transportReady);}var forceSecure=opt_forcesecure||params.forcesecure||false;setAuthToken('..',rpctoken,forceSecure);}var requiredConfig={parentRelayUrl:gadgets.config.NonEmptyStringValidator};gadgets.config.register("rpc",requiredConfig,init);}function setupContainerGenericIframe(rpctoken,opt_parent,opt_forcesecure){var forcesecure=opt_forcesecure||params.forcesecure||false;var parent=opt_parent||params.parent;if(parent){setRelayUrl('..',parent);setAuthToken('..',rpctoken,forcesecure);}}function setupChildIframe(gadgetId,opt_frameurl,opt_authtoken,opt_forcesecure){if(!gadgets.util){return;}var childIframe=document.getElementById(gadgetId);if(!childIframe){throw new Error("Cannot set up gadgets.rpc receiver with ID: "+gadgetId+", element not found.");}var relayUrl=opt_frameurl||childIframe.src;setRelayUrl(gadgetId,relayUrl);var childParams=gadgets.util.getUrlParameters(childIframe.src);var rpctoken=opt_authtoken||childParams.rpctoken;var forcesecure=opt_forcesecure||childParams.forcesecure;setAuthToken(gadgetId,rpctoken,forcesecure);}function setupReceiver(targetId,opt_receiverurl,opt_authtoken,opt_forcesecure){if(targetId==='..'){var rpctoken=opt_authtoken||params.rpctoken||params.ifpctok||"";if(window['__isgadget']===true){setupContainerGadgetContext(rpctoken,opt_forcesecure);}else{setupContainerGenericIframe(rpctoken,opt_receiverurl,opt_forcesecure);}}else{setupChildIframe(targetId,opt_receiverurl,opt_authtoken,opt_forcesecure);}}return{config:function(config){if(typeof config.securityCallback==='function'){securityCallback=config.securityCallback;}},register:function(serviceName,handler){if(serviceName===CALLBACK_NAME||serviceName===ACK){throw new Error("Cannot overwrite