//hides or displays the migration information on the BB form
function DisplayVisaMigration(selval)
{
	var_Yes = '237';

	if (selval.value == var_Yes)
	{
		document.getElementById("Blank1").style.display = 'block'; 
		document.getElementById("MigrationTxt").style.display = 'block';	
		document.getElementById("Blank2").style.display = 'block';	
		document.getElementById("CancelDate").style.display = 'block';
		document.getElementById("Termination").style.display = 'block';
		document.getElementById("MACCode").style.display = 'block';
		document.getElementById("BBSpeed").style.display = 'block';
	}
	else
	{
		document.getElementById("Blank1").style.display = 'none'; 
		document.getElementById("MigrationTxt").style.display = 'none';	
		document.getElementById("Blank2").style.display = 'none';	
		document.getElementById("CancelDate").style.display = 'none';
		document.getElementById("Termination").style.display = 'none';
		document.getElementById("MACCode").style.display = 'none';
		document.getElementById("BBSpeed").style.display = 'none';
	}
}

//hides or displays different product combo box values per contract type selction
function DisplayVisaProduct(selval)
{
	var_Standard = '645';
	var_2year = '646';
	var_1year = '647';

	if (selval.value == var_Standard)
	{
		document.getElementById("1year").style.display = 'block';
		document.getElementById("2year").style.display = 'none';
	}	
	else if (selval.value == var_2year) {
		document.getElementById("1year").style.display = 'none';
		document.getElementById("2year").style.display = 'block';
	}
	else if (selval.value == var_1year) {
		document.getElementById("1year").style.display = 'block';
		document.getElementById("2year").style.display = 'none';
	}
}

//displays email address fields for the number of licenses required that are entered for PC Backup
function DisplayPCBackupLicenseEmails(iNoOfLicenses) 
{
	var sEmails;
	sEmails = '';

	if (IsNumeric(iNoOfLicenses.value) && iNoOfLicenses.value.length == 1 ) {
		document.getElementById("LicenseEmails").style.display = 'block';
		for (i = 0; i < iNoOfLicenses.value; i++)
		{
			sEmails += "<input type='text' class=textbox name='Attr_1570' id='Attr_1570_"+ i +"' value='' maxlength='100' /><BR>";
		}
		
		document.getElementById("tdInner_1570").innerHTML = sEmails;
	}else{
		alert("Please enter a number between 1 and 9.");
		document.frmForm.Attr_1569_Int.focus();
	}
}


//displays email address fields for the number of licenses required that are entered for Business Email
function DisplayBusEmailLicenseEmails(iNoOfLicenses) 
{
	var sEmails;
	sEmails = '';

	if (IsNumeric(iNoOfLicenses.value) && iNoOfLicenses.value.length == 1 ) {
		document.getElementById("LicenseEmails").style.display = 'block';
		for (i = 0; i < iNoOfLicenses.value; i++)
		{
			sEmails += "<input type='text' class=textbox name='Attr_1596' id='Attr_1596_"+ i +"' value='' maxlength='100' /><BR>";
		}
		
		document.getElementById("tdInner_1596").innerHTML = sEmails;
	}else{
		alert("Please enter a number between 1 and 9.");
		document.frmForm.Attr_1583_Int.focus();
	}
}

//displays email address fields for the number of licenses required that are entered for Internet Security Pack
function DisplaySecurityPackLicenseEmails(iNoOfLicenses) 
{
	var sEmails;
	sEmails = '';

	if (IsNumeric(iNoOfLicenses.value) && iNoOfLicenses.value.length == 1 ) {
		document.getElementById("LicenseEmails").style.display = 'block';
		for (i = 0; i < iNoOfLicenses.value; i++)
		{
			sEmails += "<input type='text' class=textbox name='Attr_1610' id='Attr_1610_"+ i +"' value='' maxlength='100'/><BR>";
		}
		
		document.getElementById("tdInner_1610").innerHTML = sEmails;
	}else{
		alert("Please enter a number between 1 and 9.");
		document.frmForm.Attr_1597_Int.focus();
	}
}

