page.OrderForm = function () {
    
    // napoveda u labelu formulare
    $("div.formHelp").hide();
    $("form").find("label").hover(
        function() {
            $(".floatingHelp").empty();
            $("div.formHelp #help_"+$(this).attr("for")).clone().appendTo(".floatingHelp");
        },
        function() {
            $(".floatingHelp").empty();
        }
    );

    // napoveda u prvku formulare - mys
    $(".orderForm form").find(":input", ":button").hover(
        function() {
            $(".floatingHelp").empty();
            $("div.formHelp #help_"+$(this).attr("id")).clone().appendTo(".floatingHelp");
        },
        function() {
            $(".floatingHelp").empty();
        }
    );
    // napoveda u prvku formulare - klavesnice
    $(".orderForm form").find(":input").bind("focus",
        function() {
//                $(".orderForm form").find(':input').removeClass('focusInput');
//                $(this).addClass('focusInput').parent().addClass('focusLabel');
            $(".floatingHelp").empty();
            $("div.formHelp #help_"+$(this).attr("id")).clone().appendTo(".floatingHelp");
        }
    );

    // validace poli
/*        $(".orderForm form").validate({
//            event: "blur",
//            success: "valid"
        rules: {
            email: "required",
            whenFrom: "required",
            whenTo: "required",
            persons: "required"
        },
        errorElement: $(""),
    });*/
    
    // zobrazeni tlacitek kalendare
    $(".orderForm form button").show();
            
    // skryti formulare pri chybe
    $("form#orderForm_1").hide();
    $("#orderForm_1_show").click(function() {
//            $("form#orderForm_1").show();
        $(this).parent().parent().parent().find("form").show();
        return false;
    });

    // sestaveni selectu a vyber optionu
    lib.selectCountry(page.countrySelected, page.countryResorts, page.countryTransports);
    $("select#country").selectOptions(page.countrySelected);
    $("select#resort").selectOptions(page.resortSelected);
    $("select#transport").selectOptions(page.transportSelected);
    $("select#price").selectOptions(page.priceSelected);
    
    lib.selectCountrySelects(page.countrySelected, page.resortSelected, page.countryResorts);

    // vybrani optionu v OrderForm - country
    $("select#country").change( function() {
        var id = $(this).val();
        //var text = $("select#country option:selected").text();
        lib.selectCountry(id, page.countryResorts, page.countryTransports);
        lib.selectCountrySelects(id, $("select#resort").val(), page.countryResorts);
    });
    
    // vybrani optionu v OrderForm - resort
    $("select#resort").change( function() {
        var id = $(this).val();
        lib.selectCountrySelects($("select#country").val(), id, page.countryResorts);
    });
    
    // mandatory u jmena pri vybrani zavazne objednavky
    $("select#orderLevel").change( function() {
        $(this).parent().parent().parent().find("label[for=name]").removeClass("mandatory");
        var id = $(this).val();
//        alert(id);
        if(id == 1) {
            $(this).parent().parent().parent().find("label[for=name]").addClass("mandatory");
        }
    });
    
}