function setSliderAmmount(min, max) {
    if (min <= 20 && max >= 480) {
        jQuery("#amount").html('dowolna');
        jQuery("#proceMin").val(0);
        jQuery("#proceMax").val(999);
    } else if (max >= 480) {
        jQuery("#amount").html('od ' + min + 'zł w górę');
        jQuery("#proceMin").val(min);
        jQuery("#proceMax").val(999);
    } else if (min <= 20) {
        jQuery("#amount").html('do ' + max + 'zł');
        jQuery("#proceMin").val(0);
        jQuery("#proceMax").val(max);
    } else {
        jQuery("#amount").html('od ' + min + 'zł do ' + max + 'zł');
        jQuery("#proceMin").val(min);
        jQuery("#proceMax").val(max);
    } 
}
jQuery(document).ready(function(){
    jQuery(".colorboxPopup").colorbox({rel:'colorboxPopup'});
    jQuery("a.mb").colorbox({rel:'nofollow'});

	jQuery("#phrase_suggest").focus(function(){
		if(jQuery("#phrase_suggest").val() == 'Znajdź gadżet dla siebie'){
			jQuery("#phrase_suggest").val('');
		}
	});
	jQuery("#ordercommentmsg").focus(function(){
		if(jQuery("#ordercommentmsg").text() == 'Tu wpisz swoje uwagi do zamówienia...'){
			jQuery("#ordercommentmsg").text('');
		}
	});
    
    jQuery("#facebookWrapper").css("left", "-292px");
    jQuery("#facebookWrapper").hover(function(){
        jQuery("#facebookWrapper").stop(true).animate({left: '0'}, 1000);
        jQuery(this).addClass("zamknij");
    },
    function(){
        jQuery("#facebookWrapper").stop(true).animate({left: "-292px"}, 1000);
        jQuery(this).removeClass("zamknij");
    });
    var setMin = jQuery("#proceMin").val();
    var setMax = jQuery("#proceMax").val();
    if (!setMin || setMin <= 20) setMin = 20;
    if (!setMax || setMax >= 480) setMax = 480;
    jQuery("#priceSlider").slider({
        range: true,
        min: 0,
        max: 500,
        values: [setMin, setMax],
        slide: function(event, ui) {
            setSliderAmmount(ui.values[0], ui.values[1]);
        }
    });
    jQuery("#priceSlider a.ui-slider-handle:first").addClass('first').html('&gt;');
    jQuery("#priceSlider a.ui-slider-handle:last").addClass('last').html('&lt;');
    setSliderAmmount(jQuery('#priceSlider').slider('values', 0), jQuery('#priceSlider').slider('values', 1)); 
});
