$(document).ready(

    function() 
    {
        $(".NumberFormat").keyup(
            function ()
            {
                var number = $(this).val().replace(/,/g, ""), j = -1, response = "";
                number = number.split("-")
                num = number[0];

                    for (i = num.length ; i>=0 ; j++, i--)
                    {
                        response = num.charAt(i) + response;
                        
                        if (j == 2)
                        {
                            j = 0;
                            if (i > 0)
                            {
                                response = "," + response;
                            }
                        }
                    }
                
                $(this).val(response);
            }
        );
        
        $(".NumberFormat:first").closest("form").submit(
            function()
            {
                $(".NumberFormat").each(
                    function()
                    {
                        $(this).val($(this).val().replace(/,/g, ""));
                    }
                );
                return true;
            }
        );
        
        $("button, input[type=submit], input[type=button]").button();
        
        $("div.menu ul li").click(
            function()
            {
                window.location = $(this).find('a').attr('href');
                return false;
            }
        );
    }
);
