function setRightBoxTabs() {
	// boxes with id 'fbrk_right_tab_box_*'
	var $box_with_tabs=$('div[id^="fbrk_right_tab_box"]');
	$box_with_tabs.each(function() {
		// tabs in current box
		var $tabs=$('.tabs div[class^="tab"]',this);
		var tabsLast=$tabs.length-1;
		// contents in current box
		var $contents=$('.keretes_box',this).find('div.content');
		$tabs.each(function(tabsIndex) {
			//$span=$('span',this);
			// $span.unbind('click');
			$('span',this).bind('click',function() {
				// hide all contents
				$contents.each(function(){
					$(this).hide();
				});
				// show current content
				$($contents[tabsIndex]).show();
				// set tabs' classes
				$tabs.each(function(i) {
					var currentClass;
					if (i==tabsIndex) {
						currentClass='tab akt';
					} else if (i==tabsLast || i==tabsIndex-1) {
						currentClass='tab';
					} else {
						currentClass='tab elv';
					}
					$(this).removeClass().addClass(currentClass);
				});
			});
		});
	});
}	// EOF setRightBoxTabs

function forward_article_gallery(forward_page_header,doit,forward_page_title,ok_title,ok_message) {
	// popup megnevezése
	$('#forward_page_header').text(forward_page_header);
	// cikk címe
	$('#forward_page_title').text(forward_page_title);
	// popup bezárása
	$('#close_forward_window').click(function(e) {
		e.preventDefault();
		$('#errorMessageBox').hide();
		$('#okMessageBox').hide();
		$('#forward_article_and_gallery').hide();
	});
	// 'küldje tovább' link
	$('#forward_article').click(function(e) {
		e.preventDefault();
		$('#errorMessageBox').hide();
		$('#okMessageBox').hide();
		$('#forward_article_and_gallery').show();
	});
	//	elküldés
	$('#submitForwardArticle').click(function(e) {
		e.preventDefault();
		$.ajax({
			type: 'get',
			url: '/.scripts/ajax_forward_article.php',
			data: 'doit='+doit+'&'+$('#formForwardArticle').serialize(),
			dataType: 'html',
			success: function(responseHtml) {
				if ($(responseHtml+' li').length!=0) {		// error
					$('#errorMessageBox ul').html(responseHtml);
					$('#errorMessageBox').show();
					$('#close_error_message_box').click(function(e) {
						e.preventDefault();
						$('#errorMessageBox').hide();
					});						
				} else {
					$('#forward_article_and_gallery').hide();
					$('#okMessageBox_title').text(ok_title);
					$('#okMessageBox_message').text(ok_message);
					$('#okMessageBox').show();
					$('#close_ok_message_box').click(function(e) {
						e.preventDefault();
						$('#okMessageBox').hide();
					});						
				}
			}	
		});
	});
}	// EOF forward_article_gallery

// háttér képek lapozásvezérlés
function setDisplayHatter(picture_idx_first,diff) {
	$('.slide_box',$('#footer_slide')).each(function(i) {
		if (i < picture_idx_first || i > (picture_idx_first+diff+1)) {
			$(this).hide();
		} else {
			$(this).show();
		}
	});
}

function pagerHatter(pictureMaxCount,pictureVisibleCount) {
	if (pictureMaxCount > pictureVisibleCount) {
		$('#hatter_slide_elore').show();
	}
	var picture_idx_first=0;
	var diff=pictureMaxCount-pictureVisibleCount;
	// balra lapozás
	$('#hatter_slide_vissza').click(function(e) {
		e.preventDefault();
		if (picture_idx_first > 0) {
			picture_idx_first--;
		}
		if (picture_idx_first==0) {
			//$('#hatter_slide_vissza').hide();
			$('#hatter_slide_vissza').removeClass('slide_vissza link').addClass('slide_vissza_no link');
		}
		if (picture_idx_first > 0 && picture_idx_first < diff) {
			$('#hatter_slide_elore').show();
		}
		setDisplayHatter(picture_idx_first,diff);
	});
	// jobbra lapozás
	$('#hatter_slide_elore').click(function(e) {
		e.preventDefault();
		if (picture_idx_first < (diff+1)) {
			picture_idx_first++;
		}
		if (picture_idx_first==diff) {
			$('#hatter_slide_elore').hide();
		}
		if (picture_idx_first!=0) {
			//$('#hatter_slide_vissza').show();
			$('#hatter_slide_vissza').removeClass('slide_vissza_no link').addClass('slide_vissza link');
		}
		setDisplayHatter(picture_idx_first,diff);
	});
}	// EOF hatter_pager


$(document).ready(function(){
	$('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
	$('div.article_left a img').each(function(){
		var oImg=$(this);
		oImg.css("display","block");
		var oA=oImg.closest("a");
		oA.css("display","block");
		oA.css("position","relative");
		oA.css("width",oImg.css("width"));
		oImg.after('<span class="iconZoom"> </span>');
	});	
});

