$(document).ready(function() {
	
	if(selected){
		switch(selected){
			case "home" :
				$('ul.nav li a.inicio').addClass('selected'); 
			break;	
			case "catalogo" :
				$('ul.nav li a.catalogo').addClass('selected');
			break;
			case "contacto" :
				$('ul.nav li a.contacto').addClass('selected');	
			break;	
			case "empresa" :
				$('ul.nav li a.empresa').addClass('selected');
			break;
			case "links" :
				$('ul.nav li a.links').addClass('selected');
			break;
			case "servicios" :
				$('ul.nav li a.servicios').addClass('selected');
			break;
			}
	}
			
	$("#mycarousel").jcarousel({
        scroll: 2
    });

	
	$('.lightbox').lightBox();	
	
	$('#search-form button').click(function() {
		var url = 'index.php?route=product/search';
		var filter = $('#search-form #keyword').attr('value');
		
		if(filter) {
			url += '&keyword='+ encodeURIComponent(filter);
			}
			
		location = url;	
		
		return false;
		});	
		
	//	Script para scroll slideshow	
	var div = $('div.box div.thumb-container');
		ul = $('div.box div.thumb-container ul');
		ulPadding = 5;	
		
	var divWidth = div.width();
	div.css({overflow:'hidden'});	
	
	var lastLi = ul.find('li:last-child');
	
	div.mousemove(function(e) {
		var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
		var left = (e.pageX - div.offset().left)*(ulWidth-divWidth)/divWidth;
		div.scrollLeft(left);
		});
			
});

$(window).load(function() {
	$('.main .banner-home,#header div.banner').nivoSlider({
            effect : 'fade',
            directionNav : false,
            controlNav : false,
            controlNavThumbs : false,
            keyboardNav : false,
            pauseOnHover : false
            });
	});
	
domReady(function()
	{
		/*var logoSlideshow = new ImageFlow();
		logoSlideshow.init({
							ImageFlowID:'banner_flow',
							reflections:false,
							reflectionP:0.0,
							buttons:true
							});*/
							
		var logoSlideshow = new ImageFlow();
		logoSlideshow.init({ ImageFlowID: 'banner_flow',
                      circular: true,
                      reflections: false,
                      slider: true,
					  buttons: true,
					  slideshow: true,
                      slideshowAutoplay: true,
                      captions: false,
					  imagesHeight : 100, 
					  aspectRatio: (952/150), 
                      imagesHeight: (95/150),
                      startID:  1 });

	}
)	

function ajax_video(id) {
		
	if(id) {
		$.ajax({
			url:'index.php?route=module/ajax_video',
			type:'GET',
			dataType:'html',
			data:"id="+id,
			success:function(data) {
				$('.box .imagen').children().remove();
				$('.box .imagen').html(data);
				}
			});
		}	//	IF
	}	
	
