
////////////////////////////////////////////////////////////////////////////////////////
// Changes the Days of the Month in the DOB Combo accordingly //////////////////////////
////////////////

var registrationCloserURL;

function changeDays(){

	var yearObj = document.getElementById("DOB3");
	var obj = document.getElementById("DOB1");
	var dayObj = document.getElementById("DOB2");
    iSelectedYear = parseInt(yearObj.value);
    bLeapYear = false;
    if(iSelectedYear % 4 == 0) bLeapYear = true;

    iOldDayLen = dayObj.options.length;
    iNewDayLen = 31;
    if(obj.value == "2" && !bLeapYear) iNewDayLen = 28;
    if(obj.value == "2" && bLeapYear) iNewDayLen = 29;
    if(obj.value == "4" || obj.value == "6" || obj.value == "9" || obj.value == "11") iNewDayLen = 30;

    if(iOldDayLen > iNewDayLen) {

        for(i = iOldDayLen; i >= iNewDayLen; i--) dayObj.options.remove(i);
                
        dayObj.selectedIndex = 0;
                        
    } else if(iNewDayLen > iOldDayLen) {

        for(i = iOldDayLen + 1; i <= iNewDayLen; i++) {
        
            var oOption = document.createElement("option");
            dayObj.options.add(oOption);
            oOption.innerText = i;
            oOption.value = i;
        
        }
                        
    }
                             
}

////////////////////////////////////////////////////////////////////////////////////////
// Client-Side Validation (basic) //////////////////////////////////////////////////////
////////////////
function checkForm(bool){
	
	document.getElementById("hdnFunction").value = bool;
	//alert(document.getElementById("hdnFunction").value);
    patRegistration.submit();

}

///////////////////////////////////////////////////////////////////////////////////////
// Home page stuff ////////////////////////////////////////////////////////////////////
////////////////
  function goEClinic(){
    
        sReturn = showModalDialog("clinicContainer.aspx", "", "dialogWidth:763px;dialogHeight:600px");
        
    }
    
    function signUp(){
    
        clinicContinue.hdnClinicContinue.value = "001";
        clinicContinue.submit();
    
    }
    
    function help(){
    
    }
    
///////////////////////////////////////////////////////////////////////////////////////
// Registration Info security /////////////////////////////////////////////////////////
////////////////
 function goEULA(){
    
        clinicContinue2.hdnClinicContinue2.value = "002";
        clinicContinue2.submit();
        
    }
    
///////////////////////////////////////////////////////////////////////////////////////
// EULA-Specific Javascript ///////////////////////////////////////////////////////////
////////////////
function Init(){
            
    //btn_Agr.disabled=true;
    //chk_Agree.disabled=false;

}
            
function setBTNActive(){
    
    document.getElementById("btn_Agr").disabled=false;
    document.getElementById("chk_Agree").checked = true;
    document.getElementById("chk_Agree").disabled=true;

}
            
function goRegister(){
    
        clinicContinue3.hdnClinicContinue3.value = "003";
        clinicContinue3.submit();
        
    }            
    
    
    
function completeReg(){

    regCloser.submit();
    
}            


function killSession(){

    window.navigate("Default.aspx");

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Clears 'fake' form on home page 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function sendAppt(){
    alert("Please call the clinic for an appointment");
    reqAppt.pFirst.value = "";
    reqAppt.pLast.value = "";
    reqAppt.pPhone.value = "";
    reqAppt.pDOB.value = "";
    reqAppt.pSymptoms.value = "";
}

            