
var lastMouseX;
var lastMouseY;
var curPopupWindow = null;
	
function manualSubmit(action) {
	var f = document.forms[0];
	f.action = action
	f.submit();
}

function mouseCursor(cursor) {  var el = event.srcElement;
	switch (cursor) {
		case "hand":
			el.style.cursor = "hand";
			break
		default:
			el.style.cursor = "default";
	}
}

// cross browser compatible
function changeCursor(cursor, evt) {	evt = (evt) ? evt : event;  var el = (evt.target) ? evt.target : event.srcElement;

	switch (cursor) {
		case "hand":
			el.style.cursor = "pointer"; // for modzilla, don't change order
			el.style.cursor = "hand"; // for ie
			break
		default:
			el.style.cursor = "";
	}
}

function openPopup(url, name, width, height, features, snapToLastMousePosition) {
  closePopup();
	if (snapToLastMousePosition) {
		if (lastMouseX - width < 0) lastMouseX = width;
		if (lastMouseY + height > screen.height) 	lastMouseY -= (lastMouseY + height + 50) - screen.height;	
    lastMouseX -= width;
    lastMouseY += 10;
		features +=	"screenX=" + lastMouseX + ",left=" + lastMouseX + "screenY=" + lastMouseY + ",top=" + lastMouseY;
	}
	curPopupWindow = window.open(url, name, features, false);
}

function setLastMousePosition(evt) {
	evt = (evt) ? evt : event;
	lastMouseX = evt.screenX;
	lastMouseY = evt.screenY;
}

function closePopup() {
	if (curPopupWindow != null) {
		if (!curPopupWindow.closed)	curPopupWindow.close();
		curPopupWindow = null;
	}
}

function popUp_Scroll(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=yes,directories=no,menubar=no,scrollbars=1", false);
}

function popUp(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=no,directories=no,menubar=no,scrollbars=0", false);
}

function popUp_Snap(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=no,directories=no,menubar=no,scrollbars=0", true);
}

// -- CUSTOM FUNCTIONS ----------------------------------------------------------------------------

//these are for expedia maps link
	function getdirections() {
		document.forms[0].submit();
	}
		
	function OpenWindow(url){
		window.open('' + url + '', 'ex', 'width=800, height=550, toolbar=1, scrollbars=yes, resizable=yes, top=0, left=0');
	}
	function newWindowForm()
	{
		var popUp = window.open
		('','popUp','scrollbars=yes,toolbar=yes, resizable=yes,height=600,width=675');
		document.DirectionsForm.target = 'popUp';
	}
//end expedia maps functions

function financeWindow(){
		//window.open('html/finance_popup.htm', 'win', 'width=700,height=520,resizable=yes,toolbar=no,status=yes,directories=no,menubar=no,scrollbars=1');
		window.open('https://secureforms.motorwebs.com/finance_application_v1/default.aspx?dealerid=1153&id=67', 'win', 'width=640,height=520,resizable=yes,toolbar=no,status=yes,directories=no,menubar=no,scrollbars=1');
}
function chromeWindow(){
		window.open('http://www.millenniumford.com/chrome/frame.aspx?deepLinkPage=searchByMakeModel','CCB','width=800 height=600 resizable scrollbars toolabar');
}
function buildfordWindow(){
		window.open('http://www.autobuybids.com/bycnyp.asp?de_id=169&make=Ford','ford','width=800 height=600 scrollbars resizable toolbar');
}

//image preload for nav
	var ImageNames	= new Array(13);


		ImageNames[0]	= "images/nav_home_over.jpg";
		ImageNames[1]	= "images/nav_vehicles_over.jpg";
		ImageNames[2]	= "images/nav_specials_over.jpg";
		ImageNames[3]	= "images/nav_fleet_over.jpg";
		ImageNames[4]	= "images/nav_finance_over.jpg";
		ImageNames[5]	= "images/nav_service_over.jpg";
		ImageNames[6]	= "images/nav_parts_over.jpg";
		ImageNames[7]	= "images/nav_body_over.jpg";
		ImageNames[8]	= "images/nav_map_over.jpg";
		ImageNames[9]	= "images/nav_employment_over.jpg";
		ImageNames[10]	= "images/nav_company_over.jpg";
		ImageNames[11]	= "images/nav_contact_over.jpg";
		ImageNames[12]	= "images/nav_acc_over.jpg";

		if (document.images)
			{
			for(var i = 0; i < ImageNames.length; i++)
				{
					CreateImage("MenuItem" + i, ImageNames[i])
				}
			}

			function CreateImage(Name, Src)
			{
			Name = new Image();
			Name.src = Src;
		}
		//end images preload for nav
		
		
		// Div Overlay Close Funtion

function hidelink(layername) {

	if (!document.getElementById)
return
	if (layername.style.visibility=="visible")
		layername.style.visibility="hidden"
	else
		layername.style.visibility="hidden"
} 