$(document).ready(function(){
	
	
/*------------------------------------------------------------*/
/*	TOP MENU
/*------------------------------------------------------------*/
$("#header .menuBlock .menu ul li").each(function (i) {
	i = i+1;
	var x = $(this);
	x.hover(function(){
		x.find('.sub').stop(true, true).slideDown(200);
	},function(){
		x.find('.sub').stop(true, true).slideUp(200);
	});
});

/*------------------------------------------------------------*/
/*	LEFT MENU
/*------------------------------------------------------------*/
$("#left .menu ul li span").each(function (i) {
	i = i+1;
	var x = $(this);
	x.toggle(function(){
		$(this).addClass('act');
		x.next().slideDown('fast');
	},function(){
		$(this).removeClass('act');
		x.next().slideUp('fast');
	});
});

/*------------------------------------------------------------*/
/*	FANCYBOX
/*------------------------------------------------------------*/
$("a.fancy").fancybox();

/*------------------------------------------------------------*/
/*	FORMS
/*------------------------------------------------------------*/
$('form').jqTransform();

/*------------------------------------------------------------*/
/*	TABLE BIN
/*------------------------------------------------------------*/
$('#right .bin table tr:odd').addClass('colored');

/*------------------------------------------------------------*/
/*	CAROUSEL
/*------------------------------------------------------------*/
$(".mainSlider").jCarouselLite({
	btnNext: ".next",
	btnPrev: ".prev",
	visible: 3,
	scroll: 1,
	speed: 1000,
});	

/*------------------------------------------------------------*/
/*	SEARCHER
/*------------------------------------------------------------*/
$('.changer').hide();
$('#vol-0').show();
$('input[name="search2"]').click(function(){
	var selected = $(this).val(); 
	$('.changer').hide(); 
	$('#'+selected).show(); 
}); 

/*------------------------------------------------------------*/
/*	SERIES
/*------------------------------------------------------------*/
/*$("#left .series ul li").each(function (i) {
	i = i+1;
	var x = $(this);
	x.find('span').click(function(){
		$('span').not(x).removeClass('exp');
		$(this).addClass('exp');
		$('.box').not(x).slideUp(300);
		x.find('.box').slideDown(300);
	});
});*/

	$("a#single_image").fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack'
	});

/*------------------------------------------------------------*/
/*	SERIES
/*------------------------------------------------------------*/
$('.bookshelf').each(function(i){
	i = i++;
	var parent = $(this);
	var w;
	var newW;
	var h;
	var newH;
	var coordX;
	var coordY;
	parent.find('img').hover(function(){
		$(this).css('z-index','999');
		w = $(this).width();
		h = $(this).height();
		newW = (1.5*w);
		newH = (1.5*h);
		coordX = -(newW-w)/2;
		coordY = -(newH-h)/2;
		$(this).stop(true,false).animate({width:newW,height:newH,left:coordX,bottom:coordY}, 100);
	},function(){
	  	$(this).stop(false,false).animate({left:"0",bottom:"0",width:w,height:h}, 100).delay(100).css('z-index','1');
	});
});

/*
$('.bookshelf').hover(function(){
	$(this).find('img').stop(true,true).animate({width:"466px",height:"447px",left:"-77px",top:"0px"}, 800);
},function(){
	$(this).find('img').stop(true,true).animate({left:"0",top:"0",width:"311px",height:"298px"}, 800);
});
*/

/*
$('.bookshelf').hover(function(){
	$(this).find('img').stop(true,false).animate({width:"414px",height:"398px",left:"-51px",top:"0px"}, 800);
},function(){
	$(this).find('img').stop(true,false).animate({left:"0",top:"0",width:"311px",height:"298px"}, 800);
});
*/
/*---------------------------------------------------------------*/

/*------------------------------------------------------------*/
/*	SCROLL
/*------------------------------------------------------------*/
$(".scrollable").scrollable({circular: true});

});