//error checks the license email address for format and mandatory value for PC Backup
function SubmitPCBOrder()
{
	var sComplete;

	if (document.frmForm.Attr_1569_Int.value == ''){
		alert("Please enter the number of licences you require.");
		document.frmForm.Attr_1569_Int.focus();
	}else{
		for (i = 0; i < document.frmForm.Attr_1569_Int.value; i++)
		{
			if (document.getElementById("Attr_1570_" + i).value == '')
			{
				sComplete = 'N';
				break;		
			}else{
				if (isEmail(document.getElementById("Attr_1570_" + i).value)){
					sComplete = 'Y';
				}else{
					sComplete = 'N/A';
					break;
				}
			}
		}
		
		if (sComplete == 'Y') {
			Check_and_Prompt('frmForm','^^' + document.frmForm.Attr_1568.value + ':##' + document.frmForm.Attr_1569_Int.value + ':' + document.frmForm.Attr_1571.value + ':' + document.frmForm.Attr_1572.value + ':' + document.frmForm.Attr_1573.value + ':@@' + document.frmForm.Attr_1574.value + ':' + document.frmForm.Attr_1575.value + ':' + document.frmForm.Attr_1576.value + ':' + document.frmForm.Attr_1578.value + ':' + document.frmForm.Attr_1579.value,'Product required*:No. of licenses required*(1 required per PC):First name*:Last name*:Telephone*:Email*:Company name*:Address Line 1*:County*:Postcode*');
		}else if (sComplete == 'N/A') {
			alert("The license email addresses need to be in a valid email format.");
		}else {
			alert("Please enter all license email addresses.");
		}
	}
}


//error checks the license email address for format and mandatory value for Business Email
function SubmitBEOrder()
{
	var sComplete;

	if (document.frmForm.Attr_1583_Int.value == ''){
		alert("Please enter the number of licences you require.");
		document.frmForm.Attr_1583_Int.focus();
	}else{
		for (i = 0; i < document.frmForm.Attr_1583_Int.value; i++)
		{
			if (document.getElementById("Attr_1596_" + i).value == '')
			{
				sComplete = 'N';
				break;		
			}else{
				if (isEmail(document.getElementById("Attr_1596_" + i).value)){
					sComplete = 'Y';
				}else{
					sComplete = 'N/A';
					break;
				}
			}
		}
		
		if (sComplete == 'Y') {
			Check_and_Prompt('frmForm','##' + document.frmForm.Attr_1583_Int.value + ':' + document.frmForm.Attr_1584.value + ':' + document.frmForm.Attr_1585.value + ':' + document.frmForm.Attr_1586.value + ':@@' + document.frmForm.Attr_1587.value + ':' + document.frmForm.Attr_1588.value + ':' + document.frmForm.Attr_1589.value + ':' + document.frmForm.Attr_1591.value + ':' + document.frmForm.Attr_1592.value,'No. of licenses required*:First name*:Last name*:Telephone*:Email*:Company name*:Address1*:County*:Postcode*');
		}else if (sComplete == 'N/A') {
			alert("The license email addresses need to be in a valid email format.");
		}else {
			alert("Please enter all license email addresses.");
		}
	}
}


//error checks the license email address for format and mandatory value for Internet Security Pack
function SubmitSPOrder()
{
	var sComplete;

	if (document.frmForm.Attr_1597_Int.value == ''){
		alert("Please enter the number of licences you require.");
		document.frmForm.Attr_1597_Int.focus();
	}else{
		for (i = 0; i < document.frmForm.Attr_1597_Int.value; i++)
		{
			if (document.getElementById("Attr_1610_" + i).value == '')
			{
				sComplete = 'N';
				break;		
			}else{
				if (isEmail(document.getElementById("Attr_1610_" + i).value)){
					sComplete = 'Y';
				}else{
					sComplete = 'N/A';
					break;
				}
			}
		}
		
		if (sComplete == 'Y') {
			Check_and_Prompt('frmForm','##' + document.frmForm.Attr_1597_Int.value + ':' + document.frmForm.Attr_1598.value + ':' + document.frmForm.Attr_1599.value + ':' + document.frmForm.Attr_1600.value + ':@@' + document.frmForm.Attr_1601.value + ':' + document.frmForm.Attr_1602.value + ':' + document.frmForm.Attr_1603.value + ':' + document.frmForm.Attr_1605.value + ':' + document.frmForm.Attr_1606.value,'No. of licenses required*:First name*:Last name*:Telephone*:Email*:Company name*:Address1*:County*:Postcode*');
		}else if (sComplete == 'N/A') {
			alert("The license email addresses need to be in a valid email format.");
		}else {
			alert("Please enter all license email addresses.");
		}
	}
}

//validates the string is between 1 and 9
function IsNumeric(sText)
{
   var ValidChars = "123456789";
   var IsNumber=true;
   var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}

