// JavaScript Document
   
function OpenWindow(vid) {	
	var carwindow;
	carwindow=window.open('vehicle.php?vid=' + vid ,'','height=410,width=685');	
	carwindow.focus();
}

function OpenImage() {
	var imagewindow = '';
	var imagesrc = document.getElementById("mainimage").src;	
	ImageName = imagesrc.substring(54);

	if (!imagewindow.closed && imagewindow.location) {
		imagewindow.close();		
	}	
	
	imagewindow=window.open('image.php?image=' + ImageName,'imagewindow','height=496,width=656');
	if (!imagewindow.opener) imagewindow.opener = self;
	if (window.focus) {imagewindow.focus()}
	return false;
}

function OpenTDForm(vid) {
	var tdwindow = '';
	if (!tdwindow.closed && tdwindow.location) {
		tdwindow.close();		
	}	
	tdwindow=window.open('forms/usedvehicle_testdrive.php?vid=' + vid ,'tdwindow','height=600,width=424');	
	if (!tdwindow.opener) tdwindow.opener = self;
	if (window.focus) {tdwindow.focus()}
	return false;
}

function OpenENForm(vid) {
	var enwindow = '';
	if (!enwindow.closed && enwindow.location) {
		enwindow.close();		
	}	
	enwindow=window.open('forms/usedvehicle_enquiry.php?vid=' + vid ,'enwindow','height=630,width=424');	
	if (!enwindow.opener) enwindow.opener = self;
	if (window.focus) {enwindow.focus()}
	return false;
}

function OpenGearForm() {
	var gearwindow = '';
	if (!gearwindow.closed && gearwindow.location) {
		gearwindow.close();		
	}	
	gearwindow=window.open('forms/gear_brochure.php','gearwindow','height=460,width=424');	
	if (!gearwindow.opener) gearwindow.opener = self;
	if (window.focus) {gearwindow.focus()}
	return false;
}

function OpenAccessForm() {
	var accesswindow = '';
	if (!accesswindow.closed && accesswindow.location) {
		accesswindow.close();		
	}	
	accesswindow=window.open('http://www.pagaccessories.com/inter/index.do?manSC=LDR','accesswindow','height=800,width=800');	
	if (!accesswindow.opener) accesswindow.opener = self;
	if (window.focus) {accesswindow.focus()}
	return false;
}

function OpenAccessRequestForm() {
	var accessrwindow = '';
	if (!accessrwindow.closed && accessrwindow.location) {
		accessrwindow.close();		
	}	
	accessrwindow=window.open('forms/accessories_enquiry.php','accessrwindow','height=660,width=424');	
	if (!accessrwindow.opener) accessrwindow.opener = self;
	if (window.focus) {accessrwindow.focus()}
	return false;
}
function HireEnquiryForm() {
	var hirewindow = '';
	if (!hirewindow.closed && hirewindow.location) {
		hirewindow.close();		
	}	
	hirewindow=window.open('forms/hire_enquiry.php','hirewindow','height=800,width=424');	
	if (!hirewindow.opener) hirewindow.opener = self;
	if (window.focus) {hirewindow.focus()}
	return false;
}
function ServiceForm() {
	var servicewindow = '';
	if (!servicewindow.closed && servicewindow.location) {
		servicewindow.close();		
	}	
	servicewindow=window.open('forms/service_enquiry.php','servicewindow','height=650,width=424');	
	if (!servicewindow.opener) servicewindow.opener = self;
	if (window.focus) {servicewindow.focus()}
	return false;
}
function AllegianceForm() {
	var alwindow = '';
	if (!alwindow.closed && alwindow.location) {
		alwindow.close();		
	}	
	alwindow=window.open('forms/allegiance_enquiry.php','alwindow','height=620,width=424');	
	if (!alwindow.opener) alwindow.opener = self;
	if (window.focus) {alwindow.focus()}
	return false;
}
function ServiceplanForm() {
	var spwindow = '';
	if (!spwindow.closed && spwindow.location) {
		spwindow.close();		
	}	
	spwindow=window.open('forms/serviceplan_enquiry.php','spwindow','height=620,width=424');	
	if (!spwindow.opener) spwindow.opener = self;
	if (window.focus) {spwindow.focus()}
	return false;
}
function WarrantyForm() {
	var wawindow = '';
	if (!wawindow.closed && wawindow.location) {
		wawindow.close();		
	}	
	wawindow=window.open('forms/warranty_enquiry.php','wawindow','height=460,width=424');	
	if (!wawindow.opener) wawindow.opener = self;
	if (window.focus) {wawindow.focus()}
	return false;
}
function AftercareForm() {
	var afwindow = '';
	if (!afwindow.closed && afwindow.location) {
		fwindow.close();		
	}	
	afwindow=window.open('forms/aftercare_enquiry.php','afwindow','height=460,width=424');	
	if (!afwindow.opener) afwindow.opener = self;
	if (window.focus) {afwindow.focus()}
	return false;
}
function ProfileWindow(id) {
	var staffwindow = '';
	if (!staffwindow.closed && staffwindow.location) {
		staffwindow.close();		
	}	
	staffwindow=window.open('staff_profile.php?id='+id,'staffwindow','height=183,width=500');	
	if (!staffwindow.opener) staffwindow.opener = self;
	if (window.focus) {staffwindow.focus()}
	return false;
}


function OpenNewTDForm() {
	var ntdwindow = '';
	if (!ntdwindow.closed && ntdwindow.location) {
		ntdwindow.close();		
	}	
	ntdwindow=window.open('forms/newvehicle_testdrive.php' ,'ntdwindow','height=650,width=424');	
	if (!ntdwindow.opener) ntdwindow.opener = self;
	if (window.focus) {ntdwindow.focus()}
	return false;
}
function OpenNewENForm() {
	var nenwindow = '';
	if (!nenwindow.closed && nenwindow.location) {
		nenwindow.close();		
	}	
	nenwindow=window.open('forms/newvehicle_enquiry.php' ,'nenwindow','height=620,width=424');	
	if (!nenwindow.opener) nenwindow.opener = self;
	if (window.focus) {nenwindow.focus()}
	return false;
}
function OpenFinanceENForm() {
	var fenwindow = '';
	if (!fenwindow.closed && fenwindow.location) {
		fenwindow.close();		
	}	
	fenwindow=window.open('forms/finance_enquiry.php' ,'fenwindow','height=620,width=424');	
	if (!fenwindow.opener) fenwindow.opener = self;
	if (window.focus) {fenwindow.focus()}
	return false;
}

function OpenCompForm() {
	var compwindow = '';
	if (!compwindow.closed && compwindow.location) {
		compwindow.close();		
	}	
	compwindow=window.open('forms/competition.php','compwindow','height=580,width=424');	
	if (!compwindow.opener) compwindow.opener = self;
	if (window.focus) {compwindow.focus()}
	return false;
}


function SwapImage(ImgName) {
document.getElementById("mainimage").src="images/vehicles/med_" + ImgName;
}