﻿function OpenDiv(divID){if(document.getElementById(divID).style.display=="none"){HideAllDivs(divID);ShowDiv(divID);var selObj=document.getElementById("LADropDown");for(var i=0;i<selObj.length;i++){if(selObj.options[i].value==divID){selObj.selectedIndex=i;break;}}}}function HideAllDivs(divID){if(divID!="ctl00_Content_div_Adv_Main"){HideDiv('ctl00_Content_div_Adv_Main');}if(divID!="ctl00_Content_div_Adv_FAQ"){HideDiv('ctl00_Content_div_Adv_FAQ');}if(divID!="ctl00_Content_div_Adv_Pre"){HideDiv('ctl00_Content_div_Adv_Pre');}if(divID!="ctl00_Content_div_Adv_Collision"){HideDiv('ctl00_Content_div_Adv_Collision');}if(divID!="ctl00_Content_div_Adv_AutoService"){HideDiv('ctl00_Content_div_Adv_AutoService');}if(divID!="ctl00_Content_div_Adv_NewVehicles"){HideDiv('ctl00_Content_div_Adv_NewVehicles');}if(divID!="ctl00_Content_div_Adv_Main"){HideDiv('ctl00_Content_div_Adv_Main');}if(divID!="ctl00_Content_SavingsCalcResults"){HideDiv('ctl00_Content_SavingsCalcResults');}}function AdvantageScroll(direction){var obj1=document.getElementById("divLAThumb1");var obj2=document.getElementById("divLAThumb2");var obj3=document.getElementById("divLAThumb3");var obj4=document.getElementById("divLAThumb4");var obj5=document.getElementById("divLAThumb5");var obj6=document.getElementById("divLAThumb6");var obj7=document.getElementById("divLAThumb7");var objUp=document.getElementById("imgUp");var objDown=document.getElementById("imgDown");if(direction=="down"){if(obj1.style.display=="block"){obj1.style.display="none";obj2.style.display="block";obj3.style.display="block";obj4.style.display="block";obj5.style.display="block";obj6.style.display="none";obj7.style.display="none";objUp.src="/images/advantage/arrow_up_red.gif";objDown.src="/images/advantage/arrow_down_red.gif";}else if((obj1.style.display=="none")&&(obj2.style.display=="block")){obj1.style.display="none";obj2.style.display="none";obj3.style.display="block";obj4.style.display="block";obj5.style.display="block";obj6.style.display="block";obj7.style.display="none";objUp.src="/images/advantage/arrow_up_red.gif";objDown.src="/images/advantage/arrow_down_red.gif";}else if((obj1.style.display=="none")&&(obj2.style.display=="none")&&(obj3.style.display=="block")){obj1.style.display="none";obj2.style.display="none";obj3.style.display="none";obj4.style.display="block";obj5.style.display="block";obj6.style.display="block";obj7.style.display="block";objUp.src="/images/advantage/arrow_up_gray.gif";objDown.src="/images/advantage/arrow_down_red.gif";}}else{if(obj7.style.display=="block"){obj1.style.display="none";obj2.style.display="none";obj3.style.display="block";obj4.style.display="block";obj5.style.display="block";obj6.style.display="block";obj7.style.display="none";}else if((obj7.style.display=="none")&&(obj6.style.display=="block")){obj1.style.display="none";obj2.style.display="block";obj3.style.display="block";obj4.style.display="block";obj5.style.display="block";obj6.style.display="none";obj7.style.display="none";}else if((obj7.style.display=="none")&&(obj6.style.display=="none")&&(obj5.style.display=="block")){obj1.style.display="block";obj2.style.display="block";obj3.style.display="block";obj4.style.display="block";obj5.style.display="none";obj6.style.display="none";obj7.style.display="none";}}if(obj1.style.display=="block"){objUp.src="/images/advantage/arrow_up_gray.gif";}else{objUp.src="/images/advantage/arrow_up_red.gif";}if(obj7.style.display=="block"){objDown.src="/images/advantage/arrow_down_gray.gif";}else{objDown.src="/images/advantage/arrow_down_red.gif";}}function AdvantageChangeSplash(splash){var obj=document.getElementById("imgAdvImageSplash");obj.src="/images/advantage/splash_adv"+splash+".jpg"var obj1=document.getElementById("imgThumb1");var obj2=document.getElementById("imgThumb2");var obj3=document.getElementById("imgThumb3");var obj4=document.getElementById("imgThumb4");var obj5=document.getElementById("imgThumb5");var obj6=document.getElementById("imgThumb6");var obj7=document.getElementById("imgThumb7");obj1.src="/images/advantage/thumb_adv_1_gray.gif";obj2.src="/images/advantage/thumb_adv_2_gray.gif";obj3.src="/images/advantage/thumb_adv_3_gray.gif";obj4.src="/images/advantage/thumb_adv_4_gray.gif";obj5.src="/images/advantage/thumb_adv_5_gray.gif";obj6.src="/images/advantage/thumb_adv_6_gray.gif";obj7.src="/images/advantage/thumb_adv_7_gray.gif";switch(splash){case 1:obj1.src="/images/advantage/thumb_adv_1_red.gif";break;case 2:obj2.src="/images/advantage/thumb_adv_2_red.gif";break;case 3:obj3.src="/images/advantage/thumb_adv_3_red.gif";break;case 4:obj4.src="/images/advantage/thumb_adv_4_red.gif";break;case 5:obj5.src="/images/advantage/thumb_adv_5_red.gif";break;case 6:obj6.src="/images/advantage/thumb_adv_6_red.gif";break;case 7:obj7.src="/images/advantage/thumb_adv_7_red.gif";break;}}function LACalcSavings(){var result;var error=false;var errorMessage="";var objForm=document.getElementById("SavingsCalcForm");var objResults=document.getElementById("SavingsCalcResults");var objCalcResult=document.getElementById("LACalcResult");var objMilesDriven=document.getElementById("txtMilesDriven");var objMPG=document.getElementById("txtMPG");var objCarWashes=document.getElementById("txtCarWashes");var objServiceVisits=document.getElementById("txtServiceVisits");if(objMilesDriven.value==""){errorMessage="You must enter your miles driven per month.\r\n";error=true;}if(objMilesDriven.value=="0"){errorMessage=errorMessage+"Your miles driven per month must be greater than 0.\r\n";error=true;}if(objMPG.value==""){errorMessage=errorMessage+"You must enter your vehicle's miles per gallon.\r\n";error=true;}if(objMPG.value=="0"){errorMessage=errorMessage+"Your vehicle's miles per gallon must be greater than 0.\r\n";error=true;}if(objCarWashes.value==""){objCarWashes.value=0}if(objServiceVisits.value==""){objServiceVisits.value=0}var objLAGallons=document.getElementById("LAGallons");var objLAGasSavings=document.getElementById("LAGasSavings");var objLACarWashes=document.getElementById("LACarWashes");var objLACarWashSavings=document.getElementById("LACarWashSavings");var objLAServiceVisits=document.getElementById("LAServiceVisits");var objLAServiceSavings=document.getElementById("LAServiceSavings");var objLATotalSavings=document.getElementById("LATotalSavings");objLAGallons.value=Math.round((objMilesDriven.value*12)/objMPG.value);objLAGasSavings.value=Math.round((objLAGallons.value*2)*0.06);objLACarWashes.value=objCarWashes.value;objLACarWashSavings.value=(objLACarWashes.value*3)*24;objLAServiceVisits.value=objServiceVisits.value;objLAServiceSavings.value=(objLAServiceVisits.value*20)*2;objLATotalSavings.value=Math.round(objLAGasSavings.value+objLACarWashSavings.value+objLAServiceSavings.value+480);objLAGallons.innerHTML=objLAGallons.value+"&nbsp;";objLAGasSavings.innerHTML="$"+objLAGasSavings.value;objLACarWashes.innerHTML=objLACarWashes.value+"&nbsp;";objLACarWashSavings.innerHTML="$"+objLACarWashSavings.value;objLAServiceVisits.innerHTML=objLAServiceVisits.value+"&nbsp;";objLAServiceSavings.innerHTML="$"+objLAServiceSavings.value;objLATotalSavings.innerHTML="$"+objLATotalSavings.value;objCalcResult.innerHTML="$"+objLATotalSavings.value;if(error){alert(errorMessage);}else{objForm.style.display="none";objResults.style.display="block";}}function LARecalculate(){var objForm=document.getElementById("SavingsCalcForm");var objResults=document.getElementById("SavingsCalcResults");objForm.style.display="block";objResults.style.display="none";}function LADropDownChange(){var objDropDown=document.getElementById("LADropDown");if(objDropDown.value=="Renew"){window.open("http://www.lutheradvantagerenewal.com/");}else if(objDropDown.value=="SA"){window.open("http://www.speedway.com/FindUs/StoreLocator/");}else{OpenDiv(objDropDown.options[objDropDown.selectedIndex].value);}}