(function(a){a("a[data-id]").live("click",function(c){c.preventDefault();var b=a(this).attr("data-id");a("#"+b).reveal(a(this).data())});a.fn.reveal=function(b){var c={animation:"fadeAndPop",animationspeed:300,closeonbackgroundclick:true,dismissmodalclass:"close-modal"};var b=a.extend({},c,b);return this.each(function(){var k=a(this),g=parseInt(k.css("top")),i=k.height()+g,f=false,h=a(".modal-bg");if(h.length==0){h=a('<div class="modal-bg" />').insertAfter(k)}k.bind("reveal:open",function(){h.unbind("click.modalEvent");a("."+b.dismissmodalclass).unbind("click.modalEvent");if(!f){j();if(b.animation=="fadeAndPop"){k.css({top:a(document).scrollTop()-i,opacity:0,visibility:"visible"});h.fadeIn(b.animationspeed/2);k.delay(b.animationspeed/2).animate({top:a(document).scrollTop()+g+"px",opacity:1},b.animationspeed,d())}if(b.animation=="fade"){k.css({opacity:0,visibility:"visible",top:a(document).scrollTop()+g});h.fadeIn(b.animationspeed/2);k.delay(b.animationspeed/2).animate({opacity:1},b.animationspeed,d())}if(b.animation=="none"){k.css({visibility:"visible",top:a(document).scrollTop()+g});h.css({display:"block"});d()}}k.unbind("reveal:open")});k.bind("reveal:close",function(){if(!f){j();if(b.animation=="fadeAndPop"){h.delay(b.animationspeed).fadeOut(b.animationspeed);k.animate({top:a(document).scrollTop()-i+"px",opacity:0},b.animationspeed/2,function(){k.css({top:g,opacity:1,visibility:"hidden"});d()})}if(b.animation=="fade"){h.delay(b.animationspeed).fadeOut(b.animationspeed);k.animate({opacity:0},b.animationspeed,function(){k.css({opacity:1,visibility:"hidden",top:g});d()})}if(b.animation=="none"){k.css({visibility:"hidden",top:g});h.css({display:"none"})}}k.unbind("reveal:close")});k.trigger("reveal:open");var e=a("."+b.dismissmodalclass).bind("click.modalEvent",function(){k.trigger("reveal:close")});if(b.closeonbackgroundclick){h.css({cursor:"pointer"});h.bind("click.modalEvent",function(){k.trigger("reveal:close")})}a("body").keyup(function(l){if(l.which===27){k.trigger("reveal:close")}});function d(){f=false}function j(){f=true}})}})(jQuery);(function(a){a.fn.player=function(e){var d={progressbarWidth:"200px",progressbarHeight:"5px",progressbarColor:"#22ccff",progressbarBGColor:"#eeeeee",defaultVolume:0.8};if(e){a.extend(d,e)}var c='<span class="simpleplayer-play-control"></span>';var b='<span class="simpleplayer-stop-control"></span>';this.each(function(){a(this).wrap('<div class="simple-player-container" style="background-color: #ddd; padding: 0 10px 5px 5px;" />').parent().prepend('<div><ul><li style="display: inline-block; padding: 0 5px; "><a style="text-decoration: none;" class="start-button" href="javascript:void(0)">'+c+'</a></li><li class="progressbar-wrapper" style="display: inline-block; cursor: pointer; width:'+d.progressbarWidth+';"><span style="display: block; background-color: '+d.progressbarBGColor+'; width: 100%; "><span class="progressbar" style="display: block; background-color: '+d.progressbarColor+"; height: "+d.progressbarHeight+'; width: 0%; "></span></span></li></ul></div>');var i=a(this).get(0);var h=a(this).parent().find(".start-button");var g=a(this).parent().find(".progressbar-wrapper");var f=a(this).parent().find(".progressbar");i.volume=d.defaultVolume;h.click(function(){if(i.paused){i.play();a(this).find(".simpleplayer-play-control").addClass("simpleplayer-stop-control").removeClass("simpleplayer-play-control")}else{i.pause();a(this).find(".simpleplayer-stop-control").addClass("simpleplayer-play-control").removeClass("simpleplayer-stop-control")}});g.click(function(j){if(i.duration!=0){left=a(this).offset().left;offset=j.pageX-left;percent=offset/g.width();duration_seek=percent*i.duration;i.currentTime=duration_seek}});a(i).bind("ended",function(j){i.pause();h.find(".simpleplayer-stop-control").addClass("simpleplayer-play-control").removeClass("simpleplayer-stop-control");f.css("width","0%")});a(i).bind("timeupdate",function(j){duration=this.duration;time=this.currentTime;fraction=time/duration;percent=fraction*100;if(percent){f.css("width",percent+"%")}});if(i.duration>0){a(this).parent().css("display","inline-block")}});return this}})(jQuery);$(document).ready(function(){var settings={progressbarWidth:'200px',progressbarHeight:'5px',progressbarColor:'#22ccff',progressbarBGColor:'#eeeeee',defaultVolume:0.8};$(".player").player(settings);});
