// execute your scripts when the DOM is ready. this is mostly a good habit
$(function() {

	// initialize scrollable
	$(".scrollablegrande").scrollable();

});

$(function() {
// initialize scrollable
	$(".scrollablechico").scrollable();
// setup ul.tabs to work as tabs for each div directly under div.panes
	$("ul.tabs").tabs("div.panes > div");
// :first selector is optional if you have only one tabs on the page
	$(".css-tabs:first").tabs(".css-panes:first > div");
});
// What is $(document).ready ?
$(document).ready(function() {
// initialize scrollable together with the navigator plugin
	$("#browsable, #browsable1").scrollable().navigator();
});

// Galería Flash sociales
// What is $(document).ready ?
$(document).ready(function() {
// main vertical scroll
$("#menuflash").scrollable({
// basic settings
	vertical: true,
// up/down keys will always control this scrollable
//	keyboard: 'static',
// assign left/right keys to the actively viewed scrollable
	onSeek: function(event, i) {
		horizontal.eq(i).data("scrollable").focus();
	}
// main navigator (thumbnail images)
}).navigator("#menuflash_puntos");
// horizontal scrollables. each one is circular and has its own navigator instance
var horizontal = $(".scrollablexx").scrollable({ circular: true }).navigator(".puntos");
// when page loads setup keyboard focus on the first horzontal scrollable
//horizontal.eq(0).data("scrollable").focus();
});

//////////////////////////////////////////////////////////////////////////////
$(function() {
	$("#triggers img[rel]").overlay({mask: '#1F1F1F', effect: 'apple'});
});
//////////////////////////////////////////////////////////////////////////////
// What is $(document).ready ?
$(function() {
$(".slidetabs").tabs(".images > div", {
// enable "cross-fading" effect
	effect: 'fade',
	fadeOutSpeed: "slow",
// start from the beginning after the last tab
	rotate: false
// use the slideshow plugin. It accepts its own configuration
}).slideshow();
});


/////////////////////////////////////////////////////////////////////////

(function($) {

	$.fn.charCount = function(options){
	  
		// default configuration properties
		var defaults = {	
			allowed: 140,		
			warning: 25,
			css: 'counter',
			counterElement: 'span',
			cssWarning: 'warning',
			cssExceeded: 'exceeded',
			counterText: ''
		}; 
			
		var options = $.extend(defaults, options); 
		
		function calculate(obj){
			var count = $(obj).val().length;
			var available = options.allowed - count;
			if(available <= options.warning && available >= 0){
				$(obj).next().addClass(options.cssWarning);
			} else {
				$(obj).next().removeClass(options.cssWarning);
			}
			if(available < 0){
				$(obj).next().addClass(options.cssExceeded);
			} else {
				$(obj).next().removeClass(options.cssExceeded);
			}
			$(obj).next().html(options.counterText + available);
		};
				
		this.each(function() {  			
			$(this).after('<'+ options.counterElement +' class="' + options.css + '">'+ options.counterText +'</'+ options.counterElement +'>');
			calculate(this);
			$(this).keyup(function(){calculate(this)});
			$(this).change(function(){calculate(this)});
		});
	  
	};

})(jQuery);// JavaScript Document
