<?xml version="1.0" encoding="UTF-8"?>
<Module>
  <!--
   Copyright 2008 Google Inc.
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
       http://www.apache.org/licenses/LICENSE-2.0
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
  -->
  <ModulePrefs directory_title="DAfOS (0.8)"
               title_url="http://dafos.appspot.com"
               title="DAfOS (0.8)"
               screenshot="http://dafos.appspot.com/img/gadget-screenshot.png"
               thumbnail="http://dafos.appspot.com/img/gadget-thumbnail.png"
               description="This gadget provides the ability to write and save JavaScript code samples to execute against OpenSocial containers.  This helps rapidly test sample OpenSocial code."
               author_email="opensocial.coderunner@gmail.com"
               author_affiliation="Google Inc."
               author_location="Mountain View, CA, USA"
               scaling="true"
               scrolling="false"
               singleton="false">
    <Require feature="opensocial-0.8" />
    <Require feature="dynamic-height" />
    <Require feature="views" />
    <Require feature="tabs" />
    <Optional feature="flash" />
    <Optional feature="setprefs" />
    <Optional feature="content-rewrite">
      <Param name="exclude-urls">@[^@]+@</Param>
      <Param name="include-tags">script</Param>
    </Optional>
  </ModulePrefs>
<Content type="html" view="profile,home,canvas,default">
  <![CDATA[
  <style type="text/css">
    .deprecated {
      font: 14px Arial;
      color: #d00;
      padding: 10px;
    }
    .reallyimportant {
      background: #d00;
      color: #fff;
      padding: 0 2px;
    }
  </style>
  <div class="deprecated">
    <span class="reallyimportant">NOTICE:</span> DAfOS has been renamed to the <strong>OpenSocial Dev App</strong>, which includes new
    features such as <strong>a data viewer</strong>, <strong>sample OpenSocial
      code</strong> and <strong>export to XML functionality</strong>. Please
    <a target="_blank" href="http://osda.appspot.com">visit http://osda.appspot.com</a>
    to use the new version!
  </div>
    <style type="text/css">
#wrap{width:98%;margin:0 1%;}
a,.tablib_selected{color:#00d!important;}
.tablib_emptyTab,.tablib_unselected,.tablib_spacerTab{border-bottom:1px solid #ccc;}
.tablib_selected{border-color:#ccc;background:#eee;border-right:1px solid #999;}
.controls{font:14px Arial,sans;padding:0;margin:0;}
.toolbar{background:#eee;border:1px solid #ccc;border-bottom:1px solid #999;border-right:1px solid #999;border-top-width:0;padding:2px;}
.toolbar table{width:99%;border-collapse:collapse;margin:0;}
.subtoolbar{background:#ddd;padding:3px;border:1px solid #ccc;border-top:1px solid #eee;border-bottom:1px solid #999;border-right:1px solid #999;}
.controls a,.subtoolbar a,.subtoolbar span,.subtoolbar code,.subtoolbar span code a,#code_controls .controlcell a{font:14px Arial,sans!important;cursor:pointer;height:16px;}
.subtoolbar span{color:#111;}
#dom_handle{margin:10px 0;}
.toolbar select{border:1px solid #ccc;font:11px Arial;padding:2px;width:15em;}
.toolbar a img,.subtoolbar a img{height:16px;width:16px;padding:0;margin:0;vertical-align:middle;}
#code_controls table{width:100%;}
#code_controls .samplescell{width:82%;padding-top:2px;}
#code_controls .controlcell{width:9%;text-align:right;vertical-align:top;padding-top:2px;}
#button_code_down{background:url('http://dafos.appspot.com/img/arrow_down.png') no-repeat left center;padding-left:20px;}
#button_code_up{background:url('http://dafos.appspot.com/img/arrow_up.png') no-repeat left center;padding-left:20px;}
#samplesbox{width:100%;background:#fff;border:1px dashed #999;padding:2px;}
.overlay-shadow{background:#333;}
.overlay-content{border:4px solid #A7C7FB;background:#F1F6FE;left:-3px;top:-3px;padding:5px;}
.dafos-notice{font:11px Arial;color:#ccc;text-align:center;}
.dafos-button{margin-left:8px;}
.dafos-tools-cachetable,.dafos-tools-cachetable button,.dafos-tools-cachetable input{width:100%;}
.dafos-tools-cachetable td.inputcell{width:80%;}
.dom_handle_label{font:13px Courier New;background:#eee;color:#999;}
p,div,span{font:12px Verdana;}
code,var,.code,#output{font:13px Courier New;}
h1,h2,h3,h4{color:#000;font-weight:normal;font-family:Arial;margin:15px 0 5px 0;padding:0;}
h1{font-size:22px;border-bottom:1px solid #ccc;}
h2{font-size:18px;}
h3,h3 *{font-size:16px;}
code{color:#090;}
var{color:#00d;}
.code{font-weight:bold;background:#fffeee;color:#000;padding:5px;border:1px solid #999;}
p,.code{margin:2px,0;}
.dafos-message{text-align:center;padding:2px;margin-bottom:4px;background:#36b;color:#fff;}
.notice{width:70%;padding:4px;background:#fffeee;border:1px solid #eeeddd;margin:5px auto;}
.hidden{display:none;}
#output{background:#333;color:#fff;padding:5px;margin:5px 0;}
.status{color:#999;}
#link_container{background:#e0ecff;font:14px Arial;margin:10px;padding:5px;}
textarea{width:100%;height:auto;}
#code_exec{height:400px;}
.console div{font:9px Courier;color:#fff;background:#000;padding:2px;}
.console .odd{background:#111;}
.InputDisplay{width:300px;position:absolute;top:150px;left:50%;margin-left:-150px;background:#333;}
.InputDisplay table{width:300px;position:relative;border:4px solid #A7C7FB;background:#F1F6FE;left:-3px;top:-3px;font-weight:bold!important;}
.InputDisplay input{width:95%;}
.entries-list{margin:0;padding:0;}
.entries-list .entry{margin:0;padding:20px 0 0 0;list-style-type:none;font:12px Arial;}
.entries-list .title{display:block;font:18px Arial;padding:0 0 2px 0;margin:0 0 4px 0;border-bottom:1px solid #ccc;}
.entries-list .title a{text-decoration:none;}
.entries-list .subtitle{font:13px Arial;font-style:italic;color:#666;}
.entries-list .summary{margin:10px 0;}
.entries-list .code{margin:0;background:#fffeee;border:1px solid #ccc;font:12px Courier New;overflow:auto;width:100%;height:200px;}
#newstab-toc{width:40%;float:right;margin:10px 0 0 0;border-bottom:10px solid #fff;border-left:10px solid #fff;}
#newstab-toc-table thead th{font:16px Arial;font-weight:bold;text-align:left;}
#newstab-toc-table .subtitle{font:10px Arial;font-style:italic;color:#666;}
table.tabular tr.odd{background:#eee;}
table.tabular tr.even{background:#fafafa;}
table.tabular{width:100%;margin:0;padding:0;font:12px Arial;border-bottom:1px solid #999;border-top:1px solid #999;}
table.tabular tbody,table.tabular thead{width:100%;}
table.tabular tbody th{font-weight:bold;text-align:right;vertical-align:top;padding:5px;border-bottom:1px solid #ddd;}
table.tabular tbody td{padding:5px;border-bottom:1px solid #ddd;}
table.tabular thead th{background:#ddd;text-align:center;border-bottom:1px solid #999;padding:5px;}
#exporttab table.tabular tbody th{width:100px;}
#exporttab table .textinput{width:100%;padding:4px;border:1px solid #999;font:12px Arial;}
#exporttab table td.important .textinput{background-color:#fffeee;}
#exporttab table.preload tbody td{text-align:center;}
#exporttab table.preload input{width:100%;}
#exporttab table.features tbody th{width:25%;}
#exporttab textarea.code{height:200px;}
#exporttab-overlay-textbox{overflow:auto;font-weight:bold;background:#fff;padding:5px;border:1px solid #999;}
#helptab a.external{color:#0d0!important;}
#statetab .even{background:#fafafa;}
#statetab .odd{background:#eee;}
#statetab .person{width:100%;table-layout:fixed;}
#statetab .person td{vertical-align:top;}
#statetab .person td.thumbnail{width:64px;vertical-align:top;}
#statetab .person td.thumbnail img{width:64px;}
#statetab .person .persondisplayname{font:16px Arial;margin:0;padding:0;}
#statetab .person .personid{font:12px Arial;color:#666;margin:0;padding:0;}
#statetab .fieldstable{width:100%;border-collapse:collapse;table-layout:fixed;}
#statetab .fieldstable td{font:12px Arial;padding-top:2px;padding-bottom:2px;border-bottom:1px dotted #ccc;vertical-align:top;}
#statetab .fieldstable td.value{width:40%;font-weight:bold;color:#090;overflow:auto;}
#statetab .fieldstable td pre{font:12px Arial;margin:0;padding:0;}
#statetab .fieldstable tr.headerrow td pre{font-weight:bold;}
    </style>
    <script type="text/javascript">
var dafos={};dafos.bind=function(D,E){var C=[];for(var B=2,A=arguments.length;B<A;B++){C.push(arguments[B])}return function(){var G=C.slice();for(var H=0,F=arguments.length;H<F;H++){G.push(arguments[H])}D.apply(E,G)}};dafos.timeToPrettyString=function(B){if(isNaN(B)){return"an indeterminate amount of time ago"}time=(new Date().getTime()-B)/1000;if(time<60){return"less than a minute ago"}else{if(time<120){return"about a minute ago"}else{if(time<3600){var A=Math.round(time/60);return"about "+A+" minutes ago"}else{if(time<7200){return"about an hour ago"}else{if(time<86400){var A=Math.round(time/3600);return"about "+A+" hours ago"}else{if(time<172800){return"about a day ago"}else{if(time<2592000){var A=Math.round(time/86400);return"about "+A+" days ago"}else{if(time<5184000){return"about a month ago"}else{var A=Math.round(time/2592000);return"about "+A+" months ago"}}}}}}}}};dafos.monthToString=function(A){return["January","Febuary","March","April","May","June","July","August","September","October","November","December"][A-1]||""};var ark={};ark.bind=function(D,E){var C=[];for(var A=2,B;B=arguments[A];A++){C.push(B)}return function(){var F=C.slice();for(var G=0,H;H=arguments[G];G++){F.push(H)}D.apply(E,F)}};dafos.OpenSocial=function(){this.version="0.8";this.viewer={};this.owner={};this.peopledata={}};dafos.OpenSocial.prototype.getDataOr=function(C,A,B){return(C&&C.get(A)&&!C.get(A).hadError()&&C.get(A).getData())||B};dafos.OpenSocial.prototype.getOpenSocialData=function(B,C){var A=opensocial.newDataRequest();A.add(A.newFetchPersonAppDataRequest(opensocial.newIdSpec({userId:"OWNER"}),B),"peopledata");A.add(A.newFetchPersonRequest("OWNER"),"owner");A.add(A.newFetchPersonRequest("VIEWER"),"viewer");A.send(dafos.bind(this.closeGetOpenSocialData(C),this))};dafos.OpenSocial.prototype.closeGetOpenSocialData=function(A){return function(E){var B=null,D=null,C=null;this.viewer=this.getDataOr(E,"viewer",this.viewer);this.owner=this.getDataOr(E,"owner",this.owner);B=this.getDataOr(E,"peopledata",{});this.mergePersonAppData.apply(this,[B]);if(A&&typeof (A)=="function"){A()}}};dafos.OpenSocial.prototype.mergePersonAppData=function(A){for(personkey in A){if(A.hasOwnProperty(personkey)){this.peopledata[personkey]=this.peopledata[personkey]||{};for(datakey in A[personkey]){if(A[personkey].hasOwnProperty(datakey)){this.peopledata[personkey][datakey]=A[personkey][datakey]}}}}};dafos.OpenSocial.prototype.viewerIsOwner=function(){var B=this.viewer.getId&&this.viewer.getId()||-1;var A=this.owner.getId&&this.owner.getId()||-2;return B===A};dafos.OpenSocial.prototype.setAppData=function(C,A,D){var B=opensocial.newDataRequest();C=gadgets.json.stringify(C);B.add(B.newUpdatePersonAppDataRequest("VIEWER",A,C),"updatedata");B.add(B.newFetchPersonAppDataRequest(opensocial.newIdSpec({userId:"OWNER"}),A,C),"peopledata");B.send(dafos.bind(this.closeSetAppData(D),this))};dafos.OpenSocial.prototype.closeSetAppData=function(A){return function(D){var B=null,C=null;B=this.getDataOr(D,"peopledata",{});this.mergePersonAppData.apply(this,[B]);if(A&&typeof (A)=="function"){A()}}};dafos.OpenSocial.prototype.getPersonData=function(A){return(A&&this.peopledata[A])||{}};dafos.OpenSocial.prototype.getViewerData=function(){return(this.viewer&&this.viewer.getId&&this.peopledata[this.viewer.getId()])||{}};dafos.OpenSocial.prototype.getOwnerData=function(){return(this.owner&&this.owner.getId&&this.peopledata[this.owner.getId()])||{}};ark.AggregateCallback=function(B,A){this.current_=0;this.total_=A||0;this.onfinished_=[];if(B){this.onfinished_.push(B)}};ark.AggregateCallback.prototype.checkIfFinished_=function(){if(this.current_>=this.total_){while(this.onfinished_.length>0){var A=this.onfinished_.shift();A()}}};ark.AggregateCallback.prototype.addOnFinishedListener=function(A){this.onfinished_.push(A);this.checkIfFinished_()};ark.AggregateCallback.prototype.getCallback=function(){var A=this;this.total_++;return function(){A.callback()}};ark.AggregateCallback.prototype.callback=function(){this.current_++;this.checkIfFinished_()};var quikos=function(){};quikos.id={};quikos.idspec={};quikos.id.VIEWER="VIEWER";quikos.id.OWNER="OWNER";quikos.idspec.VIEWER=opensocial.newIdSpec({userId:"VIEWER",groupId:"SELF"});quikos.idspec.OWNER=opensocial.newIdSpec({userId:"OWNER",groupId:"SELF"});quikos.idspec.VIEWER_FRIENDS=opensocial.newIdSpec({userId:"VIEWER",groupId:"FRIENDS"});quikos.idspec.OWNER_FRIENDS=opensocial.newIdSpec({userId:"OWNER",groupId:"FRIENDS"});quikos.idspec.personById=function(A){return opensocial.newIdSpec({userId:A,groupId:"SELF"})};quikos.idspec.friendsById=function(A){return opensocial.newIdSpec({userId:A,groupId:"FRIENDS"})};quikos.PeopleParams=function(){};quikos.PeopleParams.prototype.ensureProfileDetails_=function(){if(!this[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]){this[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]=[]}};quikos.PeopleParams.prototype.setFirst=function(A){this[opensocial.DataRequest.PeopleRequestFields.FIRST]=A;return this};quikos.PeopleParams.prototype.setMax=function(A){this[opensocial.DataRequest.PeopleRequestFields.MAX]=A;return this};quikos.PeopleParams.prototype.addFields=function(A){this.ensureProfileDetails_();if(typeof A=="string"){A=[A]}for(var B=0,C;C=A[B];B++){if(opensocial.Person.Field.hasOwnProperty(C)){this[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS].push(opensocial.Person.Field[C])}}return this};quikos.prototype.ensureDataRequest_=function(){if(!this.request_){this.tags_=[];this.errors_={};this.request_=opensocial.newDataRequest()}};quikos.prototype.closeHandleResponse_=function(B){var A=this;return function(F){var D={};for(var E=0,C;C=A.tags_[E];E++){var G=F.get(C);if(!G.hadError()){D[C]=G.getData()}else{D[C]=null;A.errors_[C]={error_message:G.getErrorMessage(),error_code:G.getErrorCode()}}}B(D,A)}};quikos.prototype.getErrorMessage=function(A){if(this.errors_[A]){return this.errors_[A].error_message}};quikos.prototype.getErrorCode=function(A){if(this.errors_[A]){return this.errors_[A].error_code}};quikos.prototype.startRequest=function(){this.ensureDataRequest_();return this};quikos.prototype.sendRequest=function(A){this.ensureDataRequest_();this.request_.send(this.closeHandleResponse_(A));return this};quikos.prototype.fetchPerson=function(D,A,C){this.ensureDataRequest_();var B=this.request_.newFetchPersonRequest(D,C);this.request_.add(B,A);this.tags_.push(A);return this};quikos.prototype.fetchPeople=function(B,A,D){this.ensureDataRequest_();var C=this.request_.newFetchPeopleRequest(B,D);this.request_.add(C,A);this.tags_.push(A);return this};quikos.prototype.fetchData=function(B,A,E,D){this.ensureDataRequest_();if(!E){E="*"}var C=this.request_.newFetchPersonAppDataRequest(B,E,D);this.request_.add(C,A);this.tags_.push(A);return this};quikos.prototype.setData=function(B,D,A){this.ensureDataRequest_();var C=this.request_.newUpdatePersonAppDataRequest(quikos.id.VIEWER,B,D);this.request_.add(C,A);this.tags_.push(A);return this};quikos.prototype.deleteData=function(B,A){this.ensureDataRequest_();var C=this.request_.newRemovePersonAppDataRequest(quikos.id.VIEWER,opt_key);this.request_.add(C);this.tags_.push(A);return this};var w23={e:function(E,A){var F=document.createElement(E),D=0,C=0,B=0;if(A){for(C in A){if(A.hasOwnProperty(C)){if(C!="style"){F[C]=A[C]}else{for(B in A[C]){if(A[C].hasOwnProperty(B)){F[C][B]=A[C][B]}}}}}}if(arguments.length>2){for(D=2;D<arguments.length;D++){if(typeof (arguments[D])=="string"){F.appendChild(w23.t(arguments[D]))}else{F.appendChild(arguments[D])}}}return F},t:function(A){return document.createTextNode(A)},append:function(B){if(arguments.length>1){for(var A=1;A<arguments.length;A++){if(typeof (arguments[A])=="string"){B.appendChild(w23.t(arguments[A]))}else{B.appendChild(arguments[A])}}}}};ark.InputDisplay=function(A){this.parent_=A;this.className_="InputDisplay"};ark.InputDisplay.prototype.setClass=function(A){this.className_=A};ark.InputDisplay.prototype.onOk=function(A){this.hide();A(this.input_.value)};ark.InputDisplay.prototype.onCancel=function(A){this.hide();A()};ark.InputDisplay.prototype.onKeyUp=function(C,B){B=B||window.event;var A=B.keyCode||B.which;if(A==13){this.onOk(C)}};ark.InputDisplay.prototype.show=function(F,C){this.box_=w23.e("div",{className:this.className_});var D=w23.t(F);this.input_=w23.e("input",{onkeyup:ark.bind(this.onKeyUp,this,C)});var A=w23.e("button",{onclick:ark.bind(this.onOk,this,C)},"Ok");var B=w23.e("button",{onclick:ark.bind(this.onCancel,this,C)},"Cancel");var E=w23.e("table",null,w23.e("tbody",null,w23.e("tr",null,w23.e("td",{colspan:3},D)),w23.e("tr",null,w23.e("td",null,this.input_),w23.e("td",null,A),w23.e("td",null,B))));w23.append(this.box_,E);w23.append(this.parent_,this.box_);this.input_.focus()};ark.InputDisplay.prototype.hide=function(){this.parent_.removeChild(this.box_);this.box_=null};dafos.AppEngine=function(){};dafos.AppEngine.prototype.saveSample=function(B,F,E,G){var D={};var C={dafos_sample_name:B,dafos_sample_text:F,viewer_name:E};D[gadgets.io.RequestParameters.AUTHORIZATION]=gadgets.io.AuthorizationType.SIGNED;D[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.JSON;D[gadgets.io.RequestParameters.METHOD]=gadgets.io.MethodType.POST;D[gadgets.io.RequestParameters.POST_DATA]=gadgets.io.encodeValues(C);var A="http://dafos.appspot.com/gadgetapi/savesample";gadgets.io.makeRequest(A,dafos.bind(this.saveResponse,this,G),D)};dafos.AppEngine.prototype.deleteRecord=function(E,D){var C={};var B={dafos_record_id:E};C[gadgets.io.RequestParameters.AUTHORIZATION]=gadgets.io.AuthorizationType.SIGNED;C[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.JSON;C[gadgets.io.RequestParameters.METHOD]=gadgets.io.MethodType.POST;C[gadgets.io.RequestParameters.POST_DATA]=gadgets.io.encodeValues(B);var A="http://dafos.appspot.com/gadgetapi/deleterecord";gadgets.io.makeRequest(A,dafos.bind(this.saveResponse,this,D),C)};dafos.AppEngine.prototype.canSave=function(C){var B={};B[gadgets.io.RequestParameters.AUTHORIZATION]=gadgets.io.AuthorizationType.SIGNED;B[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.JSON;var A="http://dafos.appspot.com/gadgetapi/cansave";gadgets.io.makeRequest(A,dafos.bind(this.saveResponse,this,C),B)};dafos.AppEngine.prototype.getOwnerSamples=function(C){var B={};B[gadgets.io.RequestParameters.AUTHORIZATION]=gadgets.io.AuthorizationType.SIGNED;B[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.JSON;var A="http://dafos.appspot.com/gadgetapi/samples";gadgets.io.makeRequest(A,dafos.bind(this.saveResponse,this,C),B)};dafos.AppEngine.prototype.getSample=function(D,C){var B={};B[gadgets.io.RequestParameters.AUTHORIZATION]=gadgets.io.AuthorizationType.SIGNED;B[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.JSON;var A="http://dafos.appspot.com/gadgetapi/sample/"+D;gadgets.io.makeRequest(A,dafos.bind(this.saveResponse,this,C),B)};dafos.AppEngine.prototype.saveResponse=function(B,A){if(typeof B=="function"){if(A.data){B(A.data)}else{B(null)}}};dafos.CodeTab=function(A,B){this.appengine=new dafos.AppEngine();this.gadgetui=B;this.codetabui=new dafos.CodeTabUI(A);this.samples={};this.gadgetui.showLoading("capabilities");dafos.initCallback.getCallback();this.appengine.canSave(dafos.bind(this.onCanSave,this));this.gadgetui.showLoading("samples");dafos.initCallback.getCallback();this.appengine.getOwnerSamples(dafos.bind(this.onSamplesLoaded,this));dafos.initCallback.addOnFinishedListener(dafos.bind(this.onLoaded,this))};dafos.CodeTab.prototype.onCanSave=function(A){this.gadgetui.hideLoading("capabilities");dafos.cansave=(A.status=="success");dafos.initCallback.callback()};dafos.CodeTab.prototype.onSamplesLoaded=function(B){this.gadgetui.hideLoading("samples");this.gadgetui.setMessage(B.message);if(B.status=="success"){for(var A=0;A<B.payload.length;A++){this.samples[B.payload[A].id]=B.payload[A]}}dafos.initCallback.callback()};dafos.CodeTab.prototype.onLoaded=function(){var A={save:dafos.bind(this.saveCode,this),saveas:dafos.bind(this.saveCodeAs,this),loadfile:dafos.bind(this.loadCode,this),deletefile:dafos.bind(this.deleteCode,this),execute:dafos.bind(this.runCode,this)};dafos.cansave=dafos.cansave&&dafos.opensocial.viewerIsOwner();this.codetabui.renderToolbar(dafos.opensocial,A);this.drawSamples()};dafos.CodeTab.prototype.drawSamples=function(){this.codetabui.clearSamplesList();for(var A in this.samples){if(this.samples.hasOwnProperty(A)){this.codetabui.addSample(this.samples[A].name,this.samples[A].id)}}};dafos.CodeTab.prototype.runCode=function(){eval(this.codetabui.getCodeText());pageTracker._trackPageview("track/action/execute")};dafos.CodeTab.prototype.saveCodeAs=function(){var A=new ark.InputDisplay(document.body);var B=this;A.show("Save code as?",function(C){if(C){B.current_file_name=C;B.saveCode.apply(B)}pageTracker._trackPageview("track/action/savecodeas")})};dafos.CodeTab.prototype.saveCode=function(){if(!this.current_file_name){this.saveCodeAs.apply(this)}else{this.gadgetui.showLoading("save");this.appengine.saveSample(this.current_file_name,this.codetabui.getCodeText(),dafos.opensocial.viewer&&dafos.opensocial.viewer.getDisplayName&&dafos.opensocial.viewer.getDisplayName(),dafos.bind(this.onCodeSaved,this))}pageTracker._trackPageview("track/action/savecode")};dafos.CodeTab.prototype.onCodeSaved=function(A){this.gadgetui.hideLoading("save");this.gadgetui.setMessage(A.message);if(A.status=="success"){this.current_file_name=A.payload.name;this.current_file_key=A.payload.id;this.samples[A.payload.id]=A.payload;this.drawSamples();this.codetabui.renderCurrentFile(this.current_file_name,this.current_file_key)}};dafos.CodeTab.prototype.deleteCode=function(){if(this.current_file_name){this.gadgetui.showLoading("delete");this.appengine.deleteRecord(this.current_file_key,dafos.bind(this.onCodeDeleted,this));delete this.samples[this.current_file_name]}pageTracker._trackPageview("track/action/deletecode")};dafos.CodeTab.prototype.onCodeDeleted=function(A){this.gadgetui.hideLoading("delete");this.gadgetui.setMessage(A.message);if(A.status=="success"){this.codetabui.clearUserOutput();this.codetabui.setCodeText("");delete this.samples[this.current_file_key];this.drawSamples();this.current_file_name="";this.current_file_key="";this.codetabui.renderCurrentFile("","")}};dafos.CodeTab.prototype.setCodeToSnippet=function(A){if(confirm("This will clear the contents of the Code tab.  Continue?")){this.codetabui.clearUserOutput();this.codetabui.setCodeText(A);this.drawSamples();this.current_file_name="";this.current_file_key="";this.codetabui.renderCurrentFile("","");return true}else{return false}};dafos.CodeTab.prototype.getCode=function(){return this.codetabui.getCodeText()};dafos.CodeTab.prototype.loadCode=function(){this.current_file_name=this.codetabui.getSelectedLoadText();this.current_file_key=this.codetabui.getSelectedLoadValue();this.gadgetui.showLoading("load");this.appengine.getSample(this.current_file_key,dafos.bind(this.onCodeLoaded,this));pageTracker._trackPageview("track/action/loadcode")};dafos.CodeTab.prototype.onCodeLoaded=function(A){this.gadgetui.hideLoading("load");this.gadgetui.setMessage(A.message);if(A.status=="success"){this.codetabui.clearUserOutput();this.codetabui.setCodeText(A.payload.text);this.codetabui.renderCurrentFile(this.current_file_name,this.current_file_key)}};dafos.CodeTabUI=function(A){this.loading_keys={};this.dom_wrap=A;this.dom_controls=document.getElementById("codetab_controls");this.dom_code_controls=document.getElementById("code_controls");this.dom_code=document.getElementById("code_exec");this.dom_filename=null;this.dom_handle=document.getElementById("dom_handle");this.dom_toolbar=document.getElementById("codetab_toolbar");this.dom_exec_button=null;this.clearUserOutput()};dafos.CodeTabUI.prototype.renderToolbar=function(C,B){var A=["Load one of ",C.owner.getDisplayName&&C.owner.getDisplayName()||"this user","'s samples..."].join("");this.dom_button_load=w23.e("a",{id:"button_load",onclick:B.loadfile,className:"dafos-button"},w23.e("img",{src:"http://dafos.appspot.com/img/load.png"})," Load");this.dom_button_execute=w23.e("a",{id:"button_execute",onclick:B.execute,className:"dafos-button"},w23.e("img",{src:"http://dafos.appspot.com/img/execute.png"})," Execute");this.dom_button_saveas=w23.e("a",{id:"button_saveas",onclick:B.saveas,className:"dafos-button"},w23.e("img",{src:"http://dafos.appspot.com/img/saveas.png"})," Save code as");this.dom_button_delete=w23.e("a",{id:"button_delete",onclick:B.deletefile,className:"dafos-button"},w23.e("img",{src:"http://dafos.appspot.com/img/delete.png"})," Delete");this.dom_button_save=w23.e("a",{id:"button_save",onclick:B.save,className:"dafos-button"},w23.e("img",{src:"http://dafos.appspot.com/img/save.png"})," Save code");this.dom_select=w23.e("select",{id:"select_load"},w23.e("option",null,A));this.dom_select.style.display="none";this.dom_button_load.style.display="none";if(!dafos.cansave){this.dom_button_save.style.display="none";this.dom_button_saveas.style.display="none";this.dom_button_delete.style.display="none"}this.dom_toolbar.appendChild(w23.e("table",null,w23.e("tbody",null,w23.e("tr",null,w23.e("td",null,this.dom_select,this.dom_button_load,this.dom_button_saveas),w23.e("td",{style:{textAlign:"right",width:"auto"}},this.dom_button_execute)))));this.renderCodeControls();this.renderLoadedFileControls(B);gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.renderLoadedFileControls=function(A){this.dom_filename=w23.e("div",{id:"filename",className:"subtoolbar"});this.dom_file_link=w23.e("a",{target:"_blank"});this.dom_filename.appendChild(w23.e("span",null," Currently loaded ",w23.e("span",null,this.dom_file_link)," - ",this.dom_button_save,this.dom_button_delete));this.dom_filename.style.display="none";this.dom_controls.appendChild(this.dom_filename)};dafos.CodeTabUI.prototype.renderCodeControls=function(){var E={id:"button_code_down",onclick:dafos.bind(this.codeDown,this)};var B=w23.e("a",E,"Larger");var C={id:"button_code_up",onclick:dafos.bind(this.codeUp,this)};var A=w23.e("a",C,"Smaller");var D={id:"samplesbox",style:{display:"none"}};this.dom_samples=w23.e("div",D,"Samples");this.dom_code_controls.appendChild(w23.e("table",null,w23.e("tbody",null,w23.e("tr",null,w23.e("td",{className:"samplescell"},this.dom_samples),w23.e("td",{className:"controlcell"},B),w23.e("td",{className:"controlcell"},A)))));gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.codeDown=function(){this.dom_code.style.height=this.dom_code.offsetHeight+100+"px";gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.codeUp=function(){this.dom_code.style.height=Math.max(this.dom_code.offsetHeight-100,50)+"px";gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.clearSamplesList=function(){this.dom_select.innerHTML="";this.dom_select.style.display="none";this.dom_button_load.style.display="none";gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.addSample=function(A,B){this.dom_select.style.display="inline";this.dom_button_load.style.display="inline";params={value:B};this.dom_select.appendChild(w23.e("option",params,A));gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.getSelectedLoadValue=function(){return(this.dom_select&&this.dom_select.value)||""};dafos.CodeTabUI.prototype.getSelectedLoadText=function(){if(this.dom_select){return this.dom_select[this.dom_select.selectedIndex].innerHTML}else{return""}};dafos.CodeTabUI.prototype.clearUserOutput=function(){this.dom_handle.innerHTML=['<span class="dom_handle_label">','&lt;div id="dom_handle"&gt;</span>',"This <code>div</code> has an id of <code>dom_handle</code>"," that you can use to insert DOM elements into",'<span class="dom_handle_label">&lt;/div&gt;</span>'].join("");cls();gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.renderCurrentFile=function(B,D){var A=document.getElementById("select_load"),E=null,C=0;if(B&&B!=""){this.dom_file_link.innerHTML=gadgets.util.escapeString(B);this.dom_file_link.href="http://dafos.appspot.com/code/sample/"+D;this.dom_filename.style.display="block";for(C=0,E;E=A.childNodes[C];C++){if(E.value==D){E.selected="selected"}}}else{this.dom_filename.style.display="none"}gadgets.window.adjustHeight()};dafos.CodeTabUI.prototype.setCodeText=function(A){this.dom_code.value=A};dafos.CodeTabUI.prototype.getCodeText=function(){return this.dom_code.value};dafos.GadgetUI=function(A){this.dom_parent=A;this.loading_keys={};this.render()};dafos.GadgetUI.prototype.render=function(){var A={className:"dafos-message",style:{display:"none"}};var C={className:"dafos-notice"};var B={className:"dafos-loadbox",style:{display:"none",position:"absolute",right:"4px",top:"4px",backgroundColor:"#dd0000",padding:"4px",color:"#ffffff"}};var E={src:"http://dafos.appspot.com/img/loading.png"};this.dom_message=w23.e("div",A);this.dom_parent.parentNode.insertBefore(this.dom_message,this.dom_parent);this.dom_parent.appendChild(w23.e("div",C,this.getVersion()));var D=w23.e("img",E);this.dom_loadmessage=w23.e("span",null);this.dom_loadbox=w23.e("div",B,D," Loading... ");this.dom_loadbox.appendChild(this.dom_loadmessage);this.dom_parent.appendChild(this.dom_loadbox);gadgets.window.adjustHeight()};dafos.GadgetUI.prototype.getVersion=function(){var A="OpenSocial Dev App [0.8]";A+=" [0.8]";A+=" [track]";return A};dafos.GadgetUI.prototype.showLoading=function(A){if(A!=null){this.loading_keys[A]=true}var C=[];for(var B in this.loading_keys){if(this.loading_keys.hasOwnProperty(B)){C.push(B)}}this.dom_loadmessage.innerHTML=C.join(",");this.dom_loadbox.style.display="block";gadgets.window.adjustHeight()};dafos.GadgetUI.prototype.hideLoading=function(A){if(A!=null){delete this.loading_keys[A]}var C=[];for(var B in this.loading_keys){if(this.loading_keys.hasOwnProperty(B)){C.push(B)}}if(C.length==0){this.dom_loadbox.style.display="none"}else{this.dom_loadmessage.innerHTML=C.join(",")}gadgets.window.adjustHeight()};dafos.GadgetUI.prototype.setMessage=function(B){if(B&&B!=""){window.clearTimeout(this.dom_message_timeout);var A=this.dom_message;A.innerHTML=gadgets.util.escapeString(B);A.style.display="block";gadgets.window.adjustHeight();this.dom_message_timeout=window.setTimeout(function(){A.innerHTML="";A.style.display="none";gadgets.window.adjustHeight()},5000)}};var e34=function(A,B){B=(B==undefined)?true:B;this.element_=A;if(B==true){this.assertElement_()}};e34.$=function(A){if(e34.isString(A)){return new e34(document.getElementById(A))}else{if(e34.isElement(A)){return new e34(A)}else{if(e34.isE34_(A)){return A}else{return null}}}};e34.$C=function(B,A,C){if(document.getElementsByClassName){getElementsByClassName=function(I,L,H){H=H||document;var D=H.getElementsByClassName(I);var K=(L)?new RegExp("\\b"+L+"\\b","i"):null;var E=[];var G;for(var F=0,J=D.length;F<J;F+=1){G=D[F];if(!K||K.test(G.nodeName)){E.push(e34.$(G))}}return E}}else{if(document.evaluate){getElementsByClassName=function(M,P,L){P=P||"*";L=L||document;var F=M.split(" ");var N="";var J="http://www.w3.org/1999/xhtml";var O=(document.documentElement.namespaceURI===J)?J:null;var G=[];var D;var E;for(var H=0,I=F.length;H<I;H+=1){N+="[contains(concat(' ', @class, ' '), ' "+F[H]+" ')]"}try{D=document.evaluate(".//"+P+N,L,O,0,null)}catch(K){D=document.evaluate(".//"+P+N,L,null,0,null)}while((E=D.iterateNext())){G.push(e34.$(E))}return G}}else{getElementsByClassName=function(O,R,N){R=R||"*";N=N||document;var H=O.split(" ");var Q=[];var D=(R==="*"&&N.all)?N.all:N.getElementsByTagName(R);var M;var J=[];var L;for(var I=0,E=H.length;I<E;I+=1){Q.push(new RegExp("(^|\\s)"+H[I]+"(\\s|$)"))}for(var G=0,P=D.length;G<P;G+=1){M=D[G];L=false;for(var F=0,K=Q.length;F<K;F+=1){L=Q[F].test(M.className);if(!L){break}}if(L){J.push(e34.$(M))}}return J}}}if(C){C=e34.$(C).getElement()}return getElementsByClassName(B,A,C)};e34.renderTemplate=function(A,B){if(e34.isString(A)){return e34.renderStringTemplate_(A,B)}else{if(e34.isElement(A)||e34.isE34_(A)){return e34.renderStringTemplate_(e34.serializeElement_(A),B)}else{return null}}};e34.serializeElement_=function(A){A=e34.$(A);var B=document.createElement("div");B.appendChild(A.getElement().cloneNode(true));return B.innerHTML};e34.renderStringTemplate_=function(C,F){for(var B in F){if(F.hasOwnProperty(B)){var A=RegExp("@"+B+"@","g");C=C.replace(A,F[B])}}var G=/^<([^>]*)\s+(?:id='[^'>]*'|id="[^">]*"|id=[^"' >]*)(\s*[^>]*)>/;C=C.replace(G,"<$1$2>");var E=null;var D=document.createElement("div");if(C.match(/^<(?:tr|TR)/)){D.innerHTML="<table><tbody>"+C+"</tbody></table>";E=D.childNodes[0].childNodes[0].childNodes[0]}else{if(C.match(/^<(?:option|OPTION)/)){D.innerHTML="<select>"+C+"</select>";E=D.childNodes[0].childNodes[0]}else{D.innerHTML=C;E=D.childNodes[0]}}if(E){return new e34(E)}else{return null}};e34.isString=function(A){return(typeof A=="string")};e34.isElement=function(A){return A&&A.nodeType&&A.nodeType==1};e34.isBoolean=function(A){return A===true||A===false};e34.isNumber=function(A){return !isNaN(A)};e34.isObject=function(A){return(typeof A==typeof ({}))};e34.isE34_=function(A){return A&&A.e34version_};e34.isArray=function(A){return A&&!!A.length};e34.isFunction=function(A){return(typeof A=="function")};e34.prototype.e34version_=1;e34.prototype.assertElement_=function(){if(e34.isElement(this.element_)){return this}throw new Error("e34 object was not assigned to an Element")};e34.prototype.$C=function(A,B){return e34.$C(A,B,this.element_)};e34.prototype.getId=function(){return this.element_.id};e34.prototype.getClasses=function(){return this.element_.className.split(" ")};e34.prototype.getElement=function(){return this.element_};e34.prototype.getTagName=function(){return this.element_.tagName.toUpperCase()};e34.prototype.getParentElement=function(){return this.element_.parentNode};e34.prototype.getTemplateId=function(){var A=/([^ ]+)-[0-9]+$/.exec(this.element_.id);if(A){return A[1]}else{return this.element_.id}};e34.prototype.getTemplateNumber=function(){var A=/-([0-9]+)$/.exec(this.element_.id);if(A){return Number(A[1])}else{return null}};e34.prototype.getNumberedElement=function(A){};e34.prototype.appendChildren=function(){for(var A=0;A<arguments.length;A++){this.element_.appendChild(e34.$(arguments[A]).getElement())}return this};e34.prototype.setParent=function(A){e34.$(A).getElement().appendChild(this.getElement());return this};e34.prototype.removeFromParent=function(){this.element_.parentNode.removeChild(this.element_);return this};e34.prototype.removeAllChildren=function(){this.element_.innerHTML="";return this};e34.prototype.replaceElement=function(A){if(e34.isE34_(A)){var B=this.getParentElement();this.removeFromParent();B.appendChild(A.getElement())}return this};e34.prototype.setInnerHTML=function(A){this.element_.innerHTML=A};e34.prototype.hasClass=function(A){var B=RegExp("\\b"+A+"\\b");return this.element_.className&&!!this.element_.className.match(B)};e34.prototype.addClass=function(A){var B=this.element_.className||"";var C=RegExp("(\\S$)");if(!this.hasClass(A)){B=B.replace(C,"$1 ")+A}this.element_.className=B;return this};e34.prototype.removeClass=function(A){var B=this.element_.className||"";var C=RegExp("(\\s*\\b"+A+"\\b(\\s*))*","g");B=B.replace(C,"$2");this.element_.className=B;return this};e34.prototype.toggleClass=function(A){if(this.hasClass(A)){this.removeClass(A)}else{this.addClass(A)}return this};e34.prototype.addListener=function(B,C,A){if(!this.element_.addEventListener){this.element_.attachEvent("on"+B,C)}else{this.element_.addEventListener(B,C,A)}};e34.prototype.addOnClickHandler=function(A){this.addListener("click",A,true);return this};e34.prototype.hide=function(){if(this.element_.style.display!="none"){this.old_style_display_=this.element_.style.display;this.element_.style.display="none"}return this};e34.prototype.show=function(){if(this.element_.style.display=="none"){this.element_.style.display=this.old_style_display_}return this};e34.prototype.enable=function(){this.element_.disabled=false};e34.prototype.disable=function(){this.element_.disabled=true};e34.prototype.getValue=function(){if(this.element_.type&&this.element_.type=="checkbox"){return this.element_.checked}else{return this.element_.value}};e34.prototype.setValue=function(A){if(this.element_.type&&this.element_.type=="checkbox"){this.element_.checked=!!A}else{this.element_.value=A}return this};e34.prototype.getPosition=function(){var A={x:0,y:0};var B=this.element_;while(B){A.x+=B.offsetLeft;A.y+=B.offsetTop;B=B.offsetParent}return A};e34.prototype.getDimensions=function(){var A={width:this.element_.offsetWidth,height:this.element_.offsetHeight};return A};e34.prototype.getAttribute=function(A){return this.element_.getAttribute(A)};e34.prototype.scrollIntoView=function(){var A=this.getPosition();window.scrollTo(A.x,A.y);return this};e34.prototype.$T=function(A){var C=this.element_.getElementsByTagName(A);var B=[];for(var D=0,E;E=C[D];D++){B.push(e34.$(E))}return B};e34.prototype.getChild=function(A){return e34.$(this.element_.childNodes[A])};e34.prototype.setStylePosition=function(A){this.element_.style.position=A;return this};e34.prototype.setStyleLeft=function(A){this.element_.style.left=A;return this};e34.prototype.setStyleTop=function(A){this.element_.style.top=A;return this};e34.prototype.setStyleWidth=function(A){this.element_.style.width=A;return this};e34.prototype.setStyleHeight=function(A){this.element_.style.height=A;return this};e34.prototype.setStyleMarginLeft=function(A){this.element_.style.marginLeft=A;return this};e34.prototype.setStylePaddingLeft=function(A){this.element_.style.paddingLeft=A;return this};e34.prototype.$=function(A){return e34.$(this.element_.ownerDocument.getElementById(A))};var e34widgets=function(){};e34widgets.IconLink=function(F,B,E,A){var C="<a id='@id@' class='iconlink'><img src='@img@' /> @text@</a>";var D={id:F,img:B,text:E};this.element_=e34.renderTemplate(C,D).getElement();if(A){e34.$(A).appendChildren(this.element_)}};e34widgets.IconLink.prototype=new e34(null,false);e34widgets.DropDown=function(C,B){var A="<select id='@id@'></select>";this.option_template_="<option value=@value@>@text@</option>";this.num_options_=0;this.onempty_handler_=null;this.onitems_handler_=null;this.element_=e34.renderTemplate(A,{id:C}).getElement();if(B){e34.$(B).appendChildren(this.element_)}};e34widgets.DropDown.prototype=new e34(null,false);e34widgets.DropDown.prototype.checkOptionsHandlers_=function(){if(this.num_options_==1&&this.onitems_handler_){this.onitems_handler_(this)}else{if(this.num_options_==0&&this.onempty_handler_){this.onempty_handler_(this)}}return this};e34widgets.DropDown.prototype.addOption=function(B,C){var A=e34.renderTemplate(this.option_template_,{value:B,text:C});this.appendChildren(A);this.num_options_++;this.checkOptionsHandlers_();return this};e34widgets.DropDown.prototype.clearOptions=function(){this.removeAllChildren();this.num_options_=0;this.checkOptionsHandlers_();return this};e34widgets.DropDown.prototype.addOnItemsHandler=function(A){if(e34.isFunction(A)){this.onitems_handler_=A}this.checkOptionsHandlers_();return this};e34widgets.DropDown.prototype.addOnEmptyHandler=function(A){if(e34.isFunction(A)){this.onempty_handler_=A}this.checkOptionsHandlers_();return this};e34widgets.DropDown.prototype.getSelectedText=function(){return this.element_[this.element_.selectedIndex].innerHTML};e34widgets.DropDown.prototype.select=function(C){for(var A=0,B;B=this.element_.childNodes[A];A++){if(B.value==C){B.selected="selected"}}return this};e34widgets.Overlay=function(F,B,D,A){var C="<div id='@id@'></div>";var E="<div></div>";this.element_=e34.renderTemplate(C,{id:F}).getElement();if(A){e34.$(A).appendChildren(this.element_)}this.setStylePosition("absolute").setStyleLeft("50%").setWidth(B).setStyleTop(D);this.content_element_=e34.renderTemplate(E,{}).setParent(this.element_).setStylePosition("relative")};e34widgets.Overlay.prototype=new e34(null,false);e34widgets.Overlay.prototype.setContent=function(A){e34.$(A).setParent(this.content_element_);return this};e34widgets.Overlay.prototype.setWidth=function(A){this.setStyleWidth(A);var B="-"+Math.round(this.getDimensions().width/2)+"px";this.setStyleMarginLeft(B);return this};e34widgets.Overlay.prototype.addContentClass=function(A){this.content_element_.addClass(A);return this};var output_buffer=[];function getArgsAsArray(B){var A=[];for(var C=0;C<B.length;C++){A.push(B[C])}return A}function output(){var B=getArgsAsArray(output.arguments);var A=document.getElementById("output");if(window.console&&console.log){console.log("output",B)}output_buffer.push(B.join(" "));while(output_buffer.length>400){output_buffer.shift()}A.innerHTML=output_buffer.join("<br />");A.scrollTop=A.scrollHeight;if(A.style.display=="none"){A.style.display="block"}gadgets.window.adjustHeight()}function cls(){output_buffer=[];var A=document.getElementById("output");A.innerHTML="";A.style.display="none";gadgets.window.adjustHeight()}dafos.onCodeTabActivated=function(){gadgets.window.adjustHeight()};dafos.onOpenSocialData=function(A){dafos.ui.hideLoading("opensocial");if(dafos.opensocial.viewerIsOwner){pageTracker._setVar("ViewerIsOwner")}else{pageTracker._setVar("ViewerNotOwner")}dafos.initCallback.callback()};dafos.onLastLoadedSet=function(B,A){};dafos.onViewerSettingsAvailable=function(C,B){var A="Code";new quikos().startRequest().setData("lastloaded",new Date().getTime(),"setdata").fetchData(quikos.idspec.VIEWER,"fetchdata").sendRequest(dafos.onLastLoadedSet);dafos.createTabs(A)};dafos.createTabs=function(A){dafos.tabs=new gadgets.TabSet("dafos",A,dafos.wrap);dafos.tabs.alignTabs("left",10);dafos.tabs.addTab("Code",{contentContainer:document.getElementById("codetab"),callback:dafos.onCodeTabActivated,tooltip:"Write and test JavaScript code"});dafos.codetab=new dafos.CodeTab(dafos.wrap,dafos.ui)};dafos.init=function(){};gadgets.util.registerOnLoadHandler(function(){dafos.initCallback=new ark.AggregateCallback(dafos.init);dafos.cansave=false;dafos.wrap=document.getElementById("wrap");dafos.ui=new dafos.GadgetUI(dafos.wrap);dafos.opensocial=new dafos.OpenSocial();dafos.ui.showLoading("opensocial");dafos.initCallback.getCallback();dafos.opensocial.getOpenSocialData("*",dafos.onOpenSocialData);new quikos().startRequest().fetchPerson(quikos.id.VIEWER,"viewer").fetchData(quikos.idspec.VIEWER,"data").sendRequest(dafos.onViewerSettingsAvailable)});
    </script>
  ]]>
</Content>
  <Content type="html" view="profile,home">
  <![CDATA[
      <div id="wrap">
        <div id="codetab">
          <div id="sample_exec">
            <div id="codetab_controls" class="controls">
              <div id="codetab_toolbar" class="toolbar"></div>
            </div>
            <div id="code_controls"></div>
            <textarea class="code" id="code_exec">
            </textarea>
          </div>
          <div id="dom_handle"></div>
          <!-- Scrolling output buffer -->
          <div id="output"></div>
        </div>
      <script type="text/javascript">
        document.write(unescape("%3Cscript src='http://www.google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
      </script>
      <script type="text/javascript">
        var pageTracker = _gat._getTracker("UA-5081674-1");
        pageTracker._initData();
        pageTracker._trackPageview();
      </script>
   ]]>
  </Content>
  <Content type="html" view="default,canvas" >
    <![CDATA[
      <div id="wrap">
        <div id="codetab">
          <div id="sample_exec">
            <div id="codetab_controls" class="controls">
              <div id="codetab_toolbar" class="toolbar"></div>
            </div>
            <div id="code_controls"></div>
            <textarea class="code" id="code_exec">
/**
 * DEFAULT DAfOS SAMPLE CODE (0.8)
 * Fetches the OWNER and their friends.
 */
function response(data) {
  cls();
  output(data.get("req").getData().getDisplayName() + "'s Friends:");
  output("========================");
  data.get("req_friends").getData().each(function(person) {
    output(person.getDisplayName());
  });
  gadgets.window.adjustHeight();
};
function request() {
  var req = opensocial.newDataRequest();
  var spec = opensocial.newIdSpec({"userId" : "OWNER", "groupId" : "FRIENDS"});
  var params = {
    "max" : 1000
  };
  req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER), "req");
  req.add(req.newFetchPeopleRequest(spec, params), "req_friends");
  req.send(response);
};
request();
            </textarea>
          </div>
          <div id="dom_handle"></div>
          <!-- Scrolling output buffer -->
          <div id="output"></div>
        </div>
      </div>
      <script type="text/javascript">
        document.write(unescape("%3Cscript src='http://www.google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
      </script>
      <script type="text/javascript">
        var pageTracker = _gat._getTracker("UA-5081674-1");
        pageTracker._initData();
        pageTracker._trackPageview();
      </script>
    ]]>
  </Content>
</Module>
