function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}



/* video img slideshow: */ 
/* video img slideshow: */ 
var thumb_next,thumb_el,thumb_timer,thumb_gal;
//var thumb_baseurl = "http://thi.uloz.to/";
function video_thumb_start(el,g){
    thumb_gal=g;
    thumb_next=1;
    thumb_el=el;
        // set image url
        for(i=0; i<=9; i++){
            var im=new Image();
//            im.src=thumb_baseurl+thumb_gal+"."+i+".jpg";
            im.src=thumb_gal+"."+i+".jpg";
            thumb_el.src = im.src;
        }
    video_thumb_image();
}
function video_thumb_stop(){
    if(thumb_timer!=null){
        clearTimeout(thumb_timer);
        thumb_timer=null;
    }
    var im=new Image();
    im.src=thumb_gal+".0.jpg"; 
    thumb_el.src = im.src;
    $(thumb_el).css( "background","url('"+im.src+"')" );
}

function video_thumb_image(){    
    var im=new Image();
    im.src=thumb_gal+"."+thumb_next+".jpg";
    thumb_next=(thumb_next)+1;
    if(thumb_next==9){ thumb_next = 0; }
    thumb_el.src=im.src;
    $(thumb_el).css( "background","url('"+im.src+"')" );
    thumb_timer=setTimeout("video_thumb_image()",500);
}
/* /video img slideshow: */ 
$('#lang_select').live("mouseover", function(){
     $('.langs').show();
     //alert(txt+smajl);
});
 
$('#lang_select').live("mouseout", function(){
     $('.langs').hide();
}); 

$('#chosen').live("click", function(e){
	e.preventDefault();
}); 
$('#lang_select_hp').live("mouseover", function(){
     $('.langs').show();
     //alert(txt+smajl);
});
 
$('#lang_select_hp').live("mouseout", function(){
     $('.langs').hide();
}); 


$('.smile').live("click", function(){
     var smajl = $(this).attr("title");
     var txt = $('#frmcommentsForm-komentar').val();
     $('#frmcommentsForm-komentar').val(txt+' '+smajl);
     $('#frmcommentsForm-komentar').focus();
     //alert(txt+smajl);
}); 

$('.click').live("click", function(e){
	e.preventDefault();
	var visible = $(this).attr('name');
	$('.click').removeClass('active');
	$(this).addClass('active');
	$('.vyzvaRychla').hide();
	$('.vyzvaDoklad').hide();
	$('.'+visible).show();
});

$('.show').live("click", function(e){
	e.preventDefault();
	if($(this).text()=='+')
	{
		$(this).text('-');
	}
	else
	{
		$(this).text('+');
	}
	var trida = $(this).attr('name');
	$(this).nextAll('.'+trida).toggle();
	//alert($(this).attr('name'));
}); 

function showDialog(id) {
		
		//Get the A tag
		//var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').show();	
		//$('#mask').show();	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).show();
		
		$(id).draggable({ handle:'.title' });
	}


$(document).ready(function() {	

	$('#mask').fadeTo("slow",0.5);	
	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(500);	
		$('#mask').fadeTo("slow",0.5);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(1000); 
		
		$(id).draggable({ handle:'.title' });
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});
});

