$(document).ready(function(){

	// init FB buttons
	window.fbAsyncInit = function() {
	FB.init({status: true, cookie: true,
			 xfbml: true});
	};
	(function() {
	var e = document.createElement('script'); e.async = true;
	e.src = document.location.protocol +
	  '//connect.facebook.net/en_GB/all.js';
	document.getElementById('fb-root').appendChild(e);
	}());

	// okienko z fan boxem do facebooka
	$("[sideBar]").hover(function(){
		if ($(this).attr('Orginal')==undefined) {
			$(this).attr('Orginal', $(this).css('left'));			
		}
		$(this).stop(true, false).animate({left:"0"},"medium");
	},function(){
		$(this).stop(true, false).animate({left:$(this).attr('Orginal')},"medium");
	},500);

    /// pokaz jako kod na showAsCode
    $('[showAsCode]').click(function(){
		if ($(this).attr('showAsCode')==1) {
    		$(this).wrapInner('<pre/>');
			$(this).attr('showAsCode', 0);
		}
    });
    
    //// wysylanie formularza po wybraniu pliku przez uzytkownika
    $('#user_file').change(function(){
        $('#user_file_form').submit();
        $('#user_file_form_container').html('<img src="/img/wait.gif" alt=""/>');
    });
    
    //// wysylanie formularza po wybraniu pliku przez uzytkownika
    $('[last_file]').change(function(){
        $('#user_multi_file_form').submit();
        $('#user_file_form_container').html('<img src="/img/wait.gif" alt=""/>');
    });
    
    //// zaznaczenie calego linka
    $('#link_box').focus(function(){
        $('#link_box').select();
    });
    $('#link_box').click(function(){
        $('#link_box').select();
    });
    $('#link_box').mousedown(function(){
        $('#link_box').select();
    });
    
});


