Drupal.locale = { 'pluralFormula': function ($n) { return Number(($n!=1)); }, 'strings': {"An AJAX HTTP error occurred.":"Hubo un error HTTP AJAX.","HTTP Result Code: !status":"C\u00f3digo de Resultado HTTP: !status","An AJAX HTTP request terminated abnormally.":"Una solicitud HTTP de AJAX termin\u00f3 de manera anormal.","Debugging information follows.":"A continuaci\u00f3n se detalla la informaci\u00f3n de depuraci\u00f3n.","Path: !uri":"Ruta: !uri","StatusText: !statusText":"StatusText: !statusText","ResponseText: !responseText":"ResponseText: !responseText","ReadyState: !readyState":"ReadyState: !readyState","Disabled":"Desactivado","Enabled":"Activado","Edit":"Editar","none":"ninguno","Configure":"Configurar","Active":"Activo","Done":"Hecho","Show":"Mostrar","Select all rows in this table":"Seleccionar todas las filas de esta tabla","Deselect all rows in this table":"Quitar la selecci\u00f3n a todas las filas de esta tabla","Not published":"No publicado","Please wait...":"Espere, por favor...","Hide":"Ocultar","Loading":"Cargando","By @name on @date":"Por @name en @date","By @name":"Por @name","Not in menu":"No est\u00e1 en un men\u00fa","Alias: @alias":"Alias: @alias","No alias":"Sin alias","New revision":"Revisi\u00f3n nueva","Drag to re-order":"Arrastre para reordenar","Changes made in this table will not be saved until the form is submitted.":"Los cambios realizados en esta tabla no se guardar\u00e1n hasta que se env\u00ede el formulario","The changes to these blocks will not be saved until the \u003cem\u003eSave blocks\u003c\/em\u003e button is clicked.":"Los cambios sobre estos bloques no se guardar\u00e1n hasta que no pulse el bot\u00f3n \u003cem\u003eGuardar bloques\u003c\/em\u003e.","Show shortcuts":"Mostrar atajos","This permission is inherited from the authenticated user role.":"Este permiso se hereda del rol de usuario registrado.","No revision":"Sin revisi\u00f3n","@number comments per page":"@number comentarios por p\u00e1gina","Requires a title":"Necesita un t\u00edtulo","Not restricted":"Sin restricci\u00f3n","(active tab)":"(solapa activa)","Not customizable":"No personalizable","Restricted to certain pages":"Restringido a algunas p\u00e1ginas","The block cannot be placed in this region.":"El bloque no se puede colocar en esta regi\u00f3n.","Customize dashboard":"Personalizar panel de control","Hide summary":"Ocultar resumen","Edit summary":"Editar resumen","Don't display post information":"No mostrar informaci\u00f3n del env\u00edo","@title dialog":"Di\u00e1logo @title","Re-order rows by numerical weight instead of dragging.":"Reordenar las filas por peso num\u00e9rico en lugar de arrastrar.","Show row weights":"Mostrar pesos de la fila","Hide row weights":"Ocultar pesos de la fila","Searching for matches...":"Buscando coincidencias","Hide shortcuts":"Ocultar atajos","Close":"Cerrar","Select":"Seleccionar"} };;

