/*
 * This file contains both original and merged/adapted code.
 * Except where indicated, all code is
 * Copyright (c) 2006-2010 vAuto, Inc., and its Affiliates.
 * All Rights Reserved.
 * Not to be reused without permission
 */
(function(){var A=realdeal;A.HomePage=(function(){if(typeof (console)=="undefined"){console={debug:function(){}}}var B=function(){};console.debug;var C=function(){};C.prototype={init:function(){this.setupReportIdTextbox()},whatIsThis:function(){var D=document.createElement("div");$(D).attr("id","whatIsDlg").attr("class","dialog").html('<div class="instructions">A Report ID is generated by a seller and then provided to a buyer in the form of 4 - 6 random characters at the end of a web address:</div><div class="whatIsSample"><span>www.realdeal.com/dgsh</span></div>');$("body").append(D);$(D).dialog({bgiframe:true,height:160,width:360,modal:true})},lostReportId:function(){var D=this._lostReportDlgEl;if(!D){D=this._lostReportDlgEl=document.createElement("div");$(D).attr("id","lostReportIdDlg").attr("class","dialog").html('<div class="instructions"><h1>Lost your Report ID?</h1>Please enter the email address you provided when you first got your RealDeal Report and we will resend the report to you right away.</div><div class="inputCt largeRDInput" id="lostReportInput"><input type="text" id="lostReportEmailText"/><a href="javascript:void(0);" class="largeArrowButton" id="lostReportSubmit"></a></div><div id="lostReportSearching" style="display:none;">Searching...</div>');$("body").append(D);this._lostReportEmailTextBox=new A.RDTextInput({el:"#lostReportEmailText",emptyText:"Enter Email",required:true,email:true});$(D).find("a").click(this._onLostReportArrowClick.createDelegate(this));$("#lostReportEmailText").keydown(this.lostReportKeyDown.createDelegate(this));$(D).dialog({bgiframe:true,height:220,width:470,modal:true})}else{$("#lostReportEmailText").val("");this._lostReportEmailTextBox.markValid(true);$(D).dialog("open")}$(D).find("a")[0].focus()},lostReportKeyDown:function(D){if(D.keyCode==13){this._onLostReportArrowClick()}},_onLostReportArrowClick:function(){var D=this._lostReportEmailTextBox;if(!D.isValid()){return }var E=this._lostReportDlgEl;if(!E){return }this.updateLookForReportMask(true);var F={lostReportEmail:D.getValue()};$.post("HomePageHandler.ashx",F,this.submittedLostReportId.createDelegate(this),"json")},updateLookForReportMask:function(F){var E=$("#lostReportInput");var D=$("#lostReportSearching");if(E&&D){if(F){E.attr("style","display:none");D.attr("style","display:block")}else{E.attr("style","display:block");D.attr("style","display:none")}}},submittedLostReportId:function(F){this.updateLookForReportMask(false);var G=$(this._lostReportDlgEl);if(G){G.dialog("close")}if(!!F.success){var D=this._lostReportEmailTextBox;var E=this._resultDlg;if(!E){E=this._resultDlg=document.createElement("div");$(E).attr("id","resultDlg").attr("class","dialog").html('<div class="instructions"><h1>Check your email</h1><div class="message">We sent you an email containing links to any RealDeal Reports associated with the email address you specified.  If you do not receive this email, please check your junk mail folder or contact the dealership who issued the report for further assistance.</div><a id="closeLostReportResultLink" class="orange-button" href="javascript:void(0)" >OK</a></div>');$("body").append(E);$("#closeLostReportResultLink").click(this.closeLookForReportResult.createDelegate(this));$(E).dialog({bgiframe:true,height:230,width:480,modal:true})}else{$(E).dialog("open")}}else{this.showLookForReportError()}},closeLookForReportResult:function(){$("#resultDlg").dialog("close")},showLookForReportError:function(){var D=this._errorDlg;if(!D){D=this._errorDlg=document.createElement("div");$(D).attr("id","errorDlg").attr("class","dialog").html('<h1>Submission Error</h1><div class="message">There was an unexpected error.  Please try again or conact support.</div>');$("body").append(D);$(D).dialog({bgiframe:true,height:175,width:375,modal:true})}else{$(D).dialog("open")}},setupReportIdTextbox:function(){this._reportIdTextBox=new A.RDTextInput({el:"#ReportId",emptyText:"Enter Report ID",required:true});$("#ReportId").keydown(this.reportIdKeyDown.createDelegate(this))},reportIdKeyDown:function(D){if(D.keyCode==13){this.getReport()}},getReport:function(){if(!this._reportIdTextBox.isValid()){return }var D=this._reportIdTextBox.getValue();document.location="http://www.realdeal.com/"+D},__dummy:function(){}};return new C()})()})();