/*** SOUBOR OBECNYCH FUNKCIONALIT ***/
$(function(){

	
	/*
	 * ScrollToElement 1.0
	 * Copyright (c) 2009 Lauri Huovila, Neovica Oy
	 *  lauri.huovila@neovica.fi
	 *  http://www.neovica.fi
	 *  
	 * Dual licensed under the MIT and GPL licenses.
	 */

	(function($) {
	    $.scrollToElement = function( $element, speed ) {

	        speed = speed || 750;

	        $("html, body").animate({
	            scrollTop: $element.offset().top,
	            scrollLeft: $element.offset().left
	        }, speed);
	        return $element;
	    };

	    $.fn.scrollTo = function( speed ) {
	        speed = speed || "normal";
	        return $.scrollToElement( this, speed );
	    };
	})(jQuery);	
	
	
	

    // Vymazani vyhledavaciho policka po kliknuti
    function populateElement(selector, defvalue){
        $(selector).each(function() {
            if($.trim(this.value) == ''){
                this.value = defvalue;
            }
        });
        
        $(selector).focus(function(){
            if(this.value == defvalue){
                this.value = '';
            }
        });
        
        $(selector).blur(function(){
            if($.trim(this.value) == ''){
                this.value = defvalue;
            }
        });
    }
    
    
    
/*
------------------------------------------------------------------------------
*/    
	
	
	


// Inicializace FancyBox
    $("a[rel^='lightbox']").fancybox();
    //$("a[rel^='lightbox']").fancybox({'type' : 'image'}); // tento zapis by mel osetrit URL na image ve tvaru "image.php?img=123"  

    
// Externi odkazy - otvira do externiho okna
    $.expr[':'].external = function(obj){
        return !obj.href.match(/^mailto\:/) && !obj.href.match(/^javascript\:/) && (obj.hostname != location.hostname);     // vybereme pouze externi odkazy
    };
    
    //$('a:external, a.newWindow') // vyhleda vsechny externi odkazy
    $('#main-content a:external:not(:has(img)), #main-content a.newWindow:not(:has(img))') //  vyhleda vsechny externi odkazy vyjma tech, ktere odkazuji pomoci IMG
        .addClass('link-external')
        //.append('<span class="hidden"> (externí odkaz)</span>')     // indikator externiho odkazu pro slepce
        .click(function(){
            window.open(this.href);
            return false;
    });

    
    // pomale odscrollovani nahoru
    $('a[href=#top]').click(function(){
    	$('html, body').animate({scrollTop:0}, 1000);
    	return false;
    });
     



//ukonceni fce document ready
});
