/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  June 9th 2009 9:30:25 AM PDT                                 */
/*      Machine:  10.16.140.107                                                */
/*       Source:  Local Cache                                                  */
/*     Location:  rsrc:99qlpey8:en_US:/html/js/8rixrqbu87oco808.pkg.js:141     */
/*       Locale:  en_US                                                        */
/*         Path:  js/8rixrqbu87oco808.pkg.js                                   */


function PlatformCanvasController(app_id,session_key,session_timeout,app_name,callback,api_key){this.sessionKey=session_key;this.appName=app_name;this.appId=app_id;this.callback=callback;this.api_key=api_key;this.isFirstPage=false;this.isIFrame=false;this._movingPage=false;this.sessionRefresh=(session_timeout*900);if(this.appId&&this.sessionKey&&this.sessionRefresh){setTimeout(this.refreshAppSession.bind(this),this.sessionRefresh);}
PlatformCanvasController.singleton=this;}
PlatformCanvasController.AUTO_REFRESH=30000;PlatformCanvasController.prototype.setUpIFrame=function($is_static){PageTransitions.registerHandler(this.handleChange.bind(this));this.isIFrame=true;this.isStatic=$is_static;}
PlatformCanvasController.prototype.autoRefreshAd=function(){if(this.isIFrame){this.isFirstPage=true;$('app'+this.appId+'_iframe_canvas').onload=this._clickRefresh.bind(this);}
this._ignoreNext=true;this._loopRefresh();}
PlatformCanvasController.prototype.requireLogin=function(){var loginResponse=FB.IFrameUtil.CanvasUtilServer.loginResponse;FBML.requireLogin(this.appId,loginResponse.bind(null,true),loginResponse.bind(null,false),null,true,true);}
PlatformCanvasController.prototype.closeLogin=function(){FBML.closeLoginDialog();}
PlatformCanvasController.prototype.showFeedDialog=function(template_bundle_id,template_data,body_general,target_id,user_msg_prompt,user_msg){FBML.showFeedDialog(this.appId,template_bundle_id,template_data,body_general,target_id,FB.IFrameUtil.CanvasUtilServer.loginResponse.bind(null),user_msg_prompt,user_msg);}
PlatformCanvasController.prototype._loopRefresh=function(){if(this._ignoreNext){this._ignoreNext=false;}else{this.refreshAd();}
this._loopRefresh.bind(this).defer(PlatformCanvasController.AUTO_REFRESH);}
PlatformCanvasController.prototype._clickRefresh=function(){this.refreshAd();this._ignoreNext=true;}
PlatformCanvasController.prototype.refreshAppSession=function(){new AsyncRequest().setURI('/ajax/session.php').setData({'app_id':this.appId,'session_key':this.sessionKey}).setReadOnly(true).setHandler(function(response){var payload=response.getPayload();if(payload['session_end']>0){setTimeout(this.refreshAppSession.bind(this),this.sessionRefresh);}}.bind(this)).send();}
PlatformCanvasController.prototype.refreshUrl=function(newUrl){var href=newUrl.href;if(href.startsWith(this.callback)){var newSuffix=new URI(href.substring(this.callback.length));this.changeUrlSuffix(newSuffix,true);}
return false;}
PlatformCanvasController.refreshUrl=function(newUrl){if(PlatformCanvasController.singleton){PlatformCanvasController.singleton.refreshUrl(newUrl);}}
PlatformCanvasController.prototype.changeUrlSuffix=function(suffix,is_refresh){this.currentUri=URI.getRequestURI().getUnqualifiedURI();var newPath=new URI(this.getAppPrefix()+suffix);this.stripFbParams(newPath);var dontAddBackEntry=is_refresh&&PlatformCanvasController.storesIFrameHistory(this.isStatic);if(this.currentUri.toString()!=newPath.toString()){this.currentUri=newPath;this.refreshAd();PageTransitions.go(newPath.toString(),dontAddBackEntry);}}
PlatformCanvasController.prototype.getAppPrefix=function(){return"/"+this.appName+"/";}
PlatformCanvasController.prototype.convertFromApps=function(uri){var prefix=this.getAppPrefix();var suffix=uri.getUnqualifiedURI().toString().substring(prefix.length);return new URI(this.callback+suffix);}
PlatformCanvasController.prototype.convertToApps=function(uri){var suffix=uri.toString().substring(this.callback.length);return new URI(this.getAppPrefix()+suffix);}
PlatformCanvasController.prototype.stripFbParams=function(uri){var queryData=uri.getQueryData();var newQueryData={};for(key in queryData){if((!key.startsWith("fb_")||key.startsWith("fb_force_mode"))&&!key.startsWith("_fb")&&!key.startsWith("quickling_apps")){newQueryData[key]=queryData[key];}}
uri.setQueryData(newQueryData);}
PlatformCanvasController.prototype.refreshAd=function(){if(this.isFirstPage){this.isFirstPage=false;}else{ads_refresh(this.appName,'/canvas.php');}}
PlatformCanvasController.prototype.handleChange=function(uri){if(!uri.getPath().startsWith("/"+this.appName)||this._movingPage){return false;}
var unqualUri=uri.getUnqualifiedURI();this.stripFbParams(unqualUri);if(this.currentUri.toString()!=unqualUri.toString()){FB.IFrameUtil.CanvasUtilServer.loadNewUrl(this.convertFromApps(uri).toString());this.currentUri=unqualUri;}
PageTransitions.transitionComplete();return true;}
PlatformCanvasController.prototype.goURI=function(uri){this._movingPage=true;var decorated_uri=new URI(uri);decorated_uri.addQueryData({_fb_q:true});PageTransitions.go(decorated_uri);}
PlatformCanvasController.storesIFrameHistory=function(is_static){if(ua.ie()){return true;}else if(ua.firefox()){if(is_static){return true;}else{return false;}}else if(ua.safari()){return false;}else{return false;}}
var smartIframes=[];function smartSizingFrameAdded(){window.onresize=_resizeSmartFrames;smartIframes=[];var allIframes=document.getElementsByTagName('iframe');for(var i=0;i<allIframes.length;i++){var frame=allIframes[i];if(frame.className=='smart_sizing_iframe'){smartIframes.push(frame);frame.style.width=frame.parentNode.scrollWidth-2+"px";}}
_resizeSmartFrames();}
if(window.innerHeight){var windowHeight=function(){return window.innerHeight;};}else if(document.documentElement&&document.documentElement.clientHeight){var windowHeight=function(){return document.documentElement.clientHeight;};}else{var windowHeight=function(){return DOMScroll.getScrollRoot().clientHeight;};}
function _resizeSmartFrames(){var height=windowHeight();for(var i=0;i<smartIframes.length;i++){var frame=smartIframes[i];var spaceLeft=height-elementY(frame)-61;frame.style.height=spaceLeft/(smartIframes.length-i)+'px';}}

