﻿//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

//var message="Sorry, right clicking is disabled.";

///////////////////////////////////
//function clickIE4(){
//if (event.button==2){
//alert(message);
//return false;
//}
//}

//function clickNS4(e){
//if (document.layers||document.getElementById&&!document.all){
//if (e.which==2||e.which==3){
//alert(message);
//return false;
//}
//}
//}

//if (document.layers){
//document.captureEvents(Event.MOUSEDOWN);
//document.onmousedown=clickNS4;
//}
//else if (document.all&&!document.getElementById){
//document.onmousedown=clickIE4;
//}

//document.oncontextmenu=new Function("alert(message);return false")



function addBookmark() 
{
if (window.sidebar)
{ 
window.sidebar.addPanel(document.title,location.href,""); 
} 
else if( document.all )
{
window.external.AddFavorite(location.href,document.title);
} 
else if( window.opera && window.print )
{
return true;
}
}


function EmailPage()
{
strEmailBody = "mailto:?body=You have been sent a link from " + document.title + "%0D%0D" + location.href
location.href = strEmailBody
}


function e400Variation1(paypalform)
{
var selectVariation;
selectVariation=paypalform.os0temp.options[paypalform.os0temp.selectedIndex].value;

var selectPrice=selectVariation.split("?");
if (selectPrice[1]==undefined){
	paypalform.os0.value=selectVariation;
}
else{
	paypalform.os0.value=selectPrice[0];
	paypalform.amount.value=selectPrice[1];
}
}

function e400Variation2(paypalform)
{
var selectVariation;
selectVariation=paypalform.os1temp.options[paypalform.os1temp.selectedIndex].value;

var selectPrice=selectVariation.split("?");
if (selectPrice[1]==undefined){
	paypalform.os1.value=selectVariation;
}
else{
	paypalform.os1.value=selectPrice[0];
	paypalform.amount.value=selectPrice[1];
}
}

function validatePayPal(variationDropDown1,variationDropDown2)
{
if (variationDropDown1.selectedIndex==0) {
	alert("Please select from the dropdown menu");
	return false;
}
if (variationDropDown1.selectedIndex==1) {
	alert("Please select from the dropdown menu");
	return false;
}
if (variationDropDown2==undefined){}
else{
	if (variationDropDown2.selectedIndex==0) {
		alert("Please select from the dropdown menu");
		return false;
	}
	if (variationDropDown2.selectedIndex==1) {
		alert("Please select from the dropdown menu");
		return false;
	}
}
}





/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
stuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var getElm = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<getElm.length; i++) {
		getElm[i].onmouseover=function() {
			this.className+=" iehover";
		}
		getElm[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);




/*      IMAGE SWAP      */

// prepare the form when the DOM is ready 
//$(document).ready(function() {
//	$("#gallery li img").hover(function(){
//		$('#main-img').attr('src',$(this).attr('src').replace('thumb/', ''));
//	});
//	var imgSwap = [];
//	 $("#gallery li img").each(function(){
//		imgUrl = this.src.replace('thumb/', '');
//		imgSwap.push(imgUrl);
//	});
//	$(imgSwap).preload();
//});
//$.fn.preload = function() {
//    this.each(function(){
//    $('<img/>')[0].src = this;
//  });
//}

function load_image(regno){
	document.mainimage.src="database_images/"+regno
}

function load_cat_home(Cat){
if (Cat!=""){
	location.href="browse.asp?category="+Cat;
}
}



//	General form at Pertwee and Back plus most others


function checkfields(){

if (document.contact_form.Name.value.length==0){
	document.contact_form.Name.focus();
	alert("Error : Please enter your name.")
	return false;
}

if (document.contact_form.Email.value.length==0){
	document.contact_form.Email.focus();
	alert("Error : Please enter your email adress.")
	return false;
}

var str=document.contact_form.Email.value
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
var testresults
if (filter.test(str))
	testresults=true
else{
	document.contact_form.Email.focus()
	alert("Error - Please input a valid email address")
	return false;
}
//	compare two email addresses
//if (document.contact_form.Email.value!=document.contact_form.ConfirmEmail.value){
//	document.contact_form.ConfirmEmail.focus();
//	alert("Error : The Email addresses do not match.")
//	return false;
//}

//if (document.contact_form.Phone.value.length==0){
//	document.contact_form.Phone.focus();
//	alert("Error : Please enter a landline or mobile phone number where we can contact you.")
//	return false;
//}

//if (document.contact_form.Reg.value.length==0){
//	document.contact_form.Reg.focus();
//	alert("Error : Please enter your car's registration number.")
//	return false;
//}

//if (document.contact_form.VIN.value.length==0){
//	document.contact_form.VIN.focus();
//	alert("Error : Please enter your car's VIN.")
//	return false;
//}

//if (document.contact_form.Address.value.length==0){
//	document.contact_form.Address.focus();
//	alert("Error : Please enter your address.")
//	return false;
//}

//if (document.contact_form.Enquiry.value.length==0){
//	document.contact_form.Enquiry.focus();
//	alert("Error : Please enter your enquiry.")
//	return false;
//}


//strPassword=document.contact_form.exclude_blankd.value
//strPassword=strPassword+document.contact_form.exclude_blanka.value
//strPassword=strPassword+document.contact_form.exclude_blanke.value
//strPassword=strPassword+document.contact_form.exclude_blankc.value
//strPassword=strPassword+document.contact_form.exclude_blankb.value

//if (document.contact_form.exclude_captcha.value != strPassword) {
//    document.contact_form.exclude_captcha.focus();
//    alert("Incorrect entry of character verification. All characters are lowercase format. Please try again.")
//    return false;
//}

document.contact_form.submit();
}




//	Parts form at Pertwee

function checkfieldsParts(){
if (document.contact_form.Name.value.length==0){
	document.contact_form.Name.focus();
	alert("Error : Please enter your name.")
	return false;
}

if (document.contact_form.Email.value.length==0){
	document.contact_form.Email.focus();
	alert("Error : Please enter your email adress.")
	return false;
}

//	check for email address in valid format
var str=document.contact_form.Email.value
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
var testresults
if (filter.test(str))
	testresults=true
else{
	document.contact_form.Email.focus()
	alert("Error - Please input a valid email address")
	return false;
}

if (document.contact_form.VIN.value.length==0){
	document.contact_form.VIN.focus();
	alert("Error : Please enter your car's VIN.")
	return false;
}

//strPassword=document.contact_form.exclude_blankd.value
//strPassword=strPassword+document.contact_form.exclude_blanka.value
//strPassword=strPassword+document.contact_form.exclude_blanke.value
//strPassword=strPassword+document.contact_form.exclude_blankc.value
//strPassword=strPassword+document.contact_form.exclude_blankb.value

//if (document.contact_form.exclude_captcha.value != strPassword) {
//    document.contact_form.exclude_captcha.focus();
//    alert("Incorrect entry of character verification. All characters are lowercase format. Please try again.")
//    return false;
//}

document.contact_form.submit();
}


