<!--------------------------------------->
<!--------------------------------------->
<!--   Motor Stroller - Java Scripts   -->
<!--   http://www.MotorStroller.com    -->
<!--------------------------------------->
<!--------------------------------------->

<!----------------->
<!---- General ---->
<!----------------->
window.onerror = SymError;
var SymRealWinOpen = window.open;
window.open = SymWinOpen;
        
function SymError()
{
  return true;
}

function SymWinOpen(url, name, attributes)
{
  return (new Object());
}

var SymRealOnLoad;
var SymRealOnUnload;

function SymOnUnload()
{
  window.open = SymWinOpen;
  if(SymRealOnUnload != null)
     SymRealOnUnload();
}

function SymOnLoad()
{
  if(SymRealOnLoad != null)
     SymRealOnLoad();
  window.open = SymRealWinOpen;
  SymRealOnUnload = window.onunload;
  window.onunload = SymOnUnload;
}

SymRealOnLoad = window.onload;
window.onload = SymOnLoad;

var SymRealOnLoad;
var SymRealOnUnload;

function SymOnUnload()
{
  window.open = SymWinOpen;
  if(SymRealOnUnload != null)
     SymRealOnUnload();
}

function SymOnLoad()
{
  if(SymRealOnLoad != null)
     SymRealOnLoad();
  window.open = SymRealWinOpen;
  SymRealOnUnload = window.onunload;
  window.onunload = SymOnUnload;
}

SymRealOnLoad = window.onload;
window.onload = SymOnLoad;

<!------------------------->
<!---- Download button ---->
<!------------------------->
function DownloadMouseOver() {document.DownloadButton.src ="images/DownloadButton_Hover.png"}
function DownloadMouseOut()  {document.DownloadButton.src ="images/DownloadButton.png"}

<!------------------------->
<!---- Purchase button ---->
<!------------------------->
function PurchaseMouseOver() {document.PurchaseButton.src ="images/PurchaseButton_Hover.png"}
function PurchaseMouseOut()  {document.PurchaseButton.src ="images/PurchaseButton.png"}


<!------------------------->
<!---- Form validation ---->
<!------------------------->

<!---- Validate form ---->
function validate_RegistrationForm(thisform)
{with (thisform)

	{
	if (validate_empty(name,"Please enter your name")==false)
		{name.focus();return false}

	if (validate_empty(country,"Please select country from dropdown")==false)
		{country.focus();return false}


	if (validate_email(email,"Please enter a valid e-mail address")==false)
		{email.focus();return false}

	if (validate_empty(uuid1,"Please enter character 1 to 4 of your UUID")==false)
		{uuid1.focus();return false}
	if (validate_empty(uuid2,"Please enter character 5 to 8 of your UUID")==false)
		{uuid2.focus();return false}
	if (validate_empty(uuid3,"Please enter character 9 to 12 of your UUID")==false)
		{uuid3.focus();return false}
	if (validate_empty(uuid4,"Please enter character 13 to 16 of your UUID")==false)
		{uuid4.focus();return false}
	if (validate_empty(uuid5,"Please enter character 17 to 20 of your UUID")==false)
		{uuid5.focus();return false}
	if (validate_empty(uuid6,"Please enter character 21 to 24 of your UUID")==false)
		{uuid6.focus();return false}
	if (validate_empty(uuid7,"Please enter character 25 to 28 of your UUID")==false)
		{uuid7.focus();return false}
	if (validate_empty(uuid8,"Please enter character 29 to 32 of your UUID")==false)
		{uuid8.focus();return false}

	if (validate_empty(product_name,"Please select your product from the dropdown")==false)
		{product_name.focus();return false}

	if (validate_empty(order_ref,"Please enter your order reference from your invoice")==false)
		{order_ref.focus();return false}

	if (validate_empty(pocket_pc_id,"Please enter your Pocket PC ID")==false)
		{pocket_pc_id.focus();return false}

	if (device.value==null||device.value=="")
		{
			if (other.value==null||other.value=="")
			{
				alert("Please select your device from the list or enter make and model in the space provided");
				device.focus();
				return false
			}
		}
	else
		{return true}
	}
}

function validate_ContactForm(thisform)
{with (thisform)
	{
	if (validate_empty(name,"Please enter your name")==false)
		{name.focus();return false}

	if (validate_email(email,"Not a valid e-mail address")==false)
		{email.focus();return false}

	if (validate_empty(comment,"Please enter your enquiry")==false)
		{enquiry.focus();return false}
	}
}

<!---- Validate field is not empty ---->
function validate_empty(field,message)
{with (field)
	{
	if (value==null||value=="")
		{alert(message);return false}
	else {return true}
	}
}

<!---- Validate email ---->
function validate_email(field,message)
{with (field)
	{
	apos=value.indexOf("@")
	dotpos=value.lastIndexOf(".")
	if (apos<1||dotpos-apos<2) 
		{alert(message);return false}
	else {return true}
	}
}
