// ColorBox init
$(function(){
	var config={
		slideshowStart:	"spustit prezentaci",	//Text for the slideshow start button.
		slideshowStop:	"zastavit prezentaci",	//Text for the slideshow stop button
		current:		"{current} z {total}",	//Text format for the content group / gallery count. {current} and {total} are detected and replaced with actual numbers while ColorBox runs.
		previous:		"předchozí",			//Text for the previous button in a shared relation group (same values for 'rel' attribute).
		next:			"další",				//Text for the next button in a shared relation group (same values for 'rel' attribute).
		close:			"zavřít",				//Text for the close button. The 'Esc' key will also close ColorBox.
	};
	
	// 
	$("a[rel='lightbox']").colorbox(config);
	
	var groups =[];
	var arr =$("a[rel^='lightbox']");
	for(var i=0;i<arr.length;i++)
	{
		var result=$(arr[i]).attr('rel').match(/^lightbox\[(\w+)\]$/);
		if(result){
			var group=result[1];
			if($.inArray(group, groups)==-1){
					groups.push(group);
			}
		}
	}
	$.each(groups, function(key, value) { 
		$("a[rel='lightbox["+value+"]']")
		.colorbox($.extend({
			slideshow:true
		}, config));
	});
	
	// popupbanner
	if($('#popupbanner').length){
		$.fn.colorbox($.extend({
				inline:true,
				href:"#popupbanner"
			}, config));
	}
	
	$("a[rel='flash']").colorbox($.extend({
				iframe:true,
				innerWidth:425,
				innerHeight:344
			}, config));
});