/************************************************************
JavaScript Document for LMDA Regional Micro Sites
Version: 1.0
Author: Steve Getman
Date: 07-06-20
************************************************************/
function isEmailAddr(email) {
/*********************************************************
Version: 1.0
Date: 11-19-2004
Desc: Function used to check for valid email address
***********************************************************/
var result = false
var theStr = new String(email)
var index = theStr.indexOf("@");
if (index > 0) {
var pindex = theStr.indexOf(".",index);
if ((pindex > index+1) && (theStr.length > pindex+1))
result = true;
}
return result;
}
function validateZIP2(zip) {
/***********************************************************
Version: 1.0
Date: 03-30-04
Description: Validates a zip code. supresses alerts
************************************************************/
var valid = "0123456789-";
var hyphencount = 0;
if (zip.length!=5 && zip.length!=10) {
return false;
}
for (var i=0; i < zip.length; i++) {
temp = "" + zip.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
return false;
}
if ((hyphencount > 1) || ((zip.length==10) && ""+zip.charAt(5)!="-")) {
return false;
}
}
return true;
}
function popWindow(winURL,winName,winWidth,winHeight,winScroll) {
/************************************************************************
Version: 2.0
Date: 11-15-2004
Desc: (elite) Pops and centers new window based on passed parameters
*************************************************************************/
var winLeft = (screen.width - winWidth) / 2;
var winTop = (screen.height - winHeight) / 2;
var winReSize = 'no';
var winToolBar = 'no';
var winDirectory = 'no';
var winStatusBar = 'no';
var winMenuBar = 'no';
var winProps = 'height='+winHeight+',width='+winWidth+',top='+winTop+',left='+winLeft+',scrollbars='+winScroll+',resizable'
win = window.open(winURL, winName, winProps);
}
function popFamilyPlan( vehName ){
var curVeh = vehName;
var myURL = eval('"/simple/default.asp?vehicle=' + curVeh + '"');
var popFeatures = "width=409,height=500,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1";
var familyPop = window.open( myURL,'popWin', popFeatures );
familyPop.focus();
}
function viewLayer(imageName) {
if ((imageName == "mariner") || (imageName == "zephyr") || (imageName == "home")) {
document.getElementById("banner1_full").style.visibility = "hidden";
document.getElementById("banner1_text").style.visibility = "visible";
document.getElementById("banner2_text").style.visibility = "visible";
} else {
document.getElementById("banner1_text").style.visibility = "hidden";
document.getElementById("banner2_text").style.visibility = "hidden";
document.getElementById("banner1_full").style.visibility = "visible";
}
}
function turnOn(imageName) {
/*********************************************************
Version: 1.0
Date: 11-15-2004
Desc: Custom image swapping
***********************************************************/
if (document.images) {
document[imageName].src = eval(imageName + "_on.src");
}
}
function turnOff(imageName) {
/*********************************************************
Version: 1.0
Date: 11-15-2004
Desc: Custom image swapping
***********************************************************/
if (document.images) {
document[imageName].src = eval(imageName + ".src");
}
}
function frmSubmit(keyword) {
/*********************************************************
Version: 1.0
Date: 11-15-2004
Desc: Tests to see what client was looking to do.
***********************************************************/
switch (keyword) {
case "GetIncentives":
if (!validateZIP(document.forms["GetIncentives"].zip.value)) {
document.forms["GetIncentives"].zip.focus();
} else if (document.forms["GetIncentives"].vehicle.value == "none") {
alert("Please select a vehicle in order to proceed.");
document.forms["GetIncentives"].vehicle.focus();
} else {
//document.forms["GetIncentives"].submit();
getIncentive2(document.GetIncentives.serviceID.value, document.GetIncentives.ModelYear.options[document.GetIncentives.ModelYear.selectedIndex].value, document.GetIncentives.vehicleCode.value, document.GetIncentives.zip.value, document.GetIncentives.brand.value);
}
break;
case "frmFinddealer":
if (!validateZIP(document.forms["frmFinddealer"].DealerInputZip.value)) {
document.forms["frmFinddealer"].DealerInputZip.value = "";
document.forms["frmFinddealer"].DealerInputZip.focus();
} else {
document.forms["frmFinddealer"].submit();
}
break;
case "frmKeyword":
if (document.forms["frmKeyword"].keyword.value == "") {
alert("Please enter a keyword in order to proceed.");
document.forms["frmKeyword"].keyword.value = "";
document.forms["frmKeyword"].keyword.focus();
} else {
document.forms["frmKeyword"].submit();
}
break;
}
}
function clearZip() {
/*********************************************************
Version: 1.0
Date: 11-15-2004
Desc: Clears default value of zip search on click
***********************************************************/
if (document.forms["frmFinddealer"].DealerInputZip.value == "Zip Code") {
document.forms["frmFinddealer"].DealerInputZip.value = "";
}
}
function validateZIP(field) {
/*********************************************************
Version: 1.0
Date: 11-15-2004
Desc: verify valid zip code
***********************************************************/
var valid = "0123456789";
if (field.length!=5 ) {
alert("Please enter a 5-digit Zip Code in order to proceed.");
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in the Zip Code. Please try again.");
return false;
}
}
return true;
}
function drawAsset(swfPath, imgPath, width, height) {
/******************************************************************
Version: 1.0
Date: 11-15-2004
Desc: Draws either the flash object or a static "get flash" image
*******************************************************************/
if (flashEnabled) {
document.write('');
} else {
document.write('
');
}
}
//Incentives functions and data begin here
// Constructor for Vehicle Object
function Vehicle (code, name, division) {
this.code = code;
this.name = name;
this.division = division;
}
// Global Variables
var numYears = 2;
// Create One Dimensional Arrays of size 'numYears'
var VehicleArray = new Array(eval(numYears));
var YearArray = new Array(eval(numYears));
var vcnt = 0;
var selectedVehicleCode = "";
for (i=0; i \n'); // Must break up tag so it doesn't break our script
document.write('on error resume next \n');
document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
document.write(' \n'); // Must break up tag so it doesn't break our script
}
if( navigator.plugins && (navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]) ) {
var flashName = navigator.plugins["Shockwave Flash 2.0"] ? "Shockwave Flash 2.0" : "Shockwave Flash";
var flashDesc = navigator.plugins[flashName].description;
var flashVersion = parseInt(flashDesc.charAt(flashDesc.indexOf(".")-1));
flash4Installed = flashVersion == 4 || flashVersion == 5;
flash5Installed = flashVersion == 5;
flash6Installed = flashVersion == 6;
flash7Installed = flashVersion == 7;
flash8Installed = flashVersion == 8;
flash9Installed = flashVersion == 9;
}
flashEnabled = flash4Installed || flash5Installed || flash6Installed || flash7Installed || flash8Installed || flash9Installed ? true : flashEnabled;