// ProCeli - general.js


$(document).ready(function() {


	// maintain selected
	// Language	
	$("ul#language li a.trig").mouseover(function () { //When trigger is clicked...  
		//Following events are applied to the subnav itself (moving subnav up and down)  
		$(this).parent().find("ul.panel").slideDown('fast').show(); //Drop down the subnav on click  
		$(this).parent().hover(function () {}, function () {
			$(this).parent().find("ul.panel").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
		});
	});		
	$("ul#language li ul.panel").mouseenter(function(e) {
		$(this).parent("li").addClass('hover');
	}).mouseleave(function(e) {
		$(this).parent("li").removeClass('hover');
	});
	// Search filters	
	$("form #filtros a.abre").mouseover(function () { //When trigger is clicked...  
		//Following events are applied to the subnav itself (moving subnav up and down)  
		$(this).parent().find("ul#options").slideDown('fast').show(); //Drop down the subnav on click  
		$(this).parent().hover(function () {}, function () {
			$(this).parent().find("ul#options").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
		});
	});		
	$("form #filtros ul#options").mouseenter(function(e) {
		$(this).parent("div").addClass('hover');
	}).mouseleave(function(e) {
		$(this).parent("div").removeClass('hover');
	});
	// NAV	
	$("#nav-top ul li a.principal").mouseenter(function () { //When trigger is clicked...  
		//Following events are applied to the subnav itself (moving subnav up and down)  
		$(this).parent().find(".subBot").slideDown('fast').show(); //Drop down the subnav on click  
		$(this).parent().hover(function () {}, function () {
			$(this).parent().find(".subBot").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
		});
	});		
	$("#nav-top ul li .subBot").mouseenter(function(e) {
		$(this).parent("li").addClass('hover');
	}).mouseleave(function(e) {
		$(this).parent("li").removeClass('hover');
	});
	
	
	// animation productos
	$('#productos li').hover(function () {
		$(this).find('.prodText').stop().animate({
			bottom: '0'
		}, 200);

	}, function () {
		$(this).find('.prodText').stop().animate({
			bottom: '-50px'
		}, 200);
	});
		
		
	// hovers block-elements
	$('#productos li').ttarget();			
	$('.bannerDer').ttarget();			
	$('.secuLanzaItem').ttarget();			
	
	
	// Fancybox
	function formatTitle(title, currentArray, currentIndex, currentOpts) {
		return '<div id="tip-title">' + (title && title.length ? '<b>' + title + '</b>' : '') + '<span>Imagen ' + (currentIndex + 1) + ' de ' + currentArray.length + '</span></div>';
	}
	$("a[rel=fancybox]").fancybox({
		'centerOnScroll'	:	true,
		'cyclic'			:	true,
		'titlePosition'		:	'inside',
		'padding'			:	'0',
		'titleFormat'		:	formatTitle
	});

	
	
});

