var email = "enquiries"
var domain = "avantisportsandprestige.co.uk"
var eml_val = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

function checkit(thisForm) {
if (thisForm.name.value=="") {
alert("Please supply your name.");
thisForm.name.focus();
thisForm.name.select();
return false;
}

if (thisForm.details.value=="") {
alert("Please supply a few details.");
thisForm.details.focus();
thisForm.details.select();
return false;
}

if (eml_val.test(thisForm.email.value) &! thisForm.email.value=="") {
thisForm.submit();
return true; }
else {
alert("Please supply a valid e-mail address.");
thisForm.email.focus();
thisForm.email.select();
return false;
}
}

function copyContent(inputfield) {
txtobject=document.getElementById(inputfield);
varcopy=txtobject.createTextRange();
varcopy.execCommand("copy");
}

var iHandle
function openWindow(varURL) {
iHandle = window.open(varURL);return
}

function displayimage(varURL,iWidth,iHeight) {
if (iHandle != null) iHandle.close();var iLeft = (screen.width - iWidth) / 2;
var iTop = (screen.height - iHeight) / 2;
iHandle = window.open(varURL,'guest','status=no,width=' + iWidth +',height=' + iHeight + ',left=' + iLeft + ',top=' + iTop + ',scrollbars=no,resizable=no');
}

function swapimage(imgname) {
var newimg = document.getElementById("swapit");
if ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Opera") == -1)) {
	newimg.style.filter="progid:DXImageTransform.Microsoft.Fade(Overlap=1.00);";
	newimg.filters[0].apply();
	newimg.src="images/"+imgname;
	newimg.filters[0].play();
	}
else
	newimg.src="images/"+imgname;
}

function checkforms(thisForm) {
if (thisForm.name.value=="") {
alert("Please supply your name.");
thisForm.name.focus();
thisForm.name.select();
return false;
}

if (thisForm.manufacturer.value=="") {
alert("Please supply a manufacturer.");
thisForm.manufacturer.focus();
thisForm.manufacturer.select();
return false;
}

if (thisForm.model.value=="") {
alert("Please supply a model.");
thisForm.model.focus();
thisForm.model.select();
return false;
}

if (thisForm.regnum.value=="") {
alert("Please supply a registration number.");
thisForm.regnum.focus();
thisForm.regnum.select();
return false;
}

if (thisForm.mileage.value=="") {
alert("Please supply the mileage.");
thisForm.mileage.focus();
thisForm.mileage.select();
return false;
}

if (thisForm.mot.selectedIndex == 0) {
alert("Please supply MOT details.");
thisForm.mot.focus();
return false;
}

if (thisForm.tax.selectedIndex == 0) {
alert("Please supply Tax details.");
thisForm.tax.focus();
return false;
}

if (thisForm.colour.value=="") {
alert("Please supply the colour.");
thisForm.colour.focus();
thisForm.colour.select();
return false;
}

if (thisForm.trim.value=="") {
alert("Please supply the trim details.");
thisForm.trim.focus();
thisForm.trim.select();
return false;
}

if (thisForm.owners.value=="") {
alert("Please supply the number of owners.");
thisForm.owners.focus();
thisForm.owners.select();
return false;
}

if (thisForm.status.selectedIndex == 0) {
alert("Please supply service history status.");
thisForm.status.focus();
return false;
}

if (thisForm.undertaken.selectedIndex == 0) {
alert("Please supply service history management.");
thisForm.undertaken.focus();
return false;
}

if (thisForm.finance.selectedIndex == 0) {
alert("Please supply finance details.");
thisForm.finance.focus();
return false;
}

if ((thisForm.finance.selectedIndex == 1) && (thisForm.amount.value=="")) {
alert("Please supply the oustanding finance figure.");
thisForm.amount.focus();
thisForm.amount.select();
return false;
}

if (thisForm.condition.selectedIndex == 0) {
alert("Please rate your car's condition.");
thisForm.condition.focus();
return false;
}

if (eml_val.test(thisForm.email.value) &! thisForm.email.value=="") {
thisForm.submit();
return true; }
else {
alert("Please supply a valid e-mail address.");
thisForm.email.focus();
thisForm.email.select();
return false;
}
}

function checkcomp(thisForm) {
if (thisForm.forename.value=="") {
alert("Please supply your forename.");
thisForm.forename.focus();
thisForm.forename.select();
return false;
}

if (thisForm.surname.value=="") {
alert("Please supply your surname.");
thisForm.surname.focus();
thisForm.surname.select();
return false;
}

if (thisForm.answer1.value=="") {
alert("Please supply an answer to question 1.");
thisForm.answer1.focus();
thisForm.answer1.select();
return false;
}

if (thisForm.answer2.value=="") {
alert("Please supply an answer to question 2.");
thisForm.answer2.focus();
thisForm.answer2.select();
return false;
}

if (thisForm.answer3.value=="") {
alert("Please supply an answer to question 3.");
thisForm.answer3.focus();
thisForm.answer3.select();
return false;
}

if (eml_val.test(thisForm.email.value) &! thisForm.email.value=="") {
thisForm.submit();
return true; }
else {
alert("Please supply a valid e-mail address.");
thisForm.email.focus();
thisForm.email.select();
return false;
}
}

function nextfield(target) {
if(window.event && window.event.keyCode == 13) {
document.getElementById(target).focus();
return false; }
else
return true;
}

function onField(txtfield) {
txtfield.className='stdinputbox stdinputover'
}

function offField(txtfield) {
if (txtfield.type=='text') {
txtfield.className='stdinputbox'
} else {
txtfield.className='stdinputboxc'
}
}

