    <!-- Original:  Sandeep V. Tamhankar (stamhankar@hotmail.com) -->
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    function isEmail(email) {
    invalidChars = " ~\'^\`\"*+=\\|][(){}$&!#%/:,;ğüşıöçĞÜŞİÖÇ";

    // Check for null
//    if (email == "") {
//        return true;
//    }

    // Check for invalid characters as defined above
    for (i=0; i<invalidChars.length; i++) {
        badChar = invalidChars.charAt(i);
        if (email.indexOf(badChar,0) > -1) {
            return false;
        }
    }
    lengthOfEmail = email.length;
    if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
        return false;
    }
    Pos = email.indexOf("@",1);
    if (email.charAt(Pos + 1) == ".") {
        return false;
    }
    while ((Pos < lengthOfEmail) && ( Pos != -1)) {
        Pos = email.indexOf(".",Pos);
        if (email.charAt(Pos + 1) == ".") {
            return false;
        }
        if (Pos != -1) {
            Pos++;
        }
    }

    // There must be at least one @ symbol
    atPos = email.indexOf("@",1);
    if (atPos == -1) {
        return false;
    }

    // But only ONE @ symbol
    if (email.indexOf("@",atPos+1) != -1) {
        return false;
    }

    // Also check for at least one period after the @ symbol
    periodPos = email.indexOf(".",atPos);
    if (periodPos == -1) {
        return false;
    }
    if (periodPos+3 > email.length) {
        return false;
    }
    return true;
    }
    function SubmitSignIn() {
//		if (!isEmail(document.getElementById('field12').value)) {
//			alert("The email address you\'ve entered is not a valid email address.");
//			document.getElementById('field12').focus();
//			return false;
//		}
		if (document.getElementById('field10').value.length<3) {
			alert("A login ID is a minimum 6 chars in length.");
			document.getElementById('field10').focus();
			return false;
		}
		if (document.getElementById('field11').value.length<4) {
			alert("Please enter a password with minimum 4 chars length.");
			document.getElementById('field11').focus();
			return false;
		}
		document.getElementById('ActionButton').value="Login";
		document.getElementById('DetailForm').submit();
		return true;
	}

    function SubmitSignUp() {
		if (document.getElementById('field20').value.length<3) {
			alert("Please enter your name.");
			document.getElementById('field20').focus();
			return false;
		}
		if (!isEmail(document.getElementById('field21').value)) {
			alert("The email address you\'ve entered is not a valid email address.");
			document.getElementById('field21').focus();
			return false;
		}
		if (document.getElementById('field22').value.length<4) {
			alert("Please enter a password with minimum 4 chars length.");
			document.getElementById('field22').focus();
			return false;
		}
		if (document.getElementById('field22').value!=document.getElementById('field23').value) {
			alert("The passwords you\'ve entered are not same.");
			document.getElementById('field23').focus();
			return false;
		}
        	document.getElementById('ActionButton').value="Signup";
		document.getElementById('DetailForm').submit();
		return true;
	}
    function SubmitContinue(wform) {
	var wizCmd="Continue";
	if (wform == "form2") {
		if (document.getElementById('BillingFirst').value.length<1) {
			alert("The first name must be entered");
			document.getElementById('BillingFirst').focus();
			return false;		
		}
		if (document.getElementById('BillingAddress1').value.length<5) {
			alert("A full address is required");
			document.getElementById('BillingAddress1').focus();
			return false;		
		}
		if (document.getElementById('BillingCity').value.length<5) {
			alert("Please enter the suburb or city");
			document.getElementById('BillingCity').focus();
			return false;		
		}
		if (document.getElementById('BillingState').value.length<1) {
			alert("Please enter the State");
			document.getElementById('BillingState').focus();
			return false;		
		}
		if (document.getElementById('BillingZip').value.length<1) {
			alert("Please enter the post code");
			document.getElementById('BillingZip').focus();
			return false;		
		}
		if (document.getElementById('BillingPhone1').value.length + document.getElementById('BillingPhone2').value.length<5) {
			alert("Please enter at least one contact phone number");
			document.getElementById('BillingPhone1').focus();
			return false;		
		}
	}
	if (wform == "GoToCart") {
		wizCmd=wform;
	}
	if (wform == "GoToAddress") {
		wizCmd=wform;
	}
	if (wform == "<< Back") {
		wizCmd=wform;
	}
	if (wform == "<< Prev") {
		wizCmd=wform;
	}
	if (wform == "Delete") {
		wizCmd=wform;
	}
	if (wform == "Submit") {
		wizCmd=wform;
	}
	if (wform == "submit") {
		wizCmd=wform;
	}
        document.getElementById('ActionButton').value=wizCmd;
	document.getElementById('DetailForm').submit();
	return true;
    }

    // Form 2

    function getShippingAddress() {
		var return_val;
		var myRadio = document.DetailForm.field39;
		for (var i=0; i<myRadio.length; i++)  {
			if(myRadio[i].checked) {
				return_val = myRadio[i].value; 
			}
		}
		return return_val;
	}
	
    function checkShippingAddress() {
		var selectedValue = getShippingAddress();
		if(selectedValue == "Different") {
			document.getElementById('ShippingAddr02').style.display = 'block';
			document.getElementById('ShippingName').value = document.getElementById('BillingFirst').value+" "+ document.getElementById('BillingSurname').value;
			document.getElementById('ShippingAddress1').value = document.getElementById('BillingAddress1').value;
			document.getElementById('ShippingAddress2').value = document.getElementById('BillingAddress2').value;
			document.getElementById('ShippingAddress3').value = document.getElementById('BillingAddress3').value;
			document.getElementById('ShippingCity').value = document.getElementById('BillingCity').value;
			document.getElementById('ShippingState').value = document.getElementById('BillingState').value;
			document.getElementById('ShippingZip').value = document.getElementById('BillingZip').value;
			document.getElementById('ShippingPhone1').value = document.getElementById('BillingPhone1').value;
			document.getElementById('ShippingPhone2').value = document.getElementById('BillingPhone2').value;
		} else {
			document.getElementById('ShippingAddr02').style.display = 'none';
		}
	}

    function copy2shipping() {
		document.getElementById('ShippingName').value = 		document.getElementById('BillingName').value;
		document.getElementById('ShippingAddress1').value = 		document.getElementById('BillingAddress1').value;
		document.getElementById('ShippingAddress2').value = 		document.getElementById('BillingAddress2').value;
		document.getElementById('ShippingCity').value = 		document.getElementById('BillingCity').value;
		document.getElementById('ShippingState').value = 		document.getElementById('BillingState').value;
		document.getElementById('ShippingZip').value = 			document.getElementById('BillingZip').value;
		document.getElementById('ShippingPhone1').value = 		document.getElementById('BillingPhone1').value;
		document.getElementById('ShippingPhone2').value = 		document.getElementById('BillingPhone2').value;
		document.getElementById('ShippingCountryID').selectedIndex = 						document.getElementById('BillingCountryID').selectedIndex;
	}


    //  End -->
