﻿$(document).ready(function(){

	$("a[rel=fancybox]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});


		var n= ($(".slider").width())/175;
		n = n - (n%1);
		
		$(".sl-ul").jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev",
			speed: 500,
			circular: false,
			visible: n
		});

	
	$(window).resize( function() {  
			
		var ww = $(window).width();
		
		if (ww < 1042) {
			$('.slider').css('width', 703 + 'px' ); 
			var n3= ($(".slider").width())/175;
			n3 = n3 - (n3%1);
		
			$(".sl-ul").jCarouselLite({
				visible: n3
			});
		}

		else {
			var wsl = ww - 307;
			$('.slider').css('width', wsl );
			
			var n2= ($(".slider").width())/175;
			n2 = n2 - (n2%1);
			
			$(".sl-ul").jCarouselLite({
				visible: n2
			});
		}
			
		$("a[rel=fancybox]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});
		 

	}); 

	
	/*$('.menu_column .menu li').hover(
		function(){
			$(this).css('z-index',70);
			$(this).parent('ul').parent('.menu').parent('.menu_column').append('<a href="" class="width"></a>');
			var title = $(this).find('a').attr('title');
			$(this).parent('ul').parent('.menu').parent('.menu_column').find('.width').html(title);
			var width = $(this).parent('ul').parent('.menu').parent('.menu_column').find('.width').innerWidth();
			$(this).parent('ul').parent('.menu').parent('.menu_column').find('.width').remove(); 
			$(this).append('<a href="" class="help"></a>');
			var href = $(this).find('a').attr('href');
			var title = $(this).find('a').attr('title');
			$(this).find('.help').attr('href', href);
			$(this).find('.help').html(title);
			$(this).find('.help').css('width',width);
		},
		function(){
			$(this).find('.help').remove();
			$(this).css('z-index',60);
		}
	);*/
	$('a.menu_tooltip:not([imgsrc=""])').tooltip({
		delay: 0,
		opacity: 1.0,
		showURL: false,
		bodyHandler: function() { return $('<img />').attr('src', $(this).attr('imgsrc')); }
	});	
	
});	

