

        //Decided to hardwire this
        //Used in index to check for pass and if present hash it up.        
        function check_for_pass()
        {
            clean_field = $('vis_pass');
            sha_field = $('sha_pass');
            
            var clean = clean_field.value;
            if (clean !== "" && clean.length > 1)
            {
                
                sha_field.value = hex_sha1(clean);
                clean_field.value = "";
                
                return true;
            }
            else
            {
                /*
                var answer = confirm("You didn't enter a password, click ok to create a new account or cancel to enter a password");
                if(answer) //they chose to create a new account
                {
                    return true; //Tell the form to submit and go to step 2
                }
                else
                {
                    return false;
                }
                */
            }
        }
        
        //Used in step 2 to get, compare, and succes pass1 into target
        function test_and_set_pass(pass1,pass2,target)
        {
            p1 = $(pass1);
            p2 = $(pass2);
            hashed = $(target);
            
            if(p1.value === "" && p2.value === "")
            {
                return true;
            }
            //I know this is excessive, but i am not messing around anymore.
            else if(p1.value === p2.value)
            {
                hashed.value = hex_sha1(p1.value);
                p1.value = p2.value = "";
                //alert("Pass hashed to: " + hashed.value);
                return false;
            }
            else
            {
                alert("One of the passwords you entered is not the same as the other.");
                return false;
            }
        }
        
        //global val
        var current_help = 'help_main';
        function help_on(toShow)
        {
            
            //Build the ID tag for the help hint we want
            temp = 'help_' + toShow;
            if(current_help == temp)
                return
                
            //alert('Help on ' + temp)                                              
            //show the new hint.
            Element.show(temp);
            //is another field help hint .show? 
             
            Element.hide(current_help);//if so, hide it.
            
            current_help = 'help_' + toShow;
        }
        
        //Copied from http://ricardo.pacheco.name/blog/articles/2006/09/17/using-autocomplete-with-belongs_to-fields-part-ii
        //Modified to use n+ elements instead of just 1 pair
        //Used index
        //selectedElement format := target_id::value
        function auto_complete_on_select(element, selectedElement)
        {
            var entityParts = selectedElement.id.split('::');
            for(var i = 0;i<entityParts.length; i+=2)
            {
                document.getElementById(entityParts[i]).value = parseInt(entityParts[i+1]);        
            }
        }