/*
Copyright (c) 2009 SymfoniP / CRM technik Limited
Automation code for jPlayer 

*/
jQuery(document).ready(function(c){var h=0;var f=Array();c("a[href$='.mp3']").each(function(){f.push({name:c(this).text(),mp3:c(this).attr("href"),ogg:false});c(this).hide()});c("a#showplaylist").click(function(){c("#playlist_list").slideToggle('fast')});symDef={ready:function(){g();j(false)},oggSupport:false,swfPath:"js/"};if(typeof symOpts=="object"){c.extend(symDef,symOpts)}c("#jquery_jplayer").jPlayer(symDef).jPlayerId("play","player_play").jPlayerId("pause","player_pause").jPlayerId("stop","player_stop").jPlayerId("loadBar","player_progress_load_bar").jPlayerId("playBar","player_progress_play_bar").jPlayerId("volumeMin","player_volume_min").jPlayerId("volumeMax","player_volume_max").jPlayerId("volumeBar","player_volume_bar").jPlayerId("volumeBarValue","player_volume_bar_value").onProgressChange(function(t,o,l,u,m){var s=new Date(u);var p=(s.getUTCMinutes()<10)?"0"+s.getUTCMinutes():s.getUTCMinutes();var r=(s.getUTCSeconds()<10)?"0"+s.getUTCSeconds():s.getUTCSeconds();c("#play_time").text(p+":"+r);var q=new Date(m);var k=(q.getUTCMinutes()<10)?"0"+q.getUTCMinutes():q.getUTCMinutes();var n=(q.getUTCSeconds()<10)?"0"+q.getUTCSeconds():q.getUTCSeconds();c("#total_time").text(k+":"+n)}).onSoundComplete(function(){d()});c("#ctrl_prev").click(function(){b();return false});c("#ctrl_next").click(function(){d();return false});function g(){for(i=0;i<f.length;i++){c("#playlist_list ul").append("<li id='playlist_item_"+i+"'>"+f[i].name+"</li>");c("#playlist_item_"+i).data("index",i).hover(function(){if(h!=c(this).data("index")){c(this).addClass("playlist_hover")}},function(){c(this).removeClass("playlist_hover")}).click(function(){var k=c(this).data("index");if(h!=k){e(k)}else{c("#jquery_jplayer").play()}})}}function j(k){if(k){e(h)}else{a(h)}}function a(k){c("#playlist_item_"+h).removeClass("playlist_current");c("#playlist_item_"+k).addClass("playlist_current");h=k;c("#jquery_jplayer").setFile(f[h].mp3,f[h].ogg)}function e(k){a(k);c("#jquery_jplayer").play()}function d(){var k=(h+1<f.length)?h+1:0;e(k)}function b(){var k=(h-1>=0)?h-1:f.length-1;e(k)}});