//validates the string is a valid email format
function isEmail(string)
{
	var realreg = /^(\w+\.)*?(\w+\-)*?(\w+\_)*?\w+\@\w+(\.\w+)*?(\-\w+)*?\.\w+(\.\w+)*?(\w+\_)*?$/;
	if (realreg.test(string)!=true){return false;}else{return true;}
	
	
}

//error checks the WLR3 form
function Check_WLR3()
{
    var_SwitchingProviders = "";
    var_ExistingBTEmail = "";
    
    for (x=0; x<document.frmForm.Attr_1785_Rdo.length;x++) {
        if (document.frmForm.Attr_1785_Rdo[x].checked) 
        {
           var_SwitchingProviders = document.frmForm.Attr_1785_Rdo[x].value
        }
    }

    for (x=0; x<document.frmForm.Attr_2479_Rdo.length;x++) {
        if (document.frmForm.Attr_2479_Rdo[x].checked) 
        {
           var_ExistingBTEmail = document.frmForm.Attr_2479_Rdo[x].value
        }
    }

    //if (var_SwitchingProviders == "237" && document.frmForm.Attr_1787.value == "")
    //{
    //    alert("Please enter your MAC code.");
    //    return false;
    //}
    //    else if (document.frmForm.Attr_1773.value.substring(0,1) == " ")
//    {
//        alert("Please remove leading spaces in your BT Phone Number.");
//        return false;
//    }
    if (!IsNumeric(document.frmForm.Attr_1773.value))
    {
        alert("Your BT Telephone number cannot be recognised, please enter only numeric values, no spaces either.");
        return false;
    }
    //else if (document.frmForm.Attr_1773.value != "" && (document.frmForm.Attr_1773.value.length < 9 || document.frmForm.Attr_1773.value.length > 14))
    //{
    //    alert("Please enter a valid Telephone number. Should be no less than 9 and no more than 14 numbers in length.");
    //    return false;
    //}
    //else if (document.frmForm.Attr_1979.value.substring(0,2) != "07")
    //{
    //    alert("Please ensure your mobile number starts with 07.");
    //    return false;
    //}
    else if (var_ExistingBTEmail == "237" && document.frmForm.Attr_1809_Yes.value == "")
    {
        alert("Please enter your existing email name");
        return false;
    }
    else if (var_ExistingBTEmail == "237" && document.frmForm.Attr_2012_Yes.value == "")
    {
        alert("Please enter your security answer");
        return false;
    }
    else if (var_ExistingBTEmail == "237" && document.frmForm.Attr_2012_Yes.value.length < 3)
    {
        alert("Please ensure that your security answer is minimum 3 characters in length.");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_1809_No.value == "")
    {
        alert("Please enter your existing email name");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_2011.value == "0")
    {
        alert("Please select your security question");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_2012_No.value == "")
    {
        alert("Please enter your security answer");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_2012_No.value.length < 3)
    {
        alert("Please ensure that your security answer is minimum 3 characters in length.");
        return false;
    }
    else
    {
        if (var_ExistingBTEmail == "238")
        {
            document.frmForm.Attr_1809.value = document.frmForm.Attr_1809_No.value;
            document.frmForm.Attr_2012.value = document.frmForm.Attr_2012_No.value;
        }
        else if (var_ExistingBTEmail == "237")
        {
           document.frmForm.Attr_1809.value = document.frmForm.Attr_1809_Yes.value;
           document.frmForm.Attr_2012.value = document.frmForm.Attr_2012_Yes.value; 
        }
    
        Check_and_Prompt('frmForm','^^' + document.frmForm.Attr_2944.value + ':^^' + document.frmForm.Attr_1780.value + ':**Attr_1785_Rdo' + ':**Attr_2479_Rdo' + ':^^' + document.frmForm.Attr_1791.value + ':' + document.frmForm.Attr_1792.value + ':' + document.frmForm.Attr_1793.value + ':$#' + document.frmForm.Start_1964_Day.value + '/' + document.frmForm.Start_1964_Month.value + '/' + document.frmForm.Start_1964_Year.value + ':' + document.frmForm.Attr_1795.value + ':' + document.frmForm.Attr_1798.value + ':' + document.frmForm.Attr_1799.value + ':' + document.frmForm.Attr_1800.value + ':@@' + document.frmForm.Attr_1801.value + ':' + document.frmForm.txtConfirmEmail.value + ':' + document.frmForm.Attr_1802.value + ':' + document.frmForm.Attr_1979.value + ':TCAttr_1805_TC' + ':**Attr_1967_chk' + ':$$' + document.frmForm.Attr_1773.value + '$' + document.frmForm.txtConfirmTel.value + ':%%' + document.frmForm.Attr_1801.value + '%' + document.frmForm.txtConfirmEmail.value,'Tesco Store:Which broadband product would you like to order?*:Will you be switching your Broadband connection from another ISP?*:Do you have an existing BT email account*:Title*:Firstname*:Last Name*:Date of Birth*:Address 1*:City/Town*:County*:Post code*:Contact email*:Please enter the confirm email*:Contact number*:Alternative contact number*:Please confirm that you accept the BT Terms and Conditions and Privacy Policy for the service.:Please confirm that you are the account holder*');
        return false;
    }
}

