/*
Copyright (c) 2009 SymfoniP / CRM technik Limited
V1.1
Automation code for jPlayer , AutoPlay switch and Turn on and off playlist on page load 
*/
jQuery(document).ready(function(c){var j=0;var h=true;var l=c("#playlist_list").height();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={autoplay:true,dispPLonLoad:true,ready:function(){g();k(true)},oggSupport:false,swfPath:"js/"};if(typeof symOpts=="object"){c.extend(symDef,symOpts)}if(!symDef.autoplay){symDef.ready=function(){g();k(false)}}if(!symDef.dispPLonLoad){c("#playlist_list").hide()}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(v,q,n,w,o){var u=new Date(w);var r=(u.getUTCMinutes()<10)?"0"+u.getUTCMinutes():u.getUTCMinutes();var t=(u.getUTCSeconds()<10)?"0"+u.getUTCSeconds():u.getUTCSeconds();c("#play_time").text(r+":"+t);var s=new Date(o);var m=(s.getUTCMinutes()<10)?"0"+s.getUTCMinutes():s.getUTCMinutes();var p=(s.getUTCSeconds()<10)?"0"+s.getUTCSeconds():s.getUTCSeconds();c("#total_time").text(m+":"+p)}).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(j!=c(this).data("index")){c(this).addClass("playlist_hover")}},function(){c(this).removeClass("playlist_hover")}).click(function(){var m=c(this).data("index");if(j!=m){e(m)}else{c("#jquery_jplayer").play()}})}}function k(m){if(m){e(j)}else{a(j)}}function a(m){c("#playlist_item_"+j).removeClass("playlist_current");c("#playlist_item_"+m).addClass("playlist_current");j=m;c("#jquery_jplayer").setFile(f[j].mp3,f[j].ogg)}function e(m){a(m);c("#jquery_jplayer").play()}function d(){var m=(j+1<f.length)?j+1:0;e(m)}function b(){var m=(j-1>=0)?j-1:f.length-1;e(m)}});
