/**
 * DO NOT EDIT THIS FILE!
 * This is a generated file.  Your changes will be overwritten.
 */
var _ModelChooserController=Class.create();
Object.extend(_ModelChooserController.prototype,{initialize:function(_1,_2){
var _1;
this.base_element=_1;
var _3;
this.data_request;
var _4;
this.series_groups=_2||[];
var _5;
this.series_controllers=[];
var _6;
var _7;
var _8;
var _9;
var _a;
var _b;
this.init_loaded=false;
var _c;
this.view_is_loaded=false;
var _d;
this.page_is_loaded=false;
var _e;
this.app_is_ready=false;
Event.observe(window,"load",this.init_onload.bindAsEventListener(this));
this.init_loaded=true;
this.init_onReady();
},init_onload:function(){
this.model_popup_controller=new ModelController();
this.modal_backdrop=new BYL_Backdrop("chooserBackdrop","galleryWrap");
this.modal_backdrop.observe("click",this.model_popup_controller.deactivate.bind(this.model_popup_controller),false);
this.loading_panel=new LoadingPanel();
this.page_is_loaded=true;
this.init_onReady();
},init_onReady:function(){
try{
if(this.page_is_loaded&&this.init_loaded&&!this.app_is_ready){
this.drawPage();
this.deepLink();
if(window.showTimeoutPopup){
this.showTimeoutPopup();
}
this.app_is_ready=true;
return true;
}else{
return false;
}
}
catch(e){
Debug.error(e);
}
},loadTemplate:function(_f){
this.template=new Template(_f.responseText);
this.view_is_loaded=true;
this.init_onReady();
},drawPage:function(){
if(this.init_loaded&&this.base_element){
this.series_groups.each(function(_10){
var _11=_10.name.toLowerCase().replace("luxury ","").replace(" ","_");
DOM.IEPNG($(_11+"_image_set"));
$NL($(_11+"_click_map").getElementsByTagName("area")).each(function(_12){
Event.observe(_12,"mouseover",function(){
$(_11+"_image_set").addClassName(_12.getAttribute("title"));
});
Event.observe(_12,"mouseout",function(){
$(_11+"_image_set").removeClassName(_12.getAttribute("title"));
});
});
_10.series_list.each(function(_13,i){
var s=new SeriesController(_13);
this.series_controllers.push(s);
}.bind(this));
_10.series_list.each(function(_16){
}.bind(this));
}.bind(this));
}
},deepLink:function(){
if(deepLink.hasParamater("model")){
var _17=deepLink.getParameter("model");
for(var i=0;i<this.series_groups.length;i++){
var _19=this.series_groups[i];
for(var x=0;x<_19.series_list.length;x++){
var _1b=_19.series_list[x];
if(_1b.name==_17){
this.triggerModelPopup(_1b);
return;
}
}
}
}
},triggerModelPopup:function(_1c){
this.model_popup_controller.activate(_1c);
},selectModel:function(_1d){
var _1e="modelId="+_1d.id+"&zipCode="+this.model_popup_controller.zip_input.value+"&isSE="+_1d.special_edition;
if(_1d.id=="66565524"){
var _1f="/lexusConfigApp/pub/showDealerList.do?zipCode="+this.model_popup_controller.zip_input.value+"&modelId="+selected_model_id;
var _20=this.model_popup_controller.zip_input.value;
var _21=selected_model_id;
var _22=this;
var _23=new Ajax.Request(_1f,{onSuccess:function(_24){
try{
var _25=_24.responseText;
new Insertion.Top($("dealer_list_short"),_25);
_22.openSpecialOrderOverlay(_20,_21);
}
catch(e){
alert(e);
}
}});
}else{
window.location="/lexusConfigApp/pub/setStartOptions.do?"+_1e;
}
},openSpecialOrderOverlay:function(_26,_27){
var _28="false";
var qs=window.location.search.substring(1);
var qs2=qs.split("&");
for(i=0;i<qs2.length;i++){
var qs3=qs2[i].split("=");
if(qs3[0]=="dealer"){
_28="true";
}
}
hideTrimElements();
if(_28=="true"){
showDealerizedElements();
}
$("special_order").style.display="block";
setPhotoGalleryLink();
setPricingOptionsLink();
if(_28=="false"){
setMoreDealersLink();
}
function hideTrimElements(){
if($("model_chooser_form")&&$("error_message")&&$("trim_info")){
$("model_chooser_form").hide();
$("error_message").hide();
$("trim_info").hide();
}
}
function showDealerizedElements(){
$("dealerHeader").src="/configurator/images/landing_page/overlay_header_Next_Steps.gif";
$("dealerHeader").alt="Next Steps";
$("dealerMsg").innerHTML="To contact your Lexus dealer, click Purchase Inquiry:";
$("dealerMsg").style.margin="10px 0px";
}
function setPhotoGalleryLink(){
var _2c="/lexus-share/gallery/popup.html?launchGallery=true&model=LSh";
Event.observe("photo_gallery","click",function(){
window.open(_2c,"galleryWindow","height=602,width=804,scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no");
});
}
function setPricingOptionsLink(){
Event.observe("pricing_options","click",function(){
var _2d="/models/LSh/features/po_print.html";
var _2e=parseInt(screen.availHeight-110);
var _2f=window.open(_2d,"printPage","width=803,height="+_2e+",menubar=yes,resizable=yes,scrollbars=yes,status=no,left="+((window.screen.availWidth-803)/2)+",top=0");
_2f.focus();
});
}
function setMoreDealersLink(){
Event.observe("more_dealers","click",function(){
var _30="/lexusConfigApp/pub/showDealerList.do?zipCode="+_26+"&modelId="+_27;
var _31=_30+"&showMultipleDealers=true";
var _32=new Ajax.Request(_31,{onSuccess:function(_33){
try{
var _34=_33.responseText;
new Insertion.Top($("dealer_list_long"),_34);
$("dealer_list_short").hide();
$("dealer_list_long").style.display="block";
}
catch(e){
alert(e);
}
}});
});
}
},openWaitScreen:function(){
if(!$("model_chooser_popup_wait")){
var _35=document.createElement("div");
_35.id="model_chooser_popup_wait";
var _36=document.createElement("div");
_36.id="model_chooser_popup_wait_frame";
$("model_chooser_popup_frame").appendChild(_35);
_35.appendChild(_36);
}else{
$("model_chooser_popup_wait").style.display="";
}
},closeWaitScreen:function(){
if($("model_chooser_popup_wait")){
$("model_chooser_popup_wait").style.display="none";
}
},zip_verify:function(req){
try{
var xml=XML.getRootNode(req.responseXML);
var _39=xml.getElementsByTagName("zip_code")[0];
var _3a=xml.getElementsByTagName("model");
}
catch(e){
Debug.error(e);
}
var _3b;
var _3c;
if(_39){
Debug.debug("zipCode result:  "+_39.getAttribute("result"));
}
if(!_39||_39.getAttribute("result")=="invalid"){
_3b=new Template(ErrorConstants.INVALID_ZIPCODE_SERVER);
_3c=_3b.evaluate({zipcode:this.model_popup_controller.zip_input.value});
}else{
if(_39.getAttribute("result")=="off_site"){
_3b=new Template(ErrorConstants.HAWAIIAN_OR_PUERTO_RICAN_ZIPCODE);
var _3d=_3b.evaluate({zipcode:this.model_popup_controller.zip_input.value});
if(confirm(_3d)){
this.redirectToAlternativeSite(_39.getAttribute("off_site_url"));
return;
}else{
_3b=new Template(ErrorConstants.NON_SERVICED_ZIPCODE);
_3c=_3b.evaluate({zipcode:this.model_popup_controller.zip_input.value});
}
}else{
if(_3a.length<=0||_3a[0].getAttribute("is_available")!="yes"){
_3b=new Template(ErrorConstants.MODEL_NOT_AVAILABLE);
_3c=_3b.evaluate({zipcode:this.model_popup_controller.zip_input.value,model:this.model.name});
}else{
var _3e="/byl/pub/showMainConfiguration.do";
window.location=_3e;
return;
}
}
}
if(_3c){
NotificationCenter.sendNotification("ERROR",[_3c]);
this.loading_panel.deactivate();
}
},redirectToAlternativeSite:function(url){
window.location=url;
},showTimeoutPopup:function(){
if(this.timeoutWindow&&!this.timeoutWindow.closed){
this.timeoutWindow.focus();
}else{
this.timeoutWindow=window.open("/configurator/error/session_time_out.html","timeoutWindow","height=569,width=533,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no");
this.timeoutWindow.focus();
}
}});