//error checks the Switchers form
function Check_WLR3_SW()
{

     var_ExistingBTEmail = "";
    
     for (x=0; x<document.frmForm.Attr_2479_Rdo.length;x++) {
        if (document.frmForm.Attr_2479_Rdo[x].checked) 
        {
           var_ExistingBTEmail = document.frmForm.Attr_2479_Rdo[x].value
        }
     }

    //    if (document.frmForm.Attr_1773.value.substring(0,1) == " ")
//    {
//        alert("Please remove leading spaces in your BT Phone Number.");
//        return false;
//    }
    if (!IsNumeric(document.frmForm.Attr_1773.value))
    {
        alert("Your BT Telephone number cannot be recognised, please enter only numeric values.");
        return false;
    }
    else if (document.frmForm.Attr_1773.value != "" && (document.frmForm.Attr_1773.value.length < 9 || document.frmForm.Attr_1773.value.length > 14))
    {
        alert("Please enter a valid Telephone number. Should be no less than 9 and no more than 14 numbers in length.");
        return false;
    }
    else if (document.frmForm.Attr_1979.value.substring(0,2) != "07")
    {
        alert("Please ensure your mobile number starts with 07.");
        return false;
    }
    else if (var_ExistingBTEmail == "237" && document.frmForm.Attr_1809_Yes.value == "")
    {
        alert("Please enter your existing email name");
        return false;
    }
    else if (var_ExistingBTEmail == "237" && document.frmForm.Attr_2012_Yes.value == "")
    {
        alert("Please enter your security answer");
        return false;
    }
    else if (var_ExistingBTEmail == "237" && document.frmForm.Attr_2012_Yes.value.length < 3)
    {
        alert("Please ensure that your security answer is minimum 3 characters in length.");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_1809_No.value == "")
    {
        alert("Please enter your existing email name");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_2011.value == "0")
    {
        alert("Please select your security question");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_2012_No.value == "")
    {
        alert("Please enter your security answer");
        return false;
    }
    else if (var_ExistingBTEmail == "238" && document.frmForm.Attr_2012_No.value.length < 3)
    {
        alert("Please ensure that your security answer is minimum 3 characters in length.");
        return false;
    }
    else
    {
        if (var_ExistingBTEmail == "238")
        {
            document.frmForm.Attr_1809.value = document.frmForm.Attr_1809_No.value;
            document.frmForm.Attr_2012.value = document.frmForm.Attr_2012_No.value;
        }
        else if (var_ExistingBTEmail == "237")
        {
           document.frmForm.Attr_1809.value = document.frmForm.Attr_1809_Yes.value;
           document.frmForm.Attr_2012.value = document.frmForm.Attr_2012_Yes.value; 
        }

        Check_and_Prompt('frmForm',document.frmForm.Attr_1773.value + ':' + document.frmForm.txtConfirmTel.value + ':^^' + document.frmForm.Attr_1780.value + ':**Attr_2479_Rdo' + ':^^' + document.frmForm.Attr_2203.value + ':^^' + document.frmForm.Attr_1791.value + ':' + document.frmForm.Attr_1792.value + ':' + document.frmForm.Attr_1793.value + ':$#' + document.frmForm.Start_1964_Day.value + '/' + document.frmForm.Start_1964_Month.value + '/' + document.frmForm.Start_1964_Year.value + ':' + document.frmForm.Attr_1795.value + ':' + document.frmForm.Attr_1798.value + ':' + document.frmForm.Attr_1799.value + ':' + document.frmForm.Attr_1800.value + ':@@' + document.frmForm.Attr_1801.value + ':' + document.frmForm.txtConfirmEmail.value + ':' + document.frmForm.Attr_1802.value + ':' + document.frmForm.Attr_1979.value + ':TCAttr_1805_TC' + ':**Attr_1967_chk' + ':$$' + document.frmForm.Attr_1773.value + '$' + document.frmForm.txtConfirmTel.value + ':%%' + document.frmForm.Attr_1801.value + '%' + document.frmForm.txtConfirmEmail.value,'Please enter the BT telephone number you would like upgraded to Broadband*:Please enter the confirm Telephone number*:Which broadband product would you like to order?*:Do you have an existing BT email account*:Your current Broadband provider*:Title*:Firstname*:Last Name*:Date of Birth*:Address 1*:City/Town*:County*:Post code*:Contact email*:Please enter the confirm email*:Contact number*:Mobile number*:Please confirm that you accept the BT Terms and Conditions and Privacy Policy for the service.:Please confirm that you are the account holder*');
        return false;
    }
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function DisplayBTEmailDetails(elSel)
{
	var_Yes = "237";
	
	if (elSel.value == var_Yes) {
	    document.getElementById("Yes1").style.display="block";
	    document.getElementById("Yes2").style.display="block";
	    document.getElementById("Yes3").style.display="block";
	    
	    document.getElementById("No1").style.display="none";
	    document.getElementById("No2").style.display="none";
	    document.getElementById("No3").style.display="none";
	    document.getElementById("No4").style.display="none";
	    document.getElementById("No5").style.display="none";
	    document.getElementById("No6").style.display="none";

	}else {
	    document.getElementById("Yes1").style.display="none";
	    document.getElementById("Yes2").style.display="none";
	    document.getElementById("Yes3").style.display="none";
	    
	    document.getElementById("No1").style.display="block";
	    document.getElementById("No2").style.display="block";
	    document.getElementById("No3").style.display="block";
	    document.getElementById("No4").style.display="block";
	    document.getElementById("No5").style.display="block";
	    document.getElementById("No6").style.display="block";
	}
}


function CheckSpaces(ObjRef, Value) {

    var strRegExp;

    if (Value.search(" ") >= 0) {
        strRegExp = / /g;
        ObjRef.value = Value.replace(strRegExp, "");
        ObjRef.focus();
    }
}

function DisplayCBVision(elSel) {

    //display vision fields
    if (elSel.value == "1818" || elSel.value == "1819" || elSel.value == "1820" || elSel.value == "1821" || elSel.value == "1822" || elSel.value == "1823" || elSel.value == "0") {
        document.getElementById("CBVisionHead").style.display = "none";
        document.getElementById("CBVision").style.display = "none";
        document.getElementById("CBVisionESPN").style.display = "none";
        document.getElementById("CBVisionDDHead").style.display = "none";
        document.getElementById("CBVisionDDSurname").style.display = "none";
        document.getElementById("CBVisionDDSC").style.display = "none";
        document.getElementById("CBVisionDDAccNo").style.display = "none";
    } else {
        document.getElementById("CBVisionHead").style.display = "block";
        document.getElementById("CBVision").style.display = "block";
        document.getElementById("CBVisionESPN").style.display = "block";
        document.getElementById("CBVisionDDHead").style.display = "block";
        document.getElementById("CBVisionDDSurname").style.display = "block";
        document.getElementById("CBVisionDDSC").style.display = "block";
        document.getElementById("CBVisionDDAccNo").style.display = "block";
    }

    //these 3 products only show Direct Debit details
    if (elSel.value == "1821" || elSel.value == "1822" || elSel.value == "1823") {
        document.getElementById("CBVisionDDHead").style.display = "block";
        document.getElementById("CBVisionDDSurname").style.display = "block";
        document.getElementById("CBVisionDDSC").style.display = "block";
        document.getElementById("CBVisionDDAccNo").style.display = "block";        
    }

    //gold product bundles - all viewing options are selected
    if (elSel.value == "1825" || elSel.value == "1826" || elSel.value == "1829") {
        for (i = 0; i < document.frmForm.Attr_3025_chk.length; i++) {
            document.frmForm.Attr_3025_chk[i].checked = true;
        }
    }
    else {
        for (i = 0; i < document.frmForm.Attr_3025_chk.length; i++) {
            document.frmForm.Attr_3025_chk[i].checked = false;
        }
    }

    //product bundles - pre-select product & calling plans
    //Option 1
    if (elSel.value == "1818" || elSel.value == "1821" || elSel.value == "1822" || elSel.value == "1824" || elSel.value == "1827") {
        document.frmForm.Attr_1780.value = "1126";
    }
    //Option 2
    else if (elSel.value == "1819") {
        document.frmForm.Attr_1780.value = "1128";
    }
    //Option 3
    else if (elSel.value == "1820" || elSel.value == "1823" || elSel.value == "1825" || elSel.value == "1826" || elSel.value == "1828" || elSel.value == "1829") {
        document.frmForm.Attr_1780.value = "1130";
    }
    else {
        document.frmForm.Attr_1780.value = "0";
    }

    //product bundles - pre-select calling plans
    //Unlimited UK Evening & Weekend calls
     if (elSel.value == "1821" || elSel.value == "1824" || elSel.value == "1825" || elSel.value == "1826") {
        document.frmForm.Attr_1772.value = "845";
    }
    //Unlimited UK Anytime calls
    else if (elSel.value == "1822" || elSel.value == "1823") {
        document.frmForm.Attr_1772.value = "846";
    }
    else {
        document.frmForm.Attr_1772.value = "0";
    }
}

function DisplayCBVisionCC(elSel) {

    if (elSel.value == "237") {
        document.getElementById("CBVisionCCHead").style.display = "block";
        document.getElementById("CBVisionCT").style.display = "block";
        document.getElementById("CBVisionCN").style.display = "block";
        document.getElementById("CBVisionCH").style.display = "block";
        document.getElementById("CBVisionSD").style.display = "block";
        document.getElementById("CBVisionED").style.display = "block";
        document.getElementById("CBVisionIN").style.display = "block";

    } else {
        document.getElementById("CBVisionCCHead").style.display = "none";
        document.getElementById("CBVisionCT").style.display = "none";
        document.getElementById("CBVisionCN").style.display = "none";
        document.getElementById("CBVisionCH").style.display = "none";
        document.getElementById("CBVisionSD").style.display = "none";
        document.getElementById("CBVisionED").style.display = "none";
        document.getElementById("CBVisionIN").style.display = "none";
    }
}

function DisplayCBVisionPrevAdd(elSel) {

    if (elSel.value == "1837") {
        document.getElementById("CBVisionPrevAdd1").style.display = "block";
        document.getElementById("CBVisionPrevAdd2").style.display = "block";
        document.getElementById("CBVisionPrevAdd3").style.display = "block";
        document.getElementById("CBVisionPrevCity").style.display = "block";
        document.getElementById("CBVisionPrevCounty").style.display = "block";
        document.getElementById("CBVisionPrevPC").style.display = "block";
        document.getElementById("CBVisionPrevYYYY").style.display = "block";

    } else {
        document.getElementById("CBVisionPrevAdd1").style.display = "none";
        document.getElementById("CBVisionPrevAdd2").style.display = "none";
        document.getElementById("CBVisionPrevAdd3").style.display = "none";
        document.getElementById("CBVisionPrevCity").style.display = "none";
        document.getElementById("CBVisionPrevCounty").style.display = "none";
        document.getElementById("CBVisionPrevPC").style.display = "none";
        document.getElementById("CBVisionPrevYYYY").style.display = "none";
        document.getElementById("CBVisionPrevAdd1_2").style.display = "none";
        document.getElementById("CBVisionPrevAdd2_2").style.display = "none";
        document.getElementById("CBVisionPrevAdd3_2").style.display = "none";
        document.getElementById("CBVisionPrevCity_2").style.display = "none";
        document.getElementById("CBVisionPrevCounty_2").style.display = "none";
        document.getElementById("CBVisionPrevPC_2").style.display = "none";
    }
}

function DisplayCBVisionPrevAdd2(elSel) {

    if (elSel.value == "1837") {
        document.getElementById("CBVisionPrevAdd1_2").style.display = "block";
        document.getElementById("CBVisionPrevAdd2_2").style.display = "block";
        document.getElementById("CBVisionPrevAdd3_2").style.display = "block";
        document.getElementById("CBVisionPrevCity_2").style.display = "block";
        document.getElementById("CBVisionPrevCounty_2").style.display = "block";
        document.getElementById("CBVisionPrevPC_2").style.display = "block";

    } else {
        document.getElementById("CBVisionPrevAdd1_2").style.display = "none";
        document.getElementById("CBVisionPrevAdd2_2").style.display = "none";
        document.getElementById("CBVisionPrevAdd3_2").style.display = "none";
        document.getElementById("CBVisionPrevCity_2").style.display = "none";
        document.getElementById("CBVisionPrevCounty_2").style.display = "none";
        document.getElementById("CBVisionPrevPC_2").style.display = "none";
    }
}