function OpenNewWin(url, win) {
	popupWin = window.open(url, win, 'menubar=1,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,dependent=1,width=720,height=420')
} 
function OpenChildWin(url, win) {
	popupWin = window.open(url, win, 'menubar=1,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,dependent=1,width=740,height=450')
}
function OpenLittleWin(url, win) {
	popupWin = window.open(url, win, 'menubar=1,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,dependent=1,width=320,height=240')
}
function OpenTinyWin(url, win) {
	popupWin = window.open(url, win, 'menubar=1,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,dependent=1,width=320,height=240')
}

function OpenNewsWindow(NewsID){
	window.open("/popupNews.asp?NewsID=" + NewsID,"NewsWindow","Width=550,Height=500,Scrollbars=1,Resizable=yes")
}
function DisplayPopUp(){
	window.open("popup.asp?keywords=pop", "PopUPWindow", "resizable=yes,scrollbars=yes,width=500,height=400");
}

//rollovers
function findimg()
{
	var ia,imgs;
// loop through all images of the document
	imgs=document.getElementsByTagName('img');
	for(ia=0;ia<imgs.length;ia++)
	{
// test if the class 'roll' exists
		if(/roll/.test(imgs[ia].className))
		{
// add the function roll to the image onmouseover and onmouseout and send
// the image itself as an object
			imgs[ia].onmouseover=function(){roll(this);};
			imgs[ia].onmouseout=function(){roll(this);};
		}
	}
}
function roll(o)
{
// get the src of the image, and find out the file extension
	var src = o.src;
	var ftype = src.substring(src.lastIndexOf('.'), src.length);
// check if the src already has an _over and delete it, if that is the case 
	if(/_over/.test(src))
	{
		var newsrc = src.replace('_over','');
	}else{
// else, add the _over to the src 
		var newsrc = src.replace(ftype, '_over'+ftype);
	}
	o.src=newsrc;
}

$(document).ready(function(){					
	findimg();
});

function equalWidth(group) {
    var currentWidest = 920;
    $("#content > div,table,p,iframe").each(function (i) {
        if ($(this).width() > currentWidest) { currentWidest = $(this).width(); }
    });
    $("#content").css({ 'width': currentWidest });
    widest = $("#content").outerWidth(true);
    group.width(widest);
}
$(document).ready(function () {
    if ($("#content").length != 0) {
        equalWidth($(".column"));
    }
});

//For Specials button on Home Page
var backImage = new Array(); 
backImage[0] = "url(/images/btn2.png)"; //default image - always OnMouseOut to this
backImage[1] = "url(/images/btn2_over.png)"; //only specials highlighted
backImage[2] = "url(/images/btn2a_over.png)"; //only vehicles highlighted
backImage[3] = "url(/images/btn2b_over.png)"; //only service highlighted
function changeBGImage(whichImage){
var newImage = backImage[whichImage];
document.getElementById('btn2').style.backgroundImage = newImage;
}

//For Specials button on Home Page
var backImage2 = new Array(); 
backImage2[0] = "url(/images/btn4.png)"; //default image - always OnMouseOut to this
backImage2[1] = "url(/images/btn4_over.png)"; 
backImage2[2] = "url(/images/btn4a_over.png)"; //pre-owned
backImage2[3] = "url(/images/btn4b_over.png)"; //certified
function changeBGImage2(whichImage){
var newImage = backImage2[whichImage];
document.getElementById('btn4').style.backgroundImage = newImage;
}