var ModelController=Class.create();
Object.extend(ModelController.prototype,ControllerCommon);
Object.extend(ModelController.prototype,PopupCommon);
Object.extend(ModelController.prototype,{initialize:function(){
var _1;
var _2;
this.element=document.createElement("div");
var _3;
var _4;
var _5;
var _6;
var _7;
var _8;
var _9;
this.zip_input;
this.zip_input=ZipCodeInputController.create({onReturnPress:function(_a){
for(var i=0;i<this.series.models.length;i++){
if(this.series.models[i].year==this.selected_year){
this.selectModel(null,this.series.models[i]);
return;
}
}
}.bind(this)});
this.error_message="error_message";
this.zip_instructions="zip_instructions";
this.element.id="model_chooser_popup";
document.body.appendChild(this.element);
NotificationCenter.addSubscriber("ERROR",this,"updateErrorMessage");
this.loadTemplate("/configurator/includes/landing_page/model_chooser_popup.incl",{onComplete:this.init_ontemplate.bind(this)});
precache_image("/configurator/images/landing_page/build_button.gif");
precache_image("/configurator/images/landing_page/build_another_model_btn.gif");
precache_image("/configurator/images/landing_page/build_another_model_btnOver.gif");
precache_image("/configurator/images/landing_page/build_btn.gif");
precache_image("/configurator/images/landing_page/build_btnOver.gif");
precache_image("/configurator/images/landing_page/chooser_bg.gif");
precache_image("/configurator/images/landing_page/close_btn.png");
precache_image("/configurator/images/landing_page/small_square.gif");
precache_image("/configurator/images/landing_page/list_arrow.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_Lexus.png");
precache_image("/configurator/images/landing_page/btn_view_2008.gif");
precache_image("/configurator/images/landing_page/btn_view_2009.gif");
precache_image("/configurator/images/landing_page/model_chooser_popup_top_bg.gif");
precache_image("/configurator/images/landing_page/pricing_and_options_btn.gif");
precache_image("/configurator/images/landing_page/photo_gallery_btn.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_ES.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_GS.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_GSh.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_GX.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_HSh.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_IS_F.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_IS.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_IS_C.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_LS.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_LS_SO.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_LSh.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_LX.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_RXh.gif");
precache_image("/configurator/images/landing_page/overlay_header_Build_Your_SC.gif");
},init_ontemplate:function(){
if(this.activate_now){
this.activate(this.series);
this.activate_now=false;
}
},activate:function(_c){
this.series=_c;
ModelChooserController.modal_backdrop.enable({clickEventHandler:this.deactivate.bind(this)});
if(this.templates){
var _d=new Array();
var _e=new Array();
var _f=new Array();
var _10=new Array();
this.model_year_divs=new Array();
var _11=_c.series_media_id;
var _12;
if(_c.name=="IS_C"){
var _13=_c.name.replace("_"," ");
}else{
var _13=_c.name.replace("h"," Hybrid");
}
if(this.series.models.length>0){
this.series.models.each(function(_14){
precache_image("/configurator/images/trim_overlay/trim_select_"+_14.name.replace(/\s/g,"_").toLowerCase()+".png");
_12=modelYearMap[modelMap[_14.id]].find(function(_15){
if(_15.modelId==_14.id){
return true;
}else{
return false;
}
});
if(_12.linkMediaId==null){
var _16="";
}else{
var _16="<img src=\"/lexusConfigApp/pub/media?id="+_12.linkMediaId+"\" border=\"0\" alt=\"\">";
}
var p=Object.extend({},_14);
p.series_name=_c.name;
p.model_name_image=_14.name.replace(/\s/g,"_").toLowerCase();
p.price_high=_14.price_high.moneyFormat();
p.price_low=_14.price_low.moneyFormat();
p.title_media_id=_14.title_media_id;
p.is_SE=(_14.special_edition)?"_SE_":"";
if(_14.features){
p.features_list=_14.features;
}
_d=[];
_d.push(this.templates["features"].evaluate(p));
_e.push(this.templates["radio_button"].evaluate(p));
_f.push(this.templates["vehicle_details"].evaluate({model_name_image:_14.name.replace(/\s/g,"_").toLowerCase(),vehicle_promo_link:_12.linkUrl,vehicle_promo_image:_16,features:_d.join(""),disclaimer:_14.disclaimer,year:_14.year,showHSh:((_c.name=="HSh")?"display:block":"display:none"),showGX:((_c.name=="GX")?"display:block":"display:none")}));
}.bind(this));
}
this.element.innerHTML=this.templates["main"].evaluate(Object.extend({features:_d.join(""),radio_buttons:_e.join(""),series_img:_11,name_display:_13,model_name_image:model_name_image,vehicle_details:_f.join("")},_c));
var _18=this.series.models.pluck("year").uniq();
var _19=_18.max();
this.selected_year=_19;
this.num_total_trims=this.series.models.pluck("year").length;
this.multiple_diff_year_trims=false;
if(_18.length>1){
this.multiple_diff_year_trims=true;
}
this.multiple_same_year_trims=false;
var _1a=0;
this.series.models.each(function(_1b){
if(_1b.year==this.selected_year){
_1a++;
}
}.bind(this));
if(_1a>1){
this.multiple_same_year_trims=true;
}
if(this.multiple_same_year_trims==true){
document.forms.trim_btns_form.trim_choices[0].checked=true;
}else{
if(this.multiple_diff_year_trims==true){
for(i=0;i<this.num_total_trims;i++){
var _1c=document.forms.trim_btns_form.trim_choices[i].className.replace(/\s/g,"_");
var _1d=new RegExp(this.selected_year);
if(_1d.test(_1c)){
document.forms.trim_btns_form.trim_choices[i].checked=true;
}
}
}else{
document.forms.trim_btns_form.trim_choices.checked=true;
}
}
this.showTrimSelected();
_18.each(function(_1e){
var _1f=document.getElementsByClassName("year_"+_1e);
if(_1e!=_19){
_1f.each(function(_20){
_20.style.display="none";
});
}
if(document.all){
_1f.each(function(_21){
var _22=document.getElementsByClassName("series_trim_image",_21);
_22.each(function(png){
DOM.IEPNG(png,true);
});
});
}
});
if(_18.length>1){
var _24=$("view_year");
_18.each(function(_25){
var _26=_24.appendChild(document.createElement("img"));
_26.src="/configurator/images/landing_page/btn_view_"+_25+".gif";
_26.alt="View "+_25;
_26.addClassName="view_year_img";
_26.id="view_year_img_"+_25;
Event.observe(_26,"click",this.changeYear.bindAsEventListener(this));
if(_25==_19){
Element.hide(_26);
}
}.bind(this));
}
$("model_chooser_zip_input").parentNode.replaceChild(this.zip_input.input,$("model_chooser_zip_input"));
var _27=$("zip_container").getElementsByTagName("input");
if(sessionZip!=null&&sessionZip!=""){
_27[0].value=sessionZip;
}
var _28=$NL(this.element.getElementsByTagName("img"));
_28.each(function(_29){
if((_29.name=="close")&&($(_29).hasClassName("build_another_model_btn"))){
Event.observe(_29,"click",function(e){
this.deactivate();
fireTag(27.5,{"<model_name>":omni_series_name});
}.bind(this));
}else{
if(_29.name=="close"){
Event.observe(_29,"click",function(e){
this.deactivate();
}.bind(this));
}
}
if(_29.name=="trigger_select"){
Event.observe(_29,"click",this.selectModel.bindAsEventListener(this));
}
if(_29.src.indexOf(".png")>-1){
DOM.IEPNG(_29);
}
}.bind(this));
var _2c=document.getElementsByClassName("swap","model_chooser_container");
$NL(_2c).each(function(img){
if(img.src.indexOf("Over.gif")==-1){
Event.observe(img,"mouseout",function(){
swapOver(this);
}.bind(img),false);
Event.observe(img,"mouseover",function(){
swapOver(this);
}.bind(img),false);
}
}.bind(this));
var _2e=document.getElementsByClassName("trim_label","trim_btns_form");
$NL(_2e).each(function(l){
Event.observe(l,"mouseout",function(){
this.showTrimSelected();
}.bind(this),false);
Event.observe(l,"mouseover",function(_30){
this.showTrimOver(_30);
}.bind(this),false);
}.bind(this));
var _31=document.forms.trim_btns_form.trim_choices;
$NL(_31).each(function(b){
Event.observe(b,"click",function(){
this.showTrimSelected();
}.bind(this),false);
}.bind(this));
$("model_chooser_form").style.display="block";
if(this.multiple_same_year_trims==false){
$("select_model_instructions").hide();
$("trim_btns").hide();
}
if(this.multiple_same_year_trims==true){
$("zip_instructions").innerHTML="Next, enter your Zip Code to identify vehicles generally available in your area.";
}else{
$("zip_instructions").innerHTML="Enter your Zip Code to identify vehicles generally available in your area.";
}
Event.observe("why_do_we_need_this","click",function(_33){
ZipCodeOverlay.showDefinition(_33);
fireTag(27.4,{"<model_name>":omni_series_name});
}.bindAsEventListener(this));
Event.observe("your_privacy_rights","click",this.showPrivacyRights.bind(this));
this.element.style.display="block";
$("zip_input_link_options").hide();
$("zip_input_link_options").show();
this.positionCenter($("model_chooser_popup"));
this.zip_input.input.focus();
}else{
this.activate_now=true;
}
omni_series_name=this.series.name;
if(omni_series_name.match(/_/gi)){
omni_series_name=omni_series_name.replace("_"," ");
}
omni_series_name=omni_series_name.replace(" ","");
fireTag(27.6,{"<model_name>":omni_series_name,"<model_code>":_12.modelCode,"<model_year>":this.series.year});
},calculateMargin:function(){
var trs=$("model_trim_options_center_table").getElementsByTagName("TR");
for(var x=0;x<trs.length;x++){
var tds=trs[x].getElementsByTagName("TD");
var _37=[];
for(var i=0;i<tds.length;i++){
if(_37[tds[i].className]){
tds[i].style.paddingLeft="50px";
}else{
_37[tds[i].className]=true;
}
}
}
$("model_trim_options_center_table").style.width=(parseInt(document.getElementsByClassName("year_"+this.selected_year,$("model_trim_options_center_table").rows[0]).length)*25)+"%";
},changeYear:function(e){
var _3a=this.series.models.pluck("year").uniq();
var _3b=Event.element(e).id.replace(/view_year_img_/ig,"");
var _3c=(_3a.without(_3b));
_3a.each(function(_3d){
var _3e=document.getElementsByClassName("year_"+_3d);
_3e.each(function(_3f){
_3f.style.display="none";
}.bind(this));
});
Element.hide($("view_year_img_"+_3b));
Element.show($("view_year_img_"+_3c));
this.selected_year=_3b;
$(this.series.models.find(function(_40){
return _40.year==_3b;
}.bind(this)).id+"_radiobtn").checked=true;
var _41=document.getElementsByClassName("trim_radiobtns_list");
var _42=(_41.findAll(function(_43){
return _43.className.match("year_"+_3b);
}.bind(this)));
_42.each(function(_44){
_44.style.display="block";
}.bind(this));
if(_42.length>1){
$("select_model_instructions").show();
$("trim_btns").show();
}else{
$("select_model_instructions").hide();
$("trim_btns").hide();
}
this.showTrimSelected();
$("select_model_instructions").innerHTML=$("select_model_instructions").innerHTML.replace(/[0-9]+/,_3b);
},showTrimSelected:function(){
this.num_total_trims=this.series.models.pluck("year").length;
var _45=new Array("trim_","trim_promo_","trim_image_container_","trim_features_","trim_disclaimer_");
this.series.models.each(function(_46){
var _47=_46.name.replace(/\s/g,"_").toLowerCase()+"_"+_46.year;
_45.each(function(_48){
$(_48+_47).style.display="none";
});
});
var _49=this.series.models[0].name.replace(/\s/g,"_").toLowerCase()+"_"+this.series.models[0].year;
if((this.multiple_same_year_trims==true)||(this.multiple_diff_year_trims==true)){
var len=document.forms.trim_btns_form.trim_choices.length;
for(i=0;i<len;i++){
if(document.forms.trim_btns_form.trim_choices[i].checked){
_49=this.series.models[i].name.replace(/\s/g,"_").toLowerCase()+"_"+this.series.models[i].year;
if(document.forms.trim_btns_form.trim_choices[i].id.match(/_SE_/)){
selected_model_id_is_SE=true;
}else{
selected_model_id_is_SE=false;
}
selected_model_id=document.forms.trim_btns_form.trim_choices[i].value;
}
}
}else{
if(document.forms.trim_btns_form.trim_choices.id.match(/_SE_/)){
selected_model_id_is_SE=true;
}else{
selected_model_id_is_SE=false;
}
selected_model_id=document.forms.trim_btns_form.trim_choices.value;
}
_45.each(function(_4b){
$(_4b+_49).style.display="block";
});
},showTrimOver:function(_4c){
var _4d=new Array("trim_","trim_promo_","trim_image_container_","trim_features_","trim_disclaimer_");
this.series.models.each(function(_4e){
var _4f=_4e.name.replace(/\s/g,"_").toLowerCase()+"_"+_4e.year;
_4d.each(function(_50){
$(_50+_4f).style.display="none";
});
});
if(document.addEventListener){
var _51=_4c.target;
}else{
if(document.attachEvent){
var _51=_4c.srcElement;
}
}
var _52=_51.id.replace(/label_/,"");
_4d.each(function(_53){
$(_53+_52).style.display="block";
});
},selectModel:function(_54){
if(!this.zip_input.validateZipCode(null,true)){
return;
}
this.selected_model=this.series.models.find(function(m){
if((selected_model_id_is_SE==true)&&(m.id==selected_model_id)&&(m.special_edition==true)){
return true;
}
if((selected_model_id_is_SE==false)&&(m.id==selected_model_id)){
return true;
}
});
setTimeout(function(){
if(this.background_click_event){
Event.stopObserving(this.background_click_event);
this.background_click_event=null;
}
if(this.element_click_event){
Event.stopObserving(this.element_click_event);
this.element_click_event=null;
}
}.bind(this),10);
ModelChooserController.selectModel(this.selected_model);
},deactivate:function(){
this.element.style.display="none";
ModelChooserController.modal_backdrop.disable();
ZipCodeOverlay.dismiss();
},updateErrorMessage:function(_56,_57){
if(_57){
if(!Element.hasClassName($(this.zip_instructions),"model_chooser_step_header_error")){
Element.addClassName($(this.zip_instructions),"model_chooser_step_header_error");
}
}else{
Element.removeClassName($(this.zip_instructions),"model_chooser_step_header_error");
}
$(this.error_message).innerHTML=_57;
},showPrivacyRights:function(){
if(this.privacyRightsWindow&&!this.privacyRightsWindow.closed){
this.privacyRightsWindow.focus();
}else{
window.mySite="lex";
this.privacyRightsWindow=window.open("/privacy/ypr_print.html","privacyRights","height=625,width=715,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no");
this.privacyRightsWindow.focus();
}
}});

