// lightbox: takes a link or a list of links
function lightbox(el, no_download){
	el.lightBox({
		imageLoading: base_url + 'images/lightbox/lightbox-ico-loading.gif',
		imageBtnPrev: base_url + 'images/lightbox/lightbox-btn-prev.gif',
		imageBtnNext: base_url + 'images/lightbox/lightbox-btn-next.gif',
		imageBtnClose: base_url + 'images/lightbox/lightbox-btn-close.gif',
		imageBlank: base_url + 'images/lightbox/lightbox-blank.gif',
		fixedNavigation: true,
		no_download: no_download
	});
}

$(document).ready(function() {
	
	// lightbox	
	$('.show').each(function(){
		if($(this).is('a'))
		{
			lightbox($(this), $(this).find('img').hasClass('no_download'));
		}
		else
		{
			lightbox($(this).find('a'));
		}
	});

	// tabs - activation
	$('#tabs').tabs({});
	
	// tabs - prolongate line to the end of the container
	$('#tabs > ul').each(function(){
		var width = 0;
		$(this).find('li').each(function(){
			width += $(this).outerWidth();
		});
		
		var difference = $(this).width() - width;
		var last_li = $(this).find('li:last');
		last_li.width(last_li.width() + difference);
	});
	
	// nav2 - enlarge links to make them fit perfectly
	$('.nav2').each(function(){
		var width = 0;
		$(this).find('li').each(function(){
			width += $(this).outerWidth(true);
		});
		
		var difference = $(this).outerWidth() - width;
		
		// fix for Firefox 3.0 exclusively (works fine in FF 2)
		if($.browser.mozilla && $.browser.version.substr(0,5) == "1.9.0")
		{
			difference -= 1;
		}
		
		for (var i=0; i < difference; i++)
		{
			var a = $(this).find('li:eq(0) a');
			a.width(a.width() + 1);
		}
	});
	
	// disable right click
	$('.no_download').bind('contextmenu', function(e){
		e.preventDefault();
	});
	
	// popup links
	$("a[rel='external']").click(function(){
	  this.target = "_blank";
	});
	
});


