var val = 0;

$(document).ready(function(){
	
	/*============== MENU SUPERIOR =====================================*/
	$(".li-la-empresa").hover(function(){$('.li-la-empresa div').show();});
	$(".li-la-empresa").mouseleave(function(){$('.li-la-empresa div').hide();});
	
	$(".li-tarjeta-dijon").hover(function(){$('.li-tarjeta-dijon div').show();});
	$(".li-tarjeta-dijon").mouseleave(function(){$('.li-tarjeta-dijon div').hide();});	
	
	
	
	$(".li-vitriniar").mouseover(function(){
		$('.li-vitriniar div').show();
		if ($.browser.msie && $.browser.version <= 6) { // solucion de problemita para IE6
		$('.espIE6').hide();
		}
	});

	
	$(".li-vitriniar").mouseleave(function(){
		if (val == 0){
						
			$('.li-vitriniar div').hide();
			if ($.browser.msie && $.browser.version <= 6) { // solucion de problemita para IE6
			$('.espIE6').show();
			}
		}
	});
	
	$("#frmCat select").click(function(){
		val = 1;
	});
	
	$("#frmCat select").change(function(){
		val = 0;
		//alert(0)
	});
	
	
	$(".li-tu-espacio").hover(function(){
		$('.li-tu-espacio div').show();
		if ($.browser.msie && $.browser.version <= 6) { // solucion de problemita para IE6
		$('.espIE6').hide();
		}
	});
	$(".li-tu-espacio").mouseleave(function(){
		$('.li-tu-espacio div').hide(); 
		if ($.browser.msie && $.browser.version <= 6) { // solucion de problemita para IE6
		$('.espIE6').show();
		}
	});
	
	
	/*============== MENU SUPERIOR =====================================*/
	
	/*================= REDES SOCIALES ===================*/
	/*$(".icn-you-tube").colorbox({width:"300px", height:"450px", iframe:true});	//lightbox*/
	$(".icn-twitter").colorbox({width:"300px", height:"445px", iframe:true, scrolling:false});	//lightbox
	$(".icn-facebook").colorbox({width:"350px", height:"460px", iframe:true, scrolling:false});	//lightbox
	/*================= REDES SOCIALES ===================*/
		
	$(".fila_cumpleano").colorbox({width:"745px", height:"125px", iframe:true});	//lightbox
	
   	// Transversal, Input Super Cleaner.
	$(".clean").each(function(){
		var value = $(this).val();
		$(this).focusin(function(){if($(this).val() == value){$(this).val("");};});
		$(this).focusout(function(){if($(this).val() == ''){$(this).val(value);};});
	});
	//Carruseles Home
	$(".banners").scrollable({
		size: '1',
		items: ".items_top",
		clickable: false,
		circular: true
	}).navigator({navi:'.tab_top'}).autoscroll(8000);

    $(".bannersPromo").scrollable({
		size: '1',
		items: ".items_top",
		clickable: false,
		circular: true
	}).navigator({navi:'.tab_top'}).autoscroll(8000);
	//Carruseles Home
	
	
    //Carrusel Catalogo de Productos	

    
	//Carrusel Catalogo Promociones Inferior	
	$(".bannersCatalogo").scrollable({
		size: '1',
		items: ".items_top",
		clickable: false,
		circular: true
	}).navigator({navi:'.tab_top'}).autoscroll(8000);
    //Carrusel Catalogo Promociones Inferior	
	
	//Carrusel Catalogo Tiendas Locales
	$(".bannersLocales").scrollable({
		size: '1',
		items: ".items_top",
		clickable: false,
		circular: true
	}).navigator({navi:'.tab_top'}).autoscroll(8000);
    //Carrusel Catalogo Tiendas Locales
	
	//Carrusel Catalogo Tiendas Promociones
	$(".bannersTiendaPromo").scrollable({
		size: '1',
		items: ".items_top",
		clickable: false,
		circular: true
	}).navigator({navi:'.tab_top'}).autoscroll(8000);
    //Carrusel Catalogo Tiendas Promociones	
	
	//Rollover ver mas
	$(".cont_novedades .area_texto a").hover(function(){
		$(this).fadeTo("fast",0.5,function(){
			$(this).fadeTo("fast",1);	
		});	
	});
	
	
	//Rollover opciones de trivias
	$(".radio_resp").click(function(){
		$(".radio_resp").removeClass("opcActivo");
		$(this).addClass("opcActivo");
		var contenido = $(this).attr("rel");
		$("#selRespuesta").val(contenido);
	});
	
	// carrusel trivias
	$(".trivias_carru").scrollable({
		size: "3",
		items: ".items_trivias_carru",
		prev: ".prev_trivias_carru",
		next: ".next_trivias_carru",
		clickable: false,
		circular:false
	});
	
	// carrusel de cumpleañeros
	$("#cumple").scrollable({
		size: '9',
		items: ".items_cumple",
		prev: ".prev_cumple",
		next: ".next_cumple",
		clickable: false,
		vertical:true
	});
	
	// carrusel de productos cumpleañeros
	$("#productos_tucumple").scrollable({
		size: "3",
		items: ".items_productos_tucumple",
		prev: ".prev_productos_tucumple",
		next: ".next_productos_tucumple",
		clickable: false,
		circular: false
	});
	
	// carrusel de mi lista cumpleañeros
	$("#misproductos").scrollable({
		size: "8",
		items: ".items_misproductos",
		prev: ".prev_misproductos",
		next: ".next_misproductos",
		clickable: false,
		circular: false
	});
	
	// carrusel de mi lista paso 2
	$("#lista_p2").scrollable({
		size: "6",
		items: ".items_lista_p2",
		prev: ".prev_lista_p2",
		next: ".next_lista_p2",
		clickable: false,
		circular: false,
		vertical:true
	});
	
	// eliminamos productos de la lista
	$(".btn_eliminar_item").click(function(){
		var producto = $(this).attr("rel");
		
		$.ajax({
			type: "POST",
			url: "/operaciones_ajax.php",
			data: "tipo=btn_eliminar_item&producto="+producto,
			success: function(msg){				
									
			}
		});
		
		$(this).parent().remove();
	});
	
	// eliminamos invitados de la lista
	$(".btn_eliminar_invitado").click(function(){
		var invitado = $(this).attr("rel");
		$.ajax({
			type: "POST",
			url: "/operaciones_ajax.php",
			data: "tipo=btn_eliminar_invitado&invitado="+invitado,
			success: function(msg){													
			}
		});
		
		$(this).parent().parent().remove();	
	});
	
	// carga plantillas
	$(".btn_carga_plantilla").click(function(){
		var imagen = $(this).html();
		imagen = imagen.replace("88","410");
		imagen = imagen.replace("71","330");
		$(".contenedor_plantilla").html(imagen);
	});
	
	$(".btn_nina").click(function(){
		$.ajax({
			type: "POST",
			url: "/operaciones_ajax.php",
			data: "tipo=btn_nina",
			success: function(msg){
			}
		});		
	});
	$(".btn_nino").click(function(){
		$.ajax({
			type: "POST",
			url: "/operaciones_ajax.php",
			data: "tipo=btn_nino",
			success: function(msg){
			}
		});		
	});
	
	$(".btn_cargar_producto").click(function(){
		var obj = $(this);
		var producto = $(this).attr("rel");
		$.ajax({
			type: "POST",
			url: "/operaciones_ajax.php",
			data: "tipo=btn_cargar_producto&producto="+producto,
			success: function(msg){
				if(msg == "ok"){
					obj.removeClass("disponible");
					obj.addClass("pedido");
				}
			}
		});
	});
	
	$(".mini_ecards").click(function(){
		$("#btnPaso2").hide();
		$("#btnPaso1").show();
		$(".mini_ecards").removeClass("activo");
		$(this).addClass("activo");
		img = $(this).html();
		img = img.replace('70','100%');
		
		$(".ecards_interno").html(img);
	});

});
