


            function setElementMissed(element){
                element.style.border= "1px solid #818181";
                element.style.backgroundColor= "#ffff66";
            }

            function setElementDone(element){
                element.style.border= "1px solid #cccccc";
                element.style.backgroundColor= "white";
                element.style.paddingTop= "2px";
                element.style.paddingBottom = "2px";
                element.style.paddingLeft = "2px";
            }
            
            function setElementCorrect(element){
                element.style.border= "1px solid black";
                element.style.backgroundColor= "#c9d938";
            }
            
            function setElementIncorrect(element){
                element.style.border= "1px solid red";
                element.style.backgroundColor= "white";
            }



            function getAllFormElements(section) {

                var ele = document.getElementById(section);
                var out = new Array();
                formInputs = ele.getElementsByTagName('input');
                for (var i = 0; i < formInputs.length; i++)
                out.push( formInputs.item(i) );
                formInputs = ele.getElementsByTagName('textarea');
                for (var i = 0; i < formInputs.length; i++)
                out.push( formInputs.item(i) );

                return out;
            }

            function emailValidation(email)
            {
             var email_regexp = /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i 
             return email_regexp.test(email);
            }


            function displayIncomplete(id){
                    document.getElementById(id).style.backgroundColor = "#ffffcc";
                    document.getElementById(id).style.border = "1px solid #aaa";
                    document.getElementById(id).focus();
            }
            
            function displayComplete(id){
                    document.getElementById(id).style.backgroundColor = "#ffffff";
                    document.getElementById(id).style.border = "1px solid #aaa";
            }
            
            function validate(){
            
                var validate_fields = ['first_name','last_name','contact_email','contact_phone','contact_other'];
                
                var error = 0;
                
                for(var i = 0; i < validate_fields.length; i++)
                {
                    if(document.getElementById(validate_fields[i]).value == ""){
                        displayIncomplete(validate_fields[i]);
                        error = 1;
                    }
                    else
                    {
                        displayComplete(validate_fields[i]);
                    }
                }
            
                if(error == 0){ return true; }else{ return false;}
                
            }
            

            
            



            function displayDocHours(){
                var curr_doc = document.getElementById('doclist').value;
                document.getElementById('display_doc_hours').innerHTML = document.getElementById(curr_doc).innerHTML;
            }
            
            function toggleVisitTypeSelect(){
            
                document.getElementById('tripinfo').style.display = "block";

                var doc_select = document.getElementById('doclist');
                var appointment_type_select = document.getElementById('appointment_type');
                var appointment_type = appointment_type_select[appointment_type_select.selectedIndex].className;
                
                if(appointment_type == 'travelmedicine')
                {
                    document.getElementById('appointment_subtype').innerHTML = "<select name=\"appointment_subtype\" style=\"width: 290px;\">" + 
                    "<option value=\"newtrip\">For a new Trip</option><option value=\"followupvac\">Follow up Vaccinations</option>" + 
                    "<option value=\"boostervac\">Booster Vaccinations</option></select>";
                    
                    drawDocOptions(doc_select,appointment_type);
                    
                }else{

                    document.getElementById('tripinfo').style.display = "none";

                    document.getElementById('appointment_subtype').innerHTML = "<input type=\"hidden\" name=\"appointment_subtype\" value=\"\" />" + 
                    "<div style=\"width: 290px; height: 17px;background-color: #ccc;\">&nbsp;</div>";
                    
                    
                    drawDocOptions(doc_select,appointment_type);
                    
                }
                displayDocHours();
                
            }
            
            function hasClass(element,classname){
                var class_seperated = element.className.split(" ");
                for(var i = 0; i < class_seperated.length; i++){
                    if(class_seperated[i] == classname){
                        return true;
                    }
                }
                return false;
            }

            function drawDocOptions(doc_select,type){
                doc_select.innerHTML = "";
                var count = 0;



                for(var i = 0; i < doclist.length; i++){
                    if(hasClass(doclist[i],type)){
                        doc_select.options[count++] = new Option(doclist[i].innerHTML,doclist[i].value);
                    }
                }
            }


            var doclist;

            function initDocOptions(){
                doclist = document.getElementById('doclist').cloneNode(true);
                drawDocOptions(document.getElementById('doclist'),'travelmedicine')
            }


            

            

            
