
/**
 * Automatic scrollbar adder thing
 */
// So basically I am sick of scrollbars changing the centering of stuff.  So, we will always have scrollbars.
$.fn.forceScrollbars = function(rf) {
	var r = $(rf), t = $(this), rh = r.height(), th = t.height();
	if (th < rh)
		t.css("margin-bottom",(parseInt(t.css("margin-bottom")) + (rh - th)) + "px");
	return t;
}

/**
 * Unique maker
 */
GUID = {
	a:"_", b:0, c:[],
	get:function(){
		this.c.push(this.a+(this.b++));
		return this.a+this.b;
	}
};

/**
 * Add audio player to links!
 */	
$.fn.addAudioPlayer = function() {
	$(this).each(function(){
		$(this).click(function(e){

			e.preventDefault();

			// var _a = GUID.getAll();
			// for(var _c=0;_a.length;_c++){
				// $("#"+_a[_c]).removeClass("playing");
				// alert(_a[_c]);
			// };

			$(".player_playing")
				.removeClass("player_playing")
				.addClass("player_ready");

			var sound = soundManager.getSoundById($(this).attr("id"));
			
			if (sound.playState != 0) {
				sound.stop();
				return;
			}
			
			// Or, play
			soundManager.stopAll();

			$(this)
				.removeClass("player_ready")
				.addClass("player_playing");

			sound.play();
		});

		$(this)
			.addClass("player_ready")
			.attr("id",GUID.get());

		soundManager.createSound($(this).attr("id"),$(this).attr("href"));

	});
}