var ZipCodeInputController=Class.create();
Object.extend(ZipCodeInputController.prototype,{initialize:function(_1,_2){
this.input=_1;
this.prev_value="";
this.options=_2||{};
this.value=this.input.value;
Event.observe(this.input,"keyup",this.rtValidateZipCode.bindAsEventListener(this));
Event.observe(this.input,"change",this.validateZipCode.bindAsEventListener(this));
Event.observe(this.input,"keypress",this.handleKeyPress.bindAsEventListener(this));
},rtValidateZipCode:function(){
if(this.input.value.match(/[^0-9]+/)!=null){
NotificationCenter.sendNotification("ERROR",[ErrorConstants.INVALID_ZIPCODE]);
}
},validateZipCode:function(){
var _3="";
var _4=false;
if(this.input.value.match(/[^0-9]+/)!=null){
_3=ErrorConstants.INVALID_ZIPCODE;
this.value="";
}else{
if(this.input.value.length==5){
this.value=this.input.value;
_4=true;
}else{
this.value="";
this.prev_value=this.input.value;
_3=ErrorConstants.INVALID_ZIPCODE;
}
}
NotificationCenter.sendNotification("ERROR",[_3]);
if(!_4){
fireTag(27.7,{"<model_name>":omni_series_name});
}
return _4;
},setValue:function(_5){
this.input_value=_5;
this.validateZipCode();
},handleKeyPress:function(_6){
if(_6.keyCode==Event.KEY_RETURN){
if(this.options.onReturnPress){
this.options.onReturnPress(_6);
}
}
}});
ZipCodeInputController.create=function(_7){
var _8=document.createElement("input");
_8.type="text";
_8.setAttribute("maxlength",5);
return new ZipCodeInputController(_8,_7);
};

