/*1301967283,169775557*/

if (window.CavalryLogger) { CavalryLogger.start_js(["mc4+u"]); }

function typeahead_source(){}typeahead_source.prototype.cache_results=false;typeahead_source.prototype.enumerable=false;typeahead_source.prototype.allow_fake_results=false;typeahead_source.prototype.escape_results=false;typeahead_source.prototype.search_limit=10;typeahead_source.prototype.check_limit=10;typeahead_source.prototype.bootstrap=bagofholding;typeahead_source.check_match=function(f,g){g=typeahead_source.tokenize(g);for(var b=0,c=f.length;b<c;b++)if(f[b].length){var a=false;for(var d=0,e=g.length;d<e;d++)if(g[d].length>=f[b].length&&g[d].substring(0,f[b].length)==f[b]){a=true;g[d]='';break;}if(!a)return false;}return true;};typeahead_source.tokenize=function(c,a,b){return (b?c:typeahead_source.flatten_string(c)).split(a?typeahead_source.normalizer_regex_capture:typeahead_source.normalizer_regex);};typeahead_source.normalizer_regex_str='(?:(?:^| +)["\'.\\-]+ *)|(?: *[\'".\\-]+(?: +|$)|[@_]| +)';typeahead_source.normalizer_regex=new RegExp(typeahead_source.normalizer_regex_str,'g');typeahead_source.normalizer_regex_capture=new RegExp('('+typeahead_source.normalizer_regex_str+')','g');typeahead_source.flatten_string=function(b){if(!typeahead_source.accents)typeahead_source.accents={a:/\u0430|\u00e0|\u00e1|\u00e2|\u00e3|\u00e4|\u00e5/g,b:/\u0431/g,c:/\u0446|\u00e7/g,d:/\u0434|\u00f0/g,e:/\u044d|\u0435|\u00e8|\u00e9|\u00ea|\u00eb/g,f:/\u0444/g,g:/\u0433/g,h:/\u0445/g,i:/\u0438|\u00ec|\u00ed|\u00ee|\u00ef/g,j:/\u0439/g,k:/\u043a/g,l:/\u043b/g,m:/\u043c/g,n:/\u043d|\u00f1/g,o:/\u043e|\u00f8|\u00f6|\u00f5|\u00f4|\u00f3|\u00f2/g,p:/\u043f/g,r:/\u0440/g,s:/\u0441/g,t:/\u0442/g,u:/\u0443|\u044e|\u00fc|\u00fb|\u00fa|\u00f9/g,v:/\u0432/g,y:/\u044b|\u00ff|\u00fd/g,z:/\u0437/g,ae:/\u00e6/g,oe:/\u0153/g,ts:/\u0446/g,ch:/\u0447/g,sh:/\u0448/g,ya:/\u044f/g};b=b.toLowerCase();for(var a in typeahead_source.accents)b=b.replace(typeahead_source.accents[a],a);return b;};typeahead_source.prototype.set_owner=function(a){this.owner=a;if(this.is_ready)this.owner.update_status(0);};typeahead_source.prototype.ready=function(){if(this.owner&&!this.is_ready){this.is_ready=true;this.owner.update_status(0);}else this.is_ready=true;};typeahead_source.highlight_found=function(g,h){var b=[];resultv=typeahead_source.tokenize(g,true,true);g=typeahead_source.tokenize(g,true);h=typeahead_source.tokenize(h);h.sort(typeahead_source._sort);for(var c=0,d=resultv.length;c<d;c++){var a=false;for(var e=0,f=h.length;e<f;e++)if(h[e]&&g[c].lastIndexOf(h[e],0)!=-1){b.push('<em>',htmlspecialchars(resultv[c].substring(0,h[e].length)),'</em>',htmlspecialchars(resultv[c].substring(h[e].length,resultv[c].length)));a=true;break;}if(!a)b.push(htmlspecialchars(resultv[c]));}return b.join('');};typeahead_source._sort=function(a,b){return b.length-a.length;};typeahead_source.prototype.gen_nomatch=function(){return this.text_nomatch!=null?this.text_nomatch:_tx("No se han encontrado coincidencias");};typeahead_source.prototype.gen_loading=function(){return this.text_loading!=null?this.text_loading:_tx("Cargando...");};typeahead_source.prototype.gen_placeholder=function(){return this.text_placeholder!=null?this.text_placeholder:_tx("Empieza a teclear...");};typeahead_source.prototype.gen_noinput=function(){return this.text_noinput!=null?this.text_noinput:_tx("Empieza a teclear...");};typeahead_source.prototype.onselect_not_found=function(){if(typeof this.tokenizer._ontokennotfound!='undefined')this.tokenizer._ontokennotfound(this.obj.value);if(typeof this.tokenizer.onselect!='undefined')return this.tokenizer.onselect();};typeahead_source.prototype.gen_html=function(d,a){var e=d.t||d;var b=['<div>',typeahead_source.highlight_found(e,a),'</div>'];if(d.s){var c=(this.escape_results?htmlspecialchars(d.s):d.s);b.push('<div class="sub_result"><small>',c,'</small></div>');}return b.join('');};
var PlatformInvite=new function(){this._getRequestData=function(l,a,m,f,k,h,j,g,o,n){var i='';if(!k)i=ge('message')?$('message').value:'';if(j){var d=[];d.push(j);}else{var e=this._getSelectedIdsAndEmails(l);var d=e[0];var c=e[1];}var b={app_id:a,to_ids:o?o:d,to_emails:n?n:c,request_type:m,invite:f,content:l.getAttribute('content'),preview:k,is_multi:h,is_in_canvas:g,form_id:l.id,prefill:(j>0),message:i,donot_send:ge('donotsend')?$('donotsend').checked:false};return b;};this._getSelectedIdsAndEmails=function(e){var d=e.getElementsByTagName('input');var c=[];var a=[];for(var b=0;b<d.length;b++)if(d[b].getAttribute('fb_protected')=='true'&&(d[b].name=='ids[]'||d[b].name=='friend_selector_id')&&(d[b].type!='checkbox'||d[b].checked)){c.push(d[b].value);}else if(d[b].getAttribute('fb_protected')=='true'&&d[b].name=='emails[]')a.push(d[b].value);return [c,a];};this.sendInvitation=function(i,h,d,f,e){var g=$(e.request_form);var b=this._getRequestData(g,e.app_id,e.request_type,e.invite,f,e.is_multi,e.prefill,e.is_in_canvas,i,h);if(d)b.message=d;b.include_ci=Boolean(e.include_ci);var a=new AsyncRequest().setURI('/fbml/ajax/prompt_send.php').setData(b);if(f){new Dialog().setClassName('req_dialog').setAsync(a).setModal().show();}else{var c=function(n){var k=n.payload.email_converted_values;if(k){var j=n.payload.email_attribute_name;for(var l=0;l<k.length;++l){var m=$N('input',{type:'hidden',name:j,value:k[l]});m.setAttribute('fb_protected','true');g.appendChild(m);}}g.submit();};a.setHandler(c);new Dialog().setAsync(a);}return false;};this.runPlatformCI=function(j,i,d,g,f){var h=$(f.request_form);var c=this._getSelectedIdsAndEmails(h);var e=f.prefill?1:c[0].length;var b={message:d,form_id:f.request_form,app_id:f.app_id,request_type:f.request_type,invite:f.invite,is_in_canvas:f.is_in_canvas,is_multi:f.is_multi,prefill:f.prefill,num_invites_sent:e};var a=new AsyncRequest().setURI('/fbml/ajax/ci_login_render.php').setData(b);new Dialog().setModal().setAsync(a).show();};}();
