/*
HTTP Host: b.static.ak.fbcdn.net
Generated: March 18th 2010 6:21:32 PM PDT
Machine: 10.16.139.103
Locale: nu_ll
Path: js/j0c3ri2v0084gwgg.pkg.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/j0c3ri2v0084gwgg.pkg.js"]); }

function generic_dialog(_L0,_L1){this.className=_L0;this.content=null;this.obj=null;this.popup=null;this.overlay=null;this.modal=null;this.iframe=null;this.hidden_objects=[];if(_L1==true)this.modal=true;}generic_dialog.dialog_stack=null;generic_dialog.prototype.setClassName=function(_L0){if(this.obj)CSS.addClass(this.obj,_L0);this.className=_L0;};generic_dialog.hide_all=function(){if(generic_dialog.dialog_stack!==null){var _L0=generic_dialog.dialog_stack.clone();generic_dialog.dialog_stack=null;for(var i=_L0.length-1;i>=0;i--)_L0[i].hide();}};generic_dialog.prototype.should_hide_objects=!ua.windows();generic_dialog.prototype.should_use_iframe=ua.ie()<7||(ua.osx()&&ua.firefox());generic_dialog.prototype.show_dialog=function(_L0){if(generic_dialog.dialog_stack===null)onunloadRegister(generic_dialog.hide_all,true);if(!this.obj)this.build_dialog();if(typeof(_L0)=='string')_L0=HTML(_L0).setDeferred(true);DOM.setContent(this.content,_L0);var _L1=this.content.getElementsByTagName('img');for(var i=0;i<_L1.length;i++)_L1[i].onload=chain(_L1[i].onload,this.hide_objects.bind(this));this.show();this._focus_first_textbox_or_button.bind(this).defer();return this;};generic_dialog.prototype._focus_first_textbox_or_button=function(){var _L0=['input[type="text"]','textarea','input[type="password"]','input[type="button"]','input[type="submit"]'];var _L1=[];for(var ii=0;ii<_L0.length&&_L1.length==0;ii++)_L1=DOM.scry(this.content,_L0[ii]);if(_L1.length>0){var _L3=_L1[0];try{if(elementY(_L3)>0&&elementX(_L3)>0)_L3.focus();}catch(e){}}return true;};generic_dialog.prototype.make_modal=function(){if(this.modal)return;this.modal=true;if(ua.ie()==7)this.build_iframe();this.build_overlay();this.reset_iframe();};generic_dialog.prototype.show_loading=function(_L0){if(!_L0)_L0=_tx("Cargando...");return this.show_dialog('<div class="dialog_loading">'+_L0+'</div>');};generic_dialog.prototype._show_ajax_dialog_custom_loader=function(_L0,src,_L2,_L3){if(_L0)this.show_loading(_L0);var _L4=function(_L3,_L7){var _L0=_L3?_L7.getPayload():_L7.getPayload().responseText;this.show_dialog(_L0);}.bind(this,_L3);var _L5=function(_L7){ErrorDialog.showAsyncError(_L7);this.hide(false);}.bind(this);var _L6=new AsyncRequest().setOption('suppressEvaluation',!_L3).setURI(src).setData(_L2||{}).setHandler(_L4).setErrorHandler(_L5).setTransportErrorHandler(_L5);if(!_L2)_L6.setMethod('GET').setReadOnly(true);_L6.send();return this;};generic_dialog.prototype.show_ajax_dialog=function(src,_L1,_L2){_L1=_L1||false;var _L3=_tx("Cargando...");return this._show_ajax_dialog_custom_loader(_L3,src,_L1,_L2);};generic_dialog.prototype.show_prompt=function(_L0,_L1){return this.show_dialog('<h2 class="dialog_title"><span>'+_L0+'</span></h2><div class="dialog_content">'+_L1+'</div>');};generic_dialog.prototype.show_message=function(_L0,_L1,_L2){if(_L2==null)_L2=_tx("Aceptar");return this.show_choice(_L0,_L1,_L2,function(){generic_dialog.get_dialog(this).fade_out(100);});};generic_dialog.prototype.show_choice=function(title,content,button1,button1js,button2,button2js,buttons_msg,button3,button3js){var buttons='<div class="dialog_buttons" id="dialog_buttons">';if(typeof(buttons_msg)!='undefined'){buttons+='<div class="dialog_buttons_msg">';buttons+=buttons_msg;buttons+='</div>';}buttons+='<input class="inputsubmit" type="button" value="'+button1+'" id="dialog_button1" />';if(button2){var button2_class='inputsubmit';if(button2==_tx("Cancelar"))button2_class+=' inputaux';buttons+='<input class="'+button2_class+'" type="button" value="'+button2+'" id="dialog_button2" />';}if(button3){var button3_class='inputsubmit';if(button3==_tx("Cancelar"))button3_class+=' inputaux';buttons+='<input class="'+button3_class+'" type="button" value="'+button3+'" id="dialog_button3" />';}this.show_prompt(title,this.content_to_markup(content)+buttons);var inputs=this.obj.getElementsByTagName('input');if(button3){button1obj=inputs[inputs.length-3];button2obj=inputs[inputs.length-2];button3obj=inputs[inputs.length-1];}else if(button2){button1obj=inputs[inputs.length-2];button2obj=inputs[inputs.length-1];}else button1obj=inputs[inputs.length-1];if(button1js&&button1){if(typeof button1js=='string')eval('button1js = function() {'+button1js+'}');button1obj.onclick=button1js;}if(button2js&&button2){if(typeof button2js=='string')eval('button2js = function() {'+button2js+'}');button2obj.onclick=button2js;}if(button3js&&button3){if(typeof button3js=='string')eval('button3js = function() {'+button3js+'}');button3obj.onclick=button3js;}if(!this.modal){document.onkeyup=function(e){var _L1=(e&&e.which)?e.which:event.keyCode;var _L2=(typeof button2obj!='undefined');var _L3=(typeof button3obj!='undefined');var _L4=ua.safari();if(_L4&&_L1==13)button1obj.click();if(_L1==27)if(_L3){button3obj.click();}else if(_L2){button2obj.click();}else button1obj.click();document.onkeyup=function(){};};this.button_to_focus=button1obj;button1obj.offsetWidth&&button1obj.focus();}return this;};generic_dialog.prototype.content_to_markup=function(_L0){return (typeof _L0=='string')?'<div class="dialog_body">'+_L0+'</div>':'<div class="dialog_summary">'+_L0.summary+'</div><div class="dialog_body">'+_L0.body+'</div>';};generic_dialog.prototype.hide=function(_L0){if(this.obj)this.obj.style.display='none';if(this.iframe)this.iframe.style.display='none';if(this.overlay)this.overlay.style.display='none';if(this.timeout){clearTimeout(this.timeout);this.timeout=null;return;}if(this.hidden_objects.length){for(var i=0,il=this.hidden_objects.length;i<il;i++)this.hidden_objects[i].style.visibility='';this.hidden_objects=[];}clearInterval(this.active_hiding);if(!_L0){if(generic_dialog.dialog_stack){var _L3=generic_dialog.dialog_stack;for(var i=_L3.length-1;i>=0;i--)if(_L3[i]==this)_L3.splice(i,1);if(_L3.length)_L3[_L3.length-1].show();}if(this.obj){this.obj.parentNode.removeChild(this.obj);this.obj=null;}if(this.close_handler)this.close_handler();}return this;};generic_dialog.prototype.fade_out=function(_L0,_L1,_L2){if(!this.popup)return this;try{animation(this.obj).duration(_L1||0).checkpoint().to('opacity',0).hide().duration(_L0||350).ondone(function(){_L2&&_L2();this.hide();}.bind(this)).go();}catch(e){this.hide();}return this;};generic_dialog.prototype.show=function(){if(this.obj&&this.obj.style.display){this.obj.style.visibility='hidden';this.obj.style.display='';this.reset_dialog();this.obj.style.visibility='';this.obj.dialog=this;}else this.reset_dialog();this.hide_objects();clearInterval(this.active_hiding);this.active_hiding=setInterval(this.active_resize.bind(this),500);var _L0=generic_dialog.dialog_stack?generic_dialog.dialog_stack:generic_dialog.dialog_stack=[];if(_L0.length){var _L1=_L0[_L0.length-1];if(_L1!=this&&!_L1.is_stackable)_L1.hide();}for(var i=_L0.length-1;i>=0;i--)if(_L0[i]==this){_L0.splice(i,1);}else _L0[i].hide(true);_L0.push(this);return this;};generic_dialog.prototype.active_resize=function(){if(this.last_offset_height!=this.content.offsetHeight){this.hide_objects();this.last_offset_height=this.content.offsetHeight;}};generic_dialog.prototype.hide_objects=function(){var _L0=[],_L1=[];var _L2=['',0,1,2,4,5,9,3];for(var i=0;i<_L2.length;i++){var _L4=ge('ad_'+_L2[i]);if(_L4!=null)_L0.push(_L4);}var _L5={x:elementX(this.content),y:elementY(this.content),w:this.content.offsetWidth,h:this.content.offsetHeight};if(this.should_hide_objects){var _L6=document.getElementsByTagName('iframe');for(var i=0;i<_L6.length;i++)if(_L6[i].className.indexOf('share_hide_on_dialog')!=-1)_L1.push(_L6[i]);}var _L7=[].concat($A(DOM.scry(document.body,'embed')),$A(DOM.scry(document.body,'object')));for(var i=0;i<_L7.length;i++)if((_L7[i].getAttribute('wmode')||'').toLowerCase()!='transparent'||this.should_hide_objects)_L1.push(_L7[i]);for(var i=0;i<_L1.length;i++){var _L8=_L1[i].offsetHeight?_L1[i]:_L1[i].parentNode;swf_rect={x:elementX(_L8),y:elementY(_L8),w:_L8.offsetWidth,h:_L8.offsetHeight};if(!DOM.contains(this.content,_L1[i])&&_L5.y+_L5.h>swf_rect.y&&swf_rect.y+swf_rect.h>_L5.y&&_L5.x+_L5.w>swf_rect.x&&swf_rect.x+swf_rect.w>_L5.w&&this.hidden_objects.indexOf(_L8)==-1)_L0.push(_L8);}for(var i=0;i<_L0.length;i++){this.hidden_objects.push(_L0[i]);_L0[i].style.visibility='hidden';}};generic_dialog.prototype.build_dialog=function(){if(!this.obj)this.obj=document.createElement('div');CSS.setClass(this.obj,'generic_dialog'+(this.className?' '+this.className:''));this.obj.style.display='none';onloadRegister(function(){DOM.getRootElement().appendChild(this.obj);}.bind(this));if(this.should_use_iframe||(this.modal&&ua.ie()==7))this.build_iframe();if(!this.popup){this.popup=document.createElement('div');CSS.setClass(this.popup,'generic_dialog_popup');}this.popup.style.left=this.popup.style.top='';this.obj.appendChild(this.popup);if(this.modal)this.build_overlay();};generic_dialog.prototype.build_iframe=function(){if(!this.iframe&&!(this.iframe=ge('generic_dialog_iframe'))){this.iframe=document.createElement('iframe');this.iframe.id='generic_dialog_iframe';this.iframe.src="/common/blank.html";}this.iframe.frameBorder='0';onloadRegister(function(){DOM.getRootElement().appendChild(this.iframe);}.bind(this));};generic_dialog.prototype.build_overlay=function(){this.overlay=document.createElement('div');this.overlay.id='generic_dialog_overlay';this.overlay.style.height=Vector2.getDocumentDimensions().y+'px';onloadRegister(function(){DOM.getRootElement().appendChild(this.overlay);}.bind(this));};generic_dialog.prototype.reset_dialog=function(){if(!this.popup)return;onloadRegister(function(){this.reset_dialog_obj();this.reset_iframe();}.bind(this));};generic_dialog.prototype.reset_iframe=function(){if(!this.should_use_iframe&&!(this.modal&&ua.ie()==7))return;if(this.modal){this.iframe.style.left='0px';this.iframe.style.top='0px';this.iframe.style.width='100%';var _L0=Vector2.getDocumentDimensions().y;if(_L0>10000)_L0=10000;this.iframe.style.height=_L0+'px';}else{this.iframe.style.left=elementX(this.frame)+'px';this.iframe.style.top=elementY(this.frame)+'px';this.iframe.style.width=this.frame.offsetWidth+'px';this.iframe.style.height=this.frame.offsetHeight+'px';}this.iframe.style.display='';};generic_dialog.prototype.reset_dialog_obj=function(){};generic_dialog.get_dialog=function(obj){while(!obj.dialog&&obj.parentNode)obj=obj.parentNode;return obj.dialog?obj.dialog:false;};function pop_dialog(_L0,_L1,_L2){this.top=125;this.parent.construct(this,_L0,_L2);}pop_dialog.extend('generic_dialog');pop_dialog.prototype.do_expand_animation=false;pop_dialog.prototype.kill_expand_animation=true;pop_dialog.prototype.show_ajax_dialog=function(src,_L1,_L2,_L3){_L1=_L1||false;if(this.do_expand_animation&&!this.kill_expand_animation){var _L4=null;this.show_loading_title(_L2);}else var _L4=_tx("Cargando...");return this._show_ajax_dialog_custom_loader(_L4,src,_L1,_L3);};pop_dialog.prototype.show_message=function(_L0,_L1,_L2){if(this.do_expand_animation&&!this.kill_expand_animation){this.show_loading_title(_L0);}else this.show_loading();return this.parent.show_message(_L0,_L1,_L2);};pop_dialog.prototype.show_dialog=function(_L0,_L1){var _L2=this.parent.show_dialog(_L0);if(this.do_expand_animation&&!_L1&&!this.kill_expand_animation){function _L3(_L8,i){var i=(i?i:0);if(this.done_loading_title!=true&&i<10){i++;setTimeout(_L3.bind(this,_L8,i),50);}else _L8&&_L8();}function _L4(_L0,_L8,_L9){var _La=0;var _Lb=_L0.getElementsByTagName('img');var _Lc=ua.safari()<3;for(var i=0;i<_Lb.length;i++){var _Ld=_Lb[i];if(image_has_loaded(_Ld))_La++;}if(_La!=_Lb.length){if(_L9<20){_L9++;setTimeout(function(){_L4(_L0,_L8,_L9);},100);}else _L8();}else _L8();}var _L5=this.content.getElementsByTagName('div');for(var i=0;i<_L5.length;i++)if(_L5[i].className=='dialog_content'){expand_animation_div=_L5[i];break;}var _L7=document.createElement('div');_L7.style.padding='0px';_L7.style.margin='0px';_L7.style.overflow='visible';expand_animation_div.parentNode.insertBefore(_L7,expand_animation_div);_L7.appendChild(expand_animation_div);expand_animation_div.style.overflow='hidden';_L4(expand_animation_div,function(){_L3.bind(this,function(){this.content.getElementsByTagName('h2')[0].className='';animation(expand_animation_div).to('height','auto').from(0).from('opacity',0).to(1).ease(animation.ease.both).show().duration(200).ondone(function(){_L7.parentNode.insertBefore(expand_animation_div,_L7);_L7.parentNode.removeChild(_L7);if(!this.button_to_focus){var _L8=this.obj.getElementsByTagName('input');for(var i=0;i<_L8.length;i++)if(_L8[i].type=='button'&&_L8[i].id=='dialog_button1'){this.button_to_focus=_L8[i];break;}}if(this.button_to_focus)setTimeout(function(){this.button_to_focus.focus();}.bind(this),50);expand_animation_div.style.overflow='visible';this.do_expand_animation=false;this.show();}.bind(this,{expand_animation_div:expand_animation_div,container_div:_L7})).go();}.bind(this))();}.bind(this,{expand_animation_div:expand_animation_div}),0);}return _L2;};pop_dialog.prototype.build_dialog=function(){this.parent.build_dialog();CSS.addClass(this.obj,'pop_dialog');if(intl_locale_is_rtl())CSS.addClass(this.obj,'pop_dialog_rtl');var _L0;if(ua.ie()<=6){_L0='<div class="pop_squarecontainer">'+'<div class="pop_squareborder pop_borderopacity"></div>'+'<div class="pop_content pop_content_old" id="pop_content"></div>'+'</div>';}else if(ua.firefox()>=3||ua.safari()>=3){_L0='<div class="pop_container_advanced">'+'<div class="pop_content" id="pop_content"></div>'+'</div>';}else _L0='<div class="pop_container">'+'<div class="pop_verticalslab"></div>'+'<div class="pop_horizontalslab"></div>'+'<div class="pop_topleft"></div>'+'<div class="pop_topright"></div>'+'<div class="pop_bottomright"></div>'+'<div class="pop_bottomleft"></div>'+'<div class="pop_content pop_content_old" id="pop_content"></div>'+'</div>';set_inner_html(this.popup,_L0);this.frame=DOM.find(this.popup,'div.pop_content');this.content=this.frame;};pop_dialog.prototype.reset_dialog_obj=function(){this.popup.style.top=Vector2.getScrollPosition().y+this.top+'px';};pop_dialog.prototype.show_prompt=function(_L0,_L1){if(!this.do_expand_animation||this.kill_expand_animation)return this.show_dialog('<h2 class="dialog_title"><span>'+_L0+'</span></h2><div class="dialog_content">'+_L1+'</div>');return this.show_dialog('<h2 class="dialog_loading"><span>'+_L0+'</span></h2><div class="dialog_content" style="display:none;">'+_L1+'</div>');};pop_dialog.prototype.show_loading_title=function(_L0){if(!this.kill_expand_animation){this.do_expand_animation=true;this.show_dialog('<h2 class="dialog_loading"><span>'+_L0+'</span></h2>',true);setTimeout(function(){this.done_loading_title=true;}.bind(this),200);}else this.show_loading();};
function UIErrorForm(_L0,_L1,_L2,_L3,_L4){this.container=_L1;if(!is_empty(_L2)){this.form=$(_L2);this.form.listen('submit',coalesce(_L4,this.onSubmit).bind(this));}this.errorMap=_L0;this.displayedErrors={};this.endpoint=_L3;}UIErrorForm.prototype={attachError:function(_L0,_L1){if(!(_L0 in this.errorMap)){var _L2=DOM.find(this.container,'div[id="error_box_div"]');var _L3=$N('h2',{className:'"main_message'},HTML(_L1));var _L4=DOM.scry(this.container,'div[id="error_div"]')[0];if(_L4){DOM.appendContent(_L4,_L3);}else{_L4=$N('div',{id:'error_div',className:"UIMessageBox error"},_L3);DOM.setContent(_L2,_L4);}return;}var _L5=DOM.find(this.container,'div[id="'+this.errorMap[_L0]+'_div"]');var _L6=DOM.find(this.container,'[id="'+this.errorMap[_L0]+'"]');this.displayedErrors[_L0]=true;var _L4=$N('div',{className:'UIErrorForm_Flag_Inner'},_L1);var _L7=$N('div',{className:'UIErrorForm_Flag',id:_L0},_L4);var _L8=_L5.offsetWidth+2;var _L9=_L8+'px';var _La=(_L8+7)+'px';var _Lb=intl_locale_is_rtl()?'right':'left';_L7.setStyle(_Lb,_La);DOM.insertAfter(_L6,_L7);CSS.addClass(_L5,'UIErrorForm_ErrorField');animation(_L7).from(_Lb,_La).to(_Lb,_L9).duration(300).ease(function(p){return -1*Math.sin(11*p);}).go();},toggleError:function(_L0,_L1){if(this.displayedErrors[_L0]==_L1)return;var _L2=DOM.find(this.container,'div[id="'+_L0+'"]');var _L3=DOM.find(this.container,'div[id="'+this.errorMap[_L0]+'_div"]');if(_L1){CSS.addClass(_L3,'UIErrorForm_ErrorField');CSS.removeClass(_L2,'hidden_elem');}else{CSS.removeClass(_L3,'UIErrorForm_ErrorField');CSS.addClass(_L2,'hidden_elem');}this.displayedErrors[_L0]=_L1;},clearErrors:function(){for(var _L0 in this.displayedErrors)this.toggleError(_L0,false);var _L1=DOM.scry(this.container,'div[id="error_box_div"]')[0];if(_L1)DOM.empty(_L1);},displayErrors:function(_L0){this.clearErrors();if(!_L0)return;for(var _L1 in _L0)if(_L1 in this.displayedErrors){this.toggleError(_L1,true);}else this.attachError(_L1,_L0[_L1]);},errorHandler:function(_L0){var _L1=_L0.getPayload();this.displayErrors(_L1);},onSubmit:function(){var _L0=serialize_form(this.form);var req=new AsyncRequest().setURI(this.endpoint).setData(_L0).setHandler(this.clearErrors.bind(this)).setErrorHandler(this.errorHandler.bind(this));req.send();return false;}};
function UICreditCardForm(_L0,_L1,_L2,_L3,_L4){this.parent.construct(this,_L0,_L1,_L2,'/ajax/payment/CreditCardFormResponse.php',null);this.errorStrings=_L3;this.postURI=_L4;}UICreditCardForm.extend('UIErrorForm');UICreditCardForm.prototype={onSubmit:function(){if(this.validate()){var _L0=serialize_form(this.form);var req=new AsyncRequest().setURI(this.endpoint).setData(_L0).setHandler(this.post_register_card.bind(this)).setErrorHandler(this.errorHandler.bind(this));req.send();}return false;},post_register_card:function(_L0){this.clearErrors();if(this.postURI){var _L1=serialize_form(this.form);_L1.cc_id=_L0.getPayload().cc_id;dynamic_post(this.postURI,_L1);}},validate_zip_for_country:function(){var _L0=DOM.find(this.container,'select[name="cc_countryCode"]').value;var zip=trim(DOM.find(this.container,'input[name="cc_zip"]').value);if(_L0=='US'){if(zip.match(/^[0-9]{5}(-[0-9]{4}){0,1}$/)){return zip;}else if(zip.match(/^[0-9]{9}$/)){zip=zip.slice(0,5)+'-'+zip.slice(5);return zip;}}else if(_L0=='CA'){var _L2=zip.length;if(_L2>=3&&zip.match(/^[a-zA-Z][0-9][a-zA-z]/)){return zip;}else if(_L2==7&&zip.match(/[0-9][a-zA-Z][0-9]$/))return zip;}else return zip;return null;},validate_state_for_country:function(){var _L0=DOM.find(this.container,'select[name="cc_countryCode"]').value;var _L1=trim(DOM.find(this.container,'input[name="cc_state"]').value);if((_L0=='US'||_L0=='CA')&&_L1==='')return null;return _L1;},validate:function(){var _L0={};var _L1={};var _L2=DOM.scry(this.container,'input[id="for_edit"]')[0];var _L3=DOM.scry(this.container,'input[id="fewer_fields"]')[0];_L1['cc_cvv2']='CC_CVV2_INVALID';if(!_L2){_L1['cc_firstName']='CC_NO_FIRSTNAME';_L1['cc_lastName']='CC_NO_LASTNAME';_L1['cc_creditCardNumber']='CC_NO_NUMBER';}if(!_L3){_L1['cc_street']='CC_NO_STREET';_L1['cc_city']='CC_NO_CITY';}for(var _L4 in _L1){var _L5=DOM.scry(this.container,'input[name="'+_L4+'"]')[0];if(_L5&&_L5.value.length<=0)_L0[_L4]=_L1[_L4];}if(!_L3){var zip=this.validate_zip_for_country();if(zip===null)_L0['cc_zip']='CC_NO_ZIP';var _L7=this.validate_state_for_country();if(_L7===null)_L0['cc_state']='CC_NO_STATE';}var _L8=DOM.find(this.container,'select[name="cc_expMonth"]').value;var _L9=DOM.find(this.container,'select[name="cc_expYear"]').value;if(isNaN(_L8)||_L8<1||_L8>12||isNaN(_L9)||_L9<2009||_L9>2099)_L0['cc_expYear']='CC_INVALID_YEAR';var now=new Date();var _Lb=now.getMonth()+1;var _Lc=now.getFullYear();if(_L9<_Lc||(_L9==_Lc&&_L8<_Lb))_L0['cc_expYear']='CC_EXPIRED_ALREADY';if(!('cc_cvv2' in _L0)){var _Ld=DOM.find(this.container,'input[name="cc_cvv2"]').value;if(_Ld.length<3||_Ld.length>4||isNaN(_Ld))_L0['cc_cvv2']='CC_CVV2_INVALID';}if(!_L2&&!('cc_creditCardNumber' in _L0)){cc_number=DOM.find(this.container,'input[name="cc_creditCardNumber"]').value;if(isNaN(cc_number)){_L0['cc_creditCardNumber']='CC_INVALID_NUMBER_BAD_CHARS';}else if(cc_number.length<13){_L0['cc_creditCardNumber']='CC_INVALID_NUMBER';}else if(!this.validateCCNumber(cc_number)){_L0['cc_creditCardNumber']='CC_BAD_CARD_NUMBER';}else if(!this.validateCCType(cc_number))_L0['cc_creditCardNumber']='CC_CARD_TYPE_NOT_VALID';}var _Le=DOM.scry(this.container,'input[name="cc_save_required"]')[0];var _Lf=DOM.scry(this.container,'checkbox[name="cc_save_cc"]')[0];if(_Le&&_Le.value&&_Lf&&!_Lf.value)_L0['save_required']='CC_SAVE_REQUIRED';if(is_empty(_L0))return true;var _L10={};for(_L4 in _L0){var _L11=_L0[_L4];_L10[_L11]=this.errorStrings[_L11];}this.displayErrors(_L10);return false;},validateCCNumber:function(s){if(s.match(/[a-zA-Z]/))return false;s=s.replace(/[^0-9]/gi,"");var _L1=s.split('').reverse();var _L2='';for(var i=0;i<_L1.length;i++){var c=parseInt(_L1[i],10);if(i%2!=0)c=c*2;_L2=_L2+c;}var n=0;for(i=0;i<_L2.length;i++)n=n+parseInt(_L2.charAt(i),10);return (n!=0&&n%10==0);},getCCType:function(_L0){var bin=_L0.substr(0,6);if(bin.match(/^5[1-5]/)){return 77;}else if(bin.match(/^4/)){return 86;}else if(bin.match(/^3[47]/)){return 65;}else if(bin.match(/^35(2[8-9]|[3-8])/)){return 74;}else if(bin.match(/^(6011|65|64[4-9]|622([2-8]|1[3-9]|12[6-9]|9[0-1]|92[0-5]))/)){return 68;}else if(bin.match(/^30[0-5]/))return 64;return 85;},validateCCType:function(s){var _L1=DOM.scry(this.container,'input[name="supported_cards"]')[0];if(!_L1||_L1.value.match(this.getCCType(s)))return true;return false;}};
function PasswordConfirmationDialog(){this.parent.construct(this);this._initAsyncRequest();this.setHandler(this._confirm.bind(this));}PasswordConfirmationDialog.SUCCESS=1;PasswordConfirmationDialog.ERROR_BAD_PASSWORD=2;PasswordConfirmationDialog.ERROR_UNKNOWN=3;PasswordConfirmationDialog.extend('Dialog');PasswordConfirmationDialog.prototype={showError:function(_L0){this._initAsyncRequest({error:_L0});this.show();return this;},setHandler:function(_L0){this.parent.setHandler(this._confirm.bind(this,_L0));return this;},_initAsyncRequest:function(_L0){var req=new AsyncRequest('/ajax/password_check_dialog.php');if(_L0)req.setData(_L0);this.setAsync(req);},_confirm:function(_L0){var img=document.createElement('img');img.style.position='absolute';img.style.left='-100px';img.style.top='-100px';img.onload=function(){if(img.width!=PasswordConfirmationDialog.SUCCESS){this.showError(img.width);}else if(_L0)_L0();}.bind(this);img.onerror=function(){this.showError(PasswordConfirmationDialog.ERROR_UNKNOWN);}.bind(this);var _L2=$('password_dialog_text').value;var _L3=$('password_check_uri').value;img.src=URI(_L3).addQueryData({password:_L2});}};
GiftCredits={PLACE_APP:'app',PLACE_GIFTSHOP:'giftshop',getPrompt:function(_L0,_L1,_L2,_L3,_L4,_L5,_L6,_L7){GiftCredits.main('/ajax/giftcredits/prompt.php',_L0,_L1,_L2,_L3,_L4,_L5,_L6,_L7);},main:function(_L0,_L1,_L2,_L3,_L4,_L5,_L6,_L7,_L8){_L2=!_L2?0:_L2;var _L9={deadbeef:2386512837,app_id:_L1,api_key:_L7,receiver:_L2,order_info:JSON.encode(_L3),place:_L6||GiftCredits.PLACE_APP,back_url:_L4};var _La=function(_Lf){Dialog.getCurrent().setUserData(_Lf.getPayload().userData);ErrorDialog.showAsyncError(_Lf);};var _Lb=new AsyncRequest(_L0).setData(_L9).setErrorHandler(_La);if(_L8)_Lb.setContextData(_L8,'application_'+_L1);var _Lc=new Dialog().setAsync(_Lb);var _Ld=function(){if(_L5){var _Lf=_Lc.getUserData();var arg=null;if(_Lf)if(_Lf['fbpayments_data']){arg=JSON.decode(_Lf['fbpayments_data']);}else if(_Lf['fbpayments_error'])arg=JSON.decode(_Lf['fbpayments_error']);if(arg)_L5(arg);}};var _Le=function(){if(_L5){var arg={'error_code':kError_FBPayments_UserCanceled,'error_message':'User canceled the order.'};_L5(arg);}_Lc.setCloseHandler(null);};_Lc.setCancelHandler(_Le).setCloseHandler(_Ld).show();}};GiftCreditsFullPage={postData:null,displayData:null,onsubmit:function(_L0,url,_L2,_L3){DOMScroll.scrollTo(new Vector2(0,0,'document'),false);var _L4=GiftCreditsFullPage.postData;copy_properties(_L4,serialize_form(_L0.form));var _L5=function(_L7){if(_L7){_L3.clearErrors();_L4.cc_id=_L7.getPayload().cc_id;}show('loading_payment');hide('payment_footer');hide('payment_body_and_buttons');_L4.popup_window_cc=_L2;var _L8=new AsyncRequest(url).setData(_L4);if(_L2){var _L9=function(_L7){var _La=_L7.getPayload();window.opener.GiftCreditsDialog.composeConfirmationDialogForPopUpCC(_La.title,_La.label,_La.body,_La.callback_js);window.opener.GiftCreditsDialog.checkAndClosePopUpWinForCC();};}else var _L9=function(_L7){hide('checkout_cart');$('loading_payment').setContent(HTML(_L7.getPayload().body));};_L8.setHandler(_L9);_L8.setErrorHandler(function(_L7){payload=_L7.getPayload();if(payload){hide('gift_credits_body');$('order_error_msg').setContent(HTML(payload.body));$('back_button').setContent(HTML(payload.button));show('order_error_msg');show('back_button');}});_L8.send();};if(!_L3){_L5(null);return false;}if(!_L3.validate())return false;var req=new AsyncRequest().setURI(_L3.endpoint).setData(_L4).setHandler(_L5.bind(this)).setErrorHandler(_L3.errorHandler.bind(_L3));req.send();},onPaymentMethodSelected:function(_L0){if(_L0){$('payment').setContent(HTML(this.displayData['stored_credit_card_details_'+_L0]));}else $('payment').setContent(HTML(this.displayData.payment_method_new_cc));}};GiftCreditsDialog={popUpWinForCC:null,checkAndClosePopUpWinForCC:function(){if(GiftCreditsDialog.popUpWinForCC){GiftCreditsDialog.popUpWinForCC.close();GiftCreditsDialog.popUpWinForCC=null;}},getPaymentMethod:function(){if(ge('giftcredits_form')){var _L0=$('giftcredits_form');var _L1=serialize_form(_L0);return _L1.payment_method;}return 0;},getCreditsAmount:function(){if(ge('giftcredits_form')){var _L0=$('giftcredits_form');var _L1=serialize_form(_L0);return _L1.add_num_credits;}return 0;},_asyncReq:function(_L0,uri,_L2){var _L3=function(_L5){Dialog.getCurrent().setUserData(_L5.getPayload().userData);ErrorDialog.showAsyncError(_L5);};var _L4=new AsyncRequest().setURI(uri).setData(_L2).setMethod(_L0).setErrorHandler(_L3).setReadOnly(_L0=='GET');Dialog.getCurrent().setAsync(_L4);return false;},onSubmitWithEnoughCredit:function(_L0,_L1){Dialog.getCurrent().getButtonElement('use_credits').disabled=true;return GiftCreditsDialog._asyncReq('POST',_L1,_L0);},onSubmitWithCCId:function(_L0,_L1,_L2,_L3){var _L4=_L0;_L4.add_num_credits=_L2;_L4.cc_id=_L3;return GiftCreditsDialog._asyncReq('POST',_L1,_L4);},onSubmitNoCC:function(_L0,_L1,_L2,_L3){Dialog.getCurrent().getButtonElement('add_credits').disabled=true;var _L4=_L0;_L4.add_num_credits=_L1;if(!_L3){dynamic_post(_L2,_L4);return false;}else{GiftCreditsDialog.checkAndClosePopUpWinForCC();var _L5=680;var _L6=500;var _L7=0;var top=0;if(window.screenLeft){_L7=window.screenLeft;top=window.screenTop;}else if(window.screenX){_L7=window.screenX;top=window.screenY;}var _L9=Vector2.getViewportDimensions().x;var _La=Vector2.getViewportDimensions().y;var _Lb=_L7+(_L9-_L5)/2;var _Lc=top+(_La-_L6)/2;GiftCreditsDialog.popUpWinForCC=window.open('','creditcardWindow','location=yes, top='+_Lc+',left='+_Lb+',width='+_L5+',height='+_L6+'resizable=yes,scrollbars=yes',true);if(!GiftCreditsDialog.popUpWinForCC){_L4.pop_up_get_blocked=true;dynamic_post(_L2,_L4);}else dynamic_post(_L2,_L4,'creditcardWindow');return false;}},onSubmitFromPrompt:function(_L0,_L1,_L2,_L3,_L4){Dialog.getCurrent().getButtonElement('add_credits').disabled=true;if(!ge('payment_body_amount')){var _L5=_tx("Selecciona una forma de pago y una cantidad.");(new ErrorDialog()).showError(_tx("Error"),_L5);}else if(GiftCreditsDialog.getPaymentMethod()=='mobile'){GiftCreditsDialog.onSubmitUseMobile(_L0);}else GiftCreditsDialog.onSubmitUseCreditCard(_L0,_L1,_L2,_L3,_L4,null);},updatePricepoints:function(_L0,_L1){var _L2=function(_L6){if(ge('payment_body_amount')){var _L3=$('payment_body_amount');_L3.parentNode.removeChild(_L3);}$('payment_body_method').parentNode.appendContent(HTML(_L6.getPayload()));show(Dialog.getCurrent().getButtonElement('add_credits'));};if(ge('payment_body_amount')){var _L3=$('payment_body_amount');_L3.parentNode.removeChild(_L3);}var _L4={'method':GiftCreditsDialog.getPaymentMethod(),'amount':_L0,'appid':_L1};var req=new AsyncRequest().setURI('/ajax/giftcredits/pricepoints.php').setData(_L4).setHandler(_L2.bind(this)).send();},onSubmitUseMobile:function(_L0){hide('gift_cart');hide(Dialog.getCurrent().getButtonElement('add_credits'));var _L1=function(_L5){$('gift_cart').parentNode.appendContent(HTML(_L5.getPayload()));};var _L2=function(_L5){Dialog.getCurrent().hide();ErrorDialog.showAsyncError(_L5);};var _L3={'url':GiftCreditsDialog.getCreditsAmount(),'post_data':_L0};var req=new AsyncRequest().setURI('/ajax/giftcredits/zong-begin.php').setData(_L3).setHandler(_L1.bind(this)).setErrorHandler(_L2.bind(this)).send();},onSubmitUseCreditCard:function(_L0,_L1,_L2,_L3,_L4,_L5){Dialog.getCurrent().getButtonElement('add_credits').disabled=true;var _L6=GiftCreditsDialog.getPaymentMethod();var _L5=(_L5==null)?GiftCreditsDialog.getCreditsAmount():_L5;if(_L6){if(_L3){GiftCreditsDialog.onSubmitWithCCId(_L0,_L1,_L5,_L6);}else{var _L7=GiftCreditsDialog.onSubmitWithCCId.bind(null,_L0,_L1,_L5,_L6);new PasswordConfirmationDialog().setHandler(_L7).show();}}else GiftCreditsDialog.onSubmitNoCC(_L0,_L5,_L2,_L4);},onloadMobileIframe:function(){hide('zong-loading');},onMobileComplete:function(_L0){GiftCreditsDialog._asyncReq('POST','/ajax/giftcredits/mobile.php',{transactionRef:_L0});},selected_stored_cc:function(_L0,_L1,_L2){hide('redirect_message');var _L3=Dialog.getCurrent().getButtonElement('add_credits');_L3.value=_L0;if(_L1>0)GiftCreditsDialog.updatePricepoints(_L1,_L2);},selected_new_cc:function(_L0,_L1,_L2){show('redirect_message');var _L3=Dialog.getCurrent().getButtonElement('add_credits');_L3.value=_L0;if(_L1>0)GiftCreditsDialog.updatePricepoints(_L1,_L2);},selected_mobile:function(_L0,_L1,_L2){hide('redirect_message');var _L3=Dialog.getCurrent().getButtonElement('add_credits');_L3.value=_L0;if(_L1>0)GiftCreditsDialog.updatePricepoints(_L1,_L2);},showLearnMoreDialog:function(){var _L0=new AsyncRequest('/ajax/giftcredits/learn.php');new Dialog().setAsync(_L0).show();},composeConfirmationDialogForPopUpCC:function(_L0,_L1,_L2,_L3){Dialog.getCurrent().setTitle(_L0).setBody(_L2).setButtons({name:'ok',label:_L1,handler:_L3}).show();}};
function GiftsMall(_L0,_L1,_L2,_L3){this.root=_L0;this.directory=_L1;this.current=_L2;this.home=_L2;this.virtualGiftsId=this.root.find('.VIRTUAL-GIFTS').id;var _L4=this.root.find('div.dark_loaded').childNodes||[];to_array(_L4).map(function(_L5){hide(_L5);this.root.appendChild(_L5);}.bind(this));this.switchTo(_L3);Arbiter.subscribe(GiftsMall.SWITCH_TO,function(_L5,_L6){var id=_L6.id||this.home;this.directory[id]&&this.switchTo(id);}.bind(this));}GiftsMall.prototype={switchTo:function(id){if(!this.directory[id])return;var _L1=this.current;if(id==_L1)return;GiftshopController.log('switchTo-'+id);Arbiter.inform(GiftsMall.SET_PURCHASE_BUTTON,{enable:false,buttonText:_tx("Comprar Regalo")},Arbiter.BEHAVIOR_STATE);GiftStoreManager.getInstance().clearAppOrderInfo();if(typeof this.directory[id].virtualGiftsTag=='number'){GiftshopController.selectBrowseTag(this.directory[id].virtualGiftsTag);GiftStoreManager.getInstance().resetSku();}if(this.directory[id].isVirtualGiftsShortcut)id=this.virtualGiftsId;if(ge(id)){}else if(this.directory[id].html){this.root.appendContent(HTML(this.directory[id].html));hide(id);}else return;this.fadeTo(_L1,id);this.current=id;if(this.directory[_L1].isIframe)DOM.remove(_L1);Arbiter.inform(GiftsMall.SWITCHED_TO,{sender:this,prev:_L1,id:id},Arbiter.BEHAVIOR_STATE);return true;},fadeTo:function(_L0,_L1){show(_L1);hide(_L0);},getCrumbs:function(id){id=id||this.current;var _L1=[];while(id){_L1.push({title:this.directory[id].title,onclick:(id!=this.current)&&this.switchTo.curry(id).bind(this)});id=this.directory[id].parent;}return _L1.reverse();},isIframe:function(id){return this.directory[id].isIframe;}};GiftsMall.SWITCH_TO='GiftsMall.SWITCH_TO';GiftsMall.SWITCHED_TO='GiftsMall.SWITCHED_TO';GiftsMall.SET_PURCHASE_BUTTON='GiftsMall.SET_PURCHASE_BUTTON';function Breadcrumb(_L0){this.root=_L0;this.root.addClass('gifts_mall_breadcrumb');Arbiter.subscribe(GiftsMall.SWITCHED_TO,function(_L1,_L2){this.update(_L2.sender.getCrumbs());}.bind(this));}Breadcrumb.prototype={update:function(_L0){if(!_L0.length)return;this.root.setContent('');for(var i=0;i<_L0.length;++i){var _L2=_L0[i];var _L3=i?'not_first':'first';this.root.appendContent($N(_L2.onclick?'a':'span',{className:_L3,onclick:_L2.onclick||bagofholding},htmlize(_L2.title)));}}};function GiftsMallFullPage(){this.submitButton=$('giftshop_continue_button');new Breadcrumb($('gifts_full_page_breadcrumb'));Arbiter.subscribe(GiftsMall.SWITCHED_TO,function(_L0,_L1){GiftshopController.forcePublicPrivacy(_L1.sender.isIframe(_L1.id));});this.submitButton.listen('click',function(){if(!this.submitButton.hasClass('UIButton_Disabled'))GiftshopController.onclickSubmit();return false;}.bind(this));Arbiter.subscribe(GiftsMall.SET_PURCHASE_BUTTON,function(_L0,_L1){if(_L1.enable!=undefined)this.submitButton.conditionClass('UIButton_Disabled',!_L1.enable);if(_L1.buttonText!=undefined)this.submitButton.find('.UIButton_Text').setContent(_L1.buttonText);}.bind(this));}copy_properties(GiftsMallFullPage.prototype,{onSubmit:function(){var _L0=serialize_form(this.form);var _L1=$(this.form.message);_L0.message=(_L1.getControl&&trim(_L1.getControl().getValue()))||'';var _L2=_L0.receiver;delete _L0.receiver;var _L3=URI.getRequestURI().removeQueryData(['ref']).toString();GiftshopController.initOrder(_L2,_L0,_L3);}});
function GiftshopController(){}GiftshopController.giftsAppId=2386512837;GiftshopController.giftsApiKey='baf530df1c0ee03c86f5f55b2e6ca3e1';GiftshopController.maxMessageLength=200;GiftshopController.selectBrowseTag=function(_L0){if(ge('giftshop_search_option_input'))$('giftshop_search_option_input').scry('a.token').each(DOM.remove);var _L1=$('giftshop_tag_options');set_form_select_value(_L1,_L0);_L1.onchange();};GiftshopController.initialize=function(_L0,_L1,_L2,_L3,_L4){GiftshopController.cachedPages={};GiftshopController.currentSettings={};GiftshopController.setCurrentSettings(_L2);GiftshopController.setCachedPage(_L0,_L1,_L3);GiftshopController.user=_L4;GiftshopController.forcePublicPrivacy(false);GiftshopController.numSkusPerPage=_L1;};GiftshopController.buildHashkeyCachedPages=function(_L0,_L1){var _L2=JSON.encode(GiftshopController.getCurrentSettings());var _L3=[_L0,_L1,_L2].join(':');return _L3;};GiftshopController.setCachedPage=function(_L0,_L1,_L2){var _L3=GiftshopController.buildHashkeyCachedPages(_L0,_L1);GiftshopController.cachedPages[_L3]=_L2;GiftshopController.lastPage=_L3;};GiftshopController.getCachedPage=function(_L0,_L1){var _L2=GiftshopController.buildHashkeyCachedPages(_L0,_L1);return GiftshopController.cachedPages[_L2]||null;};GiftshopController.getCurrentSettings=function(){return GiftshopController.currentSettings;};GiftshopController.getCurrentSettingByKey=function(key){return GiftshopController.currentSettings[key]||null;};GiftshopController.setCurrentSettings=function(_L0){GiftshopController.currentSettings=_L0;};GiftshopController.setCurrentSettingByKey=function(key,_L1){GiftshopController.currentSettings[key]=_L1;};GiftshopController.updateComposerButtonText=function(_L0){Arbiter.inform(GiftsMall.SET_PURCHASE_BUTTON,{buttonText:_L0?_tx("Dar Regalo"):_tx("Comprar Regalo")});};GiftshopController.enablePurchaseButton=function(_L0){Arbiter.inform(GiftsMall.SET_PURCHASE_BUTTON,{enable:_L0});};GiftshopController.set_item_category=function(_L0){if(!_L0){GiftshopController.log('selected category 0');}else GiftshopController.log('selected category '+_L0);var _L1=GiftshopController.getCurrentSettingByKey('tag_id');var _L2='giftshop_top_tag_'+(_L1?_L1:'');var _L3='giftshop_top_tag_'+(_L0?_L0:'');var _L4='giftshop_top_tag_';};GiftshopController.reset_item_category=GiftshopController.set_item_category.bind(null,null);GiftshopController.search_addtag=function(_L0,_L1,_L2){GiftshopController.findgifts_by_tag(_L0,_L1,_L2.i);};GiftshopController.findgifts_by_tag=function(_L0,_L1,_L2){this.enablePurchaseButton(false);GiftshopController.set_item_category(_L2);GiftshopController.setCurrentSettingByKey('tag_id',_L2);GiftStoreManager.getInstance().updatePager();};GiftshopController.search_removetag=function(_L0,_L1,_L2){GiftshopController.reset_item_category();GiftshopController.setCurrentSettingByKey('tag_id',null);GiftStoreManager.getInstance().updatePager();};GiftshopController.skuPrices={};GiftshopController.addSkuPrices=function(_L0){copy_properties(GiftshopController.skuPrices,_L0);};GiftshopController.getSkuPrice=function(sku){return GiftshopController.skuPrices[sku];};GiftshopController.setAutoExpandedMode=function(_L0){GiftshopController.isAutoExpanded=_L0;};GiftshopController.getAutoExpandedMode=function(){return GiftshopController.isAutoExpanded;};GiftshopController.composer=null;GiftshopController.getComposer=function(){return GiftshopController.composer||null;};GiftshopController.fallBackStatusUpdate=function(){var _L0=GiftshopController.getComposer();if(_L0)_L0.reset(true,false,false).post();};GiftshopController.focusMessageInput=function(){var _L0=GiftshopController.getComposer();if(_L0){var _L1=_L0.focusInput();}else $('message').focus();};GiftshopController.initOrder=function(_L0,_L1,_L2,_L3,_L4){_L4=true;var _L5;var _L6;var gsm=GiftStoreManager.getInstance();if(!gsm)return;var _L8=gsm.getAppOrderInfo();copy_properties(_L1,_L8.order_info);_L6=_L8.api_key;if(!_L6){if(GiftshopController.getAutoExpandedMode()){GiftshopController.fallBackStatusUpdate();}else GiftshopController.log('gsh:select-gift '+_L1.sku);return;}var _L9=(_L6==GiftshopController.giftsApiKey)&&!GiftshopController.getSkuPrice(_L1.sku);if(!_L0){GiftshopController.log('gsh:select-receiver '+_L1.sku);_L5=_tx("Selecciona el destinatario de tu regalo.");DOMScroll.scrollTo(new Vector2(0,0,'document'),false);}else if(!_L1.message&&!_L4){GiftshopController.log('gsh:include-message '+_L1.sku);new Dialog().setTitle(_tx("Escribir un mensaje")).setBody(_tx("\u00bfQuieres escribir un mensaje para enviarlo con el regalo?")).setButtons([Dialog.newButton('Yes',_tx("Escribir un mensaje"),null,GiftshopController.focusMessageInput),Dialog.newButton('No',_tx("Enviar sin mensaje"),'inputaux',function(){GiftshopController.initOrder(_L0,_L1,_L2,_L3,true);})]).show();return;}else if(_L1.message.length>GiftshopController.maxMessageLength){GiftshopController.log('gsh:message-too-long '+_L1.sku);var _La=_L1.message.length-GiftshopController.maxMessageLength;_L5=_tx("Tu mensaje contiene {number} caract\u00e9res m\u00e1s de los permitidos.",{'number':_La});}if(_L5){new ErrorDialog().showError(_tx("Error"),_L5);return;}_L1.source=_L1.source||'';_L1.ref=_L1.ref||URI.getRequestURI().getQueryData().ref||'';if(_L9){var _Lb=new AsyncRequest('/ajax/giftshop/free_gifts.php').setData({order_info:JSON.encode(_L1),receiver:_L0,back_url:_L2});if(_L3)_Lb.setContextData(_L3,'application_'+_L6);new Dialog().setAsync(_Lb).show();return;}GiftshopController.enablePurchaseButton(false);GiftCredits.getPrompt(null,_L0,_L1,_L2,GiftshopController.enablePurchaseButton.curry(true),GiftCredits.PLACE_GIFTSHOP,_L6,_L3);};GiftshopController.onclickSubmit=function(_L0){var _L1=serialize_form($('giftshop_form'));_L1['message']=($('message').getControl&&trim($('message').getControl().getValue()))||'';var _L2=_L1['receiver'];delete _L1['receiver'];var _L3=URI.getRequestURI().removeQueryData(['ref']).toString();GiftshopController.initOrder(_L2,_L1,_L3);_L0&&_L0.kill();};GiftshopController.updateNumCredits=function(_L0,_L1){if(ge('giftshop_num_credits_balance_holder'))$('giftshop_num_credits_balance_holder').setContent(_L0);if(ge('giftshop_num_credits_holder'))$('giftshop_num_credits_holder').setContent(_L1);};function gift_recipient_onfound(_L0){if(!_L0){$('receiver').value='';$('recipient_pic').style.backgroundImage='';$('recipient_pic').style.height='0px';$('recipient_pic').style.width='0px';}else{$('receiver').value=_L0.i;$('recipient_pic').style.backgroundImage='url('+_L0.it+')';$('recipient_pic').style.height='50px';$('recipient_pic').style.width='50px';}return true;}copy_properties(GiftStoreManager,{_instance:null,getAndUpdateInstance:function(_L0,_L1,_L2,_L3,_L4){if(!this._instance)this._instance=new GiftStoreManager(_L0,_L1,_L2,_L3);this._instance.update(_L3);return this._instance;},getInstance:function(){return this._instance;}});function GiftStoreManager(_L0,_L1,_L2,_L3){this.embedded_store=$(_L0);onunloadRegister(bind(this,function(){DOM.remove(this.embedded_store);delete GiftStoreManager._instance;}),true);this.pageOffset=_L1;this.perPage=_L2;this.totalPages=_L3;this.prevSelect=null;this.initialize();this.initPager();this.addGiftListeners();}GiftStoreManager.prototype.updatePager=function(){this.pager.setOffset(0);this.changePage(0);};GiftStoreManager.prototype.initialize=function(_L0,_L1,_L2){this.giftsGrid=DOM.find(this.embedded_store,'div#gifts_grid');this.storeFooter=DOM.find(this.embedded_store,'div#store_footer');};GiftStoreManager.prototype.update=function(_L0){this.totalPages=_L0||this.totalPages;this.pager.setTotal(this.totalPages);};GiftStoreManager.prototype.initPager=function(){this.pager=new UIPager(this.totalPages,1,this.pageOffset,this.changePage.bind(this));this.pagerspan=DOM.find(this.embedded_store,'div#giftstore_pager');this.pagerspan.appendChild(this.pager.getRoot());this.pager.setSummaryTextHandler(this.getSummaryText.bind(this));};GiftStoreManager.prototype.getSummaryText=function(_L0,_L1,_L2){return _tx("P\u00e1gina {current} de {total}",{'current':_L0+1,'total':_L1});};GiftStoreManager.prototype.setTotalPages=function(_L0){GiftStoreManager.getInstance().totalPages=_L0;GiftStoreManager.getInstance().pager.setTotal(_L0);};GiftStoreManager.prototype.addGiftListeners=function(){var _L0=DOM.scry(this.giftsGrid,'div.gift_outer.instock');for(var i=0;i<_L0.length;i++){_L0[i].listen('click',this.giftOnClick.bind(this,_L0[i]));_L0[i].listen('mouseover',this.giftOnMouseOver.bind(this,_L0[i]));_L0[i].listen('mouseout',this.giftOnMouseOut.bind(this,_L0[i]));}};GiftStoreManager.prototype.changePage=function(_L0){this.pageOffset=_L0;if(_L0<0||_L0>this.totalPages)return;var _L1=this.perPage*_L0;GiftshopController.log('changed to page starting at '+_L1+' with '+this.perPage+' per page');var _L2=function(_L3){this.setTotalPages(_L3.total_pages);DOM.replace(this.giftsGrid,HTML(_L3.gifts_grid));this.giftsGrid=DOM.find(this.embedded_store,'div#gifts_grid');this.addGiftListeners();}.bind(this);var _L3=GiftshopController.getCachedPage(_L1,this.perPage);if(_L3){_L2(_L3);return;}DOM.setContent(this.giftsGrid,'');this.giftsGrid.addClass('gifts_loading');this.paginate(_L1,this.perPage,_L2);};GiftStoreManager.prototype.paginate=function(_L0,_L1,_L2){var _L3={start:_L0,per_page:_L1};copy_properties(_L3,GiftshopController.getCurrentSettings());new AsyncRequest().setURI('/ajax/giftshop/browse.php').setData(_L3).setHandler(function(_L4){var _L5=_L4.getPayload();if(_L2)_L2(_L5);GiftshopController.setCachedPage(_L0,_L1,_L5);}).send();};GiftStoreManager.prototype.giftOnClick=function(_L0,_L1){var sku=_L0.getAttribute('sku');GiftshopController.updateComposerButtonText(GiftshopController.getSkuPrice(sku));if(this.prevSelect!=_L0){GiftshopController.log('selected SKU '+sku);if(this.prevSelect)GiftshopController.changeGiftOuterClass(this.prevSelect,'gift_outer');}GiftshopController.changeGiftOuterClass(_L0,'gift_outer_onclick');this.prevSelect=_L0;this.setAppOrderInfo(GiftshopController.giftsApiKey,{sku:sku},true);_L1&&_L1.kill();};GiftStoreManager.prototype.resetSku=function(){if(this.prevSelect)GiftshopController.changeGiftOuterClass(this.prevSelect,'gift_outer');this.prevSelect=null;};GiftStoreManager.prototype.giftOnMouseOver=function(_L0,_L1){if(this.prevSelect!=_L0)GiftshopController.changeGiftOuterClass(_L0,'gift_outer_onmouseover');_L1.kill();};GiftshopController.changeGiftOuterClass=function(_L0,_L1){var _L2={'gift_outer':0,'gift_outer_onmouseover':0,'gift_outer_onclick':0};_L2[_L1]=1;for(var c in _L2)if(!_L2[c]){CSS.removeClass(_L0,c);}else CSS.addClass(_L0,c);};GiftStoreManager.prototype.giftOnMouseOut=function(_L0,_L1){if(this.prevSelect!=_L0)GiftshopController.changeGiftOuterClass(_L0,'gift_outer');_L1.kill();};GiftStoreManager.prototype.getAppOrderInfo=function(){return {api_key:this.appOrderApiKey||null,order_info:this.appOrderInfo||{}};};GiftStoreManager.prototype.setAppOrderInfo=function(_L0,_L1,_L2){if(!_L0)return;if(_L1){this.appOrderApiKey=_L0;this.appOrderInfo=_L1;}if(_L2!==null)GiftshopController.enablePurchaseButton(_L2);};GiftStoreManager.prototype.clearAppOrderInfo=function(){this.appOrderApiKey=null;this.appOrderInfo={};};GiftshopController.forcePublicPrivacy=function(_L0){if(ge('delivery_info')&&ge('platform_gift_privacy_txt')){var _L1=$('delivery_info');var _L2=$('platform_gift_privacy_txt');if(_L0){hide(_L1);show(_L2);var _L3=$('gift_privacy_type_0');_L3.checked=true;}else{show(_L1);hide(_L2);}}};GiftshopController.resetForm=function(){$('message').value='';$('gift_privacy_type_0').checked=true;!($('friend_selector').typeahead)&&$('friend_selector').focus();$('friend_selector').typeahead.clear();$('friend_selector').typeahead.blur();gift_recipient_onfound();GiftStoreManager.getInstance().resetSku();};GiftshopController.option_select_tag=function(obj,_L1,_L2){GiftshopController.findgifts_by_tag(0,_L2,get_form_select_value(obj));};GiftshopController.log=function(_L0){var sep='\001';var _L2=Math.floor((new Date()).getTime()/1000);var arr=new Array(_L2,GiftshopController.user,_L0);var _L4=arr.join(sep);scribe_log('giftshop',_L4);};
function FBPay(){}copy_properties(FBPay.prototype,{registerServiceForIFrame:function(){var _L0={'submitOrder':{'asyncMethod':this.onSubmitOrderRequest},'updateGiftshopOrder':{'asyncMethod':this.onUpdateGiftshopOrderRequest},'submitGiftshopOrder':{'asyncMethod':this.onSubmitGiftshopOrderRequest}};this._rpcServer=new FB.XdComm.XdRpcServer('PaymentsServer',_L0);},onSubmitOrderRequest:function(arg,_L1,_L2){var _L3=arg['app_id'];var _L4=arg['order_info'];var _L5=arg['receiver'];var _L6=arg['next_url'];var _L7=arg['api_key'];GiftCredits.getPrompt(_L3,_L5,_L4,_L6,_L1,null,_L7);},onUpdateGiftshopOrderRequest:function(arg,_L1,_L2){var _L3=arg['order_info']||null;var _L4=null;arg['price']!==undefined&&(_L4=arg['price']);var _L5=null;arg['ready']!==undefined&&(_L5=arg['ready']);GiftStoreManager.getInstance().setAppOrderInfo(arg.api_key,_L3,_L5);},onSubmitGiftshopOrderRequest:function(){var _L0=GiftshopController.getComposer();if(_L0){_L0.getData();}else GiftshopController.onclickSubmit();}});

if (window.Bootloader) { Bootloader.done(["js\/j0c3ri2v0084gwgg.pkg.js"]); }