function radio_progress_setCookie(c_name,value,expiredays){ var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function radio_progress_getCookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){ c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function save_it(){ //alert('save ' + radio_progress); if (need_save=='no_need') return false; radio_progress_setCookie('radio_progress',radio_progress,1); radio_progress_setCookie('playing_status',playing_status,1); radio_progress_setCookie('radio_status','closed',1); } function load_it(){ radio_progress = radio_progress_getCookie('radio_progress'); radio_status = radio_progress_getCookie('radio_status'); playing_status = radio_progress_getCookie('playing_status'); //alert('load ' + radio_progress); if (radio_status=='') radio_status = 'closed'; if (radio_status=='running'){ need_save = 'no_need'; return false; } radio_progress_setCookie('radio_status','running',1); setPosition(); if (playing_status=='') playing_status='pause'; if (playing_status=='pause'){ getFlashObject().SetVariable("method:pause", ""); } if (playing_status=='play'){ getFlashObject().SetVariable("method:play", ""); document.getElementById('radio_status_image').src = 'http://www.manyw.com/view/NEW/radio/radio_wave_playing.gif'; } } if (window.addEventListener){ window.addEventListener("unload", save_it, false); window.addEventListener("load", load_it, false); } else { window.attachEvent("onunload",save_it); window.attachEvent("onload",load_it); } var radio_progress = 0; var radio_status = 'closed'; var playing_status = ''; var need_save = 'need'; var radio_volume = 100; var myListener = new Object(); var thepos =""; myListener.onInit = function(){ } myListener.onUpdate = function(){ radio_progress = this.position; set_timer(radio_progress); } myListener.onFinished = function(){ //document.getElementById('playerpos').value=this.position+" a"; play(); } function getFlashObject(){ return document.getElementById("mw_radio"); } function start(flv_path){ getFlashObject().SetVariable("method:stop", ""); getFlashObject().SetVariable("method:setUrl", flv_path); getFlashObject().SetVariable("method:play", ""); } function pause(){ getFlashObject().SetVariable("method:pause", ""); playing_status = 'pause'; document.getElementById('radio_status_image').src = 'http://www.manyw.com/view/NEW/radio/radio_wave.gif'; } function play(){ getFlashObject().SetVariable("method:play", ""); playing_status = 'play'; document.getElementById('radio_status_image').src = 'http://www.manyw.com/view/NEW/radio/radio_wave_playing.gif'; } function stop(){ getFlashObject().SetVariable("method:stop", ""); playing_status = 'pause'; document.getElementById('radio_status_image').src = 'http://www.manyw.com/view/NEW/radio/radio_wave.gif'; } function setPosition(){ //alert(radio_progress); getFlashObject().SetVariable("method:stop", ""); getFlashObject().SetVariable("method:play", ""); getFlashObject().SetVariable("method:setPosition", radio_progress); } function set_timer(t){ t = Math.floor(t/1000); m = Math.floor(t/60); m = m + ''; if (m.length==1) m = '0' + m; s = t % 60; s = s + ''; if (s.length==1) s = '0' + s; document.getElementById('radio_timer').value = m + ':' + s; } function backward(){ if ( radio_progress/1 > 5000/1 ){ radio_progress = radio_progress/1 - 5000/1; getFlashObject().SetVariable("method:setPosition", radio_progress); } } function fast_forward(){ //if ( radio_progress/1 + 5000/1 < radio_duration/1 ){ radio_progress = radio_progress/1 + 5000/1; getFlashObject().SetVariable("method:setPosition", radio_progress); //} } function volume_add(){ if (radio_volume/1 + 20/1 <= 100/1){ radio_volume = radio_volume/1 + 10/1; getFlashObject().SetVariable("method:setVolume", radio_volume); } } function volume_minus(){ if (radio_volume/1 - 20/1 >= 0/1){ radio_volume = radio_volume/1 - 10/1; getFlashObject().SetVariable("method:setVolume", radio_volume); } }