// JavaScript Document
      $(document).ready(function() {
		$('.colapsar').click(function(){
				$(this).parent().next().slideUp('fast')
				$(this).fadeOut(100);
				$(this).next().delay(100).fadeIn(100);
			})
		$('.descolapsar').click(function(){
				$(this).parent().next().slideDown('fast')
				$(this).fadeOut(100);
				$(this).prev().delay(100).fadeIn(100);
			})
			
		$('.descolapsar').click(function(){
				$(this).parent().next().slideDown('fast')
				$(this).fadeOut(100);
				$(this).prev().delay(100).fadeIn(100);
		
		})
		
		$('.mostrar_votaciones').click(function(){
				$('.caja .filtro span').removeClass('verdoso').addClass('blanco');
				$('.post').fadeOut('fast');
				$('.encuesta').delay(100).fadeIn('fast');
				$(this).removeClass('blanco').addClass('verdoso');
				$('.mostrar_todos').fadeIn('fast')

				})	
					
		$('.mostrar_articulos').click(function(){
				$('.caja .filtro span').removeClass('verdoso').addClass('blanco');

				$('.encuesta').fadeOut('fast')
				$('.post').delay(100).fadeIn('fast')
				$('.mostrar_todos').fadeIn('fast')
				$(this).removeClass('blanco').addClass('verdoso');


			})	
			
		$('.mostrar_todos').click(function(){
				$('.encuesta, .post').fadeIn('fast');
				$(this).fadeOut('fast');

			})
	
	
		$('.mas').click(function(){
			$(".nuevo_post .imagenes").append("<input name='' type='file' />");
			})	
		$('.agregar label').click(function(){
			$(this).next().next().animate({
			width: ['toggle', 'swing'],
			height: ['toggle', 'swing'],
			opacity: 'toggle'
			}, 'fast', 'linear');
			});
		$('.addvideo').click(function(){
			$('.mceSimple').animate({
			width: ['toggle', 'swing'],
			height: ['toggle', 'swing'],
			opacity: 'toggle'
			}, 'fast', 'linear');
			});
      });
	  
	  
	$(function() {
        $('.lightbox').lightBox();
    });
	
	  //Run the code when document ready
  $(function() {    
   //use this method to add new colors to pallete
   //$.fn.colorPicker.addColors(['000', '000', 'fff', 'fff']);
   
   $('#color1').colorPicker();
   $('#color2').colorPicker();
   $('#color3').colorPicker(); 
   
   //fires an event when the color is changed
   //$('#color1').change(function(){
    //alert("color changed");
   //});

   $("#button1").click(function(){
    $("#color1").val("#ffffff");   
    $("#color1").change();
   });

   $("#button2").click(function(){
    $("#color2").val("#000000");   
    $("#color2").change();
   });
  
  
  //filtro//  
  
    $('.filtro span').click(function(){
      var title = $(this).attr("title");
      var enlace='consulta.php?consulta='+title;
      $('.load').fadeIn('fast',
        function(){ 
              $.ajax({
                type: 'GET',
                url: enlace,
                success: function(msg){
                  $(".content").html(msg);
                }
              }
            )
            }   
          );    
      })
   
   
   //thumb//
   
    $('.like img').click(function(){
      var param = $(this).attr("alt");
      var enlace='ajax_liker.php?pup='+param;
      var enlace2='ajax_liker.php?ndn='+param;
           $.ajax({
                type: 'GET',
                url: enlace,
                success: function(msg){
                  $('#L'+param).html(msg);
                }
              }
            )           
            
            $.ajax({
                type: 'GET',
                url: enlace2,
                success: function(msg){
                  $('#D'+param).html(msg);
                }
              }
            )
   
      })   
      
       $('.dislike img').click(function(){
      var param = $(this).attr("alt");
      var enlace='ajax_liker.php?pdn='+param;
            var enlace2='ajax_liker.php?nup='+param;

           $.ajax({
                type: 'GET',
                url: enlace,
                success: function(msg){
                  $('#D'+param).html(msg);
                }
              }
            )
           $.ajax({
                type: 'GET',
                url: enlace2,
                success: function(msg){
                  $('#L'+param).html(msg);
                }
              }
            )
      })

    $('.content .encuesta p:first').each(function(){
      $(this).css("color","");

      
      
    })

 
});