var details_shown=false;function toggle_stored_cc(obj){if(obj.checked==true){show('cvv2_div');hide_new_cc();}else{hide('cvv2_div');show_new_cc();}}
function hide_cc_payment(){hide('card_payment');hide('cvv2_div');hide_new_cc();var sel_cc=ge('cc_id');if(sel_cc){sel_cc.checked=false;}}
function show_cc_payment(){show('card_payment');}
function hide_new_cc(){hide('cc_input');hide('enter_new_card');}
function show_new_cc(){show('cc_input');show('enter_new_card');if(details_shown){toggleStoredCreditCardDetails();}}
function toggleStoredCreditCardDetails(){var link=ge('toggle_stored_credit_card_details_link');if(!details_shown){show('stored_credit_card_details');link.innerHTML=_tx("hide details");details_shown=true;}else{hide('stored_credit_card_details');link.innerHTML=_tx("show details");details_shown=false;}}
function show_csc_info(cc_type){var csc_description=_tx("A Card Security Code (CSC) is a security feature of debit and credit cards that helps fight credit card fraud.  The following graphic illustrates where to find the CSC code on your credit card.");var csc_div_style='float: left;';var paragraph_style='text-align: center; margin: 5px 0;';var amex_html='';amex_html+='<div style="'+csc_div_style+'">';amex_html+='<img src="/images/cvv2_types/amex_csc.gif" alt="" />';amex_html+='<p style="'+paragraph_style+'">'+'American Express'+'</p>';amex_html+='</div>';var non_amex_html='';non_amex_html+='<div style="margin-right: 8px;'+csc_div_style+'">';non_amex_html+='<img src="/images/cvv2_types/backofcard.gif" alt="" />';non_amex_html+='<p style="'+paragraph_style+'">'+'Visa, Mastercard, JCB'+'</p>';non_amex_html+='</div>';var html='';html+='<div class="clearfix">';html+='<p>'+csc_description+'</p>';if(cc_type==null){html+=non_amex_html;html+=amex_html;}else if(cc_type==65){html+=amex_html;}else{html+=non_amex_html;}
html+='</div>';new Dialog().setClassName('csc_type').setTitle(_tx("What's a CSC code?")).setBody(html).setButtons([Dialog.OK]).show();}
function show_csc_validation_info(){var html='';html+='<div class="clearfix">';html+='<div style="float: left">';html+='<p style="text-align: left; margin: 5px 0;">';html+=_tx("In order to fight credit card fraud, we have started to enforce CSC code validation in credit card payments.  For credit cards we have stored before, this means they will need to be CSC validated once for later uses.  You will not be prompted in the future once the card gets validated.");html+='</p>';html+='</div>';html+='</div>';new Dialog().setClassName('validation').setTitle(_tx("Why is CSC validation required?")).setBody(html).setButtons([Dialog.OK]).show();}
function get_selected_cc_type(cc_select_name,dialog_pro){if(dialog_pro){cc_type=get_form_select_value(get_dialog_pro_elem(cc_select_name));}else{cc_type=get_form_select_value(ge(cc_select_name));}
return cc_type;}
function validate_csc(cc_select_name,dialog_pro){if(dialog_pro){var cvv2_elem=get_dialog_pro_elem('cc_cvv2');}else{var cvv2_elem=ge('cc_cvv2');}
var cc_type=get_selected_cc_type(cc_select_name,dialog_pro);if(cc_type==65){if(cvv2_elem.value.length!=4){cvv2_elem.style.border="1px solid red;"}else{cvv2_elem.style.border="";}}else{if(cvv2_elem.value.length!=3){cvv2_elem.style.border="1px solid red;"}else{cvv2_elem.style.border="";}}}
function get_dialog_pro_elem(elem_name){var candidates=document.getElementsByName(elem_name);var i;var result=null;for(i=0;i<candidates.length;i++){var candidate=candidates[i];if(DOM.contains('pop_dialog_table',candidate)){result=candidate;}}
return result;}

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