$(document).ready(function() {    /* fadeIn IE fix    */    var i;    for (i in document.images) {        if (document.images[i].src) {            var imgSrc = document.images[i].src;            if (imgSrc.substr(imgSrc.length-4) === '.png' || imgSrc.substr(imgSrc.length-4) === '.PNG') {                document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + imgSrc + "')";            }        }    }    /* Intro animation */    $("#fadeIn").fadeIn(2000);    $("#autek").fadeIn(1000);    $("#autek").fadeOut(100);    $("#autek").fadeIn(100);    $("#autek").fadeOut(500);    $("#autek").fadeIn(100);    /* top nav animation */    $('div.fade').hover(function() {        if(!$(this).hasClass('animated')) {            $(this).children('div:first').dequeue().stop().fadeIn(250,0);        }    }, function() {        $(this).addClass('animated');        $(this).children('div:first').fadeOut(250, function() {            $(this).parent().removeClass('animated').dequeue();        });    }    );    /* Rollover images with _on/_off suffix */    $(".rollover").hover( function() {        this.src = this.src.replace("_off","_on");    }, function() {        this.src = this.src.replace("_on","_off");    }    );    $('li.one').mouseenter(function() {        if(!$(this).children('ul.submenu').hasClass('animated')) {            $(this).children('ul.submenu').dequeue().slideDown(1000);        }    });    $('ul.submenu').mouseover(function() {        if($(this).hasClass('animated')) {            $(this).stop(true,true).show();        }    });    $('li.one').mouseleave(function() {        $(this).children('ul.submenu').addClass('animated').slideUp(1000,function() {            $(this).removeClass('animated').dequeue();        });    });    /* gallery */    $('.show_photos').cycle({        fx: 'fade'    });    $("a[rel='fSize']").colorbox({        transition:"fade",        slideshow:true,        slideshowStart:"Rozpocznij pokaz",        slideshowStop:"Zakończ pokaz",        slideshowSpeed:"4000",        loop:"true",        returnFocus:false,        scalePhotos:true,        current:"Zdjęcie {current} z {total}",        maxHeight:"600px",        initialHeight:"600px"    });    /* Zapisy on-line */    $("#zapisy").validate({        rules: {             imiona: {                required: true,                minlength: 3            },            nazwisko: {                required: true,                minlength: 3            },            email: {                required: true,                email: true            },            dowod: {                required: true,                minlength: 9,                maxlength: 9            },            telefon: {                required: true            },            pesel: {                required: true,                digits: true,                number: true,                minlength: 11,                maxlength: 11            },            poczta: {                required: true            },            miejscowosc: {                required: true            },            nrbudynku: {                required: true            },            kodpocztowy: {                required: true,                minlength: 6            },            'kursy[]': {                required: true            }        },        errorPlacement: function(element,errorClass) {},        highlight: function(element, errorClass, validClass) {            $(element).parent().prev("label").removeClass("validMy").addClass("errorMy")            .children("img").attr("style","display: inline");            $(element).parent().parent().prev("div.checkboxLabel").addClass("errorMy").            children("img").attr("style","display: block");        },        unhighlight: function(element, errorClass, validClass) {            $(element).parent().prev("label").removeClass("errorMy").addClass("validMy")            .children("img").removeAttr("style");            $(element).parent().parent().prev("div.checkboxLabel").removeClass("errorMy").            children("img").removeAttr("style");        },        submitHandler: function(form) {            $('.mainContent').load('includes/load.inc.php');            $.post('includes/process.inc.php',$('#zapisy').serialize(),function(form) {                $('#bodyContent').children('.mainContent').html(form);            });        }    });    /**     * Ograniczenia długości znaków     */    $("form input[name=pesel]").keyup(function() {        var limit = 11;        if($(this).val().length > limit) {            var new_value = $(this).val().substring(0, limit);            $(this).val(new_value);        }    });    $("form input[name=dowod]").keyup(function() {        var limit = 9;        if($(this).val().length > limit) {            var new_value = $(this).val().substring(0, limit);            $(this).val(new_value);        }    });    $("form input[name=pesel]").keypress(function(e)  {        //if the letter is not digit then display error and don't type anything        if(e.which!=45 && e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))        {            return false;        }	    });    $("form input[name=telefon]").keypress(function(e)  {        //if the letter is not digit then display error and don't type anything        if(e.which!=43 && e.which!=9 && e.which!=11 && e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))        {            return false;        }	    });    $("form input[name=kodpocztowy]").keypress(function() {        var limit = 5;        if($(this).val().length > limit) {            var new_value = $(this).val().substring(0, limit);            $(this).val(new_value);        }    });    $("form input[name=kodpocztowy]").keypress(function(e)  {        //if the letter is not digit then display error and don't type anything        if(e.which!=45 && e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))        {            return false;        }	    });    /**     * Submit rollover     */    $("form input[type=submit]").hover( function() {        $(this).removeClass("on").addClass("off");    }, function() {        $(this).removeClass("off").addClass("on");    }    );    /**     * Checkbox stylish     */    $('input[type=checkbox],input[type=radio]').prettyCheckboxes({        display: 'list',        checkboxWidth: 16,        checkboxHeight: 16    });    $('.scrollContainer').jScrollPane({        showArrows: true,        horizontalGutter: 20,        verticalDragMaxHeight: 50,        hideFocus: true    });});