var ErrorConstants=Class.create();
ErrorConstants.INVALID_ZIPCODE="Please input a valid zip code.";
ErrorConstants.INVALID_ZIPCODE_SERVER="The zip code #{zipcode} is invalid.  Please input a valid zip code.";
ErrorConstants.MODEL_NOT_AVAILABLE="The selected model #{model} is not available for the entered zip code #{zipcode}.";
ErrorConstants.NON_SERVICED_ZIPCODE="The zip code entered  #{zipcode} is not a serviced zip code. Please choose another.";
ErrorConstants.HAWAIIAN_OR_PUERTO_RICAN_ZIPCODE="You are now leaving the Lexus of USA Web site. The content on Lexus of USA is for vehicles in the continental United States. Information may be different for Hawaii, Pureto Rico, the U.S. Virgin Islands and elsewhere.";

var SeriesController=Class.create();
Object.extend(SeriesController.prototype,{initialize:function(_1){
var _1;
this.series=_1;
this.setupButtons();
},setupButtons:function(){
try{
var _2=$(this.series.name.toLowerCase()+"_click_area");
Event.observe(_2,"click",function(){
ModelChooserController.triggerModelPopup(this.series);
return false;
}.bind(this));
}
catch(e){
Debug.error(e);
}
}});

var ZipCodePopup=Class.create();
ZipCodePopup.DESCRIPTION="Entering your Zip Code allows us to show vehicle configurations commonly available in your area. This information is discarded once you leave the tool, and is not kept by Lexus nor used for any marketing purpose.";
Object.extend(ZipCodePopup.prototype,GlossaryPopup.prototype);
Object.extend(ZipCodePopup.prototype,{initialize:function(){
Debug.log("ZipCodePopup");
this.loadTemplate("/configurator/includes/landing_page/zip_code_definition.html",{name:"zip_code_definitions",onComplete:this.init_onpartials.bind(this)});
Event.asap(function(){
this.events=[];
this.element=document.createElement("div");
this.element.className="zip_code_definition";
this.element.style.display="none";
document.body.appendChild(this.element);
}.bind(this));
},showDefinition:function(_1){
try{
Event.stop(_1);
if(!this.scroll_box){
this.element.innerHTML=this.templates["definitions"].evaluate({});
}
$("zip_code_popup_content").innerHTML=this.templates["content"].evaluate({definition:ZipCodePopup.DESCRIPTION});
this.element.style.visibility="hidden";
this.element.style.display="";
this.reposition(Event.element(_1));
this.element.style.visibility="";
this.scroll_box={destroy:function(){
}};
}
catch(e){
Debug.error(e);
}
}});
var ZipCodeOverlay=new ZipCodePopup();