(function ($) {
  Drupal.Panels = {};

  Drupal.Panels.autoAttach = function() {
    if ($.browser.msie) {
      // If IE, attach a hover event so we can see our admin links.
      $("div.panel-pane").hover(
        function() {
          $('div.panel-hide', this).addClass("panel-hide-hover"); return true;
        },
        function() {
          $('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
        }
      );
      $("div.admin-links").hover(
        function() {
          $(this).addClass("admin-links-hover"); return true;
        },
        function(){
          $(this).removeClass("admin-links-hover"); return true;
        }
      );
    }
  };

  $(Drupal.Panels.autoAttach);
})(jQuery);
;

/**
 * @file
 * Adds some show/hide to the admin form to make the UXP easier.
 *
 */
(function($){
  Drupal.behaviors.video = {
    attach: function (context, settings) {
      //lets see if we have any jmedia movies
      if($.fn.media) {
        $('.jmedia').media();
      }
	
      video_hide_all_options();
      $("input[name='video_convertor']").change(function() {
        video_hide_all_options();
      });

      // change metadata options
      video_hide_all__metadata_options();
      $("input[name='video_metadata']").change(function() {
        video_hide_all__metadata_options();
      });

      $('.video_select').each(function() {
        var ext = $(this).attr('rel');
        $('select', this).change(function() {
          if($(this).val() == 'video_play_flv') {
            $('#flv_player_'+ext).show();
          } else {
            $('#flv_player_'+ext).hide();
          }
          if($(this).val() == 'video_play_html5') {
            $('#html5_player_'+ext).show();
          } else {
            $('#html5_player_'+ext).hide();
          }
        });
        if($('select', this).val() == 'video_play_flv')
          $('#flv_player_'+ext).show();
        
        if($('select', this).val() == 'video_play_html5')
          $('#html5_player_'+ext).show();
        else
          $('#html5_player_'+ext).hide();
      });
	
      if(settings.video) {
        $.fn.media.defaults.flvPlayer = settings.video.flvplayer;

      }
	
      //lets setup our colorbox videos
      $('.video-box').each(function() {
        var url = $(this).attr('href');
        var data = $(this).metadata();
        var width = data.width;
        var height= data.height;
        var player = settings.video.player; //player can be either jwplayer or flowplayer.
        $(this).colorbox({
          html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>',
          onComplete:function() {
            if(player == 'flowplayer') {
              flowplayer("video-overlay", settings.video.flvplayer, {
                clip: {
                  autoPlay: settings.video.autoplay,
                  autoBuffering: settings.video.autobuffer
                }
              });
            } else {
              $('#video-overlay').media({
                flashvars: {
                  autostart: settings.video.autoplay
                },
                width:width,
                height:height
              });
            }
          }
        });
      });
    }
  };


  function video_hide_all_options() {
    $("input[name='video_convertor']").each(function() {
      var id = $(this).val();
      $('#'+id).hide();
      if ($(this).is(':checked')) {
        $('#' + id).show();
      }
    });
  }

  function videoftp_thumbnail_change() {
    // Add handlers for the video thumbnail radio buttons to update the large thumbnail onchange.
    $(".video-thumbnails input").each(function() {
      var path = $(this).val();
      if($(this).is(':checked')) {
        var holder = $(this).attr('rel');
        $('.'+holder+' img').attr('src', settings.basePath + path);
      }
    });

  }

  function video_hide_all__metadata_options() {
    $("input[name='video_metadata']").each(function() {
      var id = $(this).val();
      $('#'+id).hide();
      if ($(this).is(':checked')) {
        $('#' + id).show();
      }
    });
  }
})(jQuery);;
/*
 * Acorn Media Player - jQuery plugin 1.0
 *
 * Copyright (C) 2010 Cristian I. Colceriu
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * www.ghinda.net
 * contact@ghinda.net
 *
 */

(function($) {
	$.fn.acornMediaPlayer = function(options) {
		/*
		 * Define default plugin options
		 */
		var defaults = {
			theme: 'eguzki',			
			nativeSliders: false,
			volumeSlider: 'horizontal'
		};
		options = $.extend(defaults, options);
		
		/* 
		 * Function for generating a unique identifier using the current date and time
		 * Used for generating an ID for the media elmenet when none is available
		 */
		var uniqueID = function() {
			var currentDate = new Date();
			return currentDate.getTime();
		};
		
		/* 
		 * Detect support for localStorage
		 */
		function supports_local_storage() {
			try {
				return 'localStorage' in window && window.localStorage !== null;
			} catch(e){
				return false;
			}
		}
		
		/*
		 * Get the volume value from localStorage
		 * If no value is present, define as maximum
		 */
		var volume = (supports_local_storage) ? localStorage.getItem('acornvolume') : 1;
		if(!volume) {
			volume = 1;
		}
		
		/* 
		 * Main plugin function
		 * It will be called on each element in the matched set
		 */
		var acornPlayer = function() {
			// set the acorn object, will contain the needed DOM nodes and others
			var acorn = {
				$self: $(this)
			};
			
			var seeking; // The user is seeking the media
			var wasPlaying; // Media was playing when the seeking started
			var fullscreenMode; // The media is in fullscreen mode
			var captionsActive; // Captions are active
			
			/* Define all the texts used
			 * This makes it easier to maintain, make translations, etc.
			*/
			var text = {
				play: 'Play',
				playTitle: 'Start the playback',
				pause: 'Pause',
				pauseTitle: 'Pause the playback',
				mute: 'Mute',
				unmute: 'Unmute',
				fullscreen: 'Fullscreen',
				fullscreenTitle: 'Toggle fullscreen mode',
				volumeTitle: 'Volume control',
				seekTitle: 'Video seek control',
				captions: 'Captions',
				captionsTitle: 'Show captions',
				captionsChoose: 'Choose caption',
				transcript: 'Transcript',
				transcriptTitle: 'Show transcript'
			};
			
			// main wrapper element
			var $wrapper = $('<div class="acorn-player" role="application"></div>').addClass(options.theme);

			/*
			 * Define attribute tabindex on the main element to make it readchable by keyboard
			 * Useful when "aria-describedby" is present
			 *
			 * It makes more sense for screen reader users to first reach the actual <video> or <audio> elment and read of description of it,
			 * than directly reach the Media Player controls, without knowing what they control.
			 */
			acorn.$self.attr('tabindex', '0');		
			
			/*
			 * Check if the main element has an ID attribute
			 * If not present, generate one
			 */
			acorn.id = acorn.$self.attr('id');
			if(!acorn.id) {
				acorn.id = 'acorn' + uniqueID();
				acorn.$self.attr('id', acorn.id);
			}
			
			/* 
			 * Markup for the fullscreen button
			 * If the element is not <video> we leave if blank, as the button if useless on <audio> elements
			 */
			var fullscreenBtnMarkup = (acorn.$self.is('video')) ? '<button class="acorn-fullscreen-button" title="' + text.fullscreenTitle + '" aria-controls="' + acorn.id + '">' + text.fullscreen + '</button>' : '';
			
			/*
			 * Complete markup
			 */
			var template = '<div class="acorn-controls" style="display: none;">' +
								'<button class="acorn-play-button" title="' + text.playTitle + '" aria-controls="' + acorn.id + '">' + text.play + '</button>' +
								'<input type="range" class="acorn-seek-slider" title="' + text.seekTitle + '" value="0" min="0" max="150" step="0.1" aria-controls="' + acorn.id + '"/>' +
								'<span class="acorn-timer">00:00</span>' +
								'<div class="acorn-volume-box">' +
									'<button class="acorn-volume-button" title="' + text.mute + '" aria-controls="' + acorn.id + '">' + text.mute + '</button>' +
									'<input type="range" class="acorn-volume-slider" title="' + text.volumeTitle + '" value="1" min="0" max="1" step="0.05" aria-controls="' + acorn.id + '"/>' +
								'</div>' +
								//fullscreenBtnMarkup +
								'<button class="acorn-caption-button" title="' + text.captionsTitle + '"  aria-controls="' + acorn.id + '">' + text.captions + '</button>' +
								'<div class="acorn-caption-selector"></div>' +
								//'<button class="acorn-transcript-button" title="' + text.transcriptTitle + '">' + text.transcript + '</button>' +
								'<button class="acorn-info-button">info</button>'+
								'<div class="acorn-info-widget"></div>'+
								'<button class="acorn-share-button">share</button>'+
								'<div class="acorn-share-widget"></div>'+
								fullscreenBtnMarkup +
							'</div>';

			var captionMarkup = '<div class="acorn-caption"></div>';
			var transcriptMarkup = '<div class="acorn-transcript" role="region" aria-live="assertive"></div>';				
			
			/*
			 * Append the HTML markup
			 */
			acorn.$self.wrap($wrapper).after(template);
		
			/*
			 * Define the newly created DOM nodes
			 */
			acorn.$container = acorn.$self.parent('.acorn-player');
			
			acorn.$controls = $('.acorn-controls', acorn.$container);
			acorn.$playBtn = $('.acorn-play-button', acorn.$container);
			acorn.$seek = $('.acorn-seek-slider', acorn.$container);
			acorn.$timer = $('.acorn-timer', acorn.$container);
			acorn.$volume = $('.acorn-volume-slider', acorn.$container);
			acorn.$volumeBtn = $('.acorn-volume-button', acorn.$container);
			acorn.$fullscreenBtn = $('.acorn-fullscreen-button', acorn.$container);				
			
			/*
			 * Append the markup for the Captions and Transcript
			 * and define newly created DOM nodes for these
			 */
			acorn.$controls.after(captionMarkup);
			acorn.$container.after(transcriptMarkup);
			
			acorn.$transcript = acorn.$container.next('.acorn-transcript');
			acorn.$transcriptBtn = $('.acorn-transcript-button', acorn.$container);
		
			acorn.$caption = $('.acorn-caption', acorn.$container);
			acorn.$captionBtn = $('.acorn-caption-button', acorn.$container);
			acorn.$captionSelector = $('.acorn-caption-selector', acorn.$container);

			acorn.$infoBtn = $('.acorn-info-button', acorn.$container);
			acorn.$infoWidget = $('.acorn-info-widget', acorn.$container);
			acorn.$shareBtn = $('.acorn-share-button', acorn.$container);
			acorn.$shareWidget = $('.acorn-share-widget', acorn.$container);
			
			/*
			 * Use HTML5 "data-" attributes to set the original Width&Height for the <video>
			 * These are used when returning from Fullscreen Mode
			 */
			acorn.$self.attr('data-width', acorn.$self.width());
			acorn.$self.attr('data-height', acorn.$self.height());
			
			/*
			 * Time formatting function
			 * Takes the number of seconds as a parameter and return a readable format "minutes:seconds"
			 * Used with the number of seconds returned by "currentTime"
			 */
			var timeFormat = function(sec) {
				var m = Math.floor(sec/60)<10?"0" + Math.floor(sec/60):Math.floor(sec/60);
				var s = Math.floor(sec-(m*60))<10?"0" + Math.floor(sec-(m*60)):Math.floor(sec-(m*60));
				return m + ":" + s;
			};
			
			/*
			 * PLAY/PAUSE Behaviour			 
			 *
			 * Function for the Play button
			 * It triggers the native Play or Pause events
			 */
			var playMedia = function() {
				if(!acorn.$self.attr('paused')) {
					acorn.$self.trigger('pause');
				} else {
					acorn.$self.trigger('play');
				}
			};
			
			/* 
			 * Functions for native playback events (Play, Pause, Ended)
			 * These are attached to the native media events.
			 *
			 * Even if the user is still using some form of native playback control (such as using the Context Menu)
			 * it will not break the behviour of our player.
			 */
			var startPlayback = function() {
				acorn.$playBtn.text(text.pause).attr('title', text.pauseTitle);
				acorn.$playBtn.addClass('acorn-paused-button');
			};
			
			var stopPlayback = function() {
				acorn.$playBtn.text(text.play).attr('title', text.playTitle);
				acorn.$playBtn.removeClass('acorn-paused-button');
			};
			
			/*
			 * SEEK SLIDER Behaviour
			 * 
			 * Updates the Timer and Seek Slider values
			 * Is called on each "timeupdate"
			 */
			var seekUpdate = function() {
				var currenttime = acorn.$self.attr('currentTime');
				acorn.$timer.text(timeFormat(currenttime));	
				
				// If the user is not manualy seeking
				if(!seeking) {
					// Check type of sliders (Range <input> or jQuery UI)
					if(options.nativeSliders) {
						acorn.$seek.attr('value', currenttime);
					} else {
						acorn.$seek.slider('value', currenttime);
					}
				}
				
				// If captions are active, update them
				if(captionsActive) { 
					updateCaption(); 
				}
			};
			
			/*
			 * Time formatting function
			 * Takes the number of seconds as a paramenter
			 * 
			 * Used with "aria-valuetext" on the Seek Slider to provide a human readable time format to AT
			 * Returns "X minutes Y seconds"
			 */
			var ariaTimeFormat = function(sec) {
				var m = Math.floor(sec/60)<10?"" + Math.floor(sec/60):Math.floor(sec/60);
				var s = Math.floor(sec-(m*60))<10?"" + Math.floor(sec-(m*60)):Math.floor(sec-(m*60));
				var formatedTime;
									
				var mins = 'minutes';
				var secs = 'seconds';
				
				if(m == 1) {
					min = 'minute';
				}
				if(s == 1) {
					sec = 'second';
				}
				
				if(m === 0) {
					formatedTime = s + ' ' + secs;
				} else {						
					formatedTime = m + ' ' + mins + ' ' + s + ' ' + secs;
				}				
				
				return formatedTime;
			};
			
			/* 
			 * jQuery UI slider uses preventDefault when clicking any element
			 * so it stops the Blur event from being fired.
			 * This causes problems with the Caption Selector.
			 * We trigger the Blur event manually.
			 */
			var blurCaptionBtn = function() {
				acorn.$captionBtn.trigger('blur');				
			};
			
			/*
			 * Triggered when the user starts to seek manually
			 * Pauses the media during seek and changes the "currentTime" to the slider's value
			 */
			var startSeek = function(e, ui) {					
				if(!acorn.$self.attr('paused')) {
					wasPlaying = true;
				}
				acorn.$self.trigger('pause');
				seeking = true;
				
				var seekLocation;
				if(options.nativeSliders) {
					seekLocation = acorn.$seek.val();
				} else {
					seekLocation = ui.value;
				}
					
				acorn.$self.attr('currentTime', seekLocation);
				// manually blur the Caption Button
				blurCaptionBtn();
			};
			
			/*
			 * Triggered when user stoped manual seek
			 * If the media was playing when seek started, it triggeres the playback,
			 * and updates ARIA attributes
			 */
			var endSeek = function(e, ui) {
				if(wasPlaying) {
					acorn.$self.trigger('play');
					wasPlaying = false;
				}
				seeking = false;			
				var sliderUI = $(ui.handle);
				sliderUI.attr("aria-valuenow", parseInt(ui.value, 10));
				sliderUI.attr("aria-valuetext", ariaTimeFormat(ui.value));
			};
			
			/*
			 * Transforms element into ARIA Slider adding attributes and "tabindex"
			 * Used on jQuery UI sliders
			 * 
			 * Will not needed once the jQuery UI slider gets built-in ARIA 
			 */ 
			var initSliderAccess = function (elem, opts) {
				var accessDefaults = {
				 'role': 'slider',
				 'aria-valuenow': parseInt(opts.value, 10),
				 'aria-valuemin': parseInt(opts.min, 10),
				 'aria-valuemax': parseInt(opts.max, 10),
				 'aria-valuetext': opts.valuetext,
				 'tabindex': '0'
				};
				elem.attr(accessDefaults);        
			};
			
			/*
			 * Seek slider initialization
			 * Attach events, add the "duration" attribute and generate the jQuery UI Seek Slider
			 */
			var initSeek = function() {					
				// Get the duration of the media
				var duration = acorn.$self.attr('duration');
				
				// Check for the nativeSliders option
				if(options.nativeSliders) {
					acorn.$seek.attr('max', duration);
					acorn.$seek.bind('change', startSeek);
					
					acorn.$seek.bind('mousedown', startSeek);						
					acorn.$seek.bind('mouseup', endSeek);
					
				} else {
					// get existing classes
					var seekClass = acorn.$seek.attr('class');
					
					// create the new markup
					var	divSeek = '<div class="' + seekClass + '" title="' + text.seekTitle + '"></div>';
					acorn.$seek.after(divSeek).remove();
					
					// get the newly created DOM node
					acorn.$seek = $('.' + seekClass, acorn.$container);
					
					// create the buffer element
					var bufferBar = '<div class="ui-slider-range acorn-buffer"></div>';
					acorn.$seek.append(bufferBar);
					
					// get the buffer element DOM node
					acorn.$buffer = $('.acorn-buffer', acorn.$container);
					
					// set up the slider options for the jQuery UI slider
					var sliderOptions = {
						value: 0,
						step: 1,
						orientation: "horizontal",
						range: "min",
						min: 0,
						max: duration,
						slide: startSeek,
						stop: endSeek
					}; 
					// init the jQuery UI slider
					acorn.$seek.slider(sliderOptions);
					
					// add valuetext value to the slider options for better ARIA values
					sliderOptions.valuetext = ariaTimeFormat(sliderOptions.value);
					// accessify the slider
					initSliderAccess(acorn.$seek.find('.ui-slider-handle'), sliderOptions);
					
					// manully blur the Caption Button when clicking the handle
					$('.ui-slider-handle', acorn.$seek).click(blurCaptionBtn);
				}
				// show the player's controls
				acorn.$controls.show();
				
				// remove the loading class
				acorn.$self.removeClass('loading-media');
			};
			
			/*
			 * Show buffering progress
			 */
			var showBuffer = function(e) {
				var max = parseInt(acorn.$self.attr('duration'), 10);
				var tr = this.buffered;
				if(tr && tr.length) {
					var buffer = parseInt(this.buffered.end(0)-this.buffered.start(0), 10);
					var bufferWidth = (buffer*100)/max;
					
					acorn.$buffer.css('width', bufferWidth + '%');
				}				
			};
			
			/*
			 * VOLUME BUTTON and SLIDER Behaviour
			 *
			 * Change volume using the Volume Slider
			 * Also update ARIA attributes and set the volume value as a localStorage item
			 */
			var changeVolume = function(e, ui) {
				// get the slider value
				volume = ui.value;
				// set the value as a localStorage item
				localStorage.setItem('acornvolume', volume);
				
				// check if the volume was muted before
				if(acorn.$self.attr('muted')) {
					acorn.$self.attr('muted',false);
					acorn.$volumeBtn.removeClass('acorn-volume-mute');
					acorn.$volumeBtn.text(text.mute).attr('title', text.mute);
				}
				
				// set the new volume on the media
				acorn.$self.attr('volume', volume);
				
				// set the ARIA attributes
				acorn.$volume.$handle.attr("aria-valuenow", Math.round(volume*100));
				acorn.$volume.$handle.attr("aria-valuetext", Math.round(volume*100) + ' percent');
				// manually trigger the Blur event on the Caption Button
				blurCaptionBtn();
			};
			
			/*
			 * Mute and Unmute volume
			 * Also add classes and change label on the Volume Button
			 */
			var muteVolume = function() {					
				if(acorn.$self.attr('muted') === true) {						
					acorn.$self.attr('muted', false);
					if(options.nativeSliders) {
						acorn.$volume.val(volume);
					} else {
						acorn.$volume.slider('value', volume);
					}
					
					acorn.$volumeBtn.removeClass('acorn-volume-mute');
					acorn.$volumeBtn.text(text.mute).attr('title', text.mute);
				} else {
					acorn.$self.attr('muted', true);
					
					if(options.nativeSliders) {
						acorn.$volume.val('0');
					} else {
						acorn.$volume.slider('value', '0');
					}
					
					acorn.$volumeBtn.addClass('acorn-volume-mute');
					acorn.$volumeBtn.text(text.unmute).attr('title', text.unmute);
				}
			};
			
			/*
			 * Init the Volume Button and Slider
			 *
			 * Attach events, create the jQuery UI Slider for the Volume Slider and add ARIA support
			 */
			var initVolume = function() {
				if(options.nativeSliders) {
					acorn.$volume.bind('change', function() {
						acorn.$self.attr('muted',false);
						volume = acorn.$volume.val();
						acorn.$self.attr('volume', volume);
					});
				} else {
					var volumeClass = acorn.$volume.attr('class');
				
					var	divVolume = '<div class="' + volumeClass + '" title="' + text.volumeTitle + '"></div>';
					acorn.$volume.after(divVolume).remove();
					
					acorn.$volume = $('.' + volumeClass, acorn.$container);
					
					var volumeSliderOptions = {
						value: volume,
						orientation: options.volumeSlider,
						range: "min",
						max: 1,
						min: 0,
						step: 0.1,
						animate: true,
						slide: changeVolume
					};
					
					acorn.$volume.slider(volumeSliderOptions);
					
					acorn.$volume.$handle = acorn.$volume.find('.ui-slider-handle');
					
					// change and add values to volumeSliderOptions for better values in the ARIA attributes
					volumeSliderOptions.max = 100;
					volumeSliderOptions.value = volumeSliderOptions.value * 100;
					volumeSliderOptions.valuetext = volumeSliderOptions.value + ' percent';
					initSliderAccess(acorn.$volume.$handle, volumeSliderOptions);
					
					// manully blur the Caption Button when clicking the handle
					$('.ui-slider-handle', acorn.$volume).click(blurCaptionBtn);
				}
				
				acorn.$volumeBtn.click(muteVolume);
			};
			
			/*
			 * FULLSCREEN Behviour
			 * 
			 * Resize the video while in Fullscreen Mode
			 * Attached to window.resize 
			 */
			var resizeFullscreenVideo = function() {
				acorn.$self.attr({
					'width': $(window).width(),
					'height': $(window).height()
				});
			};
			
			/* 
			 * Enter and exit Fullscreen Mode
			 * 
			 * Resizes the Width & Height of the <video> element
			 * and add classes to the controls and wrapper
			 */
			var goFullscreen = function() {
				if(fullscreenMode) {
					if(acorn.$self[0].webkitSupportsFullscreen) {
						acorn.$self[0].webkitExitFullScreen();
					} else {
						$('body').css('overflow', 'auto');
					
						var w = acorn.$self.attr('data-width');
						var h = acorn.$self.attr('data-height');
					
						acorn.$self.removeClass('fullscreen-video').attr({
							'width': w,
							'height': h
						});
						
						$(window).unbind('resize');
						
						acorn.$controls.removeClass('fullscreen-controls');
					}
					
					fullscreenMode = false;
					
				} else {						
					if(acorn.$self[0].webkitSupportsFullscreen) {
						acorn.$self[0].webkitEnterFullScreen();
					} else {
						$('body').css('overflow', 'hidden');							
					
						acorn.$self.addClass('fullscreen-video').attr({							
							width: $(window).width(),
							height: $(window).height()
						});
						
						$(window).resize(resizeFullscreenVideo);
						
						acorn.$controls.addClass('fullscreen-controls');
					}
					
					fullscreenMode = true;
					
				}
			};	
			
			/* 
			 * CAPTIONS Behaviour
			 *		
			 * Turning off the captions
			 * When selecting "None" from the Caption Selector or when the caption fails to load
			 */			
			var captionBtnActiveClass = 'acorn-caption-active';
			var captionBtnLoadingClass = 'acorn-caption-loading';
			var transcriptBtnActiveClass = 'acorn-transcript-active';
			
			var captionRadioName = 'acornCaptions' + uniqueID();
			 
			var captionOff = function() {
				captions = '';
				acorn.$caption.hide();
				activeCaptions = false;

				acorn.$transcriptBtn.removeClass(transcriptBtnActiveClass).hide();
				acorn.$transcript.hide();
				
				acorn.$captionBtn.removeClass(captionBtnActiveClass);
			};
			
			/*
			 * Update caption based on "currentTime"
			 * Borrowed and adapted from Bruce Lawson's â€œAccessible HTML5 Video with JavaScripted captionsâ€
			 * http://dev.opera.com/articles/view/accessible-html5-video-with-javascripted-captions/
			 */
			var updateCaption = function() {			
				var now = acorn.$self[0].currentTime; // how soon is now?
				var text = "";
				for (var i = 0; i < captions.length; i++) {
					if (now >= captions[i].start && now <= captions[i].end) {
						text = captions[i].content; // yes? then load it into a variable called text
						break;
					}
				}
				acorn.$caption.html(text); // and put contents of text into caption div
			};
			
			/*
			 * Initialize the Caption Selector
			 * Used when multiple <track>s are present
			 */
			var initCaptionSelector = function() {
				// calculate the position relative to the parent controls element
				var setUpCaptionSelector = function() {
					var pos = acorn.$captionBtn.offset();
					var top = pos.top - acorn.$captionSelector.outerHeight(true);
					var left = pos.left - ((acorn.$captionSelector.outerWidth(true) - acorn.$captionBtn.outerWidth(true))/2);
					
					var parentPos = acorn.$controls.offset();
					
					left = left - parentPos.left;
					top = top - parentPos.top;
					
					acorn.$captionSelector.css({
							'top': top,
							'left': left
						});
					acorn.$shareWidget.css({
                                                        'top': -151,
                                                        'left': left
                                                });
					acorn.$infoWidget.css({
                                                        'top': top,
                                                        'left': left
                                                });
				};
				
				acorn.$fullscreenBtn.click(setUpCaptionSelector);
				$(window).resize(function() {
					setUpCaptionSelector();		
				});
				
				setUpCaptionSelector();
				
				/*
				 * Show and hide the caption selector based on focus rather than hover.
				 * This benefits both touchscreen and AT users.
				 */
				var hideSelector; // timeout for hiding the Caption Selector				
				var showCaptionSelector = function() {
					if(hideSelector) {
						clearTimeout(hideSelector);
					}
					acorn.$captionSelector.show();
					
				};
				var hideCaptionSelector = function() {
					hideSelector = setTimeout(function() {
						acorn.$captionSelector.hide();						
					}, 200);
				};
				
				//acorn.$captionBtn.bind('focus', showCaptionSelector);
				//acorn.$captionBtn.bind('blur', hideCaptionSelector);
				//Copiamos el comportamiento de los otros botones (share y info) en lugar de funcionar por focus
				acorn.$captionBtn.bind('click',function(){
                                        acorn.$captionSelector.toggle(0, function(){
                                                acorn.$infoBtn.removeClass("infoButtonActive"); 
                                                acorn.$infoWidget.removeClass("infoWidgetActive");
                                                acorn.$shareBtn.removeClass("shareButtonActive"); 
                                                acorn.$shareWidget.removeClass("shareWidgetActive");
                                                $(this).addClass("captionSelectorActive");
                                                });
				});

				
				$('input[name=' + captionRadioName + ']', acorn.$container).bind('focus', showCaptionSelector);
				$('input[name=' + captionRadioName + ']', acorn.$container).bind('blur', hideCaptionSelector);
				
				/*
				 * Make the Caption Selector focusable and attach events to it
				 * If we wouldn't do this, when we'd use the scroll on the Caption Selector, it would dissapear
				 */
				acorn.$captionSelector.attr('tabindex', '-1');
				acorn.$captionSelector.bind('focus', showCaptionSelector);
				acorn.$captionSelector.bind('blur', hideCaptionSelector);
			};
			
			/*
			 * Current caption loader
			 * Loads a SRT file and uses it as captions
			 * Takes the url as a parameter
			 */
			var loadCaption = function(url) {
				// add a loading class to the Caption Button when starting to load the caption
				acorn.$captionBtn.addClass(captionBtnLoadingClass);
				// make an AJAX request to load the file
				$.ajax({
					url: url,
					success: function(data) {
						/*
						 * On success use a SRT parser on the loaded data
						 * Using JavaScript SRT parser by Silvia Pfeiffer <silvia@siliva-pfeiffer.de>
						 * parseSrt included at the end of this file
						 */
						captions = parseSrt(data);
						
						// show the Transcript Button						
						acorn.$transcriptBtn.show();
						
						/* 
						 * Generate the markup for the transcript
						 * Markup based on Bruce Lawson's â€œAccessible HTML5 Video with JavaScripted captionsâ€
						 * http://dev.opera.com/articles/view/accessible-html5-video-with-javascripted-captions/
						 */
						var transcriptText = '';
						$(captions).each(function() {
							transcriptText += '<span data-begin="' + parseInt(this.start, 10) + '" data-end=' + parseInt(this.end, 10) + '>' + this.content.replace("'","") + '</span>';
						});
						// append the generated markup
						acorn.$transcript.html(transcriptText);
						
						// show caption
						acorn.$caption.show();
						captionsActive = true;
						
						// in case the media is paused and timeUpdate is not triggered, trigger it
						if(acorn.$self.attr('paused')) {
							updateCaption();
						}
						
						acorn.$captionBtn.addClass(captionBtnActiveClass).removeClass(captionBtnLoadingClass);
					},
					error: function() {
						// if an error occurs while loading the caption, turn captions off
						captionOff();
						// if a console is available, log error
						if(console) {
							console.log('Error loading captions');
						}
					}
				});
			};
			
			/*			 
			 * Show or hide the Transcript based on the presence of the active class
			 */
			var showTranscript = function() {
				if($(this).hasClass(transcriptBtnActiveClass)) {
					acorn.$transcript.hide();						
				} else {
					acorn.$transcript.show();
				}
				$(this).toggleClass(transcriptBtnActiveClass);
			};

			/*
			 * Caption loading and initialization
			 */
			var initCaption = function() {
				// get all <track> elements
				acorn.$track = $('track', acorn.$self);
				
				// if there is at least one <track> element, show the Caption Button
				//if(acorn.$track.length) {
				//	acorn.$captionBtn.show();
				//}
				
				// check if there is more than one <track> element
				// if there is more than one track element we'll create the Caption Selector
				//if(acorn.$track.length>1) {
				//IF there is any subtitle show the menu to know which subtitle is on
				if(acorn.$track.length) {
					// set a different "title" attribute
					acorn.$captionBtn.attr('title', text.captionsChoose);
					
					// markup for the Caption Selector
					var captionList = '<ul><li><label><input type="radio" name="' + captionRadioName + '" checked="true" />None</label></li>';					
					acorn.$track.each(function() {
						var tracksrc = $(this).attr('src');
						captionList += '<li><label><input type="radio" name="' + captionRadioName + '" data-url="' + $(this).attr('src') + '" />' + $(this).attr('label') + '</label></li>';
					});
					captionList += '</ul>';
					
					// append the generated markup
					acorn.$captionSelector.html(captionList);
					
					// change selected caption
					var changeCaption = function() {
						// get the original <track> "src" attribute from the custom "data-url" attribute of the radio input
						var tracksrc = $(this).attr('data-url');
						if(tracksrc) {
							loadCaption(tracksrc);						
						} else {
							// if there's not "data-url" attribute, turn off the caption
							captionOff();
						}
					};
					
					// attach event handler
					$('input[name=' + captionRadioName + ']', acorn.$container).change(changeCaption);
				
					// initialize Caption Selector
					initCaptionSelector();	
			

				} else if(acorn.$track.length) {
					// if there's only one <track> element
					// load the specific caption when activating the Caption Button
					var tracksrc = acorn.$track.attr('src');
					
					acorn.$captionBtn.bind('click', function() {		
						if($(this).hasClass(captionBtnActiveClass)) {
							captionOff();
						} else {
							loadCaption(tracksrc);
						}
						$(this).toggleClass(captionBtnActiveClass);
					});
					
				}
				
				// attach event to Transcript Button
				acorn.$transcriptBtn.bind('click', showTranscript);
	1		};

                        /* 
                         * Caption loading and initialization
                         */
                        var initInfo = function() {
                                // get all title element
                                acorn.$title = $('#metadata .title', acorn.$self);
                                acorn.$nodeUrl = $('#metadata .nodeUrl', acorn.$self);
				console.log(acorn.$title.html());
				if(acorn.$title.length){
					acorn.$infoBtn.show();
				}
                                // if there is at least one <track> element, show the Caption Button
                                //if(acorn.$track.length) {
                                //      acorn.$captionBtn.show();
                                //}

                                // check if there is more than one <track> element
                                // if there is more than one track element we'll create the Caption Selector
                                //if(acorn.$track.length>1) {
                                //IF there is any subtitle show the menu to know which subtitle is on
                                if(acorn.$title.length) {
                                        // set a different "title" attribute
                                        //acorn.$infoBtn.attr('title', text.info);

                                        // markup for the Caption Selector
                                        var infoMU = '<ul><li><label>Info video <a href="'+acorn.$nodeUrl.html()+'">'+acorn.$title.html()+'</a></label></li>';                             
					infoMU+='<li><label><textarea class="infoInput">'+acorn.$nodeUrl.html()+'</textarea></label></li>';
                                        infoMU += '</ul>';

                                        // append the generated markup
                                        acorn.$infoWidget.html(infoMU);

                                        // initialize Caption Selector
                                        //initCaptionSelector();
					
                                        acorn.$infoBtn.bind('click', function() {
                                                $(this).toggleClass("infoButtonActive");
                                                acorn.$infoWidget.toggleClass("infoWidgetActive");
						acorn.$shareBtn.removeClass("shareButtonActive");
						acorn.$shareWidget.removeClass("shareWidgetActive");
                                                acorn.$captionSelector.removeClass("captionSelectorActive");
						acorn.$captionSelector.hide()
						
                                        });
                                }
                        };
                        /*
                         * Caption loading and initialization
                         */
                        var initShare = function() {
                                // get all title element
                                acorn.$share = $('#metadata .share', acorn.$self);
                                acorn.$nodeUrl = $('#metadata .nodeUrl', acorn.$self);
                                if(acorn.$share.length){
                                        acorn.$infoBtn.show();
                                }
                                // check if there is share element
                                //IF there is any subtitle show the menu to know which subtitle is on
                                if(acorn.$share.length) {
                                        // set a different "title" attribute
                                        //acorn.$infoBtn.attr('title', text.info);

                                        // markup for the Share Selector
                                        //var shareMU = 'Share link:<ul><li><label><input type="text" value="'+acorn.$share.html()+'" enabled="false" /></label></li>';
                                        //var shareMU = '<ul><li>Share html:</li>';
                                        var shareMU = '';
                                        shareMU += '<li>'+acorn.$share.html()+'</li>';
                                        //shareMU+='<li><label></label></li>';
                                        shareMU += '</ul>';

                                        // append the generated markup
                                        acorn.$shareWidget.html(shareMU);

                                        // initialize Caption Selector
                                        //initCaptionSelector();

                                        acorn.$shareBtn.bind('click', function() {
                                                $(this).toggleClass("shareButtonActive");
                                                acorn.$shareWidget.toggleClass("shareWidgetActive");
                                                acorn.$infoBtn.removeClass("infoButtonActive"); 
                                                acorn.$infoWidget.removeClass("infoWidgetActive");
                                                acorn.$captionSelector.removeClass("captionSelectorActive");
						acorn.$captionSelector.hide()

						

                                        });
                                }
                        };


			
			/*
			 * Initialization self-invoking function
			 * Runs other initialization functions, attaches events, removes native controls
			 */
			var init = function() {
				// attach playback handlers				
				acorn.$playBtn.click(playMedia);
				acorn.$self.click(playMedia);
				
				acorn.$self.bind('play', startPlayback);
				acorn.$self.bind('pause', stopPlayback);
				acorn.$self.bind('ended', stopPlayback);
				
				// update the Seek Slider when timeupdate is triggered
				acorn.$self.bind('timeupdate', seekUpdate);
				
				// bind Fullscreen Button
				acorn.$fullscreenBtn.click(goFullscreen);
				
				// initialize volume controls
				initVolume();
			
				// show buffering progress on progress
				acorn.$self.bind('progress', showBuffer);								
				
				// once the metadata has loaded
				acorn.$self.bind('loadedmetadata', function() {
					initSeek();
					initCaption();
					initShare();
					initInfo();
				});				
								
				// remove the native controls
				acorn.$self.removeAttr('controls');
				
				// add the loading class
				acorn.$self.addClass('loading-media');
				
				if(acorn.$self.is('audio')) {
					/*
					 * If the media is <audio>, we're adding the 'audio-player' class to the element.
					 * This is because Opera 10.62 does not allow the <audio> element to be targeted by CSS
					 * and this can cause problems with themeing.
					 */
					acorn.$container.addClass('audio-player');
				}
			}();
		
		};
		
		// iterate and reformat each matched element
		return this.each(acornPlayer);
	};

})(jQuery);

/* 
 * parseSrt function
 * JavaScript SRT parser by Silvia Pfeiffer <silvia@siliva-pfeiffer.de>
 * http://silvia-pfeiffer.de/ 
 * 
 * Tri-licensed under MPL 1.1/GPL 2.0/LGPL 2.1
 *  http://www.gnu.org/licenses/gpl.html  
 *  http://www.gnu.org/licenses/lgpl.html
 *  http://www.mozilla.org/MPL/
 *
 * The Initial Developer of the Original Code is Mozilla Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2009
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *  Silvia Pfeiffer <silvia@siliva-pfeiffer.de>
 *
 *
 */
function parseSrt(data) {
    var srt = data.replace(/\r+/g, ''); // remove dos newlines
    srt = srt.replace(/^\s+|\s+$/g, ''); // trim white space start and end
    srt = srt.replace(/<[a-zA-Z\/][^>]*>/g, ''); // remove all html tags for security reasons

    // get captions
    var captions = [];
    var caplist = srt.split('\n\n');
    for (var i = 0; i < caplist.length; i=i+1) {
        var caption = "";
        var content, start, end, s;
        caption = caplist[i];
        s = caption.split(/\n/);
        if (s[0].match(/^\d+$/) && s[1].match(/\d+:\d+:\d+/)) {
            // ignore caption number in s[0]
            // parse time string
            var m = s[1].match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);
            if (m) {
                start =
                  (parseInt(m[1], 10) * 60 * 60) +
                  (parseInt(m[2], 10) * 60) +
                  (parseInt(m[3], 10)) +
                  (parseInt(m[4], 10) / 1000);
                end =
                  (parseInt(m[5], 10) * 60 * 60) +
                  (parseInt(m[6], 10) * 60) +
                  (parseInt(m[7], 10)) +
                  (parseInt(m[8], 10) / 1000);
            } else {
                // Unrecognized timestring
                continue;
            }
            // concatenate text lines to html text
            content = s.slice(2).join("<br>");
        } else {
            // file format error or comment lines
            continue;
        }
        captions.push({start: start, end: end, content: content});
    }

    return captions;
}
;
                jQuery(document).ready(function() {
                        jQuery(function() {
                                jQuery('#videoPlayerAcorn, audio').acornMediaPlayer();
				var timerRun=false;
				var t=null
				jQuery('.acorn-player.eguzki').mousemove(
					function(){
					//	jQuery(this).find(".acorn-controls").css("opacity", "0.7");
						jQuery(this).find(".acorn-controls").addClass("active");
						//jQuery(this).find(".acorn-controls").mousemove(
						if (timerRun){
							clearTimeout(t);
						}
						t= setTimeout ( "jQuery('.acorn-controls').removeClass('active');", 2000 ); 
						timerRun=true;
						
						
					},
					function(){
					//	jQuery(this).find(".acorn-controls").css("opacity", "0");
						jQuery(this).find(".acorn-controls").removeClass("active");
					}

				);
                        });
                });






