// Copyright 2009 Google Inc. All Rights Reserved.
var gweb=gweb||{};gweb.privacy=gweb.privacy||{};gweb.privacy.VideoList=function(conf){this.mainTemplate=conf.mainTemplate;this.videoTemplate=conf.videoTemplate;this.numVideos=conf.numVideos||5;this.videoDiv=conf.videoDiv;this.videoDiv.innerHTML=conf.loadingMsg||'';this.url=conf.url;google.load('feeds','1');google.setOnLoadCallback(this.createApiLoadHandler_());};gweb.privacy.VideoList.prototype.createApiLoadHandler_=function(){var self=this;return function(){gweb.feed.loadSpreadsheet(self.createDataHandler_(),self.url);};};gweb.privacy.VideoList.prototype.createDataHandler_=function(){var self=this;return function(data){if(!data){self.videoDiv.innerHTML='';return;}
var videos=[];for(var i=0,len=data.length;i<len;i++){videos.push(gweb.privacy.VideoList.templatize_(data[i],self.videoTemplate));}
self.videoDiv.innerHTML=gweb.privacy.VideoList.templatize_({videos:videos.join('')},self.mainTemplate);};};gweb.privacy.VideoList.templatize_=function(obj,template){return template.replace(/{(.*?)}/g,function(str,p1){return obj[p1]||'';});};