function ge(){var b;for(var a=0;a<arguments.length;a++){var c=arguments[a];if(typeof c=="string"){c=document.getElementById(c)}if(arguments.length==1){return c}if(!b){b=new Array()}b[b.length]=c}return b}var AudioObject={prevAudio:0,debug_mode:0,curAudio:0,curWallAudio:null,curPressed:false,flashVer:0,preventInit:false,fileInfo:new Array(),images:{playmode:{play:"images/play.gif",pause:"images/pause.gif"},editmode:{play:"images/play.png",pause:"images/pause.png"},icon:"favicon.ico",pauseicon:"favicon.ico",playicon:"favicon.ico"},getSuff:function(a){return(a)?"Wall":""},setIcon:function(c){var a=document.getElementsByTagName("link");for(i in a){var d=a[i];if(d&&d.parentNode&&(d.rel=="shortcut icon")){var b=d.parentNode;d.setAttribute("href",c);if(isOpera()){b.innerHTML=b.innerHTML}else{b.removeChild(d);b.appendChild(d)}}}},getPlayer:function(h,j){var e=false;if(!this.curVolume){this.curVolume=parseInt(readCookie("audio_vol"))}if(isNaN(this.curVolume)){this.curVolume=80;createCookie("audio_vol",this.curVolume)}var g=this.getSuff(j);var b=(j)?"playerWall":"player";if(!ge(b)){var c=(j)?"278":"342";var a=(j)?"swf/player.swf?3":"swf/miniplayer.swf?3";var d=new SWFObject(a,b,c,"14","7","#FFFFFF");if(isWindowFocused){d.addParam("wmode","transparent")}d.addParam("swliveconnect","true");d.addParam("allowScriptAccess","always");d.addVariable("debug",window.debug_mode);d.addVariable("volume",this.curVolume);for(var f in this.fileInfo[h]){d.addVariable(f,this.fileInfo[h][f])}this.flashVer=d.installedVer.major;window.isValidFlash=((this.flashVer>7)||(this.flashVer==7&&!isOpera()));d.write("player"+g+h);e=true}else{}var k=document["player"+g]||window["player"+g];return{player:k,created:e}},checkPlayer:function(e,a){var b=this.getPlayer(e,a);if(!window.isValidFlash){var d="Для того, чтобы воспользоваться аудиосервисом, Вам необходимо установить Flash-проигрыватель."+(window.showBox?"<br/><br/>":"\n\n")+"Хотите перейти на страницу установки проигрывателя?";var c=function(){if(window.hideBox){hideBox()}document.location="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW"};if(window.showBox){ge("boxMessage").innerHTML=d;showBox(c)}else{if(confirm(d)){c()}}return false}return b},operate:function(b,k,e,d,a,h){log("operate");if(!this.fileInfo[b]){this.fileInfo[b]={dbid:b,host:k,user:e,id:d,duration:a}}var g=this.checkPlayer(b,h);if(!g){return}var f=(this.curWallAudio!=null);var c=(this.curAudio||this.curWallAudio);if(c==b&&f==h){if(!h){this.curPressed=true}this.setVariable("buttonPressed","true",h);return}if(!h){this.curPressed=false}if(h){this.curWallAudio=b;this.curAudio=null}else{this.curAudio=b;this.curWallAudio=null}if(c){this.hidePlayer(c,f,f!=h);var j=this;j.showPlayer(b,h,g.created)}else{this.showPlayer(b,h,g.created)}return false},setVariable:function(f,g,a){log("setVariable: "+[f,g,a].toString());var e=this.getPlayer(this.curAudio||this.curWallAudio,a).player;var b=0;var c=0;var d=function(){try{if(isIE()||e.SetVariable){e.SetVariable("audioPlayer_mc."+f,g);clearInterval(c);return true}}catch(h){log(h.message)}if(b++>3){clearInterval(c)}return false};if(!d()){c=setInterval(d,50)}},showPlayer:function(g,b,f){log(["showPlayer",g,b,f]);var c=this.getSuff(b);var d=this.getPlayer(g,b).player;var e=(window.audioEditMode)?"editmode":"playmode";if(window.audioEditMode){ge("audio"+g).className="audioEditRowPlaying";ge("line"+c+g).style.display="none"}else{setStyle(ge("line"+c+g),{borderTop:"0px",background:"no-repeat url('images/player.gif')",position:"absolute"})}ge("imgbutton"+c+g).src=this.images[e].pause;this.setIcon(this.images.playicon);var a=(b)?236:300;ge("player"+c+g).style.display="";if(!f){}},initPlayer:function(d,a){var b="{volume:"+this.curVolume;for(var c in this.fileInfo[d]){b+=","+c+":"+this.fileInfo[d][c]}b+="}";this.setVariable("setConfig",b,a)},hidePlayer:function(f,b,d){var c=this.getSuff(b);if(!ge("player"+c+f)){return}this.setVariable("setState","stop",b);ge("player"+c+f).style.display="none";ge("player"+c+f).innerHTML="";if(window.audioEditMode){ge("audio"+f).className="audioEditRow"}else{setStyle(ge("line"+c+f),{borderTop:"dashed 1px #D8DfEA",background:"none"})}ge("line"+c+f).style.display="";var e=(window.audioEditMode)?"editmode":"playmode";ge("imgbutton"+c+f).src=this.images[e].play;this.setIcon(this.images.icon);var a=(b)?236:300;return},setTimeoutIE:function(a,b){if(isIE()){a()}else{setTimeout(a,b)}},stateChanged:function(g,a,e,c){log("stateChanged: "+[g,a,e,c].toString());var d=this;var b=this.getSuff(a);var f=(window.audioEditMode)?"editmode":"playmode";switch(e){case"stopped":break;case"created":break;case"volume":this.curVolume=parseInt(c);createCookie("audio_vol",this.curVolume);break;case"init":ge("line"+b+g).style.display="none";break;case"finished":this.setIcon(this.images.icon);ge("imgbutton"+b+g).src=this.images[f].play;this.setTimeoutIE(function(){var h=getSiblingsIds(ge("audio"+b+g));if(h[1]&&!a&&!window.audioEditMode){ge("imgbutton"+b+h[1]).onclick()}else{d.hidePlayer(g,a,true);d.curAudio=null;d.curWallAudio=null}},0);break;default:this.setIcon((e=="playing")?this.images.playicon:this.images.icon);ge("imgbutton"+b+g).src=(e=="playing")?this.images[f].pause:this.images[f].play;if(window.audioEditMode&&e!="playing"&&this.curPressed){this.setTimeoutIE(function(){d.hidePlayer(g,a,true);d.curAudio=null;d.curWallAudio=null},0);return}break}}};function isOpera(){return(navigator.userAgent.indexOf("Opera")!=-1)?true:false}function isIE(){return(navigator.userAgent.toLowerCase().indexOf("msie")!=-1)}function stateChanged(d,a,c,b){AudioObject.stateChanged(d,a,c,b)}function operateWall(e,d,a,b,c){AudioObject.operate(e,d,a,b,c,true)}function operate(e,d,a,b,c){AudioObject.operate(e,d,a,b,c,false)}function flashDebug(a){log("flash debug: "+a)}function log(a){if(!window.debug_mode){return}if(!ge("debug")){document.getElementsByTagName("body")[0].appendChild(createElement("div",{id:"debug"}))}ge("debug").innerHTML+=a+"<br/>"}var startSiblings;function getSiblingsIds(d){var c,b,a=d;while(a.previousSibling){c=a=a.previousSibling;if(c.nodeType!=3){break}c=null}a=d;while(a.nextSibling){b=a=a.nextSibling;if(b.nodeType!=3){break}b=null}return[c?c.id.match(/(\d+)/)[1]:0,b?b.id.match(/(\d+)/)[1]:0]}function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null}function player_DoFSCommand(command,args){eval(args)}function playerWall_DoFSCommand(command,args){eval(args)}var isWindowFocused=true;function createElement(b,a,d){var c=document.createElement(b);for(attr in a){c[attr]=a[attr]}setStyle(c,d);return c}function setStyle(a,b){if(a&&a.style){for(st in b){a.style[st]=b[st]}}}fixOperaTimeout=0;if(window.addEventListener){window.addEventListener("blur",function(){isWindowFocused=false},false);window.addEventListener("focus",function(){isWindowFocused=true},false);window.addEventListener("scroll",function(){if(isOpera()){clearTimeout(fixOperaTimeout);fixOperaTimeout=setTimeout(function(){head=document.getElementsByTagName("head")[0];head.innerHTML=head.innerHTML},300)}},false)}window.debug_mode=false;
