function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		logo_wood_over = newImage("images/logo-wood-over.gif");
		logo_brunning_logo_wood_over = newImage("images/logo-brunning-logo-wood_ove.gif");
		logo_brunning_over = newImage("images/logo-brunning-over.gif");
		logo_parkside_logo_wood_over = newImage("images/logo-parkside-logo-wood_ove.gif");
		logo_parkside_over = newImage("images/logo-parkside-over.gif");
		ultima_logo_wood_over = newImage("images/ultima-logo-wood_over.gif");
		ultima_over = newImage("images/ultima-over.gif");
		logo_columns_logo_wood_over = newImage("images/logo-columns-logo-wood_over.gif");
		logo_columns_over = newImage("images/logo-columns-over.gif");
		hailey_logo_wood_over = newImage("images/hailey-logo-wood_over.gif");
		hailey_over = newImage("images/hailey-over.gif");
		preloadFlag = true;
	}
}


    function rollOver(name,over,asl) {
        if (document.images) {
            var path = '/img/nav';
            if (over) {
	            document.images[name].src = path + '/roll/roll_' + name + '.gif';
            } else {
	            document.images[name].src = path + '/off/off_' + name + '.gif';
            }
        }
    }
                function popupWindow(winURL, winWidth, winHeight) {
                    var winOptions = 'menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=yes,resizable=yes,width=' + winWidth + ',height=' + winHeight;
                    window.open(winURL, 'popup', winOptions);
                }
                function compareCheck(compare) {
                    var alerts = '';
                    var total = 0;
                    var max = compare.compare.length;
                    for (var idx = 0; idx < max; idx++) {
                        if (eval('document.compare.compare[' + idx + '].checked') == true) {
                            total += 1;
                        }
                    }
                    if (total < 2) {
                        alerts = alerts + 'Please select two or three cars to compare.';
                    }
                    if (total > 3) {
                        alerts = alerts + 'Please select no more than three cars to compare.';
                    }
                    if (alerts){
                        alert (alerts);
                        return false;
                    } else {
                        return true;
                    }
                }

                var isDHTML = 0;
                var isID = 0;
                var isAll = 0;
                var isLayers = 0;
                if (document.getElementById) {
                    isID = 1;
                } else if (document.all) {
                    isAll = 1;
                }
                function getObject(objectID) {
                    if (isID) {
                        return (document.getElementById(objectID)) ;
                    } else if (isAll) {
                        return (document.all[objectID]);
                    }  else {
                        return null; // we don't want to try and support this.
                    }
                }
                
                var activeRow = "";
                function changeRow(object, color) {
                    myRow = getObject(object);
                    if (myRow != null) {
                        myRow.style.background = color;
                    }
                }
                function offRow(num, color) {
                    myRow = getObject('row' + num);
                   // myNextRow = getObject('nextRow' + num);
                    if (myRow != null) {
                        myRow.style.background = color;
						setGif(myRow);
						//myRow.className = "footer-left";
                        //myNextRow.style.background = color;
                    }
                }
                function onRow(num, color) {
                    myRow = getObject('row' + num);
                   // myNextRow = getObject('nextRow' + num);
                    if (myRow != null) {
                        myRow.style.background = color;
						setGif(myRow);
						//myRow.className = "footer-left";
						//myRow.style.backgroundImage = "url(images/_footer2_01-bg.gif)";
                       // myNextRow.style.background = color;
                    }
                }
                function rollSpot(id, color) {
                    spot = getObject(id);
                    if (spot != null) {
                        spot.style.background = color;
                    }
                }

function url_x_y(url,x,y){				
	var options = 'menubar=0,resizable=1,toolbar=0,scrollbars=1,titlebar=0,locationbar=0,statusbar=0';
	options = options + ', width = ' + x;
	options = options + ', height = ' + y;
	var newWindow = window.open(url, 'popped', options);
	if (newWindow.open) newWindow.focus();
	return false;
}

function setGif(myRow) {
	if (myRow.className == 'footer-left') {
		myRow.style.backgroundImage = "url(images/_footer2_01-bg.gif)";
		myRow.style.backgroundRepeat = "no-repeat";
		myRow.style.backgroundPosition = "left bottom";
	}

	if (myRow.className == 'footer-right') {
		myRow.style.backgroundImage = "url(images/_footer2_06-bg.gif)";
		myRow.style.backgroundRepeat = "no-repeat";
		myRow.style.backgroundPosition = "right bottom";
	}
}						