 function togglePaySms(sprice) {     //alert(sprice);     if(sprice > 8) {         $('#paySms').removeAttr('checked').val('0').hide();         $('#paySms-label').hide();              }     else {         $('#paySms').show();         $('#paySms-label').show();     } } $().ready(function() {    /* flash message close */    $('#flashMessage .close').click(function() {         $('#flashMessage').fadeOut(400);    });    /*Rejestracja uzytkownika*/    $('#extraElements').hide();    if($('#dealer').val() == 1) {         $('#extraElements').show();         $('#is_dealer').attr('checked', true);    }        $('#is_dealer').click(function() {            if($(this).is(':checked')) {                $('#dealer').val('1');                $('#extraElements').slideDown('fast');            }            else {                $('#dealer').val('0');                $('#extraElements').slideUp('fast');            }        });	$('#offers tbody tr').mouseover(function(){		$(this).addClass('hover');	}).mouseout(function(){		$(this).removeClass('hover');	});	$('#offers tbody tr:even').addClass('alt');        /*dodawanie ogloszenia - wybor kategorii*/        var status = false;        var lastId = false;        $('#selectCategory0').click(            function() {                var service= $('#selectCategory0 :selected:first').val();                $('#selectCategory1').html('');                $('#selectCategory2').html('');                $('#submitCategoryId').attr('disabled', 'disabled');                $.post(baseUrl+"ajax/get-categories", {categoryId: service},                    function(data){                        $('#selectCategory1').html(data);                    });                    return false;            }        );        $('#selectCategory1').click(            function() {                var service= $('#selectCategory1 :selected:first').val();                $('#selectCategory2').html('');                $('#submitCategoryId').attr('disabled', 'disabled');                $.post(baseUrl+"ajax/get-categories", {categoryId: service},                    function(data){                        if(data == 0) {                            status = true;                            lastId = service;                            $('#categoryIdPool').val(service);                            $('#submitCategoryId').removeAttr('disabled');                        }                        else {                            $('#submitCategoryId').attr('disabled', 'disabled');                            $('#selectCategory2').html(data);                        }                    });                    return false;            }        );        $('#selectCategory2').click(            function() {                var service= $('#selectCategory2 :selected:first').val();                $('#submitCategoryId').attr('disabled');                $.post(baseUrl+"ajax/get-categories", {categoryId: service},                    function(data){                        if(data == 0) {                            status = true;                            lastId = service;                            $('#categoryIdPool').val(service);                            $('#submitCategoryId').removeAttr('disabled', 'disabled');                                                    }                        else {                            $('#submitCategoryId').attr('disabled', 'disabled');                            $('#selectCategory2').html(data);                        }                                            });                    return false;            }        );        /* wyszukiwanie - wybor kategorii*/        var statusSearch = false;        var lastIdSearch = false;        $('#selectCategory0Search').click(            function() {                var service= $('#selectCategory0Search :selected:first').val();                                $('#selectCategory1Search').html('');                $('#selectCategory2Search').html('');                $('#submitCategoryId').attr('disabled', 'disabled');                $.post(baseUrl+"ajax/get-categories", {categoryId: service},                    function(data){                        $('#selectCategory1Search').html(data);                                               $('#categoryIdPool').val(service);                    });                    return false;            }        );        $('#selectCategory1Search').click(            function() {                var service= $('#selectCategory1Search :selected:first').val();                $('#selectCategory2Search').html('');                $('#submitCategoryId').attr('disabled', 'disabled');                $.post(baseUrl+"ajax/get-categories", {categoryId: service},                    function(data){                        if(data == 0) {                            statusSearch = true;                            lastIdSearch = service;                            $('#categoryIdPool').val(service);                            $('#submitCategoryId').removeAttr('disabled', 'disabled');                        }                        else {                                                       $('#selectCategory2Search').html(data);                            $('#submitCategoryId').removeAttr('disabled', 'disabled');                            $('#categoryIdPool').val(service);                        }                    });                    return false;            }        );        $('#selectCategory2Search').click(            function() {                var service= $('#selectCategory2Search :selected:first').val();                $('#submitCategoryId').attr('disabled');                $.post(baseUrl+"ajax/get-categories", {categoryId: service},                    function(data){                        if(data == 0) {                            statusSearch = true;                            lastIdSearch = service;                            $('#categoryIdPool').val(service);                            $('#submitCategoryId').removeAttr('disabled', 'disabled');                        }                        else {                                                       $('#selectCategory2Search').html(data);                            $('#submitCategoryId').removeAttr('disabled', 'disabled');                            $('#categoryIdPool').val(service);                        }                    });                    return false;            }        );        /* Oliczanie ceny ogłoszenia */        var price = $('#price').text();        if(price > 9) {            togglePaySms(price);        }                $('#paySms').click(function() {            if($(this).is(':checked')) {                if($('#mark').is(':checked') && price < 8) {                    price = parseInt(price) + 1;                }                else if(price < 8) {                    price = parseInt(price) + 1;                }                $('#price').text(price);            }            else {                if($('#mark').is(':checked') && price < 8) {                    price = parseInt(price) - 1;                }                else if(price < 8) {                    price = parseInt(price) -1;                }                $('#price').text(price);            }        });        //wyroznienie        $('#mark').click(function() {            if($(this).is(':checked')) {                if($('#paySms').is(':checked') && price < 8) {                                     price = parseInt(price) + 3;                }                else {                    price = parseInt(price) + 3;                }                $('#price').text(price);            }            else {                if($('#paySms').is(':checked') && price < 8) {                    price = parseInt(price) - 3;                }                else {                    price = parseInt(price) - 3;                }                $('#price').text(price);            }            togglePaySms(price);        });        //pierwsza strona kategorii        $('#listFeatured').click(function() {            if($(this).is(':checked')) {                                if($('#paySms').is(':checked')) {                    price = parseInt(price) - 1;                    if($('#mark').is(':checked')) {                        price = parseInt(price) - 3;                    }                                    }                price = parseInt(price) + 5;                                $('#price').text(price);            }            else {               /*if($('#paySms').is(':checked') && price < 8) {                    price = parseInt(price) - 4;                }                else {                    price = parseInt(price) - 3;                }*/                price = parseInt(price) - 5;                $('#price').text(price);            }            togglePaySms(price);        });        //pierwsza strona serwisu        $('#promoItem').click(function() {            if($(this).is(':checked')) {                if($('#paySms').is(':checked')) {                    price = parseInt(price) -1 ;                }                               price = parseInt(price) + 20;                $('#price').text(price);            }            else {                price = parseInt(price) - 20;                $('#price').text(price);            }            togglePaySms(price);        });        //na rok        $('#payYear').click(function() {            if($(this).is(':checked')) {                               price = parseInt(price) + 90;                $('#price').text(price);            }            else {                price = parseInt(price) - 90;                $('#price').text(price);            }            togglePaySms(price);        });        });
