function windowp() {
 	window.open('/application/pages/termsOfSale.htm', 'Terms', 'height=600, width=689, status=yes, resizable=yes, scrollbars=yes').focus();
}
function show(id, blnShow) { // This gets executed when the user clicks on the checkbox
    var obj = document.getElementById(id);
    if (blnShow) { // if it is checked, make it visible, if not, hide it
        obj.style.display = "block";
    } else {
        obj.style.display = "none";
    }
}

function CopyText () {
    if (document.frmOrder.chkBillingAddress.checked) {
    	document.frmOrder.strShipName.value       = document.frmOrder.strName.value;
		document.frmOrder.strShipAddress.value    = document.frmOrder.strAddress.value
		document.frmOrder.strShipCity.value       = document.frmOrder.strCity.value
		document.frmOrder.strShipZipCode.value    = document.frmOrder.strZipCode.value
		document.frmOrder.strShipCountry.value    = document.frmOrder.strCountry.value
		document.frmOrder.strShipTelephone.value  = document.frmOrder.strTelephone.value
		document.frmOrder.strShipFax.value        = document.frmOrder.strFax.value;
		document.frmOrder.strShipCompany.value    = document.frmOrder.strCompany.value;
		document.frmOrder.strShipVAT.value        = document.frmOrder.strVAT.value;

	}
}

function validateOrderForm()
{
    var objForm    = document.getElementById('frmOrder');
    var strMessage = '';
    var emailRegex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    if (objForm.strName.value == '') strMessage += '\n Name is empty (Billing address)';
    if (objForm.strAddress.value == '') strMessage += '\n Address is empty (Billing address)';
    if (objForm.strCity.value == '') strMessage += '\n City is empty (Billing address)';
    if (objForm.strZipCode.value == '') strMessage += '\n Zip code is empty (Billing address)';
    if (!objForm.strCountry.selectedIndex) strMessage += '\n Country is empty (Billing address)';
    if (objForm.strTelephone.value == '') strMessage += '\n Telephone is empty (Billing address)';
    if (!emailRegex.test(objForm.strEmail.value)) strMessage += '\n E-mail is not valid (Billing address)';
    //if (objForm.Company.checked && !objForm.vatOutsideEurope.checked) {
    if (objForm.Company.checked ) {
        if (objForm.strVAT.value == '' || !checkVATNumber(objForm.strVAT.value)) strMessage += '\n VAT is incorrect (Billing address)';
    }

    if (strMessage != '') strMessage += '\n';
    if (objForm.strShipName.value == '') strMessage += '\n Name is empty (Shipping address)';
    if (objForm.strShipAddress.value == '') strMessage += '\n Address is empty (Shipping address)';
    if (objForm.strShipCity.value == '') strMessage += '\n City is empty (Shipping address)';
    if (objForm.strShipZipCode.value == '') strMessage += '\n Zip code is empty (Shipping address)';
    if (!objForm.strShipCountry.selectedIndex) strMessage += '\n Country is empty (Shipping address)';
    if (objForm.strShipTelephone.value == '') strMessage += '\n Telephone is empty (Shipping address)';
    //if (objForm.Company.checked && !objForm.vatOutsideEurope.checked) {
    if (objForm.Company.checked) {
        if (objForm.strShipVAT.value == '' || !checkVATNumber(objForm.strShipVAT.value)) strMessage += '\n VAT is incorrect (Shipping address)';
    }

    if (strMessage != '') {
        strMessage = 'The following fields contain incorrect values:\n' + strMessage + '\n\n Please correct these and try again.';
        alert(strMessage);
        return false;
    }

    return true;
}