var Objs;new function(){Objs=function(o,u,s){var r,p=typeof u,t,q,n;if(typeof o!=d){throw Error(j+o)}if(p==d){if(!b[u]){throw Error(g+u)}u=b[u]}else{if(p=="object"){s=u;u=null}}if(!u&&!s&&b[o]){return b[o]}r=b[o]=function(){if(!r[f]){if(r[i]){r[i][m]=1;r[i].call(this);delete r[i][m]}if(!r[m]&&r[k][a]){r[k][a].apply(this,arguments)}}};if(u){u[f]=1;r[k]=new u();delete u[f];r[i]=u;r[l]=u[k]}if(s){n=h.slice(0);for(t in s){if(s.hasOwnProperty(t)){n.push(t)}}for(q=0;q<n.length;q++){t=n[q];r[k][t]=s[t]}}return r
};var d="string",l="$super",e="class",i=l+e,k="prototype",a="initialize",c="$Objs$",m=c+"c",f=c+"e",g="Unexistent super"+e+": ",j="Invalid "+e+"path: ",b={},h=["toString","valueOf","toLocaleString"]};

new function(){Objs("puremvc.Observer",{notify:null,context:null,initialize:function(a,b){this.setNotifyMethod(a);this.setNotifyContext(b)},getNotifyMethod:function(){return this.notify},setNotifyMethod:function(a){this.notify=a},getNotifyContext:function(){return this.context},setNotifyContext:function(a){this.context=a},notifyObserver:function(a){this.getNotifyMethod().call(this.getNotifyContext(),a)},compareNotifyContext:function(a){return a===this.getNotifyContext()}})};if(typeof HidePureMVC=="undefined"){Observer=Objs("puremvc.Observer")
}new function(){Objs("puremvc.Notification",{name:null,body:null,type:null,initialize:function(b,a,c){this.name=b;this.body=a;this.type=c},getName:function(){return this.name},setBody:function(a){this.body=a},getBody:function(){return this.body},setType:function(a){this.type=a},getType:function(){return this.type},toString:function(){var a="Notification Name: "+this.getName();a+="\nBody:"+((this.getBody()==null)?"null":this.getBody().toString());a+="\nType:"+((this.getType()==null)?"null":this.getType());
return a}})};if(typeof HidePureMVC=="undefined"){Notification=Objs("puremvc.Notification")}new function(){var a=Objs("puremvc.Observer");var b=Objs("puremvc.View",{mediatorMap:null,observerMap:null,initialize:function(){if(b.instance){throw Error(b.SINGLETON_MSG)}this.mediatorMap={};this.observerMap={};this.initializeView()},initializeView:function(){},registerObserver:function(d,c){var e=this.observerMap[d];if(e){e.push(c)}else{this.observerMap[d]=[c]}},notifyObservers:function(g){var e=g.getName();
var j=this.observerMap[e];if(j){var h=j.slice(0);var c=h.length;for(var f=0;f<c;f++){var d=h[f];d.notifyObserver(g)}}},removeObserver:function(d,f){var g=this.observerMap[d];var e=g.length;while(e--){var c=g[e];if(c.compareNotifyContext(f)){g.splice(e,1);break}}if(g.length==0){delete this.observerMap[d]}},registerMediator:function(g){var e=g.getMediatorName();if(this.mediatorMap[e]){return}this.mediatorMap[e]=g;var h=g.listNotificationInterests();var c=h.length;if(c){var d=new a(g.handleNotification,g);
for(var f=0;f<c;f++){this.registerObserver(h[f],d)}}g.onRegister()},retrieveMediator:function(c){return this.mediatorMap[c]||null},hasMediator:function(c){return this.mediatorMap[c]?true:false},removeMediator:function(c){var e=this.mediatorMap[c];if(!e){return null}var f=e.listNotificationInterests();var d=f.length;while(d--){this.removeObserver(f[d],e)}delete this.mediatorMap[c];e.onRemove();return e}});b.SINGLETON_MSG="View Singleton already constructed!";b.instance=null;b.getInstance=function(){if(!b.instance){b.instance=new b()
}return b.instance}};if(typeof HidePureMVC=="undefined"){View=Objs("puremvc.View")}new function(){var a=Objs("puremvc.Model",{proxyMap:null,initialize:function(){if(a.instance){throw Error(a.SINGLETON_MSG)}this.proxyMap={};this.initializeModel()},initializeModel:function(){},registerProxy:function(b){this.proxyMap[b.getProxyName()]=b;b.onRegister()},retrieveProxy:function(b){return this.proxyMap[b]||null},hasProxy:function(b){return this.proxyMap[b]?true:false},removeProxy:function(c){var b=this.proxyMap[c];
if(!b){return null}delete this.proxyMap[c];b.onRemove();return b}});a.SINGLETON_MSG="Model Singleton already constructed!";a.instance=new a();a.getInstance=function(){if(!a.instance){a.instance=new a()}return a.instance}};if(typeof HidePureMVC=="undefined"){Model=Objs("puremvc.Model")}new function(){var a=Objs("puremvc.Observer");var c=Objs("puremvc.View");var b=Objs("puremvc.Controller",{view:null,commandMap:null,initialize:function(){if(b.instance){throw Error(b.SINGLETON_MSG)}this.commandMap={};
this.initializeController()},initializeController:function(){this.view=c.getInstance()},executeCommand:function(d){var f=this.commandMap[d.getName()];if(f){var e=new f();e.execute(d)}},registerCommand:function(d,e){if(!this.commandMap[d]){this.view.registerObserver(d,new a(this.executeCommand,this))}this.commandMap[d]=e},hasCommand:function(d){return this.commandMap[d]?true:false},removeCommand:function(d){if(this.hasCommand(d)){this.view.removeObserver(d,this);delete this.commandMap[d]}}});b.SINGLETON_MSG="Controller Singleton already constructed!";
b.instance=null;b.getInstance=function(){if(!b.instance){b.instance=new b()}return b.instance}};if(typeof HidePureMVC=="undefined"){Controller=Objs("puremvc.Controller")}new function(){var e=Objs("puremvc.Model");var d=Objs("puremvc.View");var c=Objs("puremvc.Controller");var b=Objs("puremvc.Notification");var a=Objs("puremvc.Facade",{view:null,model:null,controller:null,initialize:function(){if(a.instance){throw Error(a.SINGLETON_MSG)}this.initializeFacade()},initializeFacade:function(){this.initializeModel();
this.initializeController();this.initializeView()},initializeModel:function(){if(!this.model){this.model=e.getInstance()}},initializeController:function(){if(!this.controller){this.controller=c.getInstance()}},initializeView:function(){if(!this.view){this.view=d.getInstance()}},registerCommand:function(f,g){this.controller.registerCommand(f,g)},removeCommand:function(f){this.controller.removeCommand(f)},hasCommand:function(f){return this.controller.hasCommand(f)},registerProxy:function(f){this.model.registerProxy(f)
},retrieveProxy:function(f){return this.model.retrieveProxy(f)},removeProxy:function(f){return this.model.removeProxy(f)},hasProxy:function(f){return this.model.hasProxy(f)},registerMediator:function(f){this.view.registerMediator(f)},retrieveMediator:function(f){return this.view.retrieveMediator(f)},removeMediator:function(f){return this.view.removeMediator(f)},hasMediator:function(f){return this.view.hasMediator(f)},sendNotification:function(g,f,h){this.notifyObservers(new b(g,f,h))},notifyObservers:function(f){this.view.notifyObservers(f)
}});a.SINGLETON_MSG="Facade Singleton already constructed!";a.instance=null;a.getInstance=function(){if(!a.instance){a.instance=new a()}return a.instance}};if(typeof HidePureMVC=="undefined"){Facade=Objs("puremvc.Facade")}new function(){var a=Objs("puremvc.Facade");Objs("puremvc.Notifier",{facade:null,initialize:function(){this.facade=a.getInstance()},sendNotification:function(c,b,d){this.facade.sendNotification(c,b,d)}})};if(typeof HidePureMVC=="undefined"){Notifier=Objs("puremvc.Notifier")}new function(){Objs("puremvc.SimpleCommand","puremvc.Notifier",{execute:function(a){}})
};if(typeof HidePureMVC=="undefined"){SimpleCommand=Objs("puremvc.SimpleCommand")}new function(){var a=Objs("puremvc.MacroCommand","puremvc.Notifier",{subCommands:null,initialize:function(){a.$super.initialize.call(this);this.subCommands=[];this.initializeMacroCommand()},initializeMacroCommand:function(){},addSubCommand:function(b){this.subCommands.push(b)},execute:function(d){var b=this.subCommands.length;for(var c=0;c<b;c++){var f=this.subCommands[c];var e=new f();e.execute(d)}}})};if(typeof HidePureMVC=="undefined"){MacroCommand=Objs("puremvc.MacroCommand")
}new function(){var a=Objs("puremvc.Mediator","puremvc.Notifier",{mediatorName:null,viewComponent:null,initialize:function(b,c){a.$super.initialize.call(this);this.mediatorName=(b!=null)?b:a.NAME;this.viewComponent=c},listNotificationInterests:function(){return[]},getMediatorName:function(){return this.mediatorName},getViewComponent:function(){return this.viewComponent},setViewComponent:function(b){this.viewComponent=b},handleNotification:function(b){},onRegister:function(){},onRemove:function(){}});
a.NAME="Mediator"};if(typeof HidePureMVC=="undefined"){Mediator=Objs("puremvc.Mediator")}new function(){var a=Objs("puremvc.Proxy","puremvc.Notifier",{data:null,proxyName:null,initialize:function(c,b){a.$super.initialize.call(this);this.proxyName=(c!=null)?c:a.NAME;this.data=b},getProxyName:function(){return this.proxyName},setData:function(b){this.data=b},getData:function(){return this.data},onRegister:function(){},onRemove:function(){}});a.NAME="Proxy"};if(typeof HidePureMVC=="undefined"){Proxy=Objs("puremvc.Proxy")
};


