
var lastMouseX;
var lastMouseY;
var curPopupWindow = null;
	
function manualSubmit(action) {
	var f = document.forms[0];
	f.action = action
	f.submit();
}

// 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 mouseCursor(cursor) {
  var el = event.srcElement;
	switch (cursor) {
		case "hand":
			el.style.cursor = "hand";
			break
		default:
			el.style.cursor = "default";
	}
}

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 manualSubmit(action) {
	var f = document.forms[0];
	f.action = action
	f.submit();
}

function CreateFlashControl(divID, classID, name, flashUrl, bgcolor, width, height, isTransparent) {
  var d = document.getElementById(divID);
  
  if (isTransparent) {
		d.innerHTML = 
			'<object classid=' + classID + ' id=' + name + ' codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0  width=' + width + ' height=' + height + ' align=middle VIEWASTEXT>' +
			'<param name=allowScriptAccess value=sameDomain />' +
			'<param name=movie value=' + flashUrl + ' />' +
			'<param name=quality value="high" />' +
			'<param name=wmode VALUE=transparent /> ' +
			'<param name=bgcolor value=' + bgcolor + ' />' +
			'<embed src=' + flashUrl + ' name=' + name + ' bgcolor=' + bgcolor + ' width=' + width + ' height=' + height + ' align=middle wmode=transparent quality=high allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer />' + 
			'</object>';
	}
	else {
		d.innerHTML = 
			'<object classid=' + classID + ' id=' + name + ' codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0  width=' + width + ' height=' + height + ' align=middle VIEWASTEXT>' +
			'<param name=allowScriptAccess value=sameDomain />' +
			'<param name=movie value=' + flashUrl + ' />' +
			'<param name=quality value="high" />' +
			'<param name=bgcolor value=' + bgcolor + ' />' +
			'<embed src=' + flashUrl + ' name=' + name + ' bgcolor=' + bgcolor + ' width=' + width + ' height=' + height + ' align=middle  quality=high allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer />' + 
			'</object>';
	}
}

function notools(win){
popup=window.open(win,'picwin','toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,menubar=no,x=0,y=0');
popup.focus();
}
function show(win){
popup=window.open(win,'picwin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,WIDTH=690,HEIGHT=575,x=10,y=20');
popup.focus();
}
function SlideShow(n){
window.open('slideshow.aspx?name=Lotus%20Elise&max=10&model=LotusElise&number=' + n, 'ParkPlaceSlideshow', 'width=600,height=470,titlebar=yes');
return;
}
function display(win, xsize, ysize){
popup=window.open(win,'picwin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,WIDTH=' + xsize + ',HEIGHT=' + ysize + ',x=10,y=20');
popup.focus();
}


//coupons display scripts		
var coupons = new Array();
coupons[coupons.length] = {src:"Images/coupons/00_Lotus01.jpg", url:"inventorydisplay.aspx?brw=lotus&s=lotus-used"};
coupons[coupons.length] = {src:"Images/coupons/01_ferrari.jpg", url:"inventorydisplay.aspx?brw=ferrari&s=used"};
coupons[coupons.length] = {src:"Images/coupons/02_spyker02.jpg", url:"inventorydisplay.aspx?brw=spyker&s=spyker"};
coupons[coupons.length] = {src:"Images/coupons/03_spyker01.jpg", url:"inventorydisplay.aspx?brw=spyker&s=spyker"};
coupons[coupons.length] = {src:"Images/coupons/04_Lamborghini02.jpg", url:"inventorydisplay.aspx?brw=all&filter=(Make=Lamborghini)#s=fp&eln=Make&elv=Lamborghini&sb=&rs=0&pc=5&pcurr=1&ps=50&els=Condition%3A~Make%3A~Model%3A"};
//coupons[coupons.length] = {src:"Images/coupons/05_Lamborghini01.jpg", url:"inventorydisplay.aspx?brw=lamborghini&s=used"};
//coupons[coupons.length] = {src:"Images/coupons/06_jaguar02.jpg", url:"inventorydisplay.aspx?brw=jaguar&s=used"};
coupons[coupons.length] = {src:"Images/coupons/07_jaguar01.jpg", url:"inventorydisplay.aspx?brw=jaguar&s=used"};
//coupons[coupons.length] = {src:"Images/coupons/08_superformance02.jpg", url:"inventorydisplay.aspx?brw=superformance&s=superformance"};
coupons[coupons.length] = {src:"Images/coupons/09_superformance01.jpg", url:"inventorydisplay.aspx?brw=superformance&s=superformance"};
coupons[coupons.length] = {src:"Images/coupons/10_astonmartin03.jpg", url:"http://www.parkplaceastonmartin.com"};
coupons[coupons.length] = {src:"Images/coupons/11_astonmartin02.jpg", url:"http://www.parkplaceastonmartin.com"};
coupons[coupons.length] = {src:"Images/coupons/12_astonmartin01.jpg", url:"http://www.parkplaceastonmartin.com"};
coupons[coupons.length] = {src:"Images/coupons/13_porsche02.jpg", url:"default.aspx?html=porsche-pre-owned.html&s=porsche-pre-owned"};
coupons[coupons.length] = {src:"Images/coupons/14_porsche01.jpg", url:"default.aspx?html=porsche-pre-owned.html&s=porsche-pre-owned"};




