var COOKIES=(function(){function create(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString()}else{var expires=""}document.cookie=name+"="+value+expires+"; path=/"}function read(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length)}}return null}function erase(name){create(name,"",-1)}return{create:create,read:read,erase:erase}}());jQuery.fn.watermark=function(watermarkString){var original=jQuery(this[0]);var cloned=jQuery(original).clone();var form=jQuery(original).closest("form");jQuery(cloned).attr("id",jQuery(cloned).attr("id")+"_cloned");jQuery(cloned).attr("type","text");jQuery(original).after(jQuery(cloned));if(jQuery(original).val().length==0){jQuery(original).hide();jQuery(original).attr("disabled",true)}else{jQuery(cloned).hide();jQuery(cloned).attr("disabled",true)}jQuery(cloned).css("color","#999999");jQuery(cloned).val(watermarkString);jQuery(cloned).focus(function(){jQuery(this).hide();jQuery(this).attr("disabled",true);jQuery(original).attr("disabled",false);jQuery(original).show();jQuery(original).focus()});jQuery(original).blur(function(){if(jQuery(this).val().length==0){jQuery(this).hide();jQuery(this).attr("disabled",true);jQuery(cloned).show();jQuery(cloned).attr("disabled",false)}else{jQuery(cloned).attr("disabled",true)}});jQuery(form).submit(function(){jQuery(cloned).attr("disabled",true);jQuery(original).attr("disabled",false)})};jQuery.fn.submitFormOnEnter=function(formName){var me=jQuery(this[0]);jQuery(me).keypress(function(e){if(e.keyCode==13){if(formName!=null){jQuery("#"+formName).submit()}else{jQuery(me).closest("form").submit()}}})};jQuery.fn.enterPressed=function(fn){var me=$j(this[0]);jQuery(me).keypress(function(e){if(e.keyCode==13){fn()}})};function retrieveAppointment(){var trackingNumber=$j("#emodTrackingNumber").val();var firstName=$j("#emodFirstName").val();var lastName=$j("#emodLastName").val();if((trackingNumber!=null&&trackingNumber!="")&&(firstName!=null&&firstName!="")&&(lastName!=null&&lastName!="")){$j("#sidebarEserveAjaxLoader").html('<img src="/images/cat/ajaxlf4f4f4.gif" />');$j.post("/eserve/ajax/sidebarAppointment",{trackingNumber:trackingNumber,firstName:firstName,lastName:lastName},function(data){$j("#sidebarEserve").html(data);OMNITURE.trackEvent("event10")})}}function disableEmailEdit(value){$j("#emailFake").attr("disabled",value);if(value){$j("#emailAddress").val($j("#emailOriginal")[0].defaultValue);$j("#emailFake").val($j("#emailOriginal")[0].defaultValue)}}function copyEmail(){$j("#emailAddress").val($j("#emailFake").val())}function showServiceSafetyFinish(){$j("#eserve_select_hide_service").show();$j("#eserve_select_hide_safety").show();$j("#eserve_select_hide_finish").show();$j("#eserve_select_a_vehicle").show();$j("#eserve_select_vehicle_or_add").show();$j("#eserve_click_add_a_vehicle").hide();$j("#eserve_what_vehicle_needs_service").hide()}function hideServiceSafetyFinish(){$j("#eserve_select_hide_service").hide();$j("#eserve_select_hide_safety").hide();$j("#eserve_select_hide_finish").hide();$j("#eserve_select_a_vehicle").hide();$j("#eserve_select_vehicle_or_add").hide();$j("#eserve_click_add_a_vehicle").show();$j("#eserve_what_vehicle_needs_service").show()}function showEserveDatepicker(){$j("#datepicker").datepicker({minDate:0,maxDate:"+1M +10D",showOn:"both",buttonImage:"/images/eserve/eserve_calendar_icon.png",buttonImageOnly:true,promoText:'<strong style="color: #000000; float:left; padding-left:.2cm;">Weekday Special</strong><div style="color: #FF0000; text-align:left; padding-left:.9cm;">$19.99 Conventional Oil Change</div>',showPromoPanel:true,beforeShowDay:setPromoDays,onSelect:function(dateText,inst){var tsTimeStamp=new Date().getTime();var store=$j("#store").val();$j.get("/eserve/ajax/when",{preferredDate:dateText,storeKey:store,time:tsTimeStamp},function(data){hideLoadingEserveTime();$j("#ajaxTimePicker").html(data);$j("#ajaxTimePicker").show();$j("#preferredTimeBlock").hide()});showLoadingEserveTime()}})}var weekdays=[2,3,4];var promoDays=[[6,15,2011,"PROMODAY"]];var holidayDays=[[12,25,2011]];function setPromoDays(date){var isPromo=false;var isHoliday=false;var promoStatus="";var day=date.getDay();for(i=0;i<weekdays.length;i++){if($j.inArray(day,weekdays)!=-1){isPromo=true;promoStatus="PROMODAY"}}for(i=0;i<promoDays.length;i++){if(date.getMonth()==promoDays[i][0]-1&&date.getDate()==promoDays[i][1]&&date.getFullYear()==promoDays[i][2]){isPromo=true;promoStatus=promoDays[i][3]}}if(holidayDays!=null){for(i=0;i<holidayDays.length;i++){if(date.getMonth()==holidayDays[i][0]-1&&date.getDate()==holidayDays[i][1]&&date.getFullYear()==holidayDays[i][2]){isHoliday=true}}}if(isHoliday){return[false,"CLOSED"]}else{if(isPromo){return[true,promoStatus]}else{return[true,""]}}}function showLoadingEserveTime(){$j("#ajaxTimePicker").hide();$j("#ajaxSpinner").show()}function hideLoadingEserveTime(){$j("#ajaxTimePicker").show();$j("#ajaxSpinner").hide()}function changeStore(storeKey){var tsTimeStamp=new Date().getTime();var editAppt=$j("#editAppt").val();$j.get("/eserve/ajax/where",{store:storeKey,isChange:true,time:tsTimeStamp,editAppt:editAppt},function(data){location.reload(true)})}function changeDate(dateText){$j("#datepicker").datepicker("setDate",dateText);var store=$j("#store").val();var tsTimeStamp=new Date().getTime();$j.get("/eserve/ajax/when",{preferredDate:dateText,storeKey:store,time:tsTimeStamp},function(data){$j("#ajaxTimePicker").html(data);hideLoadingEserveTime()});showLoadingEserveTime()}function changeTime(){$j("#ajaxTimePicker").show();$j("#preferredTimeBlock").hide()}function selectTime(time){$j("#preferredTime").val(time);$j("#preferredTimeLabel").html(time);$j("#preferredTimeBlock").show();$j("#ajaxTimePicker").hide();var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");$j.getScript(gaJsHost+"google-analytics.com/ga.js",function(){try{var pageTracker=_gat._getTracker("UA-1975190-1");pageTracker._setDomainName(".pepboys.com");pageTracker._setAllowLinker(true);pageTracker._setAllowHash("false");pageTracker._link();pageTracker._linkByPost();pageTracker._trackPageview("/eserve/appointment-store-selected")}catch(err){}})}function disclaimer(url){window.open("/disclaimer?url="+url,"popup","width=400,height=400")}function reroute(openURL){window.open(openURL,"thirdpartywin","width=800,height=600,resizable=yes, directories=yes, location=yes, menubar=yes, status=yes, toolbar=yes, scrollbars=yes");self.close();return true}function popunder(surveyName){var page="/survey?surveyName="+surveyName;var windowprops="width=501,height=450,location=no,menubar=no,toolbar=no,scrollbars=no,resizable=no,status=no";window.open(page,"Pep_Boys_Survey",windowprops);window.focus();Set_Cookie(surveyName,"true",60,"/","","");return false}function Get_Cookie(check_name){var a_all_cookies=document.cookie.split(";");var a_temp_cookie="";var cookie_name="";var cookie_value="";var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++){a_temp_cookie=a_all_cookies[i].split("=");cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,"");if(cookie_name==check_name){b_cookie_found=true;if(a_temp_cookie.length>1){cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,""))}return cookie_value;break}a_temp_cookie=null;cookie_name=""}if(!b_cookie_found){return null}}function Set_Cookie(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires){expires=expires*1000*60*60*24}var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+((expires)?";expires="+expires_date.toGMTString():"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"")}var selVeh="false";var closeURL="";var bShow=false;var doRadioRefresh=false;function showStores(){var tsTimeStamp=new Date().getTime();$j("#gloveStoresPop").css("display","block");$j.get("/store/ajax/mini",{time:tsTimeStamp},function(data){$j("#gloveNavPopList").html(data)})}function hideStores(){$j("#gloveStoresPop").css("display","none")}function showVehicles(){var tsTimeStamp=new Date().getTime();$j("#gloveVehiclesPop").css("display","block");$j.get("/ymme/ajax/mini",{time:tsTimeStamp},function(data){$j("#gloveNavPopListVeh").html(data)})}function hideVehicles(){$j("#gloveVehiclesPop").css("display","none")}function selStore(buildUrl){var tsTimeStamp=new Date().getTime();hideStores();$j.get(buildUrl,{time:tsTimeStamp},function(data){var path=window.location.pathname;var splitPath=path.split("/");if(path.indexOf("/tires/sby")>-1&&splitPath.length>=17){splitPath[8]=data;window.location=splitPath.join("/")}else{if(path.indexOf("/tires/sbt")>-1&&splitPath.length>=19){splitPath[8]=data;window.location=splitPath.join("/")}else{if(path.indexOf("/tires/sbs")>-1&&splitPath.length>=14){splitPath[12]=data;window.location=splitPath.join("/")}else{window.location.reload()}}}})}function findValue(li){if(li==null){return}else{var sValue=li.selectValue}}function selectItem(li){findValue(li)}function formatItem(row){return row[0]+" (id: "+row[1]+")"}function lookupLocal(){var oSuggest=$j("#partsLocal")[0].autocompleter;oSuggest.findValue();return false}function clear_head_box(){var f=document.siteSearch;if(f!=null){if(f.sphrase.value=="Keyword, Part Name or #"){f.sphrase.value="";f.sphrase.className="kw_textbox_focus"}}}var dialog;function popContentBox(title,height,width){var options=$j.extend({title:"",closable:false,center:true,fixed:false,modal:true},{});dialog=new Boxy('<div style="width: '+width+"px; height: "+height+'px;"><img src=/images/cat/ajaxlwhite.gif /></div>',options);var iebodyc=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var dsoctopc=document.all?iebodyc.scrollTop:pageYOffset;dsoctopc=dsoctopc+50;dialog.moveTo(10,dsoctopc);dialog.center("x");dialog.resize(width,height);$j.get("/ajax/popup","title="+title,function(data){dialog.setContent("<div>"+data+"</div>");dialog.resize(width,height);dialog.moveTo(10,dsoctopc);dialog.center("x")});return false}function domFunction(f,a){var n=0;var t=setInterval(function(){var c=true;n++;if(typeof document.getElementsByTagName!="undefined"&&(document.getElementsByTagName("body")[0]!=null||document.body!=null)){c=false;if(typeof a=="object"){for(var i in a){if((a[i]=="id"&&document.getElementById(i)==null)||(a[i]=="tag"&&document.getElementsByTagName(i).length<1)){c=true;break}}}if(!c){f();clearInterval(t)}}if(n>=60){clearInterval(t)}},250)}function externalLinks(){if(!document.getElementsByTagName){return}var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external"){var oLink=anchors[i];if(oLink.className.search(/noicon/)==-1){anchor.setAttribute("class","link_ext")}anchor.target="_blank"}}}function disclaimerLinks(){if(!document.getElementsByTagName){return}var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="disclaimer"){anchor.target="_blank";anchor.onclick=function(){openPopUp("/disclaimer.php?link="+escape(this.getAttribute("href")));return false}}}}function openPopUp(linkURL){window.open(linkURL,"popup","width=400,height=400")}function registerReset(){if(!document.getElementById){return}if(document.getElementById("reset")){document.getElementById("reset").onclick=function(){var frm=document.getElementById("register_member_form").reset();return false}}}function initFormFocus(){}function initServiceMenu(){if(document.serviceMenu){var selObj=document.getElementById("serviceSelect");document.serviceMenu.serviceSelect.onchange=function(){var selIndex=selObj.selectedIndex;self.location=selObj.options[selIndex].value}}}function clickOn(){if(document.getElementById("currentY")){document.getElementById("currentY").onclick=function(){Element.show("followUp")}}}function clickOff(){if(document.getElementById("currentN")){document.getElementById("currentN").onclick=function(){Element.hide("followUp")}}}function printScreen(){if(document.getElementById("functionPrint")){document.getElementById("functionPrint").onclick=function(){window.print();return false}}}function hideFollowUp(){if(!document.getElementById){return}if(document.getElementById("followUp")){document.getElementById("followUp").style.display="none"}if(document.getElementById("followUpMsg")){document.getElementById("followUpMsg").style.display="none"}}var pboys=new domFunction(function(){externalLinks();disclaimerLinks();registerReset()});function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!="function"){window.onload=func}else{window.onload=function(){oldonload();func()}}}addLoadEvent(initFormFocus);addLoadEvent(initServiceMenu);addLoadEvent(clickOn);addLoadEvent(clickOff);addLoadEvent(hideFollowUp);addLoadEvent(printScreen);
