/*
 * Copyright Infoterra Ltd 2005. All Rights Reserved.
 * 
 * This file must not be stored, copied, reproduced or distributed in whole or
 * in part or used for any purposes other than for that for which it has been
 * supplied, without the prior written permission of Infoterra. Any unauthorised
 * use may result in criminal or civil action. No liability is assumed for any
 * opinions or views that may be expressed in written materials. All software is
 * provided "AS IS," and no warranty of any kind is provided. All express or
 * implied warranties or representations are excluded, including any implied
 * warranty of satisfactory quality, fitness for a particular purpose or
 * non-infringement. Infoterra/its Licensors shall not be liable for any
 * damages, howsoever caused, as a result of the use, modification or
 * distribution of the software or its derivatives. In no event shall
 * Infoterra/its Licensors be liable for any special, incidental, punitive,
 * indirect or consequential loss, including but not limited to loss of profit,
 * loss of revenue, loss of data or loss of business arising out of the use of
 * or inability to use the software, even if Infoterra has been advised of the
 * possibility of the likeliness of such damages.
 */

/* Copy Invoice Address to Delivery Address */
function copyAddress()
{
	if (document.registerFrm.dAddeqIAdd.checked == true) // .checked==true required for i.e.
	{
		document.registerFrm.deliveryAddress1.value = document.registerFrm.invoiceAddress1.value;
		document.registerFrm.deliveryAddress2.value = document.registerFrm.invoiceAddress2.value;
		document.registerFrm.deliveryAddress3.value = document.registerFrm.invoiceAddress3.value;
		document.registerFrm.deliveryCity.value = document.registerFrm.invoiceCity.value;
		document.registerFrm.deliveryCounty.value = document.registerFrm.invoiceCounty.value;
		document.registerFrm.deliveryPostCode.value = document.registerFrm.invoicePostCode.value;
		document.registerFrm.deliveryCountry.value = document.registerFrm.invoiceCountry.value;
	}
	else
	{
		document.registerFrm.deliveryAddress1.value = '';
		document.registerFrm.deliveryAddress2.value = '';
		document.registerFrm.deliveryAddress3.value = '';
		document.registerFrm.deliveryCity.value = '';
		document.registerFrm.deliveryCounty.value = '';
		document.registerFrm.deliveryPostCode.value = '';
		document.registerFrm.deliveryCountry.value = '';
	}

}
var already_sent = 0;
function validateForm()
{
	var myForm = document.registerFrm;
	var isWrong = false;
	if (already_sent == 0)
	{
		if (myForm.passwordOld.value == "")
		{
			document.getElementById("passwordOldStatus").innerHTML = "* [value must be supplied]";
			isWrong = true;
		}
		else 
		{
			document.getElementById("passwordOldStatus").innerHTML = "*";
		}
	
		if (myForm.password.value == "")
		{
			document.getElementById("passwordStatus").innerHTML = "* [value must be supplied]";
			isWrong = true;
		}
		else if (myForm.password.value != myForm.password2.value)
		{
			if (myForm.password.value.length < 8)
			{
				document.getElementById("passwordStatus").innerHTML = "* [minimum 8 characters]";
			}
			else 
			{
				document.getElementById("passwordStatus").innerHTML = "*";
			}
			document.getElementById("password2Status").innerHTML = "* [value must match new password]";
			isWrong = true;
		}
		else if (myForm.password.value == myForm.password2.value) 
		{		
			if (myForm.password.value.length < 8)
			{
				document.getElementById("passwordStatus").innerHTML = "* [minimum 8 characters]";
				document.getElementById("password2Status").innerHTML = "* [minimum 8 characters]";
				isWrong = true;
			}
			else
			{
				document.getElementById("passwordStatus").innerHTML = "*";
				document.getElementById("password2Status").innerHTML = "*";
			}
		}
						
		if (isWrong == false)
		{	
			if(confirm("Are you sure?"))
			{
				already_sent = 1;
				return true;
			}			
			else
			{
				return false;
			}
		}
	}
	else
	{
		alert("Data already sent.");
	}
	
	return false;
}

