$(document).ready(function($)
{




	 
	 
	
	
	 
	});
	

	
	
function ustawZdjecie(carousel, state)
{
	var href = $("#mycarousel li:first a").attr('href');
	var cc = $("#mycarousel li:first").attr('jcarouselindex');
	window.count_items = $('.jcarousel-item').length;
   $('#graph_main').empty()
	$('#graph_main').append("<div class=\"graph_img\" style=\"background: url("+href+") no-repeat scroll center center transparent;\"><table><tbody><tr><td style=\"vertical-align: bottom; text-align: center; height: 359px; width: 600px; font-size: 16px; padding-bottom-: 1px;\">"+cc+"/"+count_items+"</td></tr></tbody></table></div>");
	
};

function mycarousel_initCallback(carousel) {
	var href = $("#mycarousel li:first a").attr('href');
	var cc = $("#mycarousel li:first").attr('jcarouselindex');
	active_item = cc;
	window.count_items = $('.jcarousel-item').length;
   $('#graph_main').empty()
	$('#graph_main').append("<div class=\"graph_img\" style=\"background: url("+href+") no-repeat scroll center center transparent;\"><table><tbody><tr><td style=\"vertical-align: bottom; text-align: center; height: 359px; width: 600px; font-size: 16px; padding-bottom-: 1px;\">"+cc+"/"+count_items+"</td></tr></tbody></table></div>").after("<div class=\"ab\"><a href=\"#\" class=\"ab prev_photo\"></a><a href=\"#\" class=\"ab next_photo\"></a></div>");
	
	
	
				$('[rel*=light]').click(function () {
					var href = $(this).attr('href');
					var cc = parseInt($(this).parent().attr('jcarouselindex'));
					active_item = cc;
						
					if(cc>0) cc = ((cc-1) % (count_items))+1;
					else 
						{
						cc = (cc-1) * -1;
						cc = ((cc-1) % (count_items))+1;
						cc = ((count_items-cc) % (count_items))+1;
						}
					
				   $('#graph_main').empty()
					$('#graph_main').append("<div class=\"graph_img\" style=\"background: url("+href+") no-repeat scroll center center transparent;\"><table><tbody><tr><td style=\"vertical-align: bottom; text-align: center; height: 359px; width: 600px; font-size: 16px; padding-bottom-: 1px;\">"+cc+"/"+count_items+"</td></tr></tbody></table></div>");

					return false;
	    		});


		    jQuery('.next_photo').bind('click', function() {
			     if (carousel.locked || carousel.animating )
				 	{
					
					}
				 else
				 	{
					carousel.options.scroll = 1;
		         carousel.next();
				   carousel.options.scroll = 3;	
					active_item++;	
				   var href = $(".jcarousel-item-"+active_item+" a").attr('href');	
				   var cc = $(".jcarousel-item-"+active_item).attr('jcarouselindex');
				   if(cc>0) cc = ((cc-1) % (count_items))+1;	
					else 
						{
						cc = (cc-1) * -1;
						cc = ((cc-1) % (count_items))+1;
						cc = ((count_items-cc) % (count_items))+1;
						}
				
			   	$('#graph_main').empty()
					$('#graph_main').append("<div class=\"graph_img\" style=\"background: url("+href+") no-repeat scroll center center transparent;\"><table><tbody><tr><td style=\"vertical-align: bottom; text-align: center; height: 359px; width: 600px; font-size: 16px; padding-bottom-: 1px;\">"+cc+"/"+count_items+"</td></tr></tbody></table></div>");
					}
				
					
		        return false;
		    });

		    jQuery('.prev_photo').bind('click', function() {
			 	  
				 if (carousel.locked || carousel.animating )
				 	{
					
					}
				 else
				 	{
					carousel.options.scroll = 1;
		         carousel.prev();
				   carousel.options.scroll = 3;	
					active_item--;	
				   var href = $(".jcarousel-item-"+active_item+" a").attr('href');	
				   var cc = $(".jcarousel-item-"+active_item).attr('jcarouselindex');
				   if(cc>0) cc = ((cc-1) % (count_items))+1;	
					else 
						{
						cc = (cc-1) * -1;
						cc = ((cc-1) % (count_items))+1;
						cc = ((count_items-cc) % (count_items))+1;
						}
				
			   	$('#graph_main').empty()
					$('#graph_main').append("<div class=\"graph_img\" style=\"background: url("+href+") no-repeat scroll center center transparent;\"><table><tbody><tr><td style=\"vertical-align: bottom; text-align: center; height: 359px; width: 600px; font-size: 16px; padding-bottom-: 1px;\">"+cc+"/"+count_items+"</td></tr></tbody></table></div>");
					}
					
				  
					
		        return false;
		    });
		}; 

