﻿


// JScript File
function loadYears()
    {
    var theDropDown;	
    if (document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlYear"))
        {
        theDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlYear");	
        }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlYear"))
        {
        theDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlYear");	
        }
    
    
    var dtmDate = new Date();
    var intYear = dtmDate.getFullYear()-16;
    var intYearEnd = intYear - 50;
    
    
    var numberOfOptions = theDropDown.options.length;
    
    for (var i = numberOfOptions; i >= 0; i--)
        {
        theDropDown.remove(0);
        }
    var i = 0
    while(intYear > intYearEnd)
        {
        theDropDown.options[i] = new Option(intYear); 
        //theDropDown.addOption(intYear);
        i++;
	    intYear--;
        }
    }


var theSelectedDay;
function GetNoDays()
    {
    
    var theYearDropDown;    
    var theMonthDropDown;
    var theDayDropDown;
    
    
    if (document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlYear"))
        {
        theYearDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlYear");
        theMonthDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlMonth");
        theDayDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlDay");		
        theSelectedDay = theDayDropDown.selectedIndex;
        }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlYear"))
        {
        theYearDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlYear");
        theMonthDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlMonth");
        theDayDropDown = document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlDay");
        theSelectedDay = theDayDropDown.selectedIndex;
        }

        
    var today = new Date();
    var intYear = theYearDropDown.value
    var intMonth = theMonthDropDown.value
    var intDays = new Date(intYear, intMonth, 0).getDate();

    var numberOfOptions = theDayDropDown.options.length;
    
    for (var i = numberOfOptions; i >= 0; i--)
        {
        theDayDropDown.remove(0);
        }
        
    var i = 1
    while(i < intDays+1)
        {
        theDayDropDown.options[i-1] = new Option(i);
        i++;
        }
        
        
        
    if (theSelectedDay > 1 && theSelectedDay <= intDays)
        {
        if (document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlYear"))
            {
            document.getElementById("ctl00_ContentPlaceHolder1_ucEditAboutCustomer1_ddlDay").selectedIndex = theSelectedDay;
            }
        else if (document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlYear"))
            {
            document.getElementById("ctl00_ContentPlaceHolder1_ucCreateUserProfile3_ddlDay").selectedIndex = theSelectedDay;
            }
        }
    }
