/* funkce pro vyhledavani */

function onfindsubmit(form){
    return true;
}

var fAction = false;
function zmenAdresuOdkazu(form, el){
    if (fAction === false) fAction = form.action;
    form.action = fAction+'?q='+el.value;
}

function zobrazDiv(div_id){
    div = document.getElementById(div_id);
    if (div.style.display == 'block'){
        document.getElementById(div_id).style.display = 'none';
    }
    else {
        document.getElementById(div_id).style.display = 'block';
    }
    
}

function submitIfEnter(e, form_id, el){
    var unicode = GetKeyCode(e);
    var form = document.getElementById(form_id);
    if (unicode == 13){
        zmenAdresuOdkazu(form, el);
        form.submit();
    }
}

$(function() {
	$( "#slider-range" ).slider({
		range: true,
		min: 0,
		max: $( "#find_price_max" ).val(),
        step:10,
        animate: true,
		values: [ $( "#find_price_from" ).val(), $( "#find_price_to" ).val() ],
		slide: function( event, ui ) {
            $( "#find_price_from" ).val(ui.values[ 0 ]);
            $( "#find_price_to" ).val(ui.values[ 1 ]);
			$( "#find_price_title" ).html( 
                "Cena: " 
                + ui.values[ 0 ] + " Kč" 
                + " - " 
                + ui.values[ 1 ] + " Kč"
            );
		}
	});
	$( "#find_price_title" ).html( 
        "Cena: " 
        + $( "#find_price_from" ).val() + " Kč" 
        + " - " 
        + $( "#find_price_to" ).val() + " Kč"
    );
});



$(document).ready(function(){
    $('#podrobne').click(function(){
        $('#attributes').slideToggle(
            'slow',
            function(){// oncomplete
                session_set('show_finding', ($('#attributes').css('display')!='none'))
            }
        );
    });
});