;
/**
 * @file base.js
 *
 * Some basic behaviors and utility functions for Views.
 */
(function ($) {

Drupal.Views = {};

/**
 * jQuery UI tabs, Views integration component
 */
Drupal.behaviors.viewsTabs = {
  attach: function (context) {
    if ($.viewsUi && $.viewsUi.tabs) {
      $('#views-tabset').once('views-processed').viewsTabs({
        selectedClass: 'active'
      });
    }

    $('a.views-remove-link').once('views-processed').click(function(event) {
      var id = $(this).attr('id').replace('views-remove-link-', '');
      $('#views-row-' + id).hide();
      $('#views-removed-' + id).attr('checked', true);
      event.preventDefault();
   });
  /**
    * Here is to handle display deletion 
    * (checking in the hidden checkbox and hiding out the row) 
    */
  $('a.display-remove-link')
    .addClass('display-processed')
    .click(function() {
      var id = $(this).attr('id').replace('display-remove-link-', '');
      $('#display-row-' + id).hide();
      $('#display-removed-' + id).attr('checked', true);
      return false;
  });
  }
};

/**
 * Helper function to parse a querystring.
 */
Drupal.Views.parseQueryString = function (query) {
  var args = {};
  var pos = query.indexOf('?');
  if (pos != -1) {
    query = query.substring(pos + 1);
  }
  var pairs = query.split('&');
  for(var i in pairs) {
    if (typeof(pairs[i]) == 'string') {
      var pair = pairs[i].split('=');
      // Ignore the 'q' path argument, if present.
      if (pair[0] != 'q' && pair[1]) {
        args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
      }
    }
  }
  return args;
};

/**
 * Helper function to return a view's arguments based on a path.
 */
Drupal.Views.parseViewArgs = function (href, viewPath) {
  var returnObj = {};
  var path = Drupal.Views.getPath(href);
  // Ensure we have a correct path.
  if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') {
    var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length));
    returnObj.view_args = args;
    returnObj.view_path = path;
  }
  return returnObj;
};

/**
 * Strip off the protocol plus domain from an href.
 */
Drupal.Views.pathPortion = function (href) {
  // Remove e.g. http://example.com if present.
  var protocol = window.location.protocol;
  if (href.substring(0, protocol.length) == protocol) {
    // 2 is the length of the '//' that normally follows the protocol
    href = href.substring(href.indexOf('/', protocol.length + 2));
  }
  return href;
};

/**
 * Return the Drupal path portion of an href.
 */
Drupal.Views.getPath = function (href) {
  href = Drupal.Views.pathPortion(href);
  href = href.substring(Drupal.settings.basePath.length, href.length);
  // 3 is the length of the '?q=' added to the url without clean urls.
  if (href.substring(0, 3) == '?q=') {
    href = href.substring(3, href.length);
  }
  var chars = ['#', '?', '&'];
  for (i in chars) {
    if (href.indexOf(chars[i]) > -1) {
      href = href.substr(0, href.indexOf(chars[i]));
    }
  }
  return href;
};

})(jQuery);
;

