    function show(param) {
            $("#"+param).show("slow");
    }

    function hide(param) {
        $("#"+param).hide("slow");
    }

function buildAlert(type, data){
    $(document).ready(function() {
        if( $('#alerts').is(':visible') ) {
            $("#alerts").hide();
        }
        $("#alerts").html("<div class='"+type+"' style='display: none'>"+data+"</div>");
        $("#alerts div").show();
        $("#alerts").fadeIn("slow");

    });
}

$(document).ready(function() {
    $("input.hint").bind("click",function(){
        var title= $(this).attr('title');
    });
});

$(document).ready(function() {
    $(".email").blur(function(){
        buildAlert("checking_email","Kontrolujem");
        $.ajax({
                url: 'http://www.suchno.sk/registracia/check_email',
                type : 'POST',
                dataType : 'json',
                data: ({email : this.value}),
                success : function(data){
                    if (data.error===false) {
                        buildAlert("checking_email_ok",data.msg);
                    } else {
                        buildAlert("checking_email_zly",data.msg);
                    }
                    
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    alert("error");
                }

            });
    });
});

// Partneri img js
$(document).ready(function() {

	$("div.partneri").hover(function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the &lt;a&gt; tag
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Fade the image to 0
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to 1
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});

});

// Cas a datum na stranke
function showTime(){
    var Digital=new Date()
    var hours=Digital.getHours()
    var minutes=Digital.getMinutes()
    var seconds=Digital.getSeconds()
    var year=Digital.getYear()
    if (year < 1000)
        year+=1900
    var day=Digital.getDay()
    var month=Digital.getMonth()
    var daym=Digital.getDate()
    //if (daym<10)     daym="0"+daym
    if (minutes<=9)
        minutes="0"+minutes
    if (seconds<=9)
        seconds="0"+seconds

	if( window.document.getElementById("cas") != null ){
		window.document.getElementById("cas").innerHTML=hours+":"+minutes+":"+seconds;
	}
	if( window.document.getElementById("datum") != null ){
		month++;
		window.document.getElementById("datum").innerHTML=daym+"."+month+"."+year;
	}
}

//Tooltip
$(document).ready(function() {
    $(".tooltip").tipTip();
});


//Highslide
    hs.graphicsDir = 'http://suchno.sk/images/highslide/';
    hs.align = 'center';
    hs.transitions = ['expand', 'crossfade'];
    hs.wrapperClassName = 'dark borderless floating-caption';
    hs.fadeInOut = true;
    hs.dimmingOpacity = .75;
    hs.registerOverlay({
            html: '<div class="closebutton" onclick="return hs.close(this)" title="Zavrieť"></div>',
            position: 'top right',
            fade: 2 // fading the semi-transparent overlay looks bad in IE
    });

    // Add the controlbar
    if (hs.addSlideshow) hs.addSlideshow({
            //slideshowGroup: 'group1',
            interval: 5000,
            repeat: false,
            useControls: true,
            fixedControls: 'fit',
            overlayOptions: {
                    opacity: .6,
                    position: 'bottom center',
                    hideOnMouseOut: true
            }
    });

//JCAROUSEL
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 3,
	wrap: 'circular',
        scroll: 1,
        initCallback: mycarousel_initCallback
    });
});

// vyhladavanie
        var time = 0;
        var t;
        var filtering = 0;
        var use_time = 700;
$(document).ready(function(){
        $("input[type=text].filter").bind('keyup input', function() {
                var value = this.value;
                time = 0;
                if(value.length<1) {
                    $("#tu").hide();
                } else {
                    if(!filtering){
                      filtering = 1;
                      timedCount();
                      $("#tu").hide();
                      $(".vyhladavanie_running").show();
                    }
                }
            });


   $("#searchbox").bind("submit",function() {
    return false;
    })

});

    function timedCount(){
        time = time+100;
        t = setTimeout("timedCount()", 100);
        if(time==use_time){
            useFilter();
            clearTimeout(t);
            filtering = 0;
        }
    }



    function useFilter(){
            $.ajax({
                type : 'POST',
                url: 'http://www.suchno.sk/databaza/result',
                dataType : 'json',
                data :   $("form").serialize(),
                success : function(data){
                        $("#tu").css("display","none");
                        $("#tu").html(data.result);
                        $(".vyhladavanie_running").hide();
                        $("#tu").slideDown("slow");
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                }
                
            });
    }
