        // formvalidation.js
         // Declaring valid date character, minimum year and maximum year
        var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
        var phoneRe = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/

        var dtCh = "/";
        var minYear = 1900;
        var maxYear = 2100;
        //------------------------------------
function toForm() {
//document.form.login.focus();
// $("input:visible:enabled:first").focus();
//thisform = $('topform');
//thisform.focusFirstElement();
}

 function passwordChanged() {
    var strength = document.getElementById('strength');
 //   var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
    var strongRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
    var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
    var enoughRegex = new RegExp("(?=.{6,}).*", "g");
    var pwd = document.getElementById("data_passwordhash");
    if (pwd.value.length==0) {
            strength.innerHTML = 'Type Password';
        } else if (false == enoughRegex.test(pwd.value)) {
            strength.innerHTML = 'More Characters';
        } else if (strongRegex.test(pwd.value)) {
            strength.innerHTML = '<span style="color:green">Strong!</span>';
        } else if (mediumRegex.test(pwd.value)) {
            strength.innerHTML = '<span style="color:orange">Medium!</span>';
        } else {
            strength.innerHTML = '<span style="color:red">Weak!</span>';
        }
    }



function CurrencyFormatted(amount)
{
    var i = parseFloat(amount);
    if(isNaN(i)) { i = 0.00; }
    var minus = '';
    if(i < 0) { minus = '-'; }
    i = Math.abs(i);
    i = parseInt((i + .005) * 100);
    i = i / 100;
    s = new String(i);
    if(s.indexOf('.') < 0) { s += '.00'; }
    if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
    s = minus + s;
    return "$ " + s;
}


        function resubmit()
        {
            document.time_form.submit();
        }

        function processavailtime(p)
        {
            document.time_form.action="prep_myavailsaver.php?prep=" + p;
            document.time_form.submit();
        }


                // radio button normalizer
 function getCheckedValue(radioObj) {
    if(!radioObj)
        return "";
    var radioLength = radioObj.length;
    if(radioLength == undefined)
        if(radioObj.checked)
            return radioObj.value;
        else
            return "";
    for(var i = 0; i < radioLength; i++) {
        if(radioObj[i].checked) {
            return radioObj[i].value;
        }
    }
    return "";
}

        function CheckValidityFormDetail3(theForm)
                {
                var returnval = true;
                var errormessage = new String();
                errormessage="";
                // Put field checks below this point.


            if (WithoutContent(theForm.name2.value))
                {
                errormessage += "\nNeed your name, please";
                }

           if (WithoutContent(theForm.email2.value))
                {
                errormessage += "\nNeed an email address.";
                }
           if (WithoutContent(theForm.phone2.value))
                {
                errormessage += "\nNeed your phone, please";
                }
           if (WithoutContent(theForm.fax2.value))
                {
                errormessage += "\nNeed your fax.";
                }

           if (theForm.ordertype.value=="Please Select")
                {
                errormessage += "\nPlease Select the Order type.";
                }





            // alert("CheckValidityBoatDetail");

              // Put field checks above this point.
                if (errormessage.length > 2)
                    {
                    alert('NOTE:' + errormessage);
                    return false;
                    }

                else
                    {
                    return true;
                    }
                }


        function WithoutContent(ss) { if (ss.length > 0) { return false; }

        return true; }

        function NoneWithContent(ss) { for (var i = 0; i < ss.length; i++)
                    {
                    if (ss[i].value.length > 0)
                        {
                        return false;
                        }
                    }

                return true;
                }

            function NoneWithCheck(ss)
                {
                for (var i = 0; i < ss.length; i++)
                    {
                    if (ss[i].checked)
                        {
                        return false;
                        }
                    }

                return true;
                }

            function WithoutCheck(ss)
                {
                if (ss.checked)
                    {
                    return false;
                    }

                return true;
                }

            function WithoutSelectionValue(ss)
                {
                for (var i = 0; i < ss.length; i++)
                    {
                    if (ss[i].selected)
                        {
                        if (ss[i].value.length)
                            {
                            return false;
                            }
                        }
                    }

                return true;
                }

            function isInteger(s)
                {
                var i;

                for (i = 0; i < s.length; i++)
                    {
                    // Check that current character is number.
                    var c = s.charAt(i);

                    if (((c < "0") || (c > "9")))
                        return false;
                    }

                // All characters are numbers.
                return true;
                }

            function stripCharsInBag(s, bag)
                {
                var i;
                var returnString = "";

                // Search through string's characters one by one.
                // If character is not in bag, append to returnString.
                for (i = 0; i < s.length; i++)
                    {
                    var c = s.charAt(i);

                    if (bag.indexOf(c) == -1)
                        returnString += c;
                    }

                return returnString;
                }

            function daysInFebruary(year)
                {
                // February has 29 days in any year evenly divisible by four,
                // EXCEPT for centurial years which are not also divisible by 400.
                return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28);
                }

            function DaysArray(n)
                {
                for (var i = 1; i <= n; i++)
                    {
                    this[i] = 31

                    if (i == 4 || i == 6 || i == 9 || i == 11)
                        {
                        this[i] = 30
                        }

                    if (i == 2)
                        {
                        this[i] = 29
                        }
                    }

                return this
                }

            function OnDDChange(dropdown)
                {
                var SelValue = dropdown.options[dropdown.selectedIndex].value;

                if (SelValue == "K")
                    document.getElementById("btnSave").value = "Delete Record";

                else
                    document.getElementById("btnSave").value = "Save Changes";

                return true;
                }