var AppConfig={APP_VERSION:"0.0.2",FLASH_VERSION:[9,0],API_URL:"http://api.cultureunplugged.com",SERVER_URL:"http://www.cultureunplugged.com",ASSETS_URL:"http://assets.cultureunplugged.com",TAG_URL:"/documentaries/watch-online/festival/films.php?view=grid&listType=tag&tags={0}",GENRE_URL:"/documentaries/watch-online/festival/films.php?view=grid&listType=genre&id={0}",ST_COUNTRY_URL:"/documentaries/watch-online/festival/storyTellers.php?view=grid&listType=country&country={0}",FM_TAG_URL:"/documentaries/watch-online/filmedia/films.php#view=thumb&tags={0}",FM_GENRE_URL:"/documentaries/watch-online/filmedia/genre.php?id={0}",FM_ST_COUNTRY_URL:"/documentaries/watch-online/filmedia/storyTellers.php?view=grid&listType=country&country={0}",FLASH_INSTALLER:"/swf/expressInstall.swf",CU_VIDEO_PLAYER:"/swf/flvPlayer6.swf",PROMO_PLAYER:"/swf/promoplayer6.swf"};var AppNotification={ADD_TO_WATCHLATER:"addToWatchLater",ADD_TO_SITE_HISTORY:"addToSiteHistory",ADD_RANDOM_MOVIES:"addRandomMovies",CLOSE_POPUP:"closePopup",EMAIL_MOVIE_LINK:"emailMovieLink",FACEBOOK_USER_LOGGEDIN:"facebookUserLoggedIn",GOTO_PAGE:"goToPage",GOTO_FIRST_PAGE:"goToFirstPage",GOTO_LAST_PAGE:"goToLastPage",GOTO_PREV_PAGE:"goToPrevPage",GOTO_NEXT_PAGE:"goToNextPage",HIDE_DIALOG:"hideDialog",HIDE_SITE_HISTORY:"hideSiteHistory",LINKTV_MOVIE_DATA_LOADED:"linkTvMovieDataLoaded",LOAD_CU_MOVIE_DATA:"loadCuMovieData",LOAD_LOGGEDIN_USER:"loadLoggedInUser",LOAD_STORYTELLER_DATA:"loadStorytellerData",LOAD_USER_MOVIE:"loadUserMovie",LOAD_VIDEO:"loadVideo",LOGGEDIN_USER_LOADED:"loggedInUserLoaded",MOVIE_DATA_LOADED:"movieDataLoaded",MOVIE_IDS_LOADED:"movieIdsLoaded",MOVIE_ITEM_ADDED:"movieItemAdded",NOW_MOVIE_LOADED:"nowMovieLoaded",UPDATE_PAGE_NUMBER:"updatePageNumber",OPEN_POPUP:"openPopup",OPEN_WINDOW:"openWindow",PAGE_COMP_CREATED:"pageComponentCreated",PAUSE_PREVIEW:"pausePreview",PAUSE_OTHER_PREVIEWS:"pauseOtherPreviews",POST_TO_TWITTER:"postToTwitter",REGISTER_FILMAKER_COMMITTEE:"registerFilmMakerCommittee",SCROLL_TO_TOP:"scrollToTop",SEARCH:"search",SEND_EMAIL_TO_STORY_TELLER:"sendEmailToStoryTeller",SET_MOVIE_RATING:"setMovieRating",SET_VIDEO_PLAYER:"setVideoPlayer",SET_PREVIEW_PLAYER:"setPreviewPlayer",SITE_HISTORY_ADDED:"siteHistoryAdded",SITE_HISTORY_LOADED:"siteHistoryLoaded",SHOW_DIALOG:"showDialog",SHOW_DOWNLOAD_IPAD_POPUP:"showDownloadIpadPopup",SHOW_FACEBOOK_LOGIN:"showFacebookLogin",SHOW_FACEBOOK_SHARE:"showFacebookShare",SHOW_LOGIN_FORM:"showLoginForm",SHOW_MAKE_SUGGESTION:"showMakeSuggestion",SHOW_MESSAGE_POPUP:"showMessagePopup",SHOW_MOVIE_INFO_POPUP:"showMovieInfoPopup",SHOW_MOVIE_SYNOPSIS_POPUP:"showMovieSynopsisPopup",SHOW_SITE_HISOTRY:"showSiteHistory",STARTUP:"startup",STORYTELLER_DATA_LOADED:"storyTellerDataLoaded",STORYTELLER_IDS_LOADED:"storyTellerIdsLoaded",STORYTELLER_ITEM_ADDED:"storyTellerItemAdded",UPDATE_PAGE_SETTINGS:"updatePageSettings",USER_LOGGED_IN:"userLoggedIn",VIDEO_PLAYER_LOADED:"videoPlayerLoaded"};function sendNotification(b,a,c){app.getInstance().sendNotification(b,a,c)}var Messages={rating:{THANK_YOU:'<h2 class="ty">Thank You!</h2><p>Thank You for watching and engaging with the film.<br/>Your rating is applied to this film.</p>',ALREADY_RATED:"You have already rated this movie.\nThank you!",EXPRESS_THANKYOU:"<h2 class=\"ty\">Thank You!</h2><p>Thank You for your expression for the film '{0}'.<br/>You have expressed/rated the film as: {1}.</br>Promote Film. Promote Consciousness."},history:{NO_RESULT:"There is no history recorded yet.<br/>Please begin to explore this festival..."},findthat:{NO_RESULT:"No matching results were found for your current search criteria. Please refine your search and discover what you wish.<br/>Hope you find the Spirit/Consciousness you are looking for. Best Wishes...",TRY_FILMEDIA:'To find more films{0}, please visit <a href="{1}">filmedia network</a>.',SEARCH_TERM_REQUIRED:"Expressing/Writing in the search box is required.\nThank you."},films:{NO_RESULT:"Exact results are not found based on your current selection criteria. Please reselect the criteria above."},warning:{UPLOAD_NOT_ALLOWED:"Apologies ! iPad does not allow this function. To upload photo(s),we request you to visit this site from a computer device.\n\nThank You."}};function _Text(c,b){if(typeof(b)!="undefined"&&$.isArray(b)){for(var a=0;a<b.length;a++){c=c.replace("{"+a+"}",b[a])}}return c}var FabricationFacade=Objs("com.cultureunplugged.utils.patterns.FabricationFacade",Facade,{startup:function(){this.sendNotification(AppNotification.STARTUP)},sendNotification:function(c,a,d,b){if(typeof b=="number"){var e=this;setTimeout(function(){e.notifyObservers(new Notification(c,a,d))},b);return}this.notifyObservers(new Notification(c,a,d))}});FabricationFacade.getInstance=function(){if(!Facade.instance){Facade.instance=new FabricationFacade()}return Facade.instance};var FabricationMediator=Objs("com.cultureunplugged.utils.patterns.FabricationMediator",Mediator,{listNotificationInterests:function(){var b=[];for(var a in this){if(typeof(this[a])=="function"&&/^respondTo.*$/.test(a)){var c=a.replace(/^respondTo(.*)$/,"$1");c=c.substr(0,1).toLowerCase()+c.substr(1);b.push(c)}}return b},handleNotification:function(b){var a=b.getName();var c="respondTo"+a.substr(0,1).toUpperCase()+a.substr(1);if(typeof(this[c])=="function"){this[c](b)}},sendNotification:function(c,a,d,b){this.facade.sendNotification(c,a,d,b)}});var FabricationSimpleCommand=Objs("com.cultureunplugged.utils.patterns.FabricationSimpleCommand",SimpleCommand,{sendNotification:function(c,a,d,b){this.facade.sendNotification(c,a,d,b)}});var FabricationValueObject=Objs("com.cultureunplugged.utils.patterns.FabricationValueObject",{initialize:function(b){for(var a in b){if(typeof(this[a])!="undefined"){this[a]=b[a]}}this.renderData()},renderData:function(){}});var HtmlUtils={htmlentities:function(b,f,e,c){var d=this.get_html_translation_table("HTML_ENTITIES",f),a="";b=b==null?"":b+"";if(!d){return false}if(f&&f==="ENT_QUOTES"){d["'"]="&#039;"}if(!!c||c==null){for(a in d){if(d.hasOwnProperty(a)){b=b.split(a).join(d[a])}}}else{b=b.replace(/([\s\S]*?)(&(?:#\d+|#x[\da-f]+|[a-zA-Z][\da-z]*);|$)/g,function(h,i,g){for(a in d){if(d.hasOwnProperty(a)){i=i.split(a).join(d[a])}}return i+g})}return b},get_html_translation_table:function(i,f){var b={},e={},d;var a={},c={};var g={},h={};a[0]="HTML_SPECIALCHARS";a[1]="HTML_ENTITIES";c[0]="ENT_NOQUOTES";c[2]="ENT_COMPAT";c[3]="ENT_QUOTES";g=!isNaN(i)?a[i]:i?i.toUpperCase():"HTML_SPECIALCHARS";h=!isNaN(f)?c[f]:f?f.toUpperCase():"ENT_COMPAT";if(g!=="HTML_SPECIALCHARS"&&g!=="HTML_ENTITIES"){throw new Error("Table: "+g+" not supported")}b["38"]="&amp;";if(g==="HTML_ENTITIES"){b["160"]="&nbsp;";b["161"]="&iexcl;";b["162"]="&cent;";b["163"]="&pound;";b["164"]="&curren;";b["165"]="&yen;";b["166"]="&brvbar;";b["167"]="&sect;";b["168"]="&uml;";b["169"]="&copy;";b["170"]="&ordf;";b["171"]="&laquo;";b["172"]="&not;";b["173"]="&shy;";b["174"]="&reg;";b["175"]="&macr;";b["176"]="&deg;";b["177"]="&plusmn;";b["178"]="&sup2;";b["179"]="&sup3;";b["180"]="&acute;";b["181"]="&micro;";b["182"]="&para;";b["183"]="&middot;";b["184"]="&cedil;";b["185"]="&sup1;";b["186"]="&ordm;";b["187"]="&raquo;";b["188"]="&frac14;";b["189"]="&frac12;";b["190"]="&frac34;";b["191"]="&iquest;";b["192"]="&Agrave;";b["193"]="&Aacute;";b["194"]="&Acirc;";b["195"]="&Atilde;";b["196"]="&Auml;";b["197"]="&Aring;";b["198"]="&AElig;";b["199"]="&Ccedil;";b["200"]="&Egrave;";b["201"]="&Eacute;";b["202"]="&Ecirc;";b["203"]="&Euml;";b["204"]="&Igrave;";b["205"]="&Iacute;";b["206"]="&Icirc;";b["207"]="&Iuml;";b["208"]="&ETH;";b["209"]="&Ntilde;";b["210"]="&Ograve;";b["211"]="&Oacute;";b["212"]="&Ocirc;";b["213"]="&Otilde;";b["214"]="&Ouml;";b["215"]="&times;";b["216"]="&Oslash;";b["217"]="&Ugrave;";b["218"]="&Uacute;";b["219"]="&Ucirc;";b["220"]="&Uuml;";b["221"]="&Yacute;";b["222"]="&THORN;";b["223"]="&szlig;";b["224"]="&agrave;";b["225"]="&aacute;";b["226"]="&acirc;";b["227"]="&atilde;";b["228"]="&auml;";b["229"]="&aring;";b["230"]="&aelig;";b["231"]="&ccedil;";b["232"]="&egrave;";b["233"]="&eacute;";b["234"]="&ecirc;";b["235"]="&euml;";b["236"]="&igrave;";b["237"]="&iacute;";b["238"]="&icirc;";b["239"]="&iuml;";b["240"]="&eth;";b["241"]="&ntilde;";b["242"]="&ograve;";b["243"]="&oacute;";b["244"]="&ocirc;";b["245"]="&otilde;";b["246"]="&ouml;";b["247"]="&divide;";b["248"]="&oslash;";b["249"]="&ugrave;";b["250"]="&uacute;";b["251"]="&ucirc;";b["252"]="&uuml;";b["253"]="&yacute;";b["254"]="&thorn;";b["255"]="&yuml;"}if(h!=="ENT_NOQUOTES"){b["34"]="&quot;"}if(h==="ENT_QUOTES"){b["39"]="&#39;"}b["60"]="&lt;";b["62"]="&gt;";for(d in b){if(b.hasOwnProperty(d)){e[String.fromCharCode(d)]=b[d]}}return e}};var Utils={formatDuration:function(d){var c="";var a=0;var b=0;d=parseInt(d);if(d>=60){b=Math.floor(d/60);d=d%60}if(b>=60){a=Math.floor(b/60);b=b%60}if(a>0){c=a+":"}if(b<10&&a>0){c+="0"}c+=b+":";if(d<10){c+="0"}c+=d;return c},convertUnixTimeStampToDate:function(a){return new Date(a*1000)},isToday:function(b){var a=new Date();return Utils.isSameDate(a,b)},isYesterday:function(b){var a=new Date();a.setTime(a.getTime()-86400000);return Utils.isSameDate(a,b)},isSameDate:function(b,a){if(b==null||a==null){return false}return b.getFullYear()==a.getFullYear()&&b.getMonth()==a.getMonth()&&b.getDate()==a.getDate()},shuffle:function(b){if(b.length>1){for(var c,a,d=b.length;d;c=parseInt(Math.random()*d),a=b[--d],b[d]=b[c],b[c]=a){}}return b},truncateString:function(c,a){var b="";if(c.length>a-3){b=' title="'+c+'"';c=c.substr(0,a)+"..."}return{text:c,tip:b}},isNumber:function(a){if(a.keyCode==46||a.keyCode==8||a.keyCode==37||a.keyCode==39){}else{if((a.keyCode<48||a.keyCode>57)&&(a.keyCode<96||a.keyCode>105)){a.preventDefault();return false}}return true},customCheckbox:function(a,b){var d=this;var c=$.extend({icon:{on:AppConfig.ASSETS_URL+"/css/skin/filmedia/images/form_check_on.gif",off:AppConfig.ASSETS_URL+"/css/skin/filmedia/images/form_check_off.gif"}},b);var e=function(g,h){var f="x-item-checked";if(h){g.attr("src",c.icon.on);g.addClass(f)}else{g.attr("src",c.icon.off);g.removeClass(f)}};a.hide().each(function(j){var g=$('<span class="custom-checkbox"/>');var f=$("<img/>");var i=$(this);var h=i.attr("name");if(typeof(h)!="undefined"&&h!=""){h=h.replace("[","\\[").replace("]","\\]")}g.insertBefore(i);g.append(i);f.insertBefore(i).bind("click",function(){i.attr("checked",!i.attr("checked"));e(f,i.attr("checked"))});if(typeof(h)!="undefined"){$("label[for="+h+"]").bind("click",function(){i.attr("checked",!i.attr("checked"));e(f,i.attr("checked"))})}e(f,i.attr("checked"))})},checkCustomCheckbox:function(a,b){if(a.parent().hasClass("custom-checkbox")){if(a.is(":checked")!=b){a.parent().find("img").trigger("click")}}},ucwords:function(a){return(a+"").replace(/^([a-z])|\s+([a-z])/g,function(b){return b.toUpperCase()})},reloadImage:function(a){if(a.length>0){var b=a.attr("src");b+=((b.search(/\?/)!=-1)?"&":"?")+"_="+(new Date()).getTime();a.attr("src",b)}},windowScrollTop:function(a,b){if(typeof(b)!="number"){b=500}$("html,body").animate({scrollTop:a},b)},trim:function(a){return a.replace(/^\s+|\s+$/g,"")},parse_str:function(d){var f={};if(/^#.*/.test(d)){d=d.substr(1)}var c=d.split("&");for(var b=0;b<c.length;b++){var e=c[b].split("=");var a=e[0];var g=e[1];if(Validator.isEmpty(a)){continue}if(typeof(g)=="undefined"){varl=""}f[a]=g}return f},parse_url:function(){var f={};var h=location.search;if(h.length>1){var d=h.substr(1);var c=d.split("&");for(var b=0;b<c.length;b++){var e=c[b].split("=");var a=e[0];var g=e[1];if(Validator.isEmpty(a)){continue}if(typeof(g)=="undefined"){varl=""}f[a]=g}}return f},getShuffledNumbers:function(f,e){if(f.length<=e){return f}var b=[];var a=Math.min(e,f.length);while(b.length<a){var d=Math.floor(Math.random()*f.length);var c=f[d];if($.inArray(c,b)==-1){b.push(c)}}return b},urlEncode:function(g){var e="";var a=0;g=g.toString();var f=/(^[a-zA-Z0-9_.]*)/;while(a<g.length){var d=f.exec(g.substr(a));if(d!=null&&d.length>1&&d[1]!=""){e+=d[1];a+=d[1].length}else{if(g[a]==" "){e+="+"}else{var c=g.charCodeAt(a);var b=c.toString(16);e+="%"+(b.length<2?"0":"")+b.toUpperCase()}a++}}return e},urlDecode:function(b){var d=b;var e,c;var a=/(%[^%]{2})/;while((match=a.exec(d))!=null&&match.length>1&&match[1]!=""){e=parseInt(match[1].substr(1),16);c=String.fromCharCode(e);d=d.replace(match[1],c)}return d},parsePageSetting:function(g,e){if(typeof(e)!="undefined"){for(var d in e){var f=e[d];var b=new RegExp("\\{"+d+"\\}");var c=new RegExp("\\{"+d+":(\\d+)\\}");if(b.test(g)){g=g.replace(b,f)}else{if(c.test(g)){var a=parseInt(c.exec(g)[1]);if(a>10){f=f.substr(0,a-3)+"..."}g=g.replace(c,f)}}}}return HtmlUtils.htmlentities(g)}};function isIPad(){return navigator.userAgent.match(/iPad/i)!=null}function isIPhone(){return navigator.userAgent.match(/iPhone/i)!=null}function isAndroid(){return navigator.userAgent.match(/Android/i)!=null}function isIOS(){return isIPad()||isIPhone()}function isMobile(){return isIPad()||isIPhone()||isAndroid()}function debug(b,a){if(typeof(window.console)!="undefined"&&!$.browser.msie){if(a=="info"){console.info(b)}else{console.log(b)}}}function debug_info(a){debug(a,"info")}function getScript(a){var b=document.createElement("script");b.type="text/javascript";b.async=true;b.src=a;(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(b)}var DisqusUtil={api_key:"",remote_auth_s3:"",config:function(a){if(a.api_key){this.api_key=a.api_key}if(a.auth){this.remote_auth_s3=a.auth;this.setLogoutLink()}},login:function(){sendNotification(AppNotification.SHOW_LOGIN_FORM)},logout:function(a){$.ajax({url:"/logout",complete:function(b){location=a}})},refresh:function(){if($("#disqus_thread").length<1){return}$.ajax({url:"/auth/disqus_session",data:{method:"/auth/disqus_session"},type:"POST",cache:false,dataType:"json",success:function(a){DisqusUtil.remote_auth_s3=a.auth;DisqusUtil.reload(window.disqus_identifier,window.disqus_url)}})},reload:function(b,a){debug("Load Disqus thread--> "+b+"::"+a);if(typeof(DISQUS)=="undefined"){return}if(DisqusUtil.remote_auth_s3==""){DISQUS.reset({reload:true,config:function(){this.page.api_key=DisqusUtil.api_key;this.page.identifier=b;this.page.url=a;this.container_id="disqus_thread"}})}else{DISQUS.reset({reload:true,config:function(){this.page.api_key=DisqusUtil.api_key;this.page.identifier=b;this.page.url=a;this.page.remote_auth_s3=DisqusUtil.remote_auth_s3;this.container_id="disqus_thread"}});DisqusUtil.setLogoutLink()}},setLogoutLink:function(){var a="#disqus_logout";if($(a).length==1){var b=$(a).attr("rel");$.ajax({url:"/auth/disqus_logout_link",type:"POST",data:{link:b},success:function(c){debug(c)}})}else{setTimeout(function(){DisqusUtil.setLogoutLink()},500)}},getLatestComments:function(a){$.ajax({url:"/data/disqus_comments",dataType:"xml",cache:false,success:function(b){if(a){a(b)}}})}};var Validator={isValidEmail:function(a){return/^([a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|cat|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)(,|;)?)+$/.test(a.toLowerCase())},hasValidEmail:function(a){return/([a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|cat|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)(,|;)?)+/.test(a.toLowerCase())},isEmpty:function(a){return typeof(a)=="undefined"||a==""||a==null},isUpdated:function(c){var a=c.attr("oValue");var b=c.val();return !this.isEmpty(b)&&a!=b}};var StatusEnum=Objs("com.cultureunplugged.app.model.enum.SattusEnum",{ordinal:null,value:null,initialize:function(b,a){this.value=b;this.ordinal=a},equals:function(a){return(this.ordinal==a.ordinal&&this.value==a.value)}});StatusEnum.LIVE=new StatusEnum("LIVE",0);StatusEnum.ARCHIVED=new StatusEnum("ARCHIVED",1);StatusEnum.SUSPENDED=new StatusEnum("SUSPENDED",2);var Templates={load:function(a){if(typeof(this[a])!="undefined"){return this[a].join("\n")}},pagination:['<div class="pagination">',"<form>",'<div class="page-first"></div>','<div class="page-prev"></div>','<input class="page-current" name="page-current" value="1"/>','<div class="page-next"></div>',"</form>","</div>"],movieInfo:['<div class="movie-info">','<div class="movie-preview"></div>','<div class="movie-thumb"></div>','<div class="info-mask">','<div class="movie-title"></div>','<div class="movie-from"><span>from:</span> <span class="x-value"></span><span class="x-separator">|</span><span class="x-country"></span></div>','<div class="movie-views"><span>Views:</span> <span class="x-value"></span></div>','<div class="movie-genre"><span class="x-value"></span></div>','<div class="movie-ca">','<b>Director:</b> <span class="movie-director"></span>','<span class="x-separator">|</span>','<b>Genre:</b> <span class="movie-genre"></span>',"</div>",'<div class="movie-synopsis"><b>Synopsis:</b><p></p></div>',"</div>",'<div class="movie-duration"><span class="x-value"></span><div class="x-info">(i)</div></div>','<div class="movie-st">','<div class="movie-rating"><div></div></div>','<div class="movie-viewed"><span>Viewed:</span> <span class="x-value"></span></div>','<div class="movie-shared"><span>Shared:</span> <span class="x-value"></span></div>','<div class="movie-storyteller"></div>',"</div>","</div>"],movieSearchResult:['<div class="movie-info">','<div class="movie-thumb"></div>','<div class="info-mask">','<div class="info-header">','<span class="movie-title"></span>','<span class="sub-info">','(<span class="movie-genre"></span>','<span class="x-separator">|</span>','<span class="movie-duration"><span class="x-value"></span></span>)',"</span>","</div>",'<div class="movie-synopsis"><p></p></div>','<div class="movie-ca">','<b>Director:</b> <span class="movie-director"></span> |','<b>Producer:</b> <span class="movie-producer"></span><br/>','<b>Produced In:</b> <span class="movie-year"></span> | ','<b>Country:</b> <span class="movie-country"></span>','<span class="movie-tags"> | ','<b>Tags: </b> <span class="x-value"></span>',"</span>","</div>","</div>","</div>"],storytellerSearchResult:['<div class="user-info">','<div class="user-thumb"></div>','<div class="info-mask">','<div class="info-header">','<span class="user-name"></span>','<span class="user-from">, from <span class="user-country"></span></span>',"</div>",'<div class="user-movies">','<i>Film(s):</i> <span class="user-movie-list"></span>',"</div>",'<div class="about"><i>About:</i> <span class="tag-list"></span></div>',"</div>","</div>"],movieInfoPopup:['<div class="popup-movie-info">','<div class="popup-info-container">','<div class="movie-info-container">','<div class="movie-title"><span class="x-value"></span> : </div>','<div class="movie-info-container">','<b>Director:</b> <span class="movie-director"></span> |','<b>Producer:</b> <span class="movie-producer"></span><br/>','<b>Genre:</b> <span class="movie-genre"></span> | ','<b>Produced In:</b> <span class="movie-year"></span> | ','<b>Story Teller\'s Country:</b> <span class="storyteller-country"></span>','<div class="movie-tags">','<b>Tags: </b> <span class="x-value"></span>',"</div>","</div>","</div>","<p>",'<b>Synopsis:</b> <span class="movie-synopsis"></span>',"</p>","<p>&nbsp;</p><p>",'<span class="movie-watchnow">Watch Now</span>',"</p>","</div>","</div>"],synopsisPopup:['<div class="popup-movie-synopsis">','<div class="popup-info-container">','<div class="movie-title"></div>',"<p>",'<span class="info-label">Synopsis:</span> <span class="movie-synopsis"></span>',"</p>","<p>&nbsp;</p><p>",'<span class="movie-watchnow">Watch Now</span>',"</p>","</div>","</div>"],messagePopup:["<div>",'<div class="popup-info-container">','<div class="popup-title"></div>','<div class="popup-content"></div>','<div class="popup-buttons"><button class="popup-ok-button">OK</button></div>',"</div>","</div>"],historyList:['<div class="item-block">','<div class="date"></div>',"<ul></ul>","</div>"],thankYouRegister:['<div class="thx">','<div class="title">Congratulations!</div>','<div class="desc">Thank you for registering. We have sent you the link to activate your account at {email}.<br/>Please check your email and activate the account by clicking on the link.</div>',"</div>"],dropdownList:['<div class="dropdownlist">',"<ul></ul>","</div>"],previewPlayer:['<div class="preview-container">','<div class="preview-inner">','<div class="title"></div>','<div class="from">from:<span class="x-value"></span></div>','<div class="preview-player">','<div class="embed-preview-player"></div>','<div class="thumbnail"></div>',"</div>",'<div class="preview-controls">','<div class="preview-button" title="watch short teaser">Preview</div>','<div class="pause-button">Pause</div>','<div class="full-screen-button">View</div>','<div class="duration"></div>',"</div>","</div>","</div>"],animatedDotLoading:['<span class="dot-loading">','<span class="message"></span><img src="/images/ani_dot_loader.gif"/>',"</span>"],spinner:['<div class="spinner">','<div class="bar1"></div><div class="bar2"></div><div class="bar3"></div><div class="bar4"></div><div class="bar5"></div><div class="bar6"></div><div class="bar7"></div><div class="bar8"></div><div class="bar9"></div><div class="bar10"></div><div class="bar11"></div><div class="bar12"></div>',"</div>"],videoPlayer:['<div class="jp-video">','<div class="jp-type-single">','<div class="jp-jplayer"></div>','<div class="jp-gui">','<div class="jp-video-play">','<a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>',"</div>",'<div class="jp-interface">','<div class="jp-controls-holder">','<a href="javascript:;" class="jp-play" tabindex="1">play</a>','<a href="javascript:;" class="jp-pause" tabindex="1">pause</a>','<a href="javascript:;" class="jp-volume-button" tabindex="1">volume</a>','<a href="javascript:;" class="jp-full-screen" tabindex="1" title="full screen">full screen</a>','<a href="javascript:;" class="jp-restore-screen" tabindex="1" title="restore screen">restore screen</a>','<div class="jp-progress">','<div class="jp-progress-bg"></div>','<div class="jp-seek-bar">','<div class="jp-play-bar"></div>',"</div>","</div>","</div>",'<div class="jp-current-time"></div>','<div class="jp-time-separator">/</div>','<div class="jp-duration"></div>','<div class="jp-volume-bar">','<div class="jp-volume-bar-value"></div>',"</div>","</div>","</div>","</div>","</div>"],downloadIpadApp:[],getHtml5Video:function(a,c,e){var b=(typeof(e)!="undefined")?'id="'+e+'"':"";var d="<video "+b+' controls="controls"><source src="'+a+'" type="video/mp4" /></video>';d+='<div class="vp-poster"><img src="'+c+'"/><div class="vp-video-play"><a href="javascript:;"  class="vp-play-icon">Play</a></div></div>';d+='<div class="vp-duration">00:00</div>';d+='<div class="vp-mature-tag"></div>';return d}};function $j(a){return document.getElementById(a)}function rollOverImage(a){if(a.src.indexOf("_rollover")==-1){a.src=a.src.replace(/(.+)\.(\w+)$/,"$1_rollover.$2")}}function normalImage(a){a.src=a.src.replace("_rollover","")}function rollOverInnerImage(b){var c=b.getElementsByTagName("img");for(var a=0;a<c.length;a++){if(c[a]){rollOverImage(c[a])}}}function normalInnerImage(c){var d=c.getElementsByTagName("img");for(var a=0;a<d.length;a++){try{if(d[a]){normalImage(d[a])}}catch(b){}}}function getLinkTVBrowseList(c,b,d,a){$.ajax({url:"/ajax/getLinkTVBrowseList.php",data:{numPerPage:a,type:c,cp:d,listType:b},cache:false,dataType:"json",success:function(e){$("#list_"+e.type).html(e.list)}})}function getMostViewedMovies(b,a){$(a).find(".header span").eq(0).removeClass("today alltime").addClass(b);$.ajax({url:"/ajax/getMostViewedMovies.php",data:{type:b},dataType:"html",cache:false,success:function(c){$(a).find(".list").eq(0).html(c)}})}var GenericPage=Objs("com.cultureunplugged.app.GenericPage",FabricationFacade,{initializeView:function(){GenericPage.$super.initializeView.call(this);this.registerMediator(new GenericPageMediator())}});GenericPage.getInstance=function(){if(!Facade.instance){Facade.instance=new GenericPage()}return Facade.instance};function showViewChangeOrg(){sendNotification("showViewChangeOrgDialog")}function showRegisterFilmMakerCommittee(){sendNotification("registerFilmMakerCommittee",null,null,10)}function showLoginPopup(){sendNotification("showLoginForm")}function showPayPalPolicy(){var a="https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=ua/AcceptableUse_print&locale.x=en_US";window.open(a,"paypalwindow","menubar=1,resizable=1,scrollbars=1,width=800,height=700")}var FestivalFilms=Objs("com.cultureunplugged.app.FestivalFilms",FabricationFacade,{initializeModel:function(){FestivalFilms.$super.initializeModel.call(this)},initializeController:function(){FestivalFilms.$super.initializeController.call(this)},initializeView:function(){FestivalFilms.$super.initializeView.call(this);this.registerMediator(new GenericPageMediator());this.registerMediator(new FestivalFilmsMediator())}});FestivalFilms.getInstance=function(){if(!Facade.instance){Facade.instance=new FestivalFilms()}return Facade.instance};var FilmediaFilms=Objs("com.cultureunplugged.app.FilmediaFilms",FabricationFacade,{initializeModel:function(){FilmediaFilms.$super.initializeModel.call(this)},initializeController:function(){FilmediaFilms.$super.initializeController.call(this);this.registerCommand(AppNotification.STARTUP,FilmediaFilmsStartupCommand);this.registerCommand(AppNotification.LOAD_CU_MOVIE_DATA,LoadCuMovieDataCommand)},initializeView:function(){FilmediaFilms.$super.initializeView.call(this);this.registerMediator(new GenericPageMediator());this.registerMediator(new FilmediaFilmsMediator());this.registerMediator(new RecommendedMovieListMediator())}});FilmediaFilms.getInstance=function(){if(!Facade.instance){Facade.instance=new FilmediaFilms()}return Facade.instance};var FilmediaStoryTellers=Objs("com.cultureunplugged.app.FilmediaStoryTellers",FabricationFacade,{initializeModel:function(){FilmediaStoryTellers.$super.initializeModel.call(this)},initializeController:function(){FilmediaStoryTellers.$super.initializeController.call(this)},initializeView:function(){FilmediaStoryTellers.$super.initializeView.call(this);this.registerMediator(new GenericPageMediator());this.registerMediator(new FilmediaStoryTellersMediator())}});FilmediaStoryTellers.getInstance=function(){if(!Facade.instance){Facade.instance=new FilmediaStoryTellers()}return Facade.instance};var Auth=Objs("com.cultureunplugged.app.Auth",FabricationFacade,{initializeModel:function(){Auth.$super.initializeModel.call(this)},initializeController:function(){Auth.$super.initializeController.call(this)},initializeView:function(){Auth.$super.initializeView.call(this);this.registerMediator(new AuthViewMediator($("#login-container")))}});Auth.getInstance=function(){if(!Facade.instance){Facade.instance=new Auth()}return Facade.instance};var VideoPlayerPage=Objs("com.cultureunplugged.app.VideoPlayerPage",FabricationFacade,{initializeModel:function(){VideoPlayerPage.$super.initializeModel.call(this);this.registerProxy(new CuApiProxy());this.registerProxy(new MovieProxy())},initializeController:function(){VideoPlayerPage.$super.initializeController.call(this);this.registerCommand(AppNotification.STARTUP,VideoPlayerStartupCommand);this.registerCommand(AppNotification.LOAD_CU_MOVIE_DATA,LoadCuMovieDataCommand)},initializeView:function(){VideoPlayerPage.$super.initializeView.call(this);this.registerMediator(new GenericPageMediator());this.registerMediator(new VideoPlayerMediator($(".video-player")));this.registerMediator(new RecommendedMovieListMediator());this.registerMediator(new ExploreCollectionsMediator())}});VideoPlayerPage.getInstance=function(){if(!Facade.instance){Facade.instance=new VideoPlayerPage()}return Facade.instance};var FindThat=Objs("com.cultureunplugged.app.FindThat",FabricationFacade,{initializeModel:function(){FindThat.$super.initializeModel.call(this);this.registerProxy(new UserProxy())},initializeController:function(){FindThat.$super.initializeController.call(this);this.registerCommand(AppNotification.LOAD_CU_MOVIE_DATA,LoadCuMovieDataCommand);this.registerCommand(AppNotification.LOAD_STORYTELLER_DATA,LoadStorytellerDataCommand)},initializeView:function(){FindThat.$super.initializeView.call(this);this.registerMediator(new GenericPageMediator());this.registerMediator(new SiteHistoryMediator());this.registerMediator(new FindThatViewMediator())}});FindThat.getInstance=function(){if(!Facade.instance){Facade.instance=new FindThat()}return Facade.instance};var NowPage=Objs("com.cultureunplugged.app.NowPage",FabricationFacade,{initializeModel:function(){NowPage.$super.initializeModel.call(this);this.registerProxy(new NowMovieProxy())},initializeController:function(){NowPage.$super.initializeController.call(this)},initializeView:function(){NowPage.$super.initializeView.call(this);this.registerMediator(new GenericPageMediator());this.registerMediator(new NowPageMediator())}});NowPage.getInstance=function(){if(!Facade.instance){Facade.instance=new NowPage()}return Facade.instance};var Movie=Objs("com.cultureunplugged.app.model.vo.Movie","com.cultureunplugged.utils.patterns.FabricationValueObject",{type:"cu",id:null,uid:null,url:"",title:"",director:"",producer:"",country:"",genre:"",year:"",from:"",duration:"",screenName:"",synopsis:"",countryFullName:"",genreId:null,thumbnail:"",large_thumb:"",small_thumb:"",playerLink:"",movieTags:[],userPhoto:"",storyTellerLink:"",storyTellerCountry:"",storyTellerCountryFullName:"",storyTellerName:"",views:0,numShared:0,rating:0,status:StatusEnum.SUSPENDED.value,allowEmbed:true,previewUrl:"",mature:false,_tags:[],_wiki:[],_setMovieTags:function(){if(this._tags.length<1&&this.movieTags!=null){this._tags=Movie.extractTags(this.movieTags,this.status)}return this._tags},getWikiItems:function(){if(this._wiki.length<1&&this.movieTags!=null){this._wiki=[];var a=[];for(var c=0;c<this.movieTags.length;c++){var e=this.movieTags[c];if(e.wikiLinks.length>0){var h=/^wiki_/.test(e.tag);for(var b=0;b<e.wikiLinks.length;b++){var f=e.wikiLinks[b];var g=f.tagLabel;if(Validator.isEmpty(g)){g=Utils.ucwords(e.tag)}var d='<a href="'+f.link+'" target="_blank">'+g+"</a>";if(h){this._wiki.push(d)}else{a.push(d)}}}}for(c=0;c<a.length;c++){this._wiki.push(a[c])}}return this._wiki},getMovieTagLinks:function(e){var c=this._setMovieTags();var b=[];for(var d=0;d<c.length;d++){var a=c[d];if(e){b.push('<a href="'+a.url+'">'+a.text+"</a>")}else{b.push(a.text)}}return b},getGenreLink:function(){var a=(this.status=="LIVE")?AppConfig.GENRE_URL:AppConfig.FM_GENRE_URL;a=a.replace("{0}",this.genreId);return'<a href="'+a+'">'+this.genre+"</a>"},getStoryTellerCountryLink:function(){var a=this.status=="LIVE"?AppConfig.ST_COUNTRY_URL:AppConfig.FM_ST_COUNTRY_URL;a=a.replace("{0}",this.storyTellerCountry);return'<a href="'+a+'">'+this.storyTellerCountryFullName+"</a>"},getShareLink:function(){return AppConfig.SERVER_URL+this.playerLink},hasTag:function(d){var b=this._setMovieTags();for(var c=0;c<b.length;c++){var a=b[c];if(a.text==d){return true}}return false}});Movie.extractTags=function(c,f){var a=[];if($.isArray(c)){var b;for(var d=0;d<c.length;d++){var e=c[d];if(e.showOnSite!="Y"){continue}if(f==StatusEnum.ARCHIVED.value){b=AppConfig.FM_TAG_URL.replace("{0}",e.tag)}else{b=AppConfig.TAG_URL.replace("{0}",e.tag)}a.push({url:b,text:Utils.ucwords(e.tag)})}}return a};var User=Objs("com.cultureunplugged.app.model.vo.User","com.cultureunplugged.utils.patterns.FabricationValueObject",{uid:null,screenName:"",firstName:"",lastName:"",organization:"",country:"",countryFullName:"",showOrganizationName:"",url:"",profilePhoto:"",hpp:false,movies:[],_tags:[],_setMovieTags:function(){if(this._tags.length<1&&this.movies.length>0){var c=[];for(var d=0;d<this.movies.length;d++){var e=this.movies[d].tags;c=$.merge(c,Movie.extractTags(e,this.movies[d].status))}var b=[];var a=[];for(d=0;d<c.length;d++){var e=c[d];if($.inArray(e.text,b)!=-1){continue}b.push(e.text);a.push(e)}this._tags=a}return this._tags},getAutoName:function(){if(this.showOrganizationName=="Y"&&!Validator.isEmpty(this.organization)){return this.organization}else{if(Validator.isEmpty(this.firstName)&&Validator.isEmpty(this.lastName)){return this.screenName}else{var a=this.firstName;if(!Validator.isEmpty(this.lastName)){a+=" "+this.lastName}return a}}},getProfileLink:function(){return"/storyteller/"+this.screenName},getThumbnail:function(){return this.profilePhoto},getMovieTagLinks:function(e){var c=this._setMovieTags();var b=[];for(var d=0;d<c.length;d++){var a=c[d];if(e){b.push('<a href="'+a.url+'">'+a.text+"</a>")}else{b.push(a.text)}}return b},getMovies:function(d,f){var a=[];var c=Math.min(d,this.movies.length);for(var e=0;e<c;e++){var b=this.movies[e];if(f){a.push('<a href="/documentary/watch-online/play/'+b.id+'">'+b.title+"</a>")}else{a.push(b.title)}}return a},getRandomMovieId:function(){if(this.movies.length<1){return -1}var a=this.movies.length>1?Math.floor(Math.random()*this.movies.length):0;return this.movies[a].id}});var SiteSearch=Objs("com.cultureunplugged.app.model.vo.SiteSearch","com.cultureunplugged.utils.patterns.FabricationValueObject",{method:"OR",type:"",tags:[],regions:[],country:-1,genreId:-1,duration:-1,interests:-1,individual:-1,scope:"festival",text:"",separator:"_",initialize:function(b,a){if(typeof(b)!="undefine"){this.type=b}else{this.type=SearchType.MOVIE}this.setValues(a)},setValues:function(b){if(typeof(b)=="object"){var c=this;for(var a in b){var d=b[a];if(a=="method"&&(d.toLowerCase()=="or"||d.toLowerCase()=="and")){this.method=d}if(a=="tags"){this.tags=[];if(typeof(d)=="string"){this.tags=d.split(this.separator)}else{if($.isArray(d)&&d.length>0){this.tags=d}}}if(a=="regions"){if(typeof(d)=="string"){this.regions=d.split(this.separator)}else{if($.isArray(d)&&d.length>0){this.regions=d}}}if(a=="country"&&d!=-1){this.country=d}if(a=="genreId"&&d!=-1){this.genreId=d}if(a=="duration"&&d!=-1){this.duration=d}if(a=="interests"&&d!=-1){this.interests=d}if(a=="individual"&&d!=-1){this.individual=d}if(a=="text"&&d!=""&&d!=null){this.text=d}if(a=="scope"){this.scope=d}}}},clearValues:function(){this.tags="";this.regions=[];this.country=-1;this.genreId=-1;this.duration=-1;this.interests=-1;this.individual=-1;this.text=""},equals:function(a){return(this.method.toLowerCase()==a.method.toLowerCase()&&this.type.toLowerCase()==a.type.toLowerCase()&&this.tags.toString()==a.tags.toString()&&this.regions.toString()==a.regions.toString()&&this.country==a.country&&this.genreId==a.genreId&&this.duration==a.duration&&this.interests==a.interests&&this.individual==a.individual&&this.scope.toLowerCase()==a.scope.toLowerCase()&&this.text.toLowerCase()==a.text.toLowerCase())},getData:function(){var a={};if(this.text!=""){a.text=this.text}a.type=this.type;if(this.tags.length>0){a.tags=this.tags.join(this.separator)}if(this.regions.length>0){a.regions=this.regions.join(this.separator)}if(this.country!=-1){a.country=this.country}if(this.genreId!=-1){a.genreId=this.genreId}if(this.duration!=-1){a.duration=this.duration}if(this.interests!=-1){a.interests=this.interests}if(this.individual!=-1){a.individual=this.individual}a.method=this.method;a.scope=this.scope;return a},isDefault:function(){if(this.type==SearchType.MOVIE){return this.text==""&&this.tags.length<1&&this.regions.length<1&&this.country==-1&&this.genreId==-1&&this.duration==-1}else{return this.text==""&&this.regions.length<1&&this.country==-1&&this.interests==-1&&this.genreId==-1}},toString:function(){return $.param(this.getData())}});var SearchType={MOVIE:"movie",STORYTELLER:"storyteller"};var LinkTvMovie=Objs("com.cultureunplugged.app.model.vo.LinkTvMovie","com.cultureunplugged.utils.patterns.FabricationValueObject",{type:"linkTV",id:null,url:"",title:"",description:"",pubDate:"",thumbnail:"",keywords:"",synopsis:"",renderData:function(){this.synopsis=this.description}});var NowMovie=Objs("com.cultureunplugged.app.model.vo.NowMovie","com.cultureunplugged.utils.patterns.FabricationValueObject",{id:null,date:"",embedCode:"",title:"",type:"",thumbnails:"",synopsis:"",source:"",getThumbnail:function(){return this.thumbnails}});var CuApiProxy=Objs("com.cultureunplugged.app.model.CuApiProxy",Proxy,{initialize:function(a,b){Proxy.prototype.initialize.call(this,CuApiProxy.NAME,b)},post:function(f,d,e){var b=AppConfig.API_URL+"/"+f;var c="POST";var a="jsonp";$.ajax({url:b,type:c,data:d,dataType:a,async:true,success:function(g){if(e!=null&&typeof(e)!="undefined"){e(g)}},error:function(g,i,h){}})}});CuApiProxy.NAME="cuApiProxy";var PageProxy=Objs("com.cultureunplugged.app.model.PageProxy",Proxy,{sections:{},initialize:function(a,b){Proxy.prototype.initialize.call(this,PageProxy.NAME,b)},load:function(d,c){if(typeof(this.sections[d])!="undefined"){if(c){c(this.sections[d])}return}var a="/data/page_settings",b=this;$.ajax({url:a,type:"GET",data:{section:d},dataType:"json",async:true,success:function(e){b.sections[d]=e.result;if(c){c(b.sections[d])}}})}});PageProxy.NAME="PageProxy";var MovieProxy=Objs("com.cultureunplugged.app.model.MovieProxy",Proxy,{api:null,movies:{},source:"cu",initialize:function(a,b){Proxy.prototype.initialize.call(this,MovieProxy.NAME,b)},onRegister:function(){this.api=this.facade.retrieveProxy(CuApiProxy.NAME)},loadMovieIds:function(a,c){var b=this;this.api.post("movielist/cu",a,function(d){if(c){c(d.results)}else{b.sendNotification(AppNotification.MOVIE_IDS_LOADED,d.results)}})},loadMovieData:function(e,g,i){if(isNaN(g)||e!="cu"){return}var c=AppNotification.MOVIE_DATA_LOADED;if(this.movies[g]){var b=this.movies[g];if(i){i(b)}else{this.sendNotification(c,b)}return}var a="/movie-data/cu-"+g+".json";var f="GET";var h="json";var d=this;$.ajax({url:a,type:f,data:null,dataType:h,async:true,cache:false,success:function(k){if(c!=""){var j=new Movie(k);d.movies[j.id]=j;if(i){i(j)}else{d.sendNotification(c,j)}}}})},submitRating:function(b,a,c){debug("movie id:"+b+", rating: "+a);$.ajax({url:"/ajax/rateTheMovie.php",data:{movieId:b,rating:a},type:"GET",dataType:"json",success:function(d){if(c){c(d)}}})},getWatchLaterList:function(a){$.ajax({url:"/ajax/getWatchLaterList.php",dataType:"json",cache:false,success:function(b){if(a){a(b)}}})},getMyDiscoverList:function(a,b){$.ajax({url:"/ajax/getMyFavorites.php",data:{type:a},dataType:"json",cache:false,success:function(c){if(b){b(c)}}})},updateExpressConsciousness:function(a,c,b){$.ajax({url:"/ajax/updateMovieRatingAttributes.php",data:{movieId:a,attrIds:c.join("|")},dataType:"json",success:function(d){if(b){b(d)}}})},loadSimilarMovies:function(a){},increaseViewCounter:function(a,b){$.ajax({url:"/ajax/viewMovie.php",data:{movieId:a.id,uid:b,movieType:a.type},cache:false,dataType:"json",type:"POST",success:function(c){}})},updateLastPlayedTime:function(a,b){$.ajax({url:"/ajax/saveMoviePlayedTime.php",data:{movieId:a.id,uid:b,movieType:a.type},cache:false,dataType:"json",type:"POST",success:function(c){}})}});MovieProxy.NAME="movieProxy";var LinkTvMovieProxy=Objs("com.cultureunplugged.app.model.LinkTvMovieProxy","com.cultureunplugged.app.model.MovieProxy",{source:"linktv",initialize:function(a,b){Proxy.prototype.initialize.call(this,LinkTvMovieProxy.NAME,b)},loadMovieIds:function(a,b){},loadMovieData:function(e,g,i){if(isNaN(g)||e!="linktv"){return}var c=AppNotification.LINKTV_MOVIE_DATA_LOADED;if(this.movies[g]){var b=this.movies[g];if(i){i(b)}else{this.sendNotification(c,b)}return}var a="/movie-data/linktv-"+g+".json";var f="GET";var h="json";var d=this;$.ajax({url:a,type:f,data:null,dataType:h,async:true,cache:false,success:function(k){if(c!=""){var j=new LinkTvMovie(k);d.movies[j.id]=j;if(i){i(j)}else{d.sendNotification(c,j)}}}})}});LinkTvMovieProxy.NAME="LinkTvMovieProxy";var AuthProxy=Objs("com.cultureunplugged.app.model.AuthProxy",Proxy,{loggedInUser:null,initialize:function(a,b){Proxy.prototype.initialize.call(this,AuthProxy.NAME,b)},login:function(e,c,b,d){var a="/auth/login";$.ajax({url:a,dataType:"json",type:"POST",data:{loginId:e,password:c,captcha:b},success:function(f){if(d){d(f)}}})},register:function(b,c){var a="/auth/register";$.ajax({url:a,dataType:"json",type:"POST",data:b.serialize(),success:function(d){if(c){c(d)}}})},forgotPassword:function(b,c){var a="/auth/forgotPassword";$.ajax({url:a,dataType:"json",type:"POST",data:{email:b},success:function(d){if(c){c(d)}}})},getLoggedInUser:function(c){var a="/auth/loggedInUser";var b=this;$.ajax({url:a,dataType:"json",type:"POST",data:{action:"getLoggedInUser"},cache:false,success:function(d){if(d.isOK){b.loggedInUser=new User(d.result)}else{b.loggedInUser=null}b.sendNotification(AppNotification.LOGGEDIN_USER_LOADED,b.loggedInUser);if(c){c(b.loggedInUser)}}})},checkLoginSession:function(b){var a="/auth/check";$.ajax({url:a,dataType:"json",type:"GET",data:{},cache:false,success:function(c){if(b){b(c.isOK==1)}}})},isUserLoggedIn:function(){return this.loggedInUser!=null},getUserId:function(){if(this.isUserLoggedIn()){return this.loggedInUser.uid}return 0}});AuthProxy.NAME="authProxy";var SiteHistoryProxy=Objs("com.cultureunplugged.app.model.SiteHistoryProxy",Proxy,{api:null,initialize:function(a,b){Proxy.prototype.initialize.call(this,SiteHistoryProxy.NAME,b)},onRegister:function(){},addItem:function(a){if(!this.isValidUrl(a)){return}debug_info("Adding to History: "+a.toString());var b=this;$.ajax({url:"/site-history/addItem",data:{url:a},type:"post",dataType:"json",success:function(c){b.sendNotification(AppNotification.SITE_HISTORY_ADDED)}})},removeItem:function(){},isValidUrl:function(a){return(/\/storyteller\/.*/.test(a)||/\/play\/\d+/.test(a))},loadList:function(){var a=this;$.ajax({url:"/site-history/getItems",type:"get",dataType:"json",success:function(b){a.sendNotification(AppNotification.SITE_HISTORY_LOADED,b)}})}});SiteHistoryProxy.NAME="SiteHistoryProxy";var SearchProxy=Objs("com.cultureunplugged.app.model.SearchProxy",Proxy,{api:null,initialize:function(a,b){Proxy.prototype.initialize.call(this,SearchProxy.NAME,b)},onRegister:function(){this.api=this.facade.retrieveProxy(CuApiProxy.NAME)},search:function(c){var a="search/"+c.type.toLowerCase();var b=this;this.api.post(a,c.getData(),function(d){if(c.type==SearchType.MOVIE){b.sendNotification(AppNotification.MOVIE_IDS_LOADED,d.results)}else{b.sendNotification(AppNotification.STORYTELLER_IDS_LOADED,d.results)}})}});SearchProxy.NAME="SearchProxy";var UserProxy=Objs("com.cultureunplugged.app.model.UserProxy",Proxy,{users:{},initialize:function(a,b){Proxy.prototype.initialize.call(this,UserProxy.NAME,b)},onRegister:function(){},loadUserData:function(b,d){if(isNaN(b)){return}if(this.users[b]){this.onUserDataLoaded(this.users[b],d);return}var a="/user-data/user-"+b+".json",c=this;$.ajax({url:a,type:"GET",data:null,dataType:"json",async:true,cache:false,success:function(f){var e=new User(f);c.users[e.id]=e;c.onUserDataLoaded(e,d)}})},onUserDataLoaded:function(a,b){if(b){b(a)}else{this.sendNotification(AppNotification.STORYTELLER_DATA_LOADED,a)}}});UserProxy.NAME="UserProxy";var NowMovieProxy=Objs("com.cultureunplugged.app.model.NowMovieProxy",Proxy,{initialize:function(a,b){Proxy.prototype.initialize.call(this,NowMovieProxy.NAME,b)},getMovie:function(a,b){if(typeof(a)=="undefined"){a="thestream"}if(typeof(b)=="undefined"){b=$.datepicker.formatDate("yy-mm-dd",new Date())}var c=this;$.ajax({url:"/data/now_movie",data:{source:a,date:b},type:"GET",dateType:"json",cache:false,success:function(e){var d=new NowMovie(e);c.sendNotification(AppNotification.NOW_MOVIE_LOADED,d)}})}});NowMovieProxy.NAME="NowMovieProxy";var BeautyTipMediator=Objs("com.cultureunplugged.app.view.BeautyTipMediator",FabricationMediator,{initialize:function(){BeautyTipMediator.$super.initialize.call(this,BeautyTipMediator.NAME,null)},onRegister:function(){this.commonTip();this.adFree();this.previewPlayers();this.nowMovieTip()},commonTip:function(){$(".btToolTip").bt({cssClass:"bt-tooltip",fill:"rgba(255,255,255,1)",padding:20,closeWhenOthersOpen:true,offsetParent:$("body"),ajaxPath:["$(this).attr('rel')","div#tooltip-content"],ajaxCache:true,showTip:function(a){$(a).fadeIn(400)},shrinkToFit:true,hoverIntentOpts:{interval:0,timeout:2000},trigger:BeautyTipMediator.trigger})},adFree:function(){$("#adfree").bt({width:290,fill:"rgba(255,255,255,1)",padding:10,positions:["bottom"],closeWhenOthersOpen:true,offsetParent:$("body"),showTip:function(a){$(a).fadeIn(600)},shrinkToFit:true,spikeLength:14,cssStyles:{lineHeight:"15px",fontSize:"12px",fontFamily:"Times New Roman"},trigger:BeautyTipMediator.trigger})},previewPlayers:function(a){$(".preview-container").find(".thumbnail a").attr("title","").bt({cssClass:"bt-tooltip",fill:"rgba(255,255,255,1)",padding:20,strokeWidth:2,spikeLength:20,closeWhenOthersOpen:true,offsetParent:$("#wrapper"),width:240,ajaxPath:["$(this).attr('infoUrl')"],ajaxCache:true,positions:["left","right","bottom","top"],showTip:function(b){$(b).fadeIn(400)},shrinkToFit:true,hoverIntentOpts:{interval:0,timeout:500}})},nowMovieTip:function(){$(".now-tabs").find(".title").bt({width:250,fill:"rgba(255,255,255,1)",contentSelector:"$('#now-player-info').html()",offsetParent:$("#wrapper"),positions:["bottom"],showTip:function(a){$(a).fadeIn(400)},cssStyles:{fontSize:"11px"},trigger:BeautyTipMediator.trigger})}});BeautyTipMediator.NAME="BeautyTipMediator";BeautyTipMediator.Trigger="hover";BeautyTipMediator.dismissIfIos=function(a,b){};var PaginationMediator=Objs("com.cultureunplugged.app.view.PaginationMediator",FabricationMediator,{currentPage:1,initialize:function(){PaginationMediator.$super.initialize.call(this,PaginationMediator.NAME,null)},respondToUpdatePageNumber:function(a){var b=a.getBody();this.currentPage=parseInt(b.page);$(b.parentClass).find(".pagination .page-current").val(b.page)},respondToPageComponentCreated:function(b){var d=this;var a=b.getBody();var c=".pagination[rel="+a+"]";$(c).find(".page-first").bind("click",function(){d.sendNotification(AppNotification.GOTO_PAGE,{parentClass:a,direction:0})});$(c).find(".page-prev").bind("click",function(){d.sendNotification(AppNotification.GOTO_PAGE,{parentClass:a,direction:-1})});$(c).find(".page-next").bind("click",function(){d.sendNotification(AppNotification.GOTO_PAGE,{parentClass:a,direction:1})});$(c).find("form").bind("submit",function(f){return false});$(c).find("input[name=page-current]").bind("keydown",function(f){return Utils.isNumber(f)}).bind("keyup",function(g){if(g.keyCode==13){var f=parseInt($(this).val());if(f==""||f==null||f==0||f>=d.currentPage){$(this).val(d.currentPage)}else{d.sendNotification(AppNotification.GOTO_PAGE,{parentClass:a,page:f})}}})}});PaginationMediator.NAME="paginationMediator";var ToolbarMediator=Objs("com.cultureunplugged.app.view.ToolbarMediator",FabricationMediator,{authProxy:null,initialize:function(a,b){ToolbarMediator.$super.initialize.call(this,ToolbarMediator.NAME,null)},onRegister:function(){this.authProxy=this.facade.retrieveProxy(AuthProxy.NAME);this.registerEvents()},registerEvents:function(){var a=this;$("#toolBar").find("a.nav-report-bug").bind("click",function(b){a.onClickReportBug();return false});$("#sendInvite").bind("click",function(b){a.onClickSendInvite();return false});$("#toolBar").find("a.nav-collaborate").bind("click",function(b){a.sendNotification("showPostProjectDialog");return false});$("a.nas-profile").bind("click",function(){a.onClickMyProfile();return false})},onClickMyProfile:function(){var a=this;this.authProxy.checkLoginSession(function(b){if(b){location="/profile.php";return}a.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){location="/profile.php";return}})})},onClickSendInvite:function(){if(!this.authProxy.isUserLoggedIn()){var a=this;this.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){setTimeout(function(){a.onClickSendInvite()},10)}});return}location="/documentary/watch-online/festival/inviteFriends.php"},onClickReportBug:function(){this.sendNotification("showReportBugDialog")}});ToolbarMediator.NAME="ToolbarMediator";var DialogMediator=Objs("com.cultureunplugged.app.view.DialogMediator",FabricationMediator,{respondToShowSendEmailToFilmMakerDialog:function(c){var e=c.getBody();var a=e.name;var f="To: "+e.name;var b=e.uid;var d=e.collaborate;if(d==1){f="I WISH TO COLLABORATE WITH:";a=e.name}this.show({title:f,type:"iframe",url:"/popups/filmedia/sendEmailToStoryTeller.php?st="+b+"&name="+escape(a)+"&exploreWork="+d,width:340,height:480,paddingLeft:25})},respondToShowMakeSuggestion:function(a){this.show({title:"MAKE SUGGESTIONS:",type:"iframe",url:"/popups/festival/makeSuggestions.php",width:340,height:480,paddingLeft:34})},respondToShowReportBugDialog:function(a){this.show({title:"REPORT PROBLEM:",type:"iframe",url:"/popups/filmedia/reportProblem.php",width:338,height:440,paddingLeft:25})},respondToShowRequestOnlineScreeningDialog:function(b){var a=b.getBody();this.show({title:"To: "+a.storyTellerName,type:"iframe",url:"/popups/requestOnlineScreening.php?movieId="+a.id,width:380,height:250,paddingLeft:30})},respondToShowContributeDialog:function(d){var e=d.getBody();var f=this;var c=e.uid;var a=e.movieId;var b=e.name;var g=e.title;$.ajax({url:"/user-data/"+c+".json",dataType:"json",success:function(h){if(h.hpp){f.show({title:"CONTRIBUTE TO PROMOTE KINDNESS",type:"iframe",url:"/popups/contribute.php?st="+c+"&movieId="+a+"&name="+b+"&title="+g,width:850,height:860,paddingLeft:82})}else{f.show({title:"CONTRIBUTE TO PROMOTE KINDNESS",type:"iframe",url:"/popups/noContribute.php?st="+c+"&name="+b+"&title="+g,width:686,height:540,paddingLeft:82})}}})},respondToShowPostProjectDialog:function(a){if(!this.isUserLoggedIn(a)){return}this.show({title:"POST FILM/MEDIA PROJECT:",type:"iframe",url:"/popups/filmedia/postProject.php",width:607,height:760,paddingLeft:34})},respondToShowViewChangeOrgDialog:function(a){this.show({title:"VIEWCHANGE.ORG",type:"iframe",url:"/popups/viewchangeorg.php",width:820,height:950,paddingLeft:20})},respondToShowReplyMessageDialog:function(a){var b=a.getBody(),c=b.msgId;this.show({title:"REPLY:",type:"iframe",url:"/popups/filmedia/replyMessage.php?msgId="+c,width:345,height:270,paddingLeft:34})},respondToShowUpdateProfileDialog:function(a){this.show({title:"UPDATE INFO:",type:"iframe",url:"/popups/festival/profile_updateInfo.php",width:429,height:348,paddingLeft:50})},respondToShowUploadUserPhotoDialog:function(a){this.show({title:"Update My Photo:",type:"iframe",url:"/popups/filmedia/profile_uploadPhoto.php",width:400,height:140,paddingLeft:34})},respondToShowSetupContributeDialog:function(a){this.show({title:"SET ACCOUNT TO RECEIVE CONTRIBUTION :",type:"iframe",url:"/popups/setupContribute.php",width:540,height:300,paddingLeft:24,titleSlicePoint:100})},respondToShowExpressDialog:function(c){var e=c.getBody(),d=e.mode=="edit",b=e.uid,a=(d)?"/popups/filmedia/updateExpress.php":"/popups/filmedia/showExpress.php?userId="+b;this.show({title:"Social Pang, my Heart Bleeds for Mind Dwells on:",type:"iframe",url:a,width:486,height:380,paddingLeft:34,titleSlicePoint:100})},respondToShowUploadPhotoMusicDialog:function(a){this.show({title:"Stills / Photos / Music:",type:"iframe",url:"/popups/filmedia/uploadPhotoMusic.php",width:570,height:205,paddingLeft:34})},respondToShowUploadScriptsDialog:function(a){this.show({title:"Scripts / Synopsis:",type:"iframe",url:"/popups/filmedia/uploadScripts.php",width:486,height:255,paddingLeft:34})},respondToShowLookingForFundDialog:function(a){this.show({title:"Looking For Fund / People:",type:"iframe",url:"/popups/filmedia/lookingForFund.php",width:486,height:375,paddingLeft:34})},respondToShowUpdateAwardsDialog:function(a){this.show({title:"Awards / Press:",type:"iframe",url:"/popups/filmedia/awardspress.php",width:600,height:560,paddingLeft:34})},respondToShowBlogPostDialog:function(a){var d=a.getBody(),c="";if(typeof(d)!="undefined"){var b=typeof(d.mode)!="undefined"&&d.mode=="edit";if(b){c="?mode=edit&postId="+d.postId}}this.show({title:"Blog Post:",type:"iframe",url:"/popups/filmedia/blogPost.php"+c,width:600,height:362,paddingLeft:34})},initialize:function(){DialogMediator.$super.initialize.call(this,DialogMediator.NAME,null)},onRegister:function(){this.authProxy=this.facade.retrieveProxy(AuthProxy.NAME);this.createDialog()},respondToShowDialog:function(a){this.show(a.getBody())},respondToHideDialog:function(a){this.close()},isUserLoggedIn:function(a){if(!this.authProxy.isUserLoggedIn()){this.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){sendNotification(a.getName(),a.getBody())}},null,10);return false}return true},createDialog:function(){var a=this;$("body").append('<div id="dialog-popup"><div class="dialog-title"></div><div class="dialog-content"><iframe frameborder="0" allowTransparency="true"></iframe></div></div>');this.viewComponent=$("#dialog-popup");this.viewComponent.dialog({width:486,height:"auto",minHeight:360,modal:true,autoOpen:false,closeOnEscape:false,resizable:false,position:["center",150],zIndex:9999,draggable:false,open:function(b,c){},close:function(b,c){a.viewComponent.find("iframe").eq(0).attr("src","/popups/blank.html").hide()}})},show:function(c){var d=$(window).height()-60;if(c.height>d){c.height=d}if(c.type=="iframe"){var a=this.viewComponent.find("iframe").eq(0);a.attr("src",c.url);a.width(c.width).height(c.height);a.show()}var e=typeof(c.title)!="undefined"?c.title:"";var b=33;if(typeof(c.titleSlicePoint)!="undefined"){b=parseInt(c.titleSlicePoint);if(b<3){b=e.length}}if(e.length>b){e=e.substr(0,b-3)+"..."}if(typeof(c.paddingLeft)!="undefined"){e='<span style="padding-left:'+c.paddingLeft+'px">'+e+"</span>"}this.viewComponent.find(".dialog-content").width(c.width).height(c.height);this.viewComponent.dialog("option","title",e);this.viewComponent.dialog("option","width",c.width);this.viewComponent.dialog("option","height",c.height+36);this.viewComponent.parent().css({position:"fixed"}).end().dialog("open")},close:function(){this.viewComponent.dialog("close")},authProxy:null});DialogMediator.NAME="DialogMediator";var PreviewPlayerMediator=Objs("com.cultureunplugged.app.view.PreviewPlayerMediator",FabricationMediator,{embedClass:"embed-preview-player",playerSwf:"/swf/preview2.swf",players:[],movieProxy:null,initialize:function(){PreviewPlayerMediator.$super.initialize.call(this,PreviewPlayerMediator.NAME,null)},onRegister:function(){this.movieProxy=this.facade.retrieveProxy(MovieProxy.NAME);this.registerEvents()},registerEvents:function(){if(isMobile()){this._setHtml5Players()}this.registerItemEvents($(".preview-container"))},registerItemEvents:function(b){var a=this;b.find(".preview-button").bind("click",function(){a.onClickPreviewButton(a.findRoot($(this)));return false});b.find(".pause-button").bind("click",function(){a.onClickPauseButton(a.findRoot($(this)));return false});b.find(".full-screen-button").bind("click",function(){var c=$(this).attr("rel");location=c;return false})},respondToSetPreviewPlayer:function(b){var c=b.getBody();var d=c.container;var a=c.movie;var e=Utils.formatDuration(a.duration);d.attr("movieId",a.id);d.find(".title").html('<a href="'+a.playerLink+'">'+a.title+"</a>");d.find(".from .x-value").html('<a href="'+a.storyTellerLink+'">'+a.from+"</a>");d.find(".thumbnail").html('<a href="'+a.playerLink+'"><img src="'+a.small_thumb+'"/></a>');d.find(".full-screen-button").attr("rel",a.playerLink);d.find(".duration").html(e);this.registerItemEvents(d)},respondToPausePreview:function(b){var a=b.getBody().movieId;var c=this.findObject(a);if(c!=null){c.root.removeClass("playing")}},respondToPauseOtherPreviews:function(d){var a=d.getBody().movieId;for(var c=0;c<this.players.length;c++){var e=this.players[c];if(a==e.movieId){e.root.addClass("playing")}else{e.root.removeClass("playing")}var b=this.getPlayer(e.id);if(b&&b.checkMovie){b.checkMovie(a)}else{if(b&&b.pause){b.pause()}}}},onClickPreviewButton:function(b){var c=b.attr("movieId");var d=this,e=b.find(".preview-player").eq(0),a=this.findRoot(e);a.addClass("playing");this.sendNotification(AppNotification.PAUSE_OTHER_PREVIEWS,{movieId:c});if(isMobile()){this.playHtml5Video(e,c)}else{this.movieProxy.loadMovieData("cu",c,function(f){d.playFlashVideo(e,f)})}},onClickPauseButton:function(a){this.sendNotification(AppNotification.PAUSE_OTHER_PREVIEWS,{movieId:-1})},playFlashVideo:function(f,b){if(!f.hasClass("active")){f.addClass("active");var d="previewPlayer_"+b.id+"_"+this.players.length;var e={video:b.previewUrl,u:b.uid,m:b.id,sURL:AppConfig.SERVER_URL};f.find("."+this.embedClass).flashembed({name:d,id:d,src:this.playerSwf,version:AppConfig.FLASH_VERSION,menu:false,wmode:"opaque",bgColor:"#2A1F28",width:208,height:120,flashvars:$.param(e)});var a=this.findRoot(f);a.addClass("playing");this.players.push({id:d,root:a,movieId:b.id})}else{var g=this.findObject(b.id);var c=this.getPlayer(g.id);if(c&&c.playVideo){c.playVideo()}}},playHtml5Video:function(e,c){if(!e.hasClass("active")){e.addClass("active");var a=this.findRoot(e);a.addClass("playing");a.find(".thumbnail").remove();this.players.push({id:e.find("video").eq(0).attr("id"),root:a,movieId:c})}var b=e.attr("rel");var d=document.getElementById("previewPlayer_"+b);d.play()},_setHtml5Players:function(){var a=this;$("."+this.embedClass).show();$(".preview-container").each(function(){var c=$(this).attr("movieId"),e=$(this).find(".preview-player").eq(0),b=c+"_"+a.players.length,d="previewPlayer_"+b;e.attr("rel",b);e.find("video").eq(0).attr("id",d)})},getPlayer:function(a){if(isMobile()){return document.getElementById(a)}return($.browser.msie)?window[a]:document[a]},findRoot:function(c){var b=0;var a=c.parent();while(!a.hasClass("preview-container")&&b<5){b++;a=a.parent()}return a},findObject:function(a){for(var b=0;b<this.players.length;b++){var c=this.players[b];if(c.movieId==a){return c}}return null}});PreviewPlayerMediator.NAME="previewPlayerMediator";if(typeof(PreviewPlayer)=="undefined"){var PreviewPlayer={};PreviewPlayer.pauseCurrent=function(a){sendNotification(AppNotification.PAUSE_PREVIEW,{movieId:a})};PreviewPlayer.stopOthers=function(a){sendNotification(AppNotification.PAUSE_OTHER_PREVIEWS,{movieId:a})}}var TopFilmsMediator=Objs("com.cultureunplugged.app.view.TopFilmsMediator",SearchMediator,{initialize:function(a,b){TopFilmsMediator.$super.initialize.call(this,TopFilmsMediator.NAME,null)},onRegister:function(){return;this.registerEvents();this.loadDefaultList()},registerEvents:function(){var b=$(".topFilms");if(b.length<1){return}for(var c=0;c<b.length;c++){var a=b.eq(c);if(a.hasClass("now-screening")){this.viewComponent=a;this.registerNowScreeningEvents();break}}},registerNowScreeningEvents:function(){var a=this;this.viewComponent.find("a.today").bind("click",function(b){a.loadTodayTopFilms();return false});this.viewComponent.find("a.alltime").bind("click",function(b){a.loadAllTimeTopFilms();return false})},loadDefaultList:function(){if(this.viewComponent!=null){this.loadTodayTopFilms()}},loadTodayTopFilms:function(){this.movieProxy.loadMovieIds({type:"todayTopFilms"},this.onGetTopFilms)},loadAllTimeTopFilms:function(){this.movieProxy.loadMovieIds({type:"allTimeTopFilms"},this.onGetTopFilms)},onGetTopFilms:function(a){}});TopFilmsMediator.NAME="TopFilmsMediator";var GenericPageMediator=Objs("com.cultureunplugged.app.view.GenericPageMediator",FabricationMediator,{authProxy:null,movieProxy:null,pageProxy:null,linkTvMovieProxy:null,afterLogin:null,watchLaterDropdown:null,myDiscoverDropdown:null,reloadWatchLaterList:true,reloadMyDiscoverList:true,initialize:function(a,b){GenericPageMediator.$super.initialize.call(this,GenericPageMediator.NAME,null)},onRegister:function(){this.authProxy=new AuthProxy();this.movieProxy=new MovieProxy();this.pageProxy=new PageProxy();this.linkTvMovieProxy=new LinkTvMovieProxy();this.authProxy.getLoggedInUser();this.facade.registerCommand(AppNotification.POST_TO_TWITTER,PostToTwitterCommand);this.facade.registerCommand(AppNotification.ADD_TO_WATCHLATER,AddToWatchLaterCommand);this.facade.registerCommand(AppNotification.EMAIL_MOVIE_LINK,EmailMovieLinkCommand);this.facade.registerCommand(AppNotification.SEND_EMAIL_TO_STORY_TELLER,SendEmailToStoryTellerCommand);this.facade.registerCommand(AppNotification.SHOW_FACEBOOK_SHARE,FacebookShareCommand);this.facade.registerCommand(AppNotification.SHOW_MOVIE_INFO_POPUP,ShowMovieInfoPopupCommand);this.facade.registerCommand(AppNotification.SHOW_MOVIE_SYNOPSIS_POPUP,ShowMovieSynopsisPopupCommand);this.facade.registerCommand(AppNotification.REGISTER_FILMAKER_COMMITTEE,RegisterFilmMakerCommitteeCommand);this.facade.registerCommand(AppNotification.SEARCH,SearchCommand);this.facade.registerCommand(AppNotification.ADD_TO_SITE_HISTORY,AddToSiteHistoryCommand);this.facade.registerProxy(this.authProxy);this.facade.registerProxy(this.pageProxy);this.facade.registerProxy(new CuApiProxy());this.facade.registerProxy(new SiteHistoryProxy());this.facade.registerProxy(this.movieProxy);this.facade.registerProxy(this.linkTvMovieProxy);this.facade.registerMediator(new DialogMediator());this.facade.registerMediator(new PopupMediator());this.facade.registerMediator(new ToolbarMediator());this.facade.registerMediator(new PaginationMediator());this.facade.registerMediator(new PreviewPlayerMediator());this.facade.registerMediator(new BeautyTipMediator());this.facade.registerMediator(new TopFilmsMediator());if(isIOS()){this.facade.registerMediator(new IPadMediator())}if(this.isFilmediaPage()){this.createWatchLaterDropdown();this.createMyDiscoveryDropdown()}this.registerEvents();this.sendNotification(AppNotification.ADD_TO_SITE_HISTORY)},registerEvents:function(){var a=this;$("#welcome").find("a").bind("click",function(b){if(!a.requireLogin()){location="/profile.php"}return false});$("#filmsOnSelection").find("a").bind("click",function(){var b=$(this).attr("class").replace("films-on-","");$("#filmsOn").removeClass().addClass(b);return false});$("#sideVisitHistory").bind("click",function(){if(a.facade.hasMediator(SiteHistoryMediator.NAME)){a.sendNotification(AppNotification.SHOW_SITE_HISOTRY)}else{if($("body").hasClass("festival")){location="/festival/findit.php#view=history"}else{location="/filmedia/findit.php#view=history"}}return false});if(!this.isFilmediaPage()){return}$("a.nav-my-discovery").parent().bind("click",function(b){if(!a.requireLogin()){}return false}).hover(function(){if(a.authProxy.isUserLoggedIn()){a.showMyDiscoverDropDown()}},function(){a.hideMyDiscoverDropDown()});$("a.nav-watchlater-playlist").parent().bind("click",function(b){if(!a.requireLogin()){}return false}).hover(function(){if(a.authProxy.isUserLoggedIn()){var b=a.watchLaterDropdown.find("ul li").length;if(b<1){a.movieProxy.getWatchLaterList(function(e){var c=a.watchLaterDropdown.find("ul").eq(0);c.find("li").remove();if(e.result.length>0){for(var d=0;d<e.result.length;d++){var f=e.result[d];c.append('<li><a href="'+f.link+'" target="_blank">'+f.title+"</a></li>")}c.append('<li class="favUpdate"><a href="/documentary/watch-online/festival/profile.php">UPDATE</a></li>');c.find("li a").bind("click",function(g){location=$(this).attr("href");return true})}else{c.append("<li>You have no movies selected.</li>")}a.showWatchLaterDropDown()})}else{a.showWatchLaterDropDown()}}},function(){a.hideWatchLaterDropDown()})},respondToUpdatePageSettings:function(b){var e=this,c=b.getBody(),d=c.section,a=c.replacements;this.pageProxy.load(d,function(f){if(typeof(f.title)!="undefined"&&f.title!=""){$("title").text(Utils.parsePageSetting(f.title,a))}if(typeof(f.description)!="undefined"&&f.description!=""){$("meta[name=Description], meta[name=description]").attr("content",Utils.parsePageSetting(f.description,a))}if(typeof(f.keywords)!="undefined"&&f.keywords!=""){$("meta[name=Keywords], meta[name=keywords]").attr("content",Utils.parsePageSetting(f.keywords,a))}})},respondToUserLoggedIn:function(a){if(typeof(DisqusUtil)!="undefined"){DisqusUtil.refresh()}var b=this;this.authProxy.getLoggedInUser(function(c){if(b.afterLogin!=null){if(typeof(b.afterLogin)=="function"){b.afterLogin(c)}else{b.sendNotification(b.afterLogin)}}b.afterLogin=null});this.sendNotification(AppNotification.CLOSE_POPUP)},respondToLoggedInUserLoaded:function(b){var a=b.getBody();if(a!=null){$("a.nav-login").removeAttr("rel").removeAttr("title").attr("href","/logout").html("Log Out").unbind();$("#welcome").find("a").html("welcome, "+a.getAutoName())}},respondToMovieDataLoaded:function(e){var f=this;var b=e.getBody();if(typeof(b.id)!="undefined"&&!this.isDetailView()){var a="cu";var d=b.id;var c=$("."+a+"-"+d);c.each(function(){var q=$(this);var m=q.attr("index");var i=q.attr("view");q.addClass(b.status.toLowerCase());var j=Math.round(b.rating);if(j<0){j=0}var k=Utils.formatDuration(b.duration);var l=Utils.truncateString(b.title,f.getSlicePointOfMovieTitle());var h=b.countryFullName!=""?b.countryFullName:b.storyTellerCountryFullName;q.find(".movie-thumb").html('<a href="'+b.playerLink+'"><img src="'+b.small_thumb+'"/></a>');q.find(".movie-title").html('<a href="'+b.playerLink+'"'+l.tip+">"+l.text+"</a>");q.find(".movie-from span.x-value").html('<a href="'+b.storyTellerLink+'">'+b.from+"</a>");q.find(".movie-from span.x-country").html(h);q.find(".movie-views span.x-value").html(b.views);q.find(".movie-genre").html('<a href="genre.php?id='+b.genreId+'">'+b.genre+"</a>");q.find(".movie-director").html(b.director);q.find(".movie-rating div").removeClass().addClass("rate_"+j);q.find(".movie-viewed span.x-value").html(b.views);q.find(".movie-shared span.x-value").html(b.numShared);q.find(".movie-storyteller").html('<a href="'+b.storyTellerLink+'"><img src="'+b.userPhoto+'"/></a>');q.find(".movie-duration .x-value").html(k);q.find(".movie-producer").html(b.producer);q.find(".movie-year").html(b.year);q.find(".movie-country").html(b.countryFullName);var g=0;if(f.isThumbView()){var o=b.from.length+b.country.length;if(o>26){g=Math.round(o/2)}}q.find(".movie-synopsis p").html(b.synopsis).expander({slicePoint:f.getSlicePointOfSynopsis(i)-g,expandText:"",userCollapseText:""}).find("span.read-more").eq(0).append('<span class="more-synopsis" rel="'+b.id+'">(<span>more</span>)</span>');var n=b.getMovieTagLinks(true);if(n.length>0){q.find(".movie-tags .x-value").html(n.join(", "));q.find(".movie-tags").show()}else{q.find(".movie-tags").hide()}var p=q.find(".preview-container").eq(0);f.sendNotification(AppNotification.SET_PREVIEW_PLAYER,{container:q.find(".preview-container").eq(0),movie:b});q.find(".movie-thumb a, .movie-title a, .preview-container .thumbnail a, .preview-container .title a").bind("click",function(r){if(f.isFilmsPage()){r.stopPropagation();f.sendNotification(AppNotification.LOAD_VIDEO,{index:m,movieId:b.id});return false}return true});q.find(".movie-duration .x-info").bind("click",function(r){f.sendNotification(AppNotification.SHOW_MOVIE_INFO_POPUP,{source:a,movieId:d,index:m})});q.find(".more-synopsis").bind("click",function(r){f.sendNotification(AppNotification.SHOW_MOVIE_SYNOPSIS_POPUP,{source:a,movieId:d,index:m})});q.css("visibility","visible");f.sendNotification(AppNotification.MOVIE_ITEM_ADDED)})}},respondToStoryTellerDataLoaded:function(d){var e=this;var b=d.getBody();if(typeof(b.uid)!="undefined"){var c=b.uid;var a=$(".user-"+c);a.each(function(){var j=$(this);var h=j.attr("index");var g=j.attr("view");var l=b.getProfileLink();j.find(".user-thumb").html('<a href="'+l+'"><img src="'+b.getThumbnail()+'"/></a>');j.find(".user-name").html('<a href="'+l+'">'+b.getAutoName()+"</a>");j.find(".user-country").html(b.countryFullName);var i=b.getMovies(5,true);var k=i.join(", ");if(b.movies.length>5){k+=', <a href="'+l+'">More...</a>'}var f=b.getMovieTagLinks(true);if(f.length>0){j.find(".tag-list").html(f.join(", "));j.find(".about").css("visibility","visible")}else{j.find(".about").css("visibility","hidden")}j.find(".user-movie-list").html(k);j.css("visibility","visible");if(j.attr("show-movie")==1){e.sendNotification(AppNotification.LOAD_USER_MOVIE,b)}e.sendNotification(AppNotification.STORYTELLER_ITEM_ADDED)})}},respondToShowLoginForm:function(a){var b=a.getBody();if(b&&typeof(b.afterLogin)=="function"){this.afterLogin=b.afterLogin}else{this.afterLogin=b}this.requireLogin()},respondToScrollToTop:function(a){Utils.windowScrollTop(0)},requireLogin:function(){if(!this.authProxy.isUserLoggedIn()){$("a.nav-login").trigger("click");return true}return false},getSlicePointOfSynopsis:function(a){if(a=="thumb"){return 200}if(this.isSearchPage()){return 96}if(this.isThumbView()){return 165}else{if(this.isListView()){return 275}else{return 400}}},getSlicePointOfMovieTitle:function(){if(this.isThumbView()){return 30}else{if(this.isListView()){return 33}else{return 400}}},isThumbView:function(){return $("#wrapper").hasClass("thumb")},isListView:function(){return $("#wrapper").hasClass("list")},isDetailView:function(){return $("#wrapper").hasClass("detail")},isSearchPage:function(){return $(".find-search-result").length>0},isFilmsPage:function(){return $("#header").hasClass("n-films")},isFestivalPage:function(){return $("body").hasClass("festival")},isFilmediaPage:function(){return $("body").hasClass("filmedia")},createWatchLaterDropdown:function(){if(this.watchLaterDropdown==null){var a=Templates.load("dropdownList");this.watchLaterDropdown=$(a).attr("id","watchlatermainmenu");$(".nav-watchlater-playlist").parent().append(this.watchLaterDropdown)}},createMyDiscoveryDropdown:function(){if(this.myDiscoverDropdown==null){var c=this;var b=Templates.load("dropdownList");this.myDiscoverDropdown=$(b).attr("id","favoritesubmenu");var a=this.myDiscoverDropdown.find("ul").eq(0);a.append('<li class="discover-films"><a href="#">FILMS</a><ul class="submenu"></ul></li>');a.append('<li class="discover-storyteller"><a href="#">STORY.TELLERS</a><ul class="submenu"></ul></li>');$(".nav-my-discovery").parent().append(this.myDiscoverDropdown);a.find("li.discover-films a").bind("click",function(d){var f=$(this).parent();c.updateMyDiscoverList("film",f,c.reloadWatchLaterList);c.reloadWatchLaterList=false;return false});a.find("li.discover-storyteller a").bind("click",function(d){var f=$(this).parent();c.updateMyDiscoverList("storyteller",f,c.reloadMyDiscoverList);c.reloadMyDiscoverList=false;return false})}},showWatchLaterDropDown:function(){this.watchLaterDropdown.show()},hideWatchLaterDropDown:function(){this.watchLaterDropdown.hide()},showMyDiscoverDropDown:function(){this.myDiscoverDropdown.find(".submenu").hide();this.myDiscoverDropdown.show()},hideMyDiscoverDropDown:function(){this.myDiscoverDropdown.find(".submenu").hide();this.myDiscoverDropdown.hide()},updateMyDiscoverList:function(b,c,a){this.myDiscoverDropdown.find(".submenu").hide();if(!a){c.find("ul.submenu").eq(0).show()}this.movieProxy.getMyDiscoverList(b,function(f){var d=c.find("ul.submenu").eq(0);d.find("li").remove();if(f.result.length>0){for(var e=0;e<f.result.length;e++){var g=f.result[e];d.append('<li><a href="'+g.link+'">'+g.title+"</a></li>")}d.append('<li class="favUpdate"><a href="/documentary/watch-online/festival/profile.php">UPDATE</a></li>');d.find("li a").bind("click",function(h){location=$(this).attr("href");return true})}else{d.append("<li>No Entry</li>")}d.show()})}});GenericPageMediator.NAME="genericPageMediator";var SearchMediator=Objs("com.cultureunplugged.app.view.SearchMediator",FabricationMediator,{movieProxy:null,userProxy:null,currentHash:"--",currentTags:"",currentView:"thumb",currentPage:1,numPerPage:{list:7,thumb:16,detail:1},itemHeight:{list:200,thumb:350,detail:-1},total:0,movieIds:[],userIds:[],loadingDiv:null,disableHash:false,noResultDiv:null,initialize:function(a,b){FabricationMediator.prototype.initialize.call(this,a,b);this.movieProxy=this.facade.retrieveProxy(MovieProxy.NAME)},updateLocation:function(){},resetLocation:function(){},isFestivalSite:function(){return $("body").hasClass("festival")},isDetailView:function(){return $("#wrapper").hasClass("detail")},goToPage:function(h){var k=this.numPerPage[this.currentView];var l=(h-1)*k;var c=h==this.currentPage;if(l<this.total&&l>-1){this.removeItems();this.showLoadingIcon();var j=this;var g=$("ul.movie-items");var e=Templates.load("movieSearchResult");this.updatePageNumber(h);for(var b=0;b<k;b++){var d=l+b;if(d<this.total){var a=parseInt(this.movieIds[d]);if(a&&!isNaN(a)){var m=$("<li>"+e+"</li>").addClass("cu-"+a).attr("index",d);g.append(m);this.sendNotification(AppNotification.LOAD_CU_MOVIE_DATA,a)}}}this.setListHeight()}else{var f=this.getLastPage();if(h>f+1){this.goToPage(f)}}},removeItems:function(){this.hideNoResultView();this.viewComponent.find(".pagination").eq(1).hide();this.viewComponent.find("ul.movie-items li").remove()},getPageNumber:function(c,a){var b=this.numPerPage[a];return Math.floor(c/b)+1},getStartIndex:function(c,a){var b=this.numPerPage[a];return(c-1)*b},getLastPage:function(){var a=parseInt(this.total)-1;return this.getPageNumber(a,this.currentView)},updatePageNumber:function(a){this.currentPage=a},showPagination:function(){this.viewComponent.find(".pagination").show()},hidePagination:function(){this.viewComponent.find(".pagination").hide()},showList:function(){this.viewComponent.find("ul.movie-items").css("visibility","visible")},hideList:function(){this.viewComponent.find("ul.movie-items").css("visibility","hidden")},setListHeight:function(){var c=this.viewComponent.find("ul.movie-items");var b,a=c.find("li").length;if(this.currentView=="detail"){return}else{if(this.currentView=="list"){b=a}else{b=Math.ceil(a/4)}}c.height(b*this.itemHeight[this.currentView])},showLoadingIcon:function(){this.hideNoResultView(false);if(this.loadingDiv!=null){this.loadingDiv.show()}},hideLoadingIcon:function(){if(this.loadingDiv!=null){this.loadingDiv.fadeOut()}},showNoResultView:function(){this.hideLoadingIcon();if(this.noResultDiv!=null){this.noResultDiv.show()}},hideNoResultView:function(a){if(this.noResultDiv!=null){if(a){this.noResultDiv.fadeOut()}else{this.noResultDiv.hide()}}}});SearchMediator.NAME="SearchMediator";var PopupMediator=Objs("com.cultureunplugged.app.view.PopupMediator",FabricationMediator,{currentDivId:null,messagePopup:null,dimension:{iframeLogin:{width:554,height:272},defaultSize:{width:550,height:300}},initialize:function(){PopupMediator.$super.initialize.call(this,PopupMediator.NAME,null)},onRegister:function(){this.createOverlay();this.registerEvents()},registerEvents:function(){var a=this;$("#header").find("a[rel^=#iframe]").bind("click",function(b){a.sendNotification(AppNotification.OPEN_POPUP,{id:$(this).attr("rel"),url:$(this).attr("href")});return false})},createPopup:function(b,a,d,c){if(typeof(c)!="undefined"){$("#overlay").removeClass().addClass(c)}this.viewComponent.width(a).height(d).append(b);this.overlay.load()},respondToShowMessagePopup:function(c){if(this.messagePopup==null){var f=this;var b=Templates.load("messagePopup");this.messagePopup=$(b).attr("id","genric-message-popup");this.messagePopup.find("button.popup-ok-button").bind("click",function(){f.sendNotification(AppNotification.CLOSE_POPUP);return false})}var e=c.getBody();var h=typeof(e.title)!="undefined"?e.title:"";var d=typeof(e.content)!="undefined"?e.content:"";var g=typeof(e.hideButton)!="undefined"&&e.hideButton==true?true:false;var a=typeof(e.cls)!="undefined"?e.cls:"";if(a!=""){this.messagePopup.addClass(a)}else{this.messagePopup.removeClass(a)}if(g){this.messagePopup.addClass("hide-button")}else{this.messagePopup.removeClass("hide-button")}this.messagePopup.find(".popup-title").html(h);this.messagePopup.find(".popup-content").html(d);if(typeof(e.height)=="undefined"){e.height="auto"}if(e.height!="auto"){this.messagePopup.find(".popup-info-container").height(parseInt(e.height)-52)}else{this.messagePopup.find(".popup-info-container").height("auto")}this.createPopup(this.messagePopup,e.width,e.height,"popup-message");this.messagePopup.show()},respondToOpenPopup:function(e){var f=this,g=e.getBody(),h=g.id,b=g.url;if(b=="#"||b==""||b==null){return}var i=this.viewComponent;if(typeof(h)=="undefined"){return}var c=h.substring(1);var d;if(typeof(g)!="undefined"&&typeof(g.width)!="undefined"&&typeof(g.height)!="undefined"){d={width:g.width,height:g.height}}else{d=this.getDimension(c)}this.currentDivId=h;i.width(d.width).height(d.height);if($(h).length>0){i.append($(h));this.overlay.load();return}else{var c=h.substring(1);var a=b;a+=a.indexOf("?")!=-1?"&":"?";a+="_v="+AppConfig.APP_VERSION;if(h.search(/^#iframe/)!=-1){i.append('<iframe id="'+c+'" name="'+c+'" src="'+a+'" frameborder="0" allowTransparency="true" style="position:absolute;overflow:hidden"></iframe>');$(h).width(d.width).height(d.height);this.overlay.load()}else{i.append('<div id="'+c+'"/>');$(h).width(d.width).height(d.height);$.ajax({url:b,dataType:"html",contentType:"text/html;charset=utf-8",success:function(j){$(h).html(j);f.overlay.load()}})}}},respondToClosePopup:function(a){this.overlay.close();$("#overlay").hide()},respondToOpenWindow:function(d){var e=d.getBody();var b=e.url;var a=e.width;var c=e.height;window.open(b,"_cuWin","height="+c+",width="+a+",scrollbars=yes")},createOverlay:function(){var b=this;$("body").append('<div id="overlay"><div class="contentWrap"/></div><div id="tempOverlayDiv"/>');this.viewComponent=$("#overlay").find("div.contentWrap").eq(0);var a=$("#overlay").overlay({top:"center",mask:{color:"#111111",opacity:0.75},closeOnClick:false,onClose:function(c){b.currentDivId=null;b.viewComponent.children().each(function(){$("#tempOverlayDiv").append($(this))});$("#overlay").removeClass()}});this.overlay=a.eq(0).overlay()},getDimension:function(a){if(this.dimension[a]){return this.dimension[a]}return this.dimension.defaultSize}});PopupMediator.NAME="popupMediator";var ExploreCollectionsMediator=Objs("com.cultureunplugged.app.view.ExploreCollectionsMediator",FabricationMediator,{currentPage:1,totalPage:1,initialize:function(){ExploreCollectionsMediator.$super.initialize.call(this,ExploreCollectionsMediator.NAME,$("#exploreCollections"))},onRegister:function(){this.load(this.currentPage)},load:function(a){var b=this;$.ajax({url:"/data/explorecollections",data:{page:a},dataType:"json",cache:false,success:function(c){b.currentPage=c.page;b.totalPage=c.totalPages;b.updateList(c.data)}})},updateList:function(a){this.clearList();var e=this.viewComponent.find("ul").eq(0);for(var c=0;c<a.length;c++){var d=a[c];var b="/"+d.type+"/explore/"+d.alias;e.append('<li><a href="'+b+'">'+d.organization+"</a></li>")}this.updateNavArrows()},clearList:function(){this.viewComponent.find("ul li").remove()},updateNavArrows:function(){var b=this;if(this.currentPage>1){if(this.viewComponent.find(".prev-page").length<1){var a=$('<div class="prev-page"></div>');this.viewComponent.find(".list").eq(0).prepend(a);a.bind("click",function(){var c=parseInt(b.currentPage)-1;b.load(c)})}this.viewComponent.find(".prev-page").show()}else{this.viewComponent.find(".prev-page").hide()}if(this.currentPage<this.totalPage){if(this.viewComponent.find(".next-page").length<1){var a=$('<div class="next-page"></div>');this.viewComponent.find(".list").eq(0).append(a);a.bind("click",function(){var c=parseInt(b.currentPage)+1;b.load(c)})}this.viewComponent.find(".next-page").show()}else{this.viewComponent.find(".next-page").hide()}}});ExploreCollectionsMediator.NAME="ExploreCollectionsMediator";var TopFilmsMediator=Objs("com.cultureunplugged.app.view.TopFilmsMediator",SearchMediator,{initialize:function(a,b){TopFilmsMediator.$super.initialize.call(this,TopFilmsMediator.NAME,null)},onRegister:function(){return;this.registerEvents();this.loadDefaultList()},registerEvents:function(){var b=$(".topFilms");if(b.length<1){return}for(var c=0;c<b.length;c++){var a=b.eq(c);if(a.hasClass("now-screening")){this.viewComponent=a;this.registerNowScreeningEvents();break}}},registerNowScreeningEvents:function(){var a=this;this.viewComponent.find("a.today").bind("click",function(b){a.loadTodayTopFilms();return false});this.viewComponent.find("a.alltime").bind("click",function(b){a.loadAllTimeTopFilms();return false})},loadDefaultList:function(){if(this.viewComponent!=null){this.loadTodayTopFilms()}},loadTodayTopFilms:function(){this.movieProxy.loadMovieIds({type:"todayTopFilms"},this.onGetTopFilms)},loadAllTimeTopFilms:function(){this.movieProxy.loadMovieIds({type:"allTimeTopFilms"},this.onGetTopFilms)},onGetTopFilms:function(a){}});TopFilmsMediator.NAME="TopFilmsMediator";var RecommendedMovieListMediator=Objs("com.cultureunplugged.app.view.RecommendedMovieListMediator",FabricationMediator,{initialize:function(){RecommendedMovieListMediator.$super.initialize.call(this,RecommendedMovieListMediator.NAME,null)},onRegister:function(){this.tempFixes()},tempFixes:function(){var a=this;$(".topFilms").find(".morelink a").each(function(){var b=$(this).attr("href").replace(/[^0-9]/g,"");$(this).attr("href","#").attr("rel",b)});$(".topFilms").find(".morelink a").bind("click",function(){var b=$(this).attr("rel");a.sendNotification(AppNotification.SHOW_MOVIE_SYNOPSIS_POPUP,{source:"cu",movieId:b},false,10);return false})}});RecommendedMovieListMediator.NAME="RecommendedMovieListMediator";var MovieRatingMediator=Objs("com.cultureunplugged.app.view.MovieRatingMediator",FabricationMediator,{ratingOverlay:null,movie:null,ratedMovies:[],initialize:function(a){MovieRatingMediator.$super.initialize.call(this,MovieRatingMediator.NAME,a)},onRegister:function(){this.createRatingDiv();this.registerEvents()},registerEvents:function(){var a=this;this.ratingOverlay.find("div").hover(function(){if(a.isMovieRated()){return}var b=$(this).attr("class").replace("r_","rate_");$(this).parent().removeClass().addClass(b)},function(){if(a.isMovieRated()){return}var b=$(this).attr("class").replace("r_","rate_");$(this).parent().removeClass(b)});this.ratingOverlay.find("div").bind("click",function(c){if(a.isMovieRated()){alert(_Text(Messages.rating.ALREADY_RATED));return}var b=$(this).attr("class").replace("r_","");setTimeout(function(){a.onSubmitMovieRating(a.movie.id,b)},10);return false})},respondToSetMovieRating:function(a){this.movie=a.getBody();this.updateRating(this.movie.rating)},isMovieRated:function(){return $.inArray(this.movie.id,this.ratedMovies)!=-1},onSubmitMovieRating:function(b,a){var d=this;var c=this.facade.retrieveProxy(AuthProxy.NAME);c.checkLoginSession(function(e){if(!e){d.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){d.submitMovieRating(b,a)}})}else{d.submitMovieRating(b,a)}})},submitMovieRating:function(b,a){var d=this;var c=this.facade.retrieveProxy(MovieProxy.NAME);c.submitRating(b,a,function(e){if(e.isOK){d.ratedMovies.push(b);d.updateRating(a);$("#rating-overlay").addClass("rated");d.sendNotification(AppNotification.SHOW_MESSAGE_POPUP,{cls:"center-align",width:500,height:"auto",hideButton:true,content:_Text(Messages.rating.THANK_YOU)},null,500)}else{alert(e.message)}})},createRatingDiv:function(){var a=['<div id="rating-overlay">','<div class="r_1"/>','<div class="r_2"/>','<div class="r_3"/>','<div class="r_4"/>','<div class="r_5"/>',"</div>"];this.ratingOverlay=$(a.join(""));this.viewComponent.append(this.ratingOverlay)},updateRating:function(a){a=Math.round(a);if(a<0){a=0}this.viewComponent.find("div").eq(0).removeClass().addClass("rate_"+a)}});MovieRatingMediator.NAME="MovieRatingMediator";var VideoPlayerMediator=Objs("com.cultureunplugged.app.view.VideoPlayerMediator",FabricationMediator,{containerId:"embedPlayer",playerSwf:null,playerId:"swfPlayer",jpContainerId:"jp_container_vp",jpPlayerId:"jp_player_vp",viewCounterUpdated:false,currentMovieId:-1,currentMovie:null,movieDataSet:false,timer:null,details:null,detailClass:"x-detail",movieProxy:null,authProxy:null,emailLinkEvent:false,pageLoaded:false,suspendWarning:null,initialize:function(a){VideoPlayerMediator.$super.initialize.call(this,VideoPlayerMediator.NAME,a);this.playerSwf=AppConfig.CU_VIDEO_PLAYER},onRegister:function(){Utils.customCheckbox(this.viewComponent.find("input[type=checkbox]"),{icon:{on:AppConfig.ASSETS_URL+"/css/skin/common/images/player_checkbox_on.png",off:AppConfig.ASSETS_URL+"/css/skin/common/images/player_checkbox_off.png"}});this.details=this.viewComponent.find(".movie-details-container").eq(0);this.suspendWarning=$("#suspendMovieWarning");this.authProxy=this.facade.retrieveProxy(AuthProxy.NAME);this.movieProxy=this.facade.retrieveProxy(MovieProxy.NAME);this.facade.registerMediator(new MovieRatingMediator($(".movie-rating").eq(0)));this.registerEvents();this.sendNotification(AppNotification.VIDEO_PLAYER_LOADED)},registerEvents:function(){var b=this;this.viewComponent.find("div[id^=action-]").bind("click",function(f){var d=$(this).attr("id").replace("action-","");var c=d.substr(0,1).toUpperCase()+d.substr(1);if(typeof(b["onClick"+c])=="function"){if(!$(this).hasClass("tab")){$("#movie-actions").removeClass().addClass(d)}setTimeout(function(){b["onClick"+c]()},10)}b.handleOtherActions(d);return false});this.viewComponent.find(".action-contribute").bind("click",function(c){b.handleOtherActions("contribute");return false});$("#embed-size-selection").find("span").bind("click",function(){var c=$(this).attr("class");if(c!=""&&c!=null){$(this).parent().removeClass().addClass(c);b.setEmbedCode()}return false});$("a.request-online-screening").bind("click",function(){b.onRequestOnlineScreening();return false});$(".send-email").bind("click",function(c){b.onClickSendEmail();return false});var a=$("form[name=frmExpress]").eq(0);a.submit(function(){return false});a.find("button[name=btn-submit-express]").bind("click",function(c){b.onSumbitExpressConsciousness();return false});a.find("span.custom-checkbox img").bind("click",function(){var d=$(this).hasClass("x-item-checked");var c=$(this).parent().find("input[type=checkbox]").eq(0);if(c.hasClass("clear-others")&&d){a.find("input[type=checkbox]").each(function(){if(!$(this).hasClass("clear-others")){Utils.checkCustomCheckbox($(this),false)}})}if(!c.hasClass("clear-others")&&d){Utils.checkCustomCheckbox(a.find("input[type=checkbox].clear-others"),false)}})},respondToSetVideoPlayer:function(a){var b=a.getBody();if(this.currentMovieId==b.movieId){return}this.currentMovieId=b.movieId;this.currentMovie=null;this.movieDataSet=false;this.pageLoaded=false},respondToLoadVideo:function(a){this.respondToSetVideoPlayer(a)},respondToMovieDataLoaded:function(e){if(!this.isActive()){return}var c=e.getBody();var f=this;if(typeof(c.id)!="undefined"&&this.currentMovieId==c.id&&!this.movieDataSet){this.movieDataSet=true;this.currentMovie=c;this.currentMovieId=c.id;var d=this.viewComponent;var b=Utils.truncateString(c.title,c.status=="LIVE"?47:60);var a=Utils.truncateString(c.from,c.status=="LIVE"?48:60);if(b.tip!=""){d.find(".movie-title .x-title").html(b.text).attr("title",c.title)}else{d.find(".movie-title .x-title").html(b.text)}d.find(".movie-title .x-from .x-value").html('<a href="'+c.storyTellerLink+'" '+a.tip+">"+a.text+"</a>");d.find(".movie-stats .x-views .x-value").html(c.views);d.find(".movie-stats .x-shared .x-value").html(c.numShared);this.sendNotification(AppNotification.SET_MOVIE_RATING,c);setTimeout(function(){f.setMovie(c)},100);if(!$("#wrapper").hasClass("player")){setTimeout(function(){DisqusUtil.reload("cu-movie-"+c.id,AppConfig.SERVER_URL+"/documentary/watch-online/play/"+c.id)},500)}this.sendNotification(AppNotification.UPDATE_PAGE_SETTINGS,{section:"player",replacements:{film_name:c.title,synopsis:c.synopsis}});this.setEmbedCode();this.loadDefaultView()}},showPlayer:function(){this.currentMovie=null;this.movieDataSet=false;$("#wrapper").addClass("detail player")},setMovie:function(a){if(a.status=="SUSPENDED"){this.suspendWarning.find(".mask").height(this.suspendWarning.parent().height());this.suspendWarning.show();this.viewComponent.find(".player-header span").hide();return}else{this.suspendWarning.hide();this.viewComponent.find(".player-header span").show()}if(isMobile()){this._setHtml5Player(a)}else{this._setFlashPlayer(a)}},_setFlashPlayer:function(a){$("#"+this.containerId).children().remove();var b={video:a.url,u:this.authProxy.getUserId(),m:a.id,thumb:a.large_thumb,sURL:AppConfig.SERVER_URL};$("#"+this.containerId).flashembed({name:this.playerId,id:this.playerId,src:this.playerSwf,version:AppConfig.FLASH_VERSION,menu:false,wmode:"opaque",bgColor:"#000000",flashvars:$.param(b)})},_setHtml5Player:function(a){var c,d=this,e=$("#"+this.containerId),b=this.authProxy.getUserId();this.viewCounterUpdated=false;e.children().remove();e.append(Templates.load("spinner"));e.append(Templates.getHtml5Video(a.url,a.large_thumb,this.jpPlayerId));e.find(".vp-duration").html(Utils.formatDuration(a.duration));if(a.mature){e.find(".vp-mature-tag").show()}c=document.getElementById(this.jpPlayerId);c.addEventListener("timeupdate",function(g){var f=parseInt(g.target.currentTime);if(f>10&&!d.viewCounterUpdated){d.movieProxy.increaseViewCounter(a,b);d.movieProxy.updateLastPlayedTime(a,b);d.viewCounterUpdated=true}if(f>5&&$(".vp-mature-tag").eq(0).is(":visible")){e.find(".vp-mature-tag").fadeOut("slow")}},false);c.addEventListener("playing",function(f){e.find(".spinner").hide();e.find("video").css("top",0).css("left",0)});e.find("a.vp-play-icon").bind("click",function(){$(this).unbind();e.find(".vp-poster").remove();e.find(".vp-duration").hide();c.play();return false});return},getPlayer:function(){return($.browser.msie)?window[this.playerId]:document[this.playerId]},isActive:function(){return this.viewComponent.is(":visible")},hideDetailDivs:function(){this.details.find("."+this.detailClass).hide()},loadDefaultView:function(){var a=Utils.parse_url();$(this.detailClass).hide();if(typeof(a.commentId)!="undefined"&&a.commentId!=""){$("#action-disqus").trigger("click")}else{$("#action-info").trigger("click")}},setMovieInfo:function(a){$div=$("#details-info");$div.find(".movie-title .x-value").html(a.title);$div.find(".movie-director").html(a.director);$div.find(".movie-producer").html(a.producer);$div.find(".movie-genre").html(a.getGenreLink());$div.find(".movie-year").html(a.year);$div.find(".storyteller-country").html(a.getStoryTellerCountryLink());var b=a.getMovieTagLinks(true);if(b.length>0){$div.find(".movie-tags .x-value").html(b.join(", "));$div.find(".movie-tags").show()}else{$div.find(".movie-tags").hide()}$div.find(".movie-synopsis").html(a.synopsis)},setWikiLinks:function(a){var b=a.getWikiItems();var d=$("#details-wiki").find("ul").eq(0);d.find("li").remove();for(var c=0;c<b.length;c++){d.append("<li>"+b[c]+"</li>")}},setEmbedCode:function(){var c=$("#embed-size-selection").attr("class");var b=this.currentMovie;if(b.allowEmbed){$("#details-embed").find(".embed-form").show();$("#details-embed").find(".no-embed").hide();var g=AppConfig.SERVER_URL+"/documentary/watch-online/play/"+b.id+"/"+b.title.replace(/[^0-9a-zA-Z]/,"-");var i=AppConfig.SERVER_URL+"/swf/embedplayer.swf";var f="video="+b.url.replace(" ","%20")+"&m="+b.id+"&u=0&thumb="+b.large_thumb+"&sURL="+AppConfig.SERVER_URL+"&title="+b.title+"&from="+b.from;var a,d;if(/large/.test(c)){a=700;d=480}else{a=400;d=320}var e=['<div style="width:'+a+'px"><embed src="'+i+'" width="'+a+'" height="'+d+'" flashvars="'+f+'" ','name="cultureUnpluggedPlayer" quality="high" salign="b" allowScriptAccess="always" align="middle" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>','<div style="margin-top:5px;text-align:center"><a href="'+g+'" target="_blank">View this movie at cultureunplugged.com</a></div></div>'];$("#details-embed").find("textarea[name=embedCode]").val(e.join(""))}else{$("#details-embed").find(".embed-form").hide();$("#details-embed").find(".no-embed").show();$("#details-embed").find("textarea[name=embedCode]").val("")}},getDetailDiv:function(d){var a=$("#"+d);if(a.length<1){var c=d.replace("-","_");var b=Templates.load(c);a=$('<div id="'+d+'"/>');a.append($(b));a.addClass(this.detailClass).hide();this.details.append(a)}return a},showDetailDiv:function(e,b){var a=this.getDetailDiv(e);if(!a.is(":visible")){this.hideDetailDivs()}b();a.show();debug_info("Show "+e+" --> player loaded:"+this.pageLoaded);if(this.pageLoaded){var d=$("body").hasClass("filmedia")?435:465;var c=this.viewComponent.offset().top+d;setTimeout(function(){Utils.windowScrollTop(c)},200)}this.pageLoaded=true},handleOtherActions:function(a){var b=this.currentMovie;var c=this;switch(a){case"watchLater":this.sendNotification(AppNotification.ADD_TO_WATCHLATER,{movieId:b.id});break;case"tweet":this.sendNotification(AppNotification.POST_TO_TWITTER,{movieId:b.id,movieTitle:b.title});break;case"exploreWork":this.onClickCollaborate();break;case"contribute":this.sendNotification("showContributeDialog",{uid:b.uid,movieId:b.id,name:b.storyTellerName,title:b.title});break;case"recommend":this.sendNotification(AppNotification.SHOW_FACEBOOK_SHARE,{movieId:b.id});break}},onClickDisqus:function(){var a=this;this.showDetailDiv("details-disqus",function(){})},onClickInfo:function(){var a=this;this.showDetailDiv("details-info",function(){a.setMovieInfo(a.currentMovie)})},onClickEmbed:function(){var a=this;this.showDetailDiv("details-embed",function(){})},onClickShare:function(){var a=this;this.showDetailDiv("details-share",function(){var c=a.currentMovie;$("#share-link").html('<a href="'+c.getShareLink()+'">'+c.getShareLink()+"</a>");if(!a.emailLinkEvent){a.emailLinkEvent=true;var b=$("#details-share");var d=b.find("form[name=frmShare]").eq(0);b.find("input[name=from]").example(function(){return $(this).attr("oValue")});b.find("button.mail-share-link").bind("click",function(){a.sendNotification(AppNotification.EMAIL_MOVIE_LINK,{movie:a.currentMovie});return false});b.find("button.btn-login").bind("click",function(f){a.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){b.find(".x-login").hide();b.find(".x-form").show()}});return false});b.find("input[name=captchaTotal]").keydown(function(f){return Utils.isNumber(f)});b.find("button.post-share-link").bind("click",function(i){var g=d.find("input[name=captchaTotal]").eq(0);var h=d.find("textarea[name=emails]").eq(0);var j=d.find("input[name=from]").eq(0);if(g.val()==""){alert("Please enter sum of two numbers.")}else{if(h.val()==""){alert("Please enter email address.")}else{if(j.val()==""||j.val()==j.attr("oValue")){alert("Please enter your email address.")}else{b.find(".x-buttons").addClass("sending");var f=AppConfig.SERVER_URL+"/documentary/watch-online/play/";$.ajax({url:"/xt_sendShareLink.php",data:{movieId:a.currentMovie.id,from:j.val(),emails:h.val(),shareLink:f,captchaTotal:g.val()},dataType:"json",type:"POST",success:function(e){b.find(".x-buttons").removeClass("sending");a.reloadCaptcha(d);if(e.isOK){h.val("").focus().blur();alert("Email has been sent.")}else{alert(e.message)}}})}}}return false})}})},onClickWiki:function(){var a=this;this.showDetailDiv("details-wiki",function(){a.setWikiLinks(a.currentMovie)})},onClickSendEmail:function(){this.sendNotification(AppNotification.SEND_EMAIL_TO_STORY_TELLER,{uid:this.currentMovie.uid,name:this.currentMovie.storyTellerName})},onClickCollaborate:function(){this.sendNotification(AppNotification.SEND_EMAIL_TO_STORY_TELLER,{uid:this.currentMovie.uid,name:this.currentMovie.storyTellerName,collaborate:1})},onRequestOnlineScreening:function(){this.sendNotification("showRequestOnlineScreeningDialog",this.currentMovie)},onSumbitExpressConsciousness:function(){var a=this;this.authProxy.checkLoginSession(function(b){if(!b){a.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){a.sumbitExpressConsciousness()}})}else{a.sumbitExpressConsciousness()}})},sumbitExpressConsciousness:function(){var c=$("form[name=frmExpress]").eq(0),b=this.currentMovie,a=[];expressions=[];c.find("input[type=checkbox]").each(function(){if($(this).is(":checked")){a.push($(this).val());expressions.push($(this).attr("rel"))}});if(a.length<1){alert("Please select at least one attribute.")}else{var e=expressions.join(", ");var d=this;this.movieProxy.updateExpressConsciousness(this.currentMovie.id,a,function(f){d.sendNotification(AppNotification.SHOW_MESSAGE_POPUP,{cls:"center-align",width:500,height:"auto",hideButton:true,content:_Text(Messages.rating.EXPRESS_THANKYOU,[b.title,e])},null,500)})}},reloadCaptcha:function(a){Utils.reloadImage(a.find(".captcha-0"));Utils.reloadImage(a.find(".captcha-1"));$("input[name=captchaTotal]").val("")}});VideoPlayerMediator.NAME="videoPlayerMediator";var FestivalFilmsMediator=Objs("com.cultureunplugged.app.view.FestivalFilmsMediator",SearchMediator,{playMovieId:-1,listOptions:null,initialize:function(a,b){FestivalFilmsMediator.$super.initialize.call(this,FestivalFilmsMediator.NAME,null)},onRegister:function(){this.registerEvents()},registerEvents:function(){var a=this;$("#topNav").find("a[rel=films]").bind("click",function(b){b.stopPropagation();a.resetLocation();return false});this.highlightIcons(this.currentView)},highlightIcons:function(a){$("#wrapper").removeClass("list thumb detail").addClass(a);$("#header").removeClass("list thumb detail").addClass(a);$(".nav-view").removeClass("list thumb detail").addClass(a)},resetLocation:function(){location="/documentaries/watch-online/festival/films.php?view=grid&listType=entries&tags=&id=1"}});FestivalFilmsMediator.NAME="FestivalFilmsMediator";var FilmediaFilmsMediator=Objs("com.cultureunplugged.app.view.FilmediaFilmsMediator",SearchMediator,{playMovieId:-1,listOptions:null,initialize:function(a,b){FilmediaFilmsMediator.$super.initialize.call(this,FilmediaFilmsMediator.NAME,$(".filmsList"))},onRegister:function(){this.createLoadingIcon();this.createPagination();this.createJumpUpLink();$("#header").addClass("n-films");this.facade.registerMediator(new VideoPlayerMediator($(".video-player")));this.registerEvents()},registerEvents:function(){var a=this;$("#topNav").find("a[rel=films]").bind("click",function(b){b.stopPropagation();a.resetLocation();return false});$(".nav-view").find("a").bind("click",function(d){d.stopPropagation();$(this).blur();var b=$(this).attr("class");var c=b.split("-")[0];if(c!=a.currentView){a.switchView(c)}return false});$("#filmsOnNav,#filmsOn table").find("a").bind("click",function(c){c.stopPropagation();$(this).blur();var b=$(this).attr("rel");if(a.currentTags!=b){a.resetView(b)}return false});$("#filmsOnNavFilters").find("select").bind("change",function(b){a.resetView()});$(window).bind("hashchange",function(b){a.loadContents(window.location.hash)})},resetView:function(a){if(this.isDetailView()){var b=this;this.removeItems();setTimeout(function(){Utils.windowScrollTop(0);b.currentPage=1;b.currentView="thumb";b.highlightIcons(b.currentView);b.updateLocation(a)},200)}else{this.updateLocation(a)}},respondToMovieItemAdded:function(a){this.hideLoadingIcon()},respondToVideoPlayerLoaded:function(a){this.loadContents(location.hash)},respondToMovieIdsLoaded:function(b){this.movieIds=b.getBody();this.movieIds=Utils.shuffle(this.movieIds);this.total=this.movieIds.length;if(this.total<1){this.removeItems();this.showNoResultView()}else{if(this.isDetailView()){if(this.playMovieId!=-1){var a=$.inArray(this.playMovieId,this.movieIds);if(a!=-1){this.currentPage=this.getPageNumber(a,this.currentView)}this.playMovieId=-1}this.switchView(this.currentView,this.currentPage)}else{this.goToPage(this.currentPage)}}this.showList()},respondToLoadVideo:function(a){var c=a.getBody();var b=parseInt(c.index)+1;this.switchView("detail",b)},respondToGoToPage:function(a){var c=a.getBody();if(c.parentClass=="filmsList"){var b=1;if(typeof(c.page)!="undefined"){b=c.page}else{switch(c.direction){case 1:b=parseInt(this.currentPage)+1;break;case -1:b=parseInt(this.currentPage)-1;break}}this.goToPage(b)}},switchView:function(a,b){var c=this.getStartIndex(this.currentPage,this.currentView);this.currentView=a;this.highlightIcons(this.currentView);if(typeof(b)=="undefined"){b=this.getPageNumber(c,this.currentView)}this.sendNotification(AppNotification.SET_VIDEO_PLAYER,{movieId:this.movieIds[c]});this.goToPage(b)},createLoadingIcon:function(){var a=Templates.load("animatedDotLoading");this.viewComponent.find(".list-header").append($(a));this.loadingDiv=this.viewComponent.find(".list-header .dot-loading");this.loadingDiv.find("span.message").html("LOADING THE FILMS/DOCS/TALKS SELECTION")},createPagination:function(){var b=Templates.load("pagination");var a="filmsList";this.viewComponent.prepend($(b).attr("rel",a));this.viewComponent.append($(b).attr("rel",a));this.sendNotification(AppNotification.PAGE_COMP_CREATED,a)},createJumpUpLink:function(){var a=this;this.viewComponent.append('<div class="jump-up">Jump Up</div>');$(".jump-up").bind("click",function(b){a.sendNotification(AppNotification.SCROLL_TO_TOP)}).hide()},highlightTags:function(a){a=a.toLowerCase();$("#filmsOnNav,#filmsOn table").find("a").removeClass("hlt");$("#filmsOnNav,#filmsOn table").find("a").each(function(){var c,b=$(this).attr("rel").replace("."," ").toLowerCase();if(b==a){$(this).addClass("hlt");return}if(b.indexOf(",")!=-1){c=b.split(",")}else{c=[b]}if($.inArray(a,c)!=-1){$(this).addClass("hlt")}})},highlightIcons:function(a){$("#wrapper").removeClass("list thumb detail").addClass(a);$("#header").removeClass("list thumb detail").addClass(a);$(".nav-view").removeClass("list thumb detail").addClass(a)},resetLocation:function(){this.currentTags="";this.currentView="thumb";location="#view="+this.currentView+"&page=1&country=-1&genreId=-1&duration=-1"},updateLocation:function(d){var f;var e=this.currentPage;if(typeof(d)!="undefined"){this.currentTags=d;f="&page=1&tags="+d;e=1}else{if(this.currentTags!=""&&typeof(this.currentTags)!="undefined"){f="&page="+e+"&tags="+this.currentTags}else{f="&page="+e}}var g=$("select[name=country]").val();var a=$("select[name=genreId]").val();var h=$("select[name=duration]").val();if(g!=-1){f+="&country="+g}if(a!=-1){f+="&genreId="+a}if(h!=-1){f+="&duration="+h}if(typeof(this.currentTags)!="undefined"){this.highlightTags(this.currentTags)}if(this.currentView=="detail"){var b;if(this.movieIds.length>0){var c=this.getStartIndex(e,"detail");b=this.movieIds[c]}else{b=this.playMovieId}this.currentHash="#url=/documentary/watch-online/play/"+b+"&view=detail"+f}else{this.currentHash="#view="+this.currentView+f;this.sendNotification(AppNotification.UPDATE_PAGE_SETTINGS,{section:"filmedia_films"})}location=this.currentHash},setVideoPlayer:function(a){this.sendNotification(AppNotification.SET_VIDEO_PLAYER,{movieId:this.movieIds[a]})},loadContents:function(f){this.showLoadingIcon();var d=f.substr(1).split("&");var c={};for(var b=0;b<d.length;b++){var e=d[b].split("=");if(Validator.isEmpty(e[0])){continue}if(typeof(e[1])=="undefined"){e[1]=""}c[e[0]]=e[1].replace("%20"," ")}if(typeof(c.view)!="undefined"){this.currentView=c.view}if(typeof(c.tags)!="undefined"){this.currentTags=c.tags}else{this.currentTags=""}if(typeof(c.country)=="undefined"){c.country=-1}if(typeof(c.genreId)=="undefined"){c.genreId=-1}if(typeof(c.duration)=="undefined"){c.duration=-1}this.highlightIcons(this.currentView);$("select[name=country]").val(c.country);$("select[name=genreId]").val(c.genreId);$("select[name=duration]").val(c.duration);if(typeof(c.url)!="undefined"&&/^\/play\/\d+$/.test(c.url)){this.currentView="detail";var a=c.url.replace(/^\/play\/(\d+)$/,"$1");if(this.movieIds.length<1){this.playMovieId=a}}if(typeof(c.page)!="undefined"){this.currentPage=c.page}this.loadMovies(true)},loadMovies:function(d){if(typeof(d)=="undefined"){d=false}var b={status:StatusEnum.ARCHIVED.value,country:$("select[name=country]").val(),genreId:$("select[name=genreId]").val(),duration:$("select[name=duration]").val(),tags:this.currentTags};var c=false;if(this.listOptions!=null){for(var a in this.listOptions){if(this.listOptions[a]!=b[a]){c=true;break}}}else{c=true}if(c||d){this.listOptions=b;this.removeItems();this.updatePageNumber(this.currentPage);this.updateLocation();if(!c&&d){this.goToPage(this.currentPage)}else{this.hidePagination();this.hideList();this.movieProxy.loadMovieIds(b)}}},goToPage:function(j){var m=this.numPerPage[this.currentView];var n=(j-1)*m;var c=j==this.currentPage;if(n<this.total&&n>-1){this.removeItems();this.showLoadingIcon();var k=this;var g=$("ul.movie-items");var e=Templates.load("movieInfo");var h=Templates.load("previewPlayer");this.updatePageNumber(j);for(var b=0;b<m;b++){var d=n+b;if(d<this.total){var a=parseInt(this.movieIds[d]);if(a&&!isNaN(a)){var o=$("<li>"+e+"</li>").addClass("cu-"+a).attr("index",d);o.find(".movie-preview").append($(h));g.append(o);this.sendNotification(AppNotification.LOAD_CU_MOVIE_DATA,a)}}}this.setListHeight();$(".jump-up").show();if(this.isDetailView()||!c){var l=this.isDetailView()?250:0;Utils.windowScrollTop(l)}setTimeout(function(){k.showPagination()},100)}else{var f=this.getLastPage();if(j>f+1){this.goToPage(f)}}},updatePageNumber:function(a){this.currentPage=a;this.updateLocation();this.sendNotification(AppNotification.UPDATE_PAGE_NUMBER,{parentClass:".filmsList",page:a})},showNoResultView:function(){this.hideLoadingIcon();if(this.noResultDiv==null){this.noResultDiv=$('<div id="find-no-result"/>');this.noResultDiv.insertBefore($("ul.movie-items").eq(0))}$(".jump-up").hide();this.viewComponent.height(300);this.noResultDiv.html(_Text(Messages.films.NO_RESULT));this.noResultDiv.fadeIn()}});FilmediaFilmsMediator.NAME="filmediaFilmsMediator";var FilmediaStoryTellersMediator=Objs("com.cultureunplugged.app.view.FilmediaStoryTellersMediator",SearchMediator,{initialize:function(a,b){FilmediaStoryTellersMediator.$super.initialize.call(this,FilmediaStoryTellersMediator.NAME,null)},onRegister:function(){this.registerEvents()},registerEvents:function(){var a=this;$(".nav-view").find("a").bind("click",function(f){f.stopPropagation();$(this).blur();var c=$(this).attr("class");var d=c.split("-")[0];if(d!=a.currentView){a.switchView(d)}return false});var b=Utils.parse_url();if(/storyteller/.test(location.toString())){this.currentView="detail"}else{if(typeof(b.view)!="undefined"){debug(b.view);if(b.view=="grid"){b.view="thumb"}this.currentView=b.view}}this.highlightIcons(this.currentView)},switchView:function(a,c){var b="/documentary/watch-online/filmedia/switchView.php?type=";if(a=="detail"){a="one"}location=b+a},highlightIcons:function(a){$("#wrapper").removeClass("list thumb detail").addClass(a);$("#header").removeClass("list thumb detail").addClass(a);$(".nav-view").removeClass("list thumb detail").addClass(a)}});FilmediaStoryTellersMediator.NAME="FilmediaStoryTellersMediator";var AuthViewMediator=Objs("com.cultureunplugged.app.view.AuthViewMediator",FabricationMediator,{authProxy:null,loginForm:null,forgotForm:null,registerForm:null,initialize:function(a){AuthViewMediator.$super.initialize.call(this,AuthViewMediator.NAME,a)},onRegister:function(){this.authProxy=new AuthProxy();this.facade.registerCommand(AppNotification.SHOW_FACEBOOK_LOGIN,FacebookLoginCommand);this.facade.registerProxy(this.authProxy);this.loginForm=this.viewComponent.find("form[name=frm-login]").eq(0);this.forgotForm=this.viewComponent.find("form[name=frm-forgotpassword]").eq(0);this.registerForm=this.viewComponent.find("form[name=frm-register]").eq(0);this.registerEvents()},respondToFacebookUserLoggedIn:function(a){if(top.sendNotification){top.sendNotification(AppNotification.USER_LOGGED_IN)}},registerEvents:function(){var a=this;this.viewComponent.find(".nav a").bind("click",function(c){c.stopPropagation();var b=$(this).attr("class");if(b=="x-facebook"){a.sendNotification(AppNotification.SHOW_FACEBOOK_LOGIN);a.closeView()}else{a.viewComponent.removeClass("x-cu x-new-user x-forgot-password").addClass(b)}return false});this.viewComponent.find("a.forgot-password").bind("click",function(b){a.viewComponent.removeClass("x-cu x-new-user").addClass(" x-forgot-password");return false});this.viewComponent.find("form").bind("submit",function(b){return false});this.viewComponent.find("button").bind("click",function(c){var b=$(this).attr("id").replace("btn-","");if(typeof(a[b])=="function"){a.disableSubmitButton();a[b]()}return false});this.viewComponent.find("input").example(function(){return $(this).attr("oValue")});this.viewComponent.find("input[name=captchaTotal]").keydown(function(b){return Utils.isNumber(b)});this.viewComponent.find("input").keydown(function(c){var b=$(this).attr("name");if(c.keyCode==9){if(!c.shiftKey){switch(b){case"loginId":a.loginForm.find(".pwdHelper").eq(0).trigger("click");return false;case"password":a.loginForm.find("input[name=captchaTotal]").eq(0).focus();return false;case"newEmail":a.registerForm.find(".pwdHelper").eq(0).trigger("click");return false;case"newPassword1":a.registerForm.find(".pwdHelper").eq(1).trigger("click");return false}}}else{if(c.keyCode==13){if(b=="captchaTotal"){$(this).parent().parent().parent().find("button").trigger("click")}return false}}return true});this.enableSubmitButton()},login:function(){var d=this.loginForm,f=this;var e=d.find("input[name=loginId]").eq(0);var c=d.find("input[name=password]").eq(0);var b=d.find("input[name=captchaTotal]").eq(0);var a=true;if(!Validator.isUpdated(e)){alert("Please enter your login id.")}else{if(!Validator.isUpdated(c)){alert("Please enter your password.")}else{if(Validator.isEmpty(b.val())){alert("Please enter sum of two numbers.")}else{a=false}}}if(a){this.enableSubmitButton();return}this.authProxy.login(e.val(),c.val(),b.val(),function(g){if(g.isOK==1){if(top.sendNotification){top.sendNotification(AppNotification.USER_LOGGED_IN)}}else{alert(g.message);f.reloadCaptcha(d)}f.enableSubmitButton()})},registerUser:function(){var a=this.registerForm,i=this;var e=a.find("input[name=screenName]").eq(0);var g=a.find("input[name=newEmail]").eq(0);var b=a.find("select[name=country]").eq(0);var c=a.find("input[name=newPassword1]").eq(0);var d=a.find("input[name=newPassword2]").eq(0);var f=a.find("input[name=captchaTotal]").eq(0);var h=true;if(!Validator.isUpdated(e)){alert("Please enter screen name.")}else{if(e.val().length<4||e.val().length>16){alert("Screen name must be between 4 and 16 characters")}else{if(!e.val().match(/^[a-zA-Z0-9\._]+$/)){alert("Invalid Screen name.\nScreen name can only have dot,underscore, and alphanumeric characters.")}else{if(!Validator.isUpdated(g)){alert("Please enter email address.")}else{if(!Validator.isValidEmail(g.val())){alert("Invalid email address.")}else{if(b.val()==-1){alert("Please select country.")}else{if(!Validator.isUpdated(c)||!Validator.isUpdated(d)){alert("Please enter password")}else{if(c.val().length<6){alert("Password must be at least 6 character long.")}else{if(c.val()!=d.val()){alert("Two passwords don't match.")}else{if(Validator.isEmpty(f.val())){alert("Please enter sum of two numbers.")}else{h=false}}}}}}}}}}if(h){this.enableSubmitButton();return}this.authProxy.register(this.registerForm,function(j){if(j.isOK==1){i.showThankYouRegister(g.val())}else{alert(j.message);i.reloadCaptcha(a)}i.enableSubmitButton()})},forgotPassword:function(){var b=this.forgotForm,c=this;var a=b.find("input[name=email]").eq(0);if(!Validator.isUpdated(a)){alert("Please enter your email address.");this.enableSubmitButton();return}this.authProxy.forgotPassword(a.val(),function(d){alert(d.message);c.reloadCaptcha();c.enableSubmitButton()})},showThankYouRegister:function(b){if($("#thx").length<1){var a=Templates.load("thankYouRegister");a=a.replace("{email}",b);$("#login-container").append($(a))}$(".thx").show();$(".layout-left, .layout-right").hide()},closeView:function(){},reloadCaptcha:function(a){Utils.reloadImage(a.find(".captcha-0"));Utils.reloadImage(a.find(".captcha-1"));$("input[name=captchaTotal]").val("")},enableSubmitButton:function(){$(".btn-submit").removeAttr("disabled");setTimeout(function(){$("form").find("input").focus().blur()},50)},disableSubmitButton:function(){return;$(".btn-submit").attr("disabled",true).blur()}});AuthViewMediator.NAME="authViewMediator";var SiteHistoryMediator=Objs("com.cultureunplugged.app.view.SiteHistoryMediator",FabricationMediator,{proxy:null,items:[],searchResultDiv:null,noResultMessage:null,movieIds:[],urls:[],initialize:function(){FabricationMediator.prototype.initialize.call(this,SiteHistoryMediator.NAME,$("#site-history-result"))},onRegister:function(){this.proxy=this.facade.retrieveProxy(SiteHistoryProxy.NAME);this.searchResultDiv=$(".layout-sub")},respondToShowSiteHistory:function(a){this.show()},respondToHideSiteHistory:function(a){this.hide()},respondToSiteHistoryLoaded:function(a){this.items=a.getBody().result;this.createList(this.items)},createList:function(c){var h=this.viewComponent.find(".history-items").eq(0);var e=Templates.load("historyList");var b=null;var a;this.urls=[];h.find(".item-block").remove();if(c.length<1){this.showNoResultView();return}this.searchResultDiv.show();for(var f=0;f<c.length;f++){var g=c[f];if($.inArray(g.url,this.urls)!=-1){continue}var d=Utils.convertUnixTimeStampToDate(g.date);if(!Utils.isSameDate(b,d)){b=d;a=$(e);a.find(".date").html(this.getDateLabel(d)+":");h.append(a)}this.extractMovieId(g.url);a.find("ul").eq(0).append('<li><a href="'+g.url+'">http://'+document.domain+g.url+"</a></li>")}this.addRandomMovies()},getDateLabel:function(a){if(Utils.isToday(a)){return"Today"}else{if(Utils.isYesterday(a)){return"Yesterday"}else{return(a.getMonth()+1)+"/"+a.getDate()}}},extractMovieId:function(b){this.urls.push(b);var a=b.replace(/^.*\/play\/(\d+)(.*)?$/,"$1");if(a!=b&&$.inArray(a,this.movieIds)==-1){this.movieIds.push(a)}},addRandomMovies:function(){Utils.windowScrollTop(640);this.sendNotification(AppNotification.ADD_RANDOM_MOVIES,{movieIds:this.movieIds,numDisplay:3})},showNoResultView:function(){$(".find-top").addClass("no-history");if(this.noResultMessage==null){this.noResultMessage=$('<div class="no-history-message"/>');this.noResultMessage.html(_Text(Messages.history.NO_RESULT));$(".find-top").eq(0).append(this.noResultMessage)}this.noResultMessage.show();this.searchResultDiv.hide();Utils.windowScrollTop(0)},hideNoResultView:function(){if(this.noResultMessage!=null){$(".find-top").removeClass("no-history");this.noResultMessage.hide()}},show:function(){if($("#wrapper").hasClass("history")){return}$("#wrapper").addClass("history");if(this.items.length<1){this.proxy.loadList()}else{this.addRandomMovies()}this.viewComponent.show()},hide:function(){$("#wrapper").removeClass("history");this.hideNoResultView();this.viewComponent.hide()}});SiteHistoryMediator.NAME="SiteHistoryMediator";var FindThatViewMediator=Objs("com.cultureunplugged.app.view.FindThatViewMediator",SearchMediator,{currentView:"list",currentPage:1,numPerPage:{list:20,thumb:16,detail:1},currentSearch:null,findWhatForm:null,findWhoForm:null,randomResultList:null,searchResultDiv:null,numRandomResults:6,initialLoaded:true,initialize:function(a,b){FindThatViewMediator.$super.initialize.call(this,FindThatViewMediator.NAME,$(".find-search-result").eq(0));this.userProxy=this.facade.retrieveProxy(UserProxy.NAME)},onRegister:function(){this.createPagination();Utils.customCheckbox($("input[type=checkbox]"),{icon:{on:AppConfig.ASSETS_URL+"/css/skin/common/images/form_check_white_on.png",off:AppConfig.ASSETS_URL+"/css/skin/common/images/form_check_white_off.png"}});this.findWhatForm=$("form[name=frm-find-what]").eq(0);this.findWhoForm=$("form[name=frm-find-who]").eq(0);this.randomResultList=$(".find-random-result ul.movie-items").eq(0);this.searchResultDiv=$(".layout-sub");this.registerEvents();this.search(Utils.urlDecode(window.location.hash))},registerEvents:function(){var a=this;$("form[name^=frm-find]").submit(function(b){return false});this.findWhatForm.find("button.btn-find-what").bind("click",function(b){a.onClickFindWhat();return false});this.findWhatForm.find(".find-region-list .custom-checkbox img").bind("click",function(b){a.findWhatForm.find("select[name=country] option[region=1]").hide()});this.findWhoForm.find("button.btn-find-who").bind("click",function(b){a.onClickFindWho();return false});$(".find-type").find("a").bind("click",function(d){var c=$(this).attr("class");var b=$(this).parent().parent();if(!b.hasClass(c)){b.removeClass("broad narrow").addClass(c);a.updateSearchScope(c)}return false});$(".find-suggestion").find("a.x-suggestion").bind("click",function(b){a.sendNotification(AppNotification.SHOW_MAKE_SUGGESTION,null,null,10);return false});$(window).bind("hashchange",function(b){if(!a.disableHash){a.search(Utils.urlDecode(window.location.hash))}a.disableHash=false})},respondToMovieIdsLoaded:function(a){this.movieIds=a.getBody();this.movieIds=Utils.shuffle(this.movieIds);this.total=this.movieIds.length;if(this.total<1){this.removeItems();this.showNoResultView()}else{this.goToPage(this.currentPage)}this.showList();if(this.initialLoaded){this.initialLoaded=false;return}},respondToStoryTellerIdsLoaded:function(a){this.userIds=a.getBody();this.total=this.userIds.length;if(this.total<1){this.removeItems();this.showNoResultView()}else{this.goToPage(this.currentPage)}this.showList();if(this.initialLoaded){this.initialLoaded=false;return}},respondToStoryTellerItemAdded:function(a){this.hideLoadingIcon()},respondToLoadUserMovie:function(c){var b=c.getBody();var a=b.getRandomMovieId();this.addRandomMovie(a)},respondToAddRandomMovies:function(d){var e=d.getBody();var c=e.movieIds;var h=e.numDisplay;if(c.length>0){this.randomResultList.find("li").remove();var f=Utils.shuffle(c);var a=Math.min(c.length,h);for(var b=0;b<a;b++){var g=f[b];if(typeof(g)=="undefined"){continue}this.addRandomMovie(g)}}},respondToShowSiteHistory:function(a){this.viewComponent.hide();this.currentSearch=null;this.hideNoResultView()},respondToHideSiteHistory:function(a){this.viewComponent.show()},respondToGoToPage:function(a){var c=a.getBody();if(c.parentClass=="findit"){var b=1;if(typeof(c.page)!="undefined"){b=c.page}else{switch(c.direction){case 1:b=parseInt(this.currentPage)+1;break;case -1:b=parseInt(this.currentPage)-1;break}}this.goToPage(b)}},onClickFindWhat:function(){var a=this.findWhatForm,c=[],d=[];a.find("input[type=checkbox].find-tags").each(function(){if($(this).is(":checked")){c.push($(this).val())}});a.find("input[type=checkbox].find-regions").each(function(){if($(this).is(":checked")){d.push($(this).val())}});var b=new SiteSearch(SearchType.MOVIE,{scope:this.isFestivalSite()?"festival":"all",method:this.getSearchMethod(),tags:c,regions:d,country:a.find("select[name=country]").eq(0).val(),genreId:a.find("select[name=genreId]").eq(0).val(),duration:a.find("select[name=duration]").eq(0).val(),text:Utils.trim(a.find("input[name=searchText]").eq(0).val())});if(!b.isDefault()){this.search(b)}else{alert(_Text(Messages.findthat.SEARCH_TERM_REQUIRED))}},onClickFindWho:function(b){var b=this.findWhoForm,e=[];var d=b.find("select[name=region]").eq(0).val();if(d!=-1){e.push(d)}var a=Utils.trim(b.find("input[name=searchText]").eq(0).val());var c=new SiteSearch(SearchType.STORYTELLER,{scope:this.isFestivalSite()?"festival":"all",method:this.getSearchMethod(),regions:e,country:b.find("select[name=country]").eq(0).val(),interests:b.find("select[name=interests]").eq(0).val(),genreId:b.find("select[name=genreId]").eq(0).val(),individual:b.find("select[name=individual]").eq(0).val(),text:Utils.trim(b.find("input[name=searchText]").eq(0).val())});if(!c.isDefault()){this.search(c)}else{alert(_Text(Messages.findthat.SEARCH_TERM_REQUIRED))}},search:function(a){this.hidePagination();if(typeof(a)=="string"){if(Validator.isEmpty(a)){this.initialLoaded=false;return}var c=Utils.parse_str(a);if(typeof(c.view)!="undefined"&&c.view=="history"){this.sendNotification(AppNotification.SHOW_SITE_HISOTRY);return}var b=typeof(c.type)!="undefined"?c.type:SearchType.MOVIE;a=new SiteSearch(b,c)}if(this.currentSearch==null||!this.currentSearch.equals(a)){this.currentSearch=a;this._search(a)}else{this.showList()}this.sendNotification(AppNotification.HIDE_SITE_HISTORY)},_search:function(a){this.currentPage=1;this.updateLocation();this.updateFieldValues();this.sendNotification(AppNotification.SEARCH,a)},updateSearchScope:function(a){},updateLocation:function(){this.disableHash=true;location="#"+this.currentSearch.toString().replace(/\+/g," ")+"&page="+this.currentPage},updateFieldValues:function(){var b=this.currentSearch,c;var f=$("form[name=frm-find-what]").eq(0);var d=$("form[name=frm-find-who]").eq(0);var a=b.type==SearchType.MOVIE?f:d;a.find("select[name=country]").eq(0).val(b.country);a.find("select[name=genreId]").eq(0).val(b.genreId);a.find("input[name=searchText]").eq(0).val(b.text);if(b.type==SearchType.MOVIE){this.resetForm(this.findWhoForm);f.find(".find-tags-list").eq(0).find("input[type=checkbox]").each(function(){var g=$(this).val().split("_");var j=false;if($.inArray($(this).val(),b.tags)!=-1){j=true}else{for(var h=0;h<g.length;h++){if($.inArray(g[h],b.tags)!=-1){j=true}}}Utils.checkCustomCheckbox($(this),j)});f.find(".find-region-list").eq(0).find("input[type=checkbox]").each(function(){var g=$.inArray($(this).val(),b.regions)!=-1;Utils.checkCustomCheckbox($(this),g)});a.find("select[name=duration]").eq(0).val(b.duration)}else{this.resetForm(this.findWhatForm);var e=b.regions.length>0?b.regions[0]:-1;a.find("select[name=region]").eq(0).val(e);a.find("select[name=interests]").eq(0).val(b.interests);a.find("select[name=individual]").eq(0).val(b.individual)}if(b.method.toLowerCase()=="or"){$(".find-type").removeClass("narrow").addClass("broad")}else{$(".find-type").removeClass("broad").addClass("narrow")}},resetForm:function(a){a.find("select").val(-1);a.find("input[name=searchText]").val("");a.find("input[type=checkbox]").each(function(){Utils.checkCustomCheckbox($(this),false)})},getSearchMethod:function(){return $(".find-type").hasClass("narrow")?"AND":"OR"},goToPage:function(d){var c=this.numPerPage[this.currentView];var g=(d-1)*c;var h=d==this.currentPage;var b=this.currentSearch.type;if(g<this.total&&g>-1){this.removeItems();this.showLoadingIcon();var f=this,j,n,a,r=[];var o=this.viewComponent.find("ul.movie-items").eq(0);if(b==SearchType.MOVIE){j="movieSearchResult";n=this.movieIds;a="cu-"}else{j="storytellerSearchResult";n=this.userIds;a="user-"}var s=Templates.load(j);this.updatePageNumber(d);for(var m=0;m<c;m++){var e=g+m;if(e<this.total){var k=parseInt(n[e]);if(k&&!isNaN(k)){r.push(k);var p=$("<li>"+s+"</li>").attr("index",e).addClass(a+k);o.append(p)}}}if(b==SearchType.MOVIE){this.genereateRandomMovieResults(r);$.each(r,function(i,t){f.sendNotification(AppNotification.LOAD_CU_MOVIE_DATA,t)})}else{var l=Utils.getShuffledNumbers(r,this.numRandomResults);$.each(r,function(i,t){if($.inArray(t,l)!=-1){f.viewComponent.find("ul.movie-items li."+a+t).attr("show-movie",1)}f.sendNotification(AppNotification.LOAD_STORYTELLER_DATA,t)})}this.setListHeight();if(!h){this.scrollToResult()}setTimeout(function(){f.showPagination()},100)}else{var q=this.getLastPage();if(d>q+1){this.goToPage(q)}}},removeItems:function(){this.hideNoResultView();this.viewComponent.find(".pagination").eq(1).hide();this.viewComponent.find("ul.movie-items li").remove();this.randomResultList.find("li").remove()},genereateRandomMovieResults:function(c){if(c.length>0){var d=Utils.shuffle(c);for(var b=0;b<this.numRandomResults;b++){var e=d[b];if(typeof(e)=="undefined"){continue}var a=$.inArray(e,c);this.createRandomMovieItem(e,a)}}},createRandomMovieItem:function(d,b){if(typeof(d)=="undefined"){return}var a=Templates.load("movieInfo");var c=$("<li>"+a+"</li>").addClass("cu-"+d).attr("index",b).attr("view","thumb");this.randomResultList.append(c)},addRandomMovie:function(b){if(!isNaN(b)){var a=$.inArray(b,this.movieIds);if(a==-1){this.movieIds.push(b);a=this.movieIds.length-1}this.createRandomMovieItem(b,a);this.sendNotification(AppNotification.LOAD_CU_MOVIE_DATA,b)}},showList:function(){this.searchResultDiv.show();FindThatViewMediator.$super.showList.call(this);this.scrollToResult()},setListHeight:function(){},showNoResultView:function(){if(this.noResultDiv==null){this.noResultDiv=$('<div id="find-no-result"/>');this.viewComponent.parent().parent().append(this.noResultDiv)}var e='<div class="no-result-message">'+_Text(Messages.findthat.NO_RESULT)+"</div>";if(this.isFestivalSite()&&this.currentSearch.type==SearchType.MOVIE){var a=this.currentSearch.text;var d=new SiteSearch(this.currentSearch.type,this.currentSearch.getData());d.scope="all";var c="/filmedia/findit.php#"+d.toString().replace(/\+/g,"%20");var b="";if(a!=""){b=" on &lt;<b>"+a+"</b>&gt;"}e+="<p>"+_Text(Messages.findthat.TRY_FILMEDIA,[b,c])+"</p>"}this.noResultDiv.html(e);this.noResultDiv.show()},hideNoResultView:function(){if(this.noResultDiv!=null){this.noResultDiv.hide()}},createPagination:function(){var b=Templates.load("pagination");var a="findit";var c=this.viewComponent.parent().parent();c.append($(b).attr("rel",a));this.sendNotification(AppNotification.PAGE_COMP_CREATED,a)},updatePageNumber:function(a){this.currentPage=a;this.updateLocation();this.sendNotification(AppNotification.UPDATE_PAGE_NUMBER,{parentClass:".findit",page:a})},showPagination:function(){if(this.total>this.numPerPage[this.currentView]){$(".pagination[rel=findit]").show()}else{this.hidePagination()}},hidePagination:function(){$(".pagination[rel=findit]").hide()},scrollToResult:function(){var a=this.isFestivalSite()?640:630;setTimeout(function(){Utils.windowScrollTop(a)},500)}});FindThatViewMediator.NAME="FindThatViewMediator";var NowPageMediator=Objs("com.cultureunplugged.app.view.NowPageMediator",FabricationMediator,{authProxy:null,nowMovieProxy:null,currentMovie:null,player:null,playerId:"nowSwfPlayer",playerSwf:null,initialize:function(a,b){NowPageMediator.$super.initialize.call(this,NowPageMediator.NAME,null);this.playerSwf=AppConfig.PROMO_PLAYER},onRegister:function(){this.authProxy=this.facade.retrieveProxy(AuthProxy.NAME);this.nowMovieProxy=this.facade.retrieveProxy(NowMovieProxy.NAME);this.player=$("#now-embed").find(".embed-container").eq(0);this.registerEvents();this.resizeImages();this.loadNowMovie()},registerEvents:function(){var a=this;$(".image").find("img").load(function(){var b=parseInt($(this).parent().attr("rel"));if(b>1){a.resizeImage(b,$(this))}});$(".now-tabs").find("div").bind("click",function(){var b=$(this).attr("class").replace("now-tab-","");switch(b){case"thestream":case"activate":case"earthrise":case"slavery":if(a.currentMovie!=null&&b!=a.currentMovie.source){a.loadNowMovie(b)}break}return false})},resizeImages:function(){var a=this;$(".image").find("img").each(function(){var b=parseInt($(this).parent().attr("rel"));if(b>1){a.resizeImage(b,$(this))}})},resizeImage:function(b,d){var a=d.width(),f=d.height(),e=a/f,c=0;if(b==2||b==3){c=220}else{if(b>3){c=133}}if(c>0){if(f>c){d.height(c).width(c*e)}}},loadNowMovie:function(a){this.updateTitle(a);this.nowMovieProxy.getMovie(a)},updateTitle:function(a){if(typeof(a)=="undefined"){a="thestream"}var b="";switch(a){case"thestream":b="The Stream";break;default:b=Utils.ucwords(a)}$(".now-tabs").find(".title .x-value").html(b)},updateDate:function(b){var a=$.datepicker.formatDate("MM d, yy",$.datepicker.parseDate("yy-mm-dd",b));$(".now-tabs").find(".title .date").text(a)},respondToNowMovieLoaded:function(b){var a=b.getBody();if(a==null){this.currentMovie=null;this.player.children().remove()}else{if(this.currentMovie==null||this.currentMovie.id!=a.id){this.currentMovie=a;this.player.children().remove();this.updateDate(a.date);this.setMovieInfo(a);if(a.type=="embed"){var c=a.embedCode.replace(/width="(\d+)"/g,'width="708"').replace(/height="(\d+)"/g,'height="406"');var d=this;this.player.width(0).height(0).append(c);setTimeout(function(){d.player.width(708).height(406)},2500)}else{this.setPlayerMovie(a)}}}},setMovieInfo:function(b){var a=$("#now-player-info");a.find(".title b").html(b.title);a.find(".synopsis").html(b.synopsis)},setPlayerMovie:function(a){var b={video:a.url,u:this.authProxy.getUserId(),m:a.id,thumb:a.getThumbnail(),sURL:AppConfig.SERVER_URL,title:a.title,mType:"nowTV"};this.player.flashembed({name:this.playerId,id:this.playerId,src:this.playerSwf,version:AppConfig.FLASH_VERSION,menu:false,wmode:"opaque",bgColor:"#000000",flashvars:$.param(b)})},});NowPageMediator.NAME="NowPageMediator";var IPadMediator=Objs("com.cultureunplugged.app.view.IPadMediator",FabricationMediator,{initialize:function(a,b){IPadMediator.$super.initialize.call(this,IPadMediator.NAME,null)},onRegister:function(){this.facade.registerCommand(AppNotification.SHOW_DOWNLOAD_IPAD_POPUP,ShowDownloadIPadAppCommand);$("label[for=yourphoto]").hide();$(".fileinputs").hide();this.registerEvents()},registerEvents:function(){var a=this;$("#special").find("a").bind("click",function(b){setTimeout(function(){a.onClickFilmFestivalTV()},10);return false});$("#profileUpdate").find("a").attr("href","#").bind("click",function(){a.uploadNotAllowed();return false});$("a.upload-in-profile").attr("href","#").bind("click",function(){a.uploadNotAllowed();return false})},uploadNotAllowed:function(){alert(_Text(Messages.warning.UPLOAD_NOT_ALLOWED))},onClickFilmFestivalTV:function(){this.sendNotification(AppNotification.SHOW_DOWNLOAD_IPAD_POPUP)}});IPadMediator.NAME="IPadMediator";var SearchCommand=Objs("com.cultureunplugged.app.controller.SearchCommand",SimpleCommand,{execute:function(b){var c=b.getBody();debug_info("Start Searching..."+c.toString());var a=this.getSearchProxy();a.search(c)},getSearchProxy:function(){if(!this.facade.hasProxy(SearchProxy.NAME)){this.facade.registerProxy(new SearchProxy())}return this.facade.retrieveProxy(SearchProxy.NAME)}});var AddToWatchLaterCommand=Objs("com.cultureunplugged.app.controller.AddToWatchLaterCommand",SimpleCommand,{execute:function(c){var b=this.facade.retrieveProxy(AuthProxy.NAME);var a=c.getBody().movieId;var d=this;if(!b.isUserLoggedIn()){this.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(e){d.addToWatchLater(e.uid,a)}})}else{this.addToWatchLater(b.loggedInUser.uid,a)}},addToWatchLater:function(b,a){$.ajax({url:"/ajax/addToWatchLater.php",data:{movieId:a},dataType:"json",success:function(c){alert(c.message)}})}});var AddToSiteHistoryCommand=Objs("com.cultureunplugged.app.controller.AddToSiteHistoryCommand",SimpleCommand,{execute:function(b){var a=this.facade.retrieveProxy(SiteHistoryProxy.NAME);a.addItem(window.location.toString())}});var LoadCuMovieDataCommand=Objs("com.cultureunplugged.app.controller.LoadCuMovieDataCommand",SimpleCommand,{execute:function(c){var a=c.getBody();var b=this.facade.retrieveProxy(MovieProxy.NAME);b.loadMovieData("cu",a)}});var LoadStorytellerDataCommand=Objs("com.cultureunplugged.app.controller.LoadStorytellerDataCommand",SimpleCommand,{execute:function(c){var a=c.getBody();var b=this.facade.retrieveProxy(UserProxy.NAME);b.loadUserData(a)}});var RegisterFilmMakerCommitteeCommand=Objs("com.cultureunplugged.app.controller.RegisterFilmMakerCommitteeCommand",FabricationSimpleCommand,{movieProxy:null,execute:function(a){this.onRegisterFilmMaker()},onRegisterFilmMaker:function(){var a=this.facade.retrieveProxy(AuthProxy.NAME);if(!a.isUserLoggedIn()){var b=this;this.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){setTimeout(function(){b.onRegisterFilmMaker()},500)}});return}this.sendNotification(AppNotification.OPEN_POPUP,{id:"#iframe_registerFilmMakerCommittee",url:"/popups/filmMakerCommittee.php",width:730,height:466})}});var PostToTwitterCommand=Objs("com.cultureunplugged.app.controller.PostToTwitterCommand",SimpleCommand,{execute:function(c){var d=c.getBody();if(!d.movieTitle||d.movieTitle==""){return}var h="http://cutv.ws/"+d.movieId;var g="http://cultureunplugged.com/?text=";var e=typeof(d.username)=="undefined"?"":d.username;var a=typeof(d.movieCategory)=="undefined"?"":d.movieCategory;if(typeof(d.commentId)!="undefined"){h+="?commentId="+d.commentId;g+=e+' commented on "'+d.movieTitle+'", a '+a+" documentary. "}else{g+="I'm watch'in "+d.movieTitle+"."}var b="http://twitter.com/share";var f={count:"horizontal",counturl:h,url:h,via:"worldfilms",original_referer:g};b+="?"+$.param(f);window.open(b,"twitterwindow","menubar=1,resizable=1,scrollbars=1,width=500,height=400")}});var SendEmailToStoryTellerCommand=Objs("com.cultureunplugged.app.controller.SendEmailToStoryTellerCommand",SimpleCommand,{execute:function(c){var e=c.getBody(),b=e.uid,a=e.name,d=typeof(e.collaborate)!="undefined"&&e.collaborate==1?1:0;this.onSendEmail(b,a,d)},onSendEmail:function(c,a,d){var b=this.facade.retrieveProxy(AuthProxy.NAME);if(!b.isUserLoggedIn()){var e=this;this.sendNotification(AppNotification.SHOW_LOGIN_FORM,{afterLogin:function(){setTimeout(function(){e.onSendEmail(c,a,d)},500)}});return}this.sendNotification("showSendEmailToFilmMakerDialog",{uid:c,name:a,collaborate:d})}});var ShowMovieInfoPopupCommand=Objs("com.cultureunplugged.app.controller.ShowMovieInfoPopupCommand",FabricationSimpleCommand,{movieProxy:null,execute:function(c){var e=this,d=c.getBody(),b=d.index,a=d.source;if(a=="cu"){this.movieProxy=this.facade.retrieveProxy(MovieProxy.NAME)}else{this.movieProxy=this.facade.retrieveProxy(LinkTvMovieProxy.NAME)}this.movieProxy.loadMovieData(d.source,d.movieId,function(f){e.setMovieInfo(f,b)})},setMovieInfo:function(b,d){var e=this,a=this.createPopup("movieInfoPopup","movieInfoPopup");a.find(".movie-title .x-value").html(b.title);a.find(".movie-director").html(b.director);a.find(".movie-producer").html(b.producer);a.find(".movie-genre").html(b.genre);a.find(".movie-year").html(b.year);a.find(".storyteller-country").html(b.storyTellerCountryFullName);var c=b.getMovieTagLinks(false);if(c.length>0){a.find(".movie-tags .x-value").html(c.join(", "));a.find(".movie-tags").show()}else{a.find(".movie-tags").hide()}a.find(".movie-synopsis").html(b.synopsis);this.addWatchNow(a,b,d);this.showPopup(a,745,"auto","movie-popup")},createPopup:function(c,d){var a=$("#"+c);if(a.length<1){var b=this.getTemplate(d);a=$(b).attr("id",c)}return a},showPopup:function(b,a,e,c){var d=this.facade.retrieveMediator(PopupMediator.NAME);d.createPopup(b,a,e,c)},getTemplate:function(a){return Templates.load(a)},isFilmsPage:function(){return $("#header").hasClass("n-films")},addWatchNow:function(b,a,c){if(this.movieProxy.source!="cu"){b.find(".movie-watchnow").hide();return}var d=a.status=="LIVE"?"festival":"filmedia";b.find(".movie-watchnow").html('<a href="/documentary/watch-online/play/'+a.id+'">Watch Now</a>').show();if(this.isFilmsPage()&&!Validator.isEmpty(c)){var e=this;b.find(".movie-watchnow a").bind("click",function(){e.sendNotification(AppNotification.CLOSE_POPUP);e.sendNotification(AppNotification.LOAD_VIDEO,{index:c,movieId:a.id},null,500);return false})}}});var ShowMovieSynopsisPopupCommand=Objs("com.cultureunplugged.app.controller.ShowMovieSynopsisPopupCommand",ShowMovieInfoPopupCommand,{setMovieInfo:function(b,c){var a=this.createPopup("movie-synopsis-popup","synopsisPopup");a.find(".movie-title").html(b.title);a.find(".movie-synopsis").html(b.synopsis);this.addWatchNow(a,b,c);this.showPopup(a,620,"auto","synopsis-popup")}});var ShowDownloadIPadAppCommand=Objs("com.cultureunplugged.app.controller.ShowDownloadIPadAppCommand",ShowMovieInfoPopupCommand,{execute:function(b){var c=this,a=this.createPopup("downloadIpadAppPopup","");a.find(".popup-no-button").bind("click",function(){$(this).unbind();c.sendNotification(AppNotification.CLOSE_POPUP);return false});a.find(".popup-yes-button").bind("click",function(){$(this).unbind();c.sendNotification(AppNotification.CLOSE_POPUP);location="http://itunes.apple.com/us/app/film-festival-tv/id437050049?mt=8";return false});this.showPopup(a,745,"auto","synopsis-popup")},getTemplate:function(c){var b="<p>Film Festival TV is a free and non-commercial service, which can be accessed via a computer device. To access it via iPad, please download the application.</p>";b+="<p>About Film-Festival TV:<br/>";b+="On Film-Festival TV, you will discover documentaries and films from around the world from film-makers, activists, grassroot-productions and purpose driven institutions. This is an alternative offering of Culture Unplugged Festivals.<br/>";b+="This program is brought to you by all participating film-makers, festival partners and the organizaing team around the world, as a philanthropic offering to uplift our collective consciousness.";b+="We all share the dream of a more compassionate humanity and hope for global cultural harmony - an interconnected world. We all, together with you unite here to participate in the conscious evolution of humanity ";b+="by witnessing our present existence through cinema and contemplating the current need that is in the process of crafting our future.</p>";var a=['<div class="popup-movie-synopsis">','<div class="popup-info-container">',b,'<div class="popup-buttons"><button class="popup-no-button">Stay Here</button><button class="popup-yes-button">Download iPad App Now</button></div>',"</div>","</div>"];return a.join("\n")}});var FacebookLoginCommand=Objs("com.cultureunplugged.app.controller.FacebookLoginCommand",SimpleCommand,{execute:function(a){if(FB){FacebookLogin()}}});function FacebookLogin(){FB.login(function(a){if(a.authResponse){FB.api("/me",function(b){$.ajax({url:"/auth/facebookLogin",data:{fbUserId:b.id,name:b.name,first_name:b.first_name,last_name:b.last_name},dataType:"json",type:"POST",success:function(c){if(!c.isOK){alert(c.message)}else{if(window.sendNotification){sendNotification(AppNotification.FACEBOOK_USER_LOGGEDIN)}}}})})}else{}},{scope:"email"})}function FacebookLogout(){FB.logout(function(a){})}var FacebookShareCommand=Objs("com.cultureunplugged.app.controller.FacebookShareCommand",SimpleCommand,{execute:function(b){var a=b.getBody().movieId;this.sendNotification(AppNotification.OPEN_WINDOW,{url:"/facebook/share.php?movieId="+a,width:480,height:320})}});var EmailMovieLinkCommand=Objs("com.cultureunplugged.app.controller.EmailMovieLinkCommand",SimpleCommand,{execute:function(d){var b=d.getBody().movie;var c="discover this film on Culture Unplugged...";var a=this.getBody(b);location="mailto:?subject="+encodeURI(c)+"&body="+encodeURIComponent(a)},getBody:function(b){var a=["Dear friend,\n","I have found an interesting documentary "+b.title+" on Culture Unplugged and want to share with you.\n","http://www.cultureunplugged.com/documentary/watch-online/play/"+b.id+"\n","Director:  "+b.director+"  |  Producer: "+b.producer+"\n","Genre: "+b.genre+"  |  Produced In: "+b.year+"  |  Country: "+b.country+"\n","Synopsis: "+b.synopsis+"\n\n","Hope you Enjoy!","promote films. promote consciousness.\n","Culture Unplugged\n"];return a.join("\n")}});var FilmediaFilmsStartupCommand=Objs("com.cultureunplugged.app.controller.FilmediaFilmsStartupCommand",SimpleCommand,{execute:function(a){}});var VideoPlayerStartupCommand=Objs("com.cultureunplugged.app.controller.VideoPlayerStartupCommand",SimpleCommand,{execute:function(b){var c=this,a=this.facade.retrieveProxy(AuthProxy.NAME);a.getLoggedInUser(function(d){c.showPlayer()})},showPlayer:function(){var a=this.facade.retrieveMediator(VideoPlayerMediator.NAME);a.currentMovieId=movieId;a.showPlayer();var b=this.facade.retrieveProxy(MovieProxy.NAME);b.loadMovieData("cu",movieId)}});if(isIOS()){BeautyTipMediator.trigger="click";document.addEventListener("touchend",jQuery.bt.docClick,false)};

