function frameset(){if(window.opera){return}if(document.getElementById("content")==null){setTimeout(frameset,100)}else{redirect()}}function redirect(){var b="/index/";if(window.location.hash!=""){b=window.top.location.toString();b=b.substr(b.indexOf("#")+1);if(b=="/"){b="/index/"}}if(window.opera){document.getElementById("content").contentWindow.location="/"+b}else{document.getElementById("content").contentWindow.location.replace(b)}}var storedLocation="";var contentWindow=null;window.onload=function(b){contentWindow=application.getWindow("content");storedLocation=window.location.toString();window.setInterval(listenLocation,1000)};function listenLocation(){var c=window.location;if(storedLocation!=c.toString()){storedLocation=window.location.toString();var d=storedLocation.match(/^(.+?)#(.*)$/);if(d[2]=="/"){d[2]="/index/"}contentWindow.location.replace(d[2])}}var currentLocation="";frameset();function bmObject(d,e,f){if(f!==false){this.create(d,e,f)}}bmObject.prototype.className="bmObject";bmObject.prototype.create=function(d,e,f){this.application=d;this.owner=e;this.parameters=f};bmObject.prototype.type="bmObject";function bmCGI(d,e,f){if(f!==false){this.create(d,e,f)}}bmCGI.inherit(bmObject);bmCGI.prototype.addCookie=function(f,e,g,h){e="="+((e!=null)?escape(e):"")+";";if(typeof(g)=="undefined"){g=new Date();g.setFullYear(g.getFullYear()+2)}g="expires="+g.toGMTString()+";";h=(h!=null)?"path="+escape(h)+";":"";document.cookie=f+e+g+h};bmCGI.prototype.getCookie=function(c){var k=c+"=";var g=document.cookie.split(";");for(var l=0;l<g.length;++l){var h=g[l];while(h.charAt(0)==" "){h=h.substring(1,h.length)}if(h.indexOf(k)==0){return h.substring(k.length,h.length)}}return null};bmCGI.prototype.deleteCookie=function(b){};var requests=new Array();function deleteRequests(){var b=0;for(b=0;b<requests.length;++b){if(requests[b]&&requests[b].done){delete requests[b].fRequest.onreadystatechange;delete requests[b].fRequest;delete requests[b]}}setTimeout(deleteRequests,1000)}setTimeout(deleteRequests,1000);function bmHTTPRequestWrapper(g,h,l){if(l!==false){this.create(g,h,l)}var m=this;this.createRequest();this.fRequest.open(l.method,l.url,true);this.fRequest.onreadystatechange=function(){if(m.fRequest.readyState==4){var c=200;try{c=m.fRequest.status}catch(b){c=200}if(c==200||c==0){var a=new Array();a.data=m.fRequest.responseText;a.url=l.url;if(l.handler!=null){l.handler(a)}}else{}m.done=true}};var n;var k=new Array();var k=l.headers;if(l.headers!==null){for(n in l.headers){this.fRequest.setRequestHeader(n,l.headers[n])}}this.fRequest.send(l.data)}bmHTTPRequestWrapper.inherit(bmObject);bmHTTPRequestWrapper.prototype.fRequest=null;bmHTTPRequestWrapper.prototype.done=false;bmHTTPRequestWrapper.prototype.create=function(d,e,f){bmObject.prototype.create.call(this,d,e,f)};bmHTTPRequestWrapper.prototype.createRequest=function(){if(typeof ActiveXObject=="function"){this.fRequest=new ActiveXObject("Microsoft.XMLHTTP")}else{if(typeof XMLHttpRequest=="function"){this.fRequest=new XMLHttpRequest()}else{if(typeof XMLHttpRequest=="object"){this.fRequest=new XMLHttpRequest()}}}};function bmHTTPRequest(d,e,f){if(f!==false){this.create(d,e,f)}}bmHTTPRequest.inherit(bmObject);bmHTTPRequest.prototype.fRequest=null;bmHTTPRequest.prototype.fQueue=null;bmHTTPRequest.prototype.create=function(d,e,f){bmObject.prototype.create.call(this,d,e,f)};bmHTTPRequest.prototype.execute=function(h,g,l,k,f){parameters=new Array();parameters.method=h;parameters.url=g;parameters.data=l;parameters.headers=k;parameters.handler=f;requests.push(new bmHTTPRequestWrapper(application,this,parameters));return(requests.length-1)};bmHTTPRequest.prototype.execute_1=function(k,h,n,l,m){parameters=new Array();parameters.method=k;parameters.url=h;parameters.data=n;parameters.headers=l;parameters.control=m;var g=new bmHTTPRequestWrapper(application,this,parameters)};bmHTTPRequest.prototype.get=function(d,e){var f=new Array();f["Content-type"]="text/html; charset=utf-8";return this.execute("GET",d,null,f,e)};bmHTTPRequest.prototype.get_1=function(e,d){var f=new Array();f["Content-type"]="text/html; charset=utf-8";this.execute_1("GET",e,null,f,d)};bmHTTPRequest.prototype.prepareFormData=function(k,m){var m=m==null?window:m;var g="";var n=null;var l=m.document.getElementById(k);if(l!=null){for(i=0;i<l.elements.length;++i){n=l.elements[i];var h=true;if((n.checked===false)&&((n.type=="radio")||(n.type=="checkbox"))){h=false}if(n.name.length==0){h=false}if(h){g+='--bmHTTPRequest\ncontent-disposition: form-data; name="'+n.name+'"\ncontent-type: text/plain; charset="utf-8"\n\n'+n.value+"\n"}}}g+="--bmHTTPRequest";return g};bmHTTPRequest.prototype.sendForm=function(h,k,n,g){var m=this.prepareFormData(k,g);var l=new Array();l.Connection="close";l["Content-length"]=m.length;l["Content-type"]='multipart/form-data; boundary="bmHTTPRequest"';return this.execute("POST",h,m,l,n)};bmHTTPRequest.prototype.prepareData=function(o,n){var k="--bmHTTPRequest\n";var p=null;if(o!=null){var h="";for(h in o){var l=h,m="--bmHTTPRequest\n";if(typeof(n)!="undefined"){l=n+"["+l+"]";m=""}switch(typeof(o[h])){case"string":case"number":case"boolean":k+=m+'Content-disposition: form-data; name="'+l+'"\ncontent-type: text/plain; charset="utf-8"\n\n'+o[h]+"\n--bmHTTPRequest\n";break;case"object":case"array":k+=this.prepareData(o[h],h);break}}}return k};bmHTTPRequest.prototype.sendData=function(f,h,e){h=this.prepareData(h);var g=new Array();g.Connection="close";g["Content-length"]=h.length;g["Content-type"]='multipart/form-data; boundary="bmHTTPRequest"';return this.execute("POST",f,h,g,e)};bmHTTPRequest.prototype.deleteRequest=function(b){if(typeof requests[b]!="undefined"){delete requests[b].fRequest.onreadystatechange;requests[b].fRequest.onreadystatechange=function(){};if(!requests[b].fRequest.done){requests[b].fRequest.abort()}delete requests[b].fRequest;delete requests[b]}};bmHTTPRequest.prototype.requestsClear=function(){for(i=0;i<requests.length;++i){this.deleteRequest(i)}};function bmComponent(d,e,f){if(f!==false){this.create(d,e,f)}}bmComponent.inherit(bmObject);bmComponent.prototype.name=null;bmComponent.prototype.components=null;bmComponent.prototype.create=function(d,e,f){bmObject.prototype.create.call(this,d,e,f);this.components=new Array();this.name=f.name;if(this.owner.components!=null){this.owner.components[this.name]=this}};bmComponent.prototype.getComponentString=function(){var d=this.name;var c=this.owner;while(c!=null){if(c.name!=null){d=c.name+"."+d}c=c.owner}d="application."+d;return d};function bmCustomControl(d,e,f){if(f!==false){this.create(d,e,f)}}bmCustomControl.inherit(bmComponent);bmCustomControl.prototype.events=null;bmCustomControl.prototype.saveCursor="";bmCustomControl.prototype.instance="";bmCustomControl.prototype.initialization="";bmCustomControl.prototype.ownerForm="";bmCustomControl.prototype.reloadUrl="";bmCustomControl.prototype.state="undefined";bmCustomControl.prototype.create=function(e,f,g){bmComponent.prototype.create.call(this,e,f,g);this.state="creating";var h=this;this.reloadHandler=function(a){if(h.instance!=null){h.replaceContent(a.data)}h.state="idle";h.setCursor(h.saveCursor);if(h.userReloadHandler){h.userReloadHandler(a)}return};this.events=new Array();this.state="idle"};bmCustomControl.prototype.initialize=function(recreateEvents){this.instance=document.getElementById(this.name);if(this.instance){this.initialization=document.getElementById(this.name+"Initialization");if(this.initialization){eval(this.initialization.innerHTML)}if(this.ownInitialize){this.ownInitialize()}if(this.recreateEvents&&recreateEvents){this.recreateEvents()}}if(recreateEvents){for(i in this.components){this.components[i].initialize(true)}}};bmCustomControl.prototype.recreateEvents=function(){for(eventName in this.events){for(handler in this.events[eventName]){application.attachEvent(this,eventName,this.events[eventName][handler])}}var b=null};bmCustomControl.prototype.getEventElement=function(b){if(typeof b.currentTarget=="object"){return b.currentTarget}else{return b.srcElement}};bmCustomControl.prototype.getInitialEventElement=function(b){if(typeof b.target=="object"){return b.target}else{return b.srcElement}};bmCustomControl.prototype.replaceContent=function(g){var f=this.ownerForm.createBufferElement();f.innerHTML=g;var h=this.instance.parentNode;var e=f.firstChild.cloneNode(true);h.replaceChild(e,this.instance);this.ownerForm.deleteBufferElement(f);this.initialize(true)};bmCustomControl.prototype.control=null;bmCustomControl.prototype.ownEvents=null;bmCustomControl.prototype.setTop=function(b){this.instance.style.top=b+"px"};bmCustomControl.prototype.getTop=function(){return this.instance.offsetTop};bmCustomControl.prototype.getHeight=function(){return this.instance.offsetHeight};bmCustomControl.prototype.setLeft=function(b){this.instance.style.left=b+"px"};bmCustomControl.prototype.getLeft=function(){return this.instance.offsetLeft};bmCustomControl.prototype.setCursor=function(b){if(this.instance){this.instance.style.cursor=b}};bmCustomControl.prototype.getCursor=function(){if(this.instance){return this.instance.style.cursor}};bmCustomControl.prototype.setVisible=function(b){if(b){this.instance.style.display="block"}else{this.instance.style.display="none"}};bmCustomControl.prototype.getVisible=function(){return !(this.instance.style.display=="none")};bmCustomControl.prototype.reload=function(f,d){if(this.state=="idle"){this.saveCursor=this.getCursor();this.setCursor("wait");this.state="reloading";var e=this.getReloadUrl();if(f!=null){for(i in f){e+="&"+i+"="+f[i]}}this.userReloadHandler=d;application.httpGateway.get(e,this.reloadHandler)}};bmCustomControl.prototype.createEvent=function(b){if(this.events==null){this.events=new Array()}else{if(this.events[b]==null){this.events[b]=new Array()}}return this.events[b]};bmCustomControl.prototype.attachEvent=function(e,h,g){var f=null;if((f=this.events[e])==null){f=this.createEvent(e)}f.push(h);if(this.ownEvents==null||(this.ownEvents!=null&&this.ownEvents[e]==null)){application.attachEvent(this,e,h,g)}};bmCustomControl.prototype.detachEvent=function(e,g){var f=null;if((f=this.events[e])!=null){var h;for(h in f){if(f[h]==g){delete f[h]}}}};bmCustomControl.prototype.getReloadUrl=function(){if(this.reloadUrl==""){var d=this.ownerForm.name;var c=this.name;this.reloadUrl="/chat/main.php?application.switchForm="+d+"&application."+d+".drawControl="+c}return this.reloadUrl};function bmHTMLView(d,e,f){if(f!==false){this.create(d,e,f)}}bmHTMLView.inherit(bmCustomControl);bmCustomControl.prototype.reloadCount=0;bmHTMLView.prototype.ownInitialize=function(){this.instance=document.getElementById(this.name);document.pawAccess=this};bmHTMLView.prototype.create=function(application,owner,parameters){this.type="bmHTMLView";this.className=this.className||"bmHTMLView";bmCustomControl.prototype.create.call(this,application,owner,parameters);this.window=parameters.window;this.document=this.window.document;var sender=this;var loadTimer=null;var ieLoader={};this.loadHandler=function(event){if(sender.loadTimer!=null){clearInterval(sender.loadTimer)}if(ieLoader[sender.className]){ieLoader[sender.className].parentNode.removeChild(ieLoader[sender.className]);delete (ieLoader[sender.className])}if(sender.load!=null){sender.load(event)}if(sender.unload!=null){application.attachEvent(sender.window,"beforeunload",sender.unload)}};this.loadTimerCallback=function(){if(/^loaded|complete$/.test(sender.document.readyState)){sender.loadHandler(sender.document.readyState)}};var o=sender.window.opera?true:false;if(o||/WebKit/i.test(navigator.userAgent)){sender.loadTimer=setInterval(sender.loadTimerCallback,10)}else{if(sender.window.addEventListener){application.attachEvent(sender.window,"DOMContentLoaded",sender.loadHandler)}}
/*@cc_on @*/
/*@if (@_win32)

    ieLoader[this.className] = this.document.getElementById("__ie_onload_" + this.className);
    if ( !ieLoader[this.className] )
    {
      var proto = "src='javascript:void(0)'";
      if (location.protocol == "https:") 
      {
        proto = "src=//0";
      }
      this.document.write("<scr"+"ipt id=\"__ie_onload_" + this.className + "\" defer " + proto + "><\/scr"+"ipt>");
      ieLoader[this.className] = this.document.getElementById("__ie_onload_" + this.className);
      ieLoader[this.className].onreadystatechange = function()
	    {
        if (this.readyState == "complete")
		    {
          sender.loadHandler(this.className);
	      }
      };
    }
  /*@end @*/
};bmHTMLView.prototype.showWaitScreen=function(){this.waitScreen.style.display="block"};bmHTMLView.prototype.hideWaitScreen=function(){this.waitScreen.style.display="none"};bmHTMLView.prototype.data=null;bmHTMLView.prototype.elementsBuffer=null;bmHTMLView.prototype.window=null;bmHTMLView.prototype.document=null;bmHTMLView.prototype.createBufferElement=function(){var d=document.createElement("div");var c=Math.floor(Math.random()*1000)+1;d.setAttribute("style","display: none;");d.setAttribute("id","bufferElement"+c);this.elementsBuffer.appendChild(d);return d};bmHTMLView.prototype.deleteBufferElement=function(b){this.elementsBuffer.removeChild(b)};function bmPlaylist(aApplication,owner,parameters){var sender=this;sender.items=new Array();sender.itemsOffset=new Array();sender.cacheMood=0;sender.callLoadPlaylist=function(){sender.readyState=sender.PLAYLIST_READY;var event={playlist:sender,offset:this.itemsOffset};if((handlers=sender.events.loadplaylist)!=null){var i;var handler;for(i in handlers){try{handler=handlers[i];var result=handler(event);if(result){return false}}catch(err){}}}};sender.loadContentHandler=function(event){if(this.currentRequest!==null){this.currentRequest=null}var data;if(typeof event.data=="string"){data=eval("("+event.data+")");sender.setCache({data:data,url:event.url})}else{data=event.data}if((data||0).errorCode>0){switch(data.errorCode){case 132:sender.filter="";break;case 1382:sender.cacheMood=sender.mood;sender.loadContent(0,"playlist","new",11,sender.filter,0);return false;break;case 1381:sender.filter.air=0;sender.loadContent(0,"playlist","new",11,sender.filter,0);return false;break;case 133:case 1383:sender.mood=sender.cacheMood;delete (sender.filter.air);if(sender.filter.artistId){sender.filter=""}if(sender.filter.genreId){sender.filter=""}sender.loadContent(0,"playlist","new",11,sender.filter,sender.mood);return false;break}sender.callLoadPlaylist();return false}var fromElement=application.player.readyState==application.player.PLAYER_READY?0:1;var temp=new Array();var i=0;var itemsLength=sender.items.length-1;for(i=itemsLength;i>=fromElement;--i){if((sender.items[i]||0).random==false){fromElement=i+1;break}}temp=sender.items.splice(fromElement,sender.items.length-fromElement);var i=0;var filterStr=event.url.match(/filter=([^&]*)/i);while(data.trackList[i]){data.trackList[i]["progress"]=0;data.trackList[i]["filter"]=filterStr;data.trackList[i]["status"]={identifier:data.identifier,type:data.type};if(data.trackList[i].random==false){sender.items.push(data.trackList[i])}else{temp.push(data.trackList[i])}i++}var i=0;while(temp[i]){sender.items.push(temp[i]);i++}sender.setAliases();sender.callLoadPlaylist();if(sender.items.length<11){sender.loadContent(0,"playlist","add",11-sender.items.length,sender.filter,sender.mood)}};sender.loadContentNewHandler=function(event){if(this.currentRequest!==null){this.currentRequest=null}var data;if(typeof event.data=="string"){data=eval("("+event.data+")");sender.setCache({data:data,url:event.url})}else{data=event.data}var trackList=data.trackList.slice(event.offset);if((data||0).errorCode>0){switch(data.errorCode){case 132:sender.filter="";break;case 1382:sender.cacheMood=sender.mood;sender.loadContent(0,"playlist","new",11,sender.filter,0);return false;break;case 1381:sender.filter.air=0;sender.loadContent(0,"playlist","new",11,sender.filter,0);return false;break;case 133:case 1383:sender.mood=sender.cacheMood;if(sender.filter.artistId){sender.filter=""}if(sender.filter.genreId){sender.filter=""}sender.loadContent(0,"playlist","new",11,sender.filter,sender.mood);return false;break}sender.callLoadPlaylist();return false}if((trackList[0]!=null)&&(trackList[0].random)){var playlistLength=sender.items.length;if(sender.waitSongEnd&&(application.player.readyState!=application.player.PLAYER_READY)){if(playlistLength>1){playlistLength--}}for(var ii=0;ii<playlistLength;ii++){sender.items.pop()}var i=0;var filterStr=event.url.match(/filter=([^&]*)/i);while(trackList[i]){trackList[i]["progress"]=0;trackList[i]["filter"]=filterStr;trackList[i]["status"]={identifier:data.identifier,type:data.type};sender.items.push(trackList[i]);i++}}else{var startChangingElement=0;if(sender.waitSongEnd&&(application.player.readyState!=application.player.PLAYER_READY)){startChangingElement=1}var i=0;var filterStr=event.url.match(/filter=([^&]*)/i);while(trackList[i]){trackList[i]["progress"]=0;trackList[i]["filter"]=filterStr;trackList[i]["status"]={identifier:data.identifier,type:data.type};if(trackList[i].random==false){sender.items.splice(startChangingElement,0,trackList[i]);startChangingElement++}else{sender.items.push(trackList[i])}i++}}sender.waitSongEnd=false;sender.setAliases();sender.callLoadPlaylist();if(sender.items.length<11){sender.loadContent(0,"playlist","add",11-sender.items.length,sender.filter,sender.mood)}};sender.suspendSongsEventHandler=function(event){var trackList=eval("("+event.data+")");if(((trackList||0).errorCode>0)===false){var insertPosition=sender.getInsertSongsPosition();var newItems=new Array();if(insertPosition==1){newItems.push(application.playlist.items[0])}var length=application.playlist.items.length;for(var i=insertPosition;i<length;i++){if(application.playlist.items[i].suspend){newItems.push(application.playlist.items[i])}}for(var i in trackList.trackList){trackList.trackList[i].suspend=true;newItems.push(trackList.trackList[i])}for(var i=insertPosition;i<length;i++){if((!application.playlist.items[i].suspend)&&(newItems.length<11)){newItems.push(application.playlist.items[i])}}application.playlist.items=newItems;application.playlist.setAliases()}};sender.getInsertSongsPosition=function(){var result=0;var playerIsPlay=(application.player.readyState==application.player.PLAYER_PLAY);var playerIsPause=(application.player.readyState==application.player.PLAYER_PAUSE);if(playerIsPlay||playerIsPause){result=1}return result};sender.getLengthTrackList=function(){return sender.items.length};if(parameters!==false){this.create(aApplication,owner,parameters)}}bmPlaylist.inherit(bmCustomControl);bmPlaylist.prototype.items=null;bmPlaylist.prototype.cache=null;bmPlaylist.prototype.aliases=null;bmPlaylist.prototype.itemsOffset=null;bmPlaylist.prototype.filter="";bmPlaylist.prototype.mood="any";bmPlaylist.prototype.readyState=-1;bmPlaylist.prototype.randomList=false;bmPlaylist.prototype.waitSongEnd=false;bmPlaylist.prototype.currentRequest=null;bmPlaylist.prototype.PLAYLIST_READY=0;bmPlaylist.prototype.PLAYLIST_LOADING=1;bmPlaylist.prototype.PLAYLIST_RESUL_NOMATCH=132;bmPlaylist.prototype.lastInsertPosition=0;bmPlaylist.prototype.playlistGeneratorSource="/modules/player/index_json.php";bmPlaylist.prototype.create=function(n,r,l){bmCustomControl.prototype.create.call(this,n,r,l);this.ownEvents={loadplaylist:1};var t=(l.contentId)?l.contentId:0;var o=(l.type)?l.type:"playlist";var q=(l.action)?l.action:"new";var p=(l.limit)?l.limit:11;var s=(l.filter)?l.filter:"";var m=(l.mood)?l.mood:"any";this.items=new Array();this.aliases={};this.cache={audio:{},playlist:{},album:{},genre:{},artist:{},community:{}}};bmPlaylist.prototype.loadContent=function(F,v,D,C,E,u,A){this.readyState=this.PLAYLIST_LOADING;var G="/modules/player/index_json.php";if(F!==""||F>0){if(application.keyExists(this.cache[v],F)){this.currentRequest=null;var H={data:this.cache[v][F],url:"cache",offset:A||0};if(D=="add"){this.loadContentHandler(H)}else{this.loadContentNewHandler(H)}return}}if(typeof u=="undefined"){u=this.mood}G+="?id="+F+"&type="+v+"&act="+D+"&mood="+u;if(typeof C!="undefined"){G+="&limit="+C}if(typeof E!="undefined"&&E!=null){var x=new Array();var z=0;if(typeof(E)=="object"){for(var t in E){var w="";if(typeof(E[t])=="object"){var y=new Array();for(var B in E[t]){y.push(E[t][B])}w=y.join(",")}else{w=E[t]}x.push(t+":"+w);z++}x=x.join(";");if(typeof E.firstId!="undefined"){delete (E.firstId);z--;if(z>0){this.filter=E}}else{this.filter=E}}else{if(E!=""){alert("Если ты разработчик Веборамы, то ты знаешь что делать. Если ты пользователь, то извини за причинённые неудобства, и если не сложно, сообщи об этом сообщении в службу поддержки ");x=E}}if(x!=""&&F==0){G+="&filter="+x}}if(F==0){G+="&seed="+Math.random()}this.mood=u;this.contentId=F;if(this.currentRequest!==null){application.httpGateway.deleteRequest(this.currentRequest)}var s=this;this.currentRequest=this.application.httpGateway.get(G,function(a){a.offset=A||0;s[D=="add"?"loadContentHandler":"loadContentNewHandler"](a)})};bmPlaylist.prototype.shift=function(b){this.itemsOffset=new Array();this.itemsOffset=this.items.splice(0,b);this.setAliases();b=11-this.items.length;if(b>0){this.loadContent(0,"playlist","add",b,this.filter,this.mood)}return this.itemsOffset};bmPlaylist.prototype.pop=function(d){var c=application.player.readyState==2?0:1;if(d==null){d=this.items.length-c}else{c=this.items.length-d}this.itemsOffset=new Array();this.itemsOffset=this.items.splice(c,d);d=11-this.items.length;if(d>0){this.loadContent(0,"playlist","add",d,this.filter,this.mood)}return this.itemsOffset};bmPlaylist.prototype.randomContentUpdate=function(){var f=application.player.readyState==2?0:1;for(var e=this.items.length-1;e>=f;--e){if(this.items[e].random==false){f=e+1;break}}var d=this.items.length-f;this.itemsOffset=new Array();this.itemsOffset=this.items.splice(f,d);d=11-this.items.length;if(d>0){this.loadContent(0,"playlist","add",d,this.filter,this.mood)}return this.itemsOffset};bmPlaylist.prototype.setAliases=function(){var b=0;while(this.items[b]){this.aliases[this.items[b].identifier]=b;b++}};bmPlaylist.prototype.setCache=function(x){var t=x.data,v=t.identifier.length==32?t.identifier:parseInt(t.identifier),p=this.cache[t.type],q=t.trackList,s=0,w=(x.url.indexOf("offset=")!=-1);if(!w&&v&&!application.keyExists(p,v)){p[v]=t}if(t.type!="audio"){while(q[s]){var c=q[s],o={identifier:c.identifier,mood:c.mood,type:"audio",trackList:[c]};this.setCache({data:o,url:""});s++}}var u=(t.type=="audio"?50:10),r=0;for(s in p){r++;if(r>=u){delete (p[s])}}};bmPlaylist.prototype.insertSongs=function(f){var e=f.length;if(e>0){var d=this.playlistGeneratorSource+"?id=0&type=playlist&limit="+e+"&filter=firstId:"+f.join(",");application.httpGateway.get(d,this.suspendSongsEventHandler)}};function bmPlayer(e,f,g){var h=this;h.callPlaySong=function(a){var b={songNumber:a};if((handlers=h.events.playsong)!=null){var d;for(i in handlers){try{d=handlers[i];var l=d(b);if(l){return false}}catch(c){}}}};h.callOnStateChange=function(){var a=h.readyState;if((handlers=h.events.statechange)!=null){var c;for(i in handlers){try{c=handlers[i];var d=c(a);if(d){return false}}catch(b){}}}};h.callOnFlashStateChange=function(a){if((handlers=h.events.flashstatechange)!=null){var b;for(i in handlers){b=handlers[i];var c=b(a);if(c){return false}}}};h.callOnProgress=function(c,d){h.songOffset=d;var a=h.getItem(h.getIdentifier(c));a.position=d;if((handlers=h.events.progress)!=null){var b;for(i in handlers){b=handlers[i];var l=b(a);if(l){return false}}}};h.callOnBuffering=function(d,b){var a={item:h.getItem(h.getIdentifier(d)),buffering:b};if((handlers=h.events.bufering)!=null){var c;for(i in handlers){c=handlers[i];var l=c(a);if(l){return false}}}};h.callOnComplete=function(c,d){h.readyState=h.PLAYER_SONG_COMPLETE;h.callOnStateChange();h.songOffset=-1;var a=h.readyState;a.position=d;if((handlers=h.events.complete)!=null){var b;for(i in handlers){b=handlers[i];var l=b(a);if(l){return false}}}};h.callOnFileError=function(a){if(h.songOffset){h.playerObject.stopFile();h.playerObject.playFile(a,h.songOffset)}};h.callOnOpen=function(){};h.callOnId3=function(){};h.onPlaylistChange=function(){};h.playOnPlaylistChange=function(){h.playNewWithoutShift();application.playlist.detachEvent("loadplaylist",h.playOnPlaylistChange)};h.waitForLoad=function(){if((top||0).document===null){setTimeout(h.waitForLoad,500);return false}if(window.top.document.getElementById("player")===null){setTimeout(h.waitForLoad,500);return false}var a=application.getWindow("player");if(a===null){setTimeout(h.waitForLoad,500);return false}a=a.document.getElementById(h.playerObjectContainer);if(a===null){setTimeout(h.waitForLoad,500);return false}h.createFlashObject(a);h.playerAccessible()};if(g!==false){this.create(e,f,g)}}bmPlayer.inherit(bmCustomControl);bmPlayer.prototype.playerObject=null;bmPlayer.prototype.playerObjectInit=false;bmPlayer.prototype.playerObjectContainer="playerObjectContainer";bmPlayer.prototype.readyState=-1;bmPlayer.prototype.songOffset=-1;bmPlayer.prototype.currentSong=null;bmPlayer.prototype.volume=0;bmPlayer.prototype.statisticRP="/modules/player/rp/writeStatisticsData.php";bmPlayer.prototype.PLAYER_READY=0;bmPlayer.prototype.PLAYER_PLAY=1;bmPlayer.prototype.PLAYER_PAUSE=2;bmPlayer.prototype.PLAYER_SONG_COMPLETE=3;bmPlayer.prototype.playerAccessible=function(){if(this.playerObjectInit&&(this.readyState!=-1)){if(application.cgi.getCookie("volume")){this.setVolume(application.cgi.getCookie("volume"))}else{this.setVolume(100)}}};bmPlayer.prototype.create=function(d,e,f){bmCustomControl.prototype.create.call(this,d,e,f);this.ownEvents={play:-1,statechange:-1,progress:-1,flashstatechange:-1,buffering:-1,complete:-1};this.waitForLoad();d.playlist.attachEvent("loadplaylist",this.onPlaylistChange)};bmPlayer.prototype.playNew=function(b){if(this.playerObject!=null){if(typeof(b)==="undefined"){b=0}this.stop();application.playlist.shift(b);this.writeListenStatistic();this.currentSong=application.playlist.items[0];this.playerObject.playFile(this.currentSong.location,this.currentSong.progress);this.readyState=this.PLAYER_PLAY;this.callOnStateChange()}};bmPlayer.prototype.writeListenStatistic=function(){if(application.player.currentSong){if(application.player.currentSong.duration!=0){if((application.player.currentSong.position/application.player.currentSong.duration)>0.8){application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=1")}else{application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=0")}}else{application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=0")}}};bmPlayer.prototype.playNewWithoutShift=function(b){if(this.playerObject!=null){if(b==null){b=0}this.stop();if(application.player.currentSong){if(application.player.currentSong.duration!=0){if((application.player.currentSong.position/application.player.currentSong.duration)>0.8){application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=1")}else{application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=0")}}else{application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=0")}}this.currentSong=application.playlist.items[0];this.playerObject.playFile(this.currentSong.location,this.currentSong.progress);this.readyState=this.PLAYER_PLAY;this.callOnStateChange()}};bmPlayer.prototype.playContent=function(l,p,o,k,h,m,n){application.playlist.attachEvent("loadplaylist",this.playOnPlaylistChange);application.playlist.loadContent(l,p,o,k,h,m,n)};bmPlayer.prototype.play=function(){this.playerObject.playFile();this.readyState=this.PLAYER_PLAY;this.callOnStateChange()};bmPlayer.prototype.pause=function(){this.playerObject.pauseFile();this.readyState=this.PLAYER_PAUSE;this.callOnStateChange()};bmPlayer.prototype.stop=function(){this.playerObject.stopFile();this.readyState=this.PLAYER_READY;this.callOnStateChange()};bmPlayer.prototype.setVolume=function(b){this.volume=b;this.playerObject.setVolume(this.volume);application.cgi.addCookie("volume",this.volume)};bmPlayer.prototype.getListenContentType=function(){var d="";var c=application.player.currentSong;if(c!=null){if(c.status!=null){d=c.status.type}}return d};bmPlayer.prototype.getListenContentId=function(){var d=0;var c=application.player.currentSong;if(c!=null){if(c.status!=null){d=c.status.identifier}}return d};bmPlayer.prototype.getProgress=function(b){this.songOffset=b};bmPlayer.prototype.onFlashReady=function(){this.readyState=this.PLAYER_READY;this.callOnStateChange();this.playerAccessible()};bmPlayer.prototype.onComplete=function(b){this.readyState=this.PLAYER_READY;this.callOnStateChange();if(application.player.currentSong){if(application.player.currentSong.duration!=0){if((application.player.currentSong.position/application.player.currentSong.duration)>0.8){application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=1")}else{application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=0")}}else{application.httpGateway.get(this.statisticRP+"?id="+application.player.currentSong.identifier+"&full=0")}}this.currentSong=null;this.callOnComplete()};bmPlayer.prototype.createFlashObject=function(e){var d="application.player.";var f={debug:"1",getState:"getState",onStateChange:d+"callOnFlashStateChange",playFile:"playFile",pause:"pauseFile",stop:"stopFile",setVolume:"setVolume",progressTimer:50,onReady:d+"onFlashReady",onOpen:d+"callOnOpen",onProgress:d+"callOnProgress",onBuffering:d+"callOnBuffering",onComplete:d+"onComplete",onFileError:d+"callOnFileError",onInitError:d+"callOnInitError",onId3:d+"callOnId3"};objectHTML=application.createMovie("weboramaPlayer","/flash/hidden-player.swf",1,1,f);if(/Webkit/i.test(navigator.userAgent)){application.updateElement(e,objectHTML,e.ownerDocument)}else{e.innerHTML=objectHTML}this.playerObject=application.getFlashObject(application.getWindow("player"),"weboramaPlayer");this.playerObjectInit=true};bmPlayer.prototype.getItem=function(b){return application.playlist.items[application.playlist.aliases[b]]};bmPlayer.prototype.getItemIndex=function(b){return application.playlist.aliases[b]};bmPlayer.prototype.getIdentifier=function(b){return b.match(/\/([a-z0-9]{32})$/i)[1]};bmPlayer.prototype.insertSongsToTrackList=function(b){application.playlist.insertSongs(b)};function bmUploader(d,e,f){if(f!==false){this.create(d,e,f)}}bmUploader.inherit(bmCustomControl);bmUploader.prototype.readyState=-1;bmUploader.prototype.uploaderObject=null;bmUploader.prototype.progressFiles=null;bmUploader.prototype.info=null;bmUploader.prototype.requestURI="/modules/upload/rp/uploadMusic.php";bmUploader.prototype.instanceName="uploader";bmUploader.prototype.window="content";bmUploader.prototype.container="uploaderTest";bmUploader.prototype.oneFile=false;bmUploader.prototype.FILE_STATUS=-1;bmUploader.prototype.FILE_STATUS_UPLOAD=0;bmUploader.prototype.FILE_STATUS_COMLETE=1;bmUploader.prototype.FILE_STATUS_ERROR=2;bmUploader.prototype.FILE_STATUS_CANCEL=3;bmUploader.prototype.UPLOADER_STATUS=-1;bmUploader.prototype.UPLOADER_STATUS_READY=0;bmUploader.prototype.UPLOADER_STATUS_BROWSE=1;bmUploader.prototype.UPLOADER_STATUS_UPLOAD=2;bmUploader.prototype.UPLOADER_STATUS_SEND=3;bmUploader.prototype.UPLOADER_MAX_FILE_SIZE=67108864;bmUploader.prototype.create=function(e,f,g){var h=this;h.info={audio:{countFiles:0,uploadedFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0},photo:{countFiles:0,uploadedFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0},countFiles:0,uploadedFiles:0,progressFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0,string:""};h.progressFiles={};h.callOnAddFile=function(d){var a=d;if((handlers=h.events.onaddfile)!=null){var b;var c;for(c in handlers){b=handlers[c];var l=b(a);if(l){return false}}}};h.callOnBrowseComplete=function(){var a={comlete:1};if((handlers=h.events.onbrowsecomplete)!=null){var b;var c;for(c in handlers){b=handlers[c];var d=b(a);if(d){return false}}}};h.callOnProgress=function(a){h.info.string=h.info.progressFiles+" / "+h.info.countFiles+" "+application.declineNumber(h.info.countFiles,["файл","файла","файлов"]);var b={current:a,total:h.info};if((handlers=h.events.onprogress)!=null){var c;var d;for(d in handlers){c=handlers[d];var l=c(b);if(l){return false}}}};h.callOnCompleteFile=function(d){var a=d;if((handlers=h.events.oncompletefile)!=null){var b;var c;for(c in handlers){b=handlers[c];var l=b(a);if(l){return false}}}};h.callOnErrorFile=function(d){var a=h.progressFiles[d];if((handlers=h.events.onerrorfile)!=null){var b;var c;for(c in handlers){b=handlers[c];var l=b(a);if(l){return false}}}};h.callOnErrorServer=function(d){var a=d;if((handlers=h.events.onerrorserver)!=null){var b;var c;for(c in handlers){b=handlers[c];var l=b(a);if(l){return false}}}};h.callReadyStateChange=function(d){h.readyState=d;if(d==h.UPLOADER_STATUS_UPLOAD){h.info.progressFiles++}var a={readyState:d};if((handlers=h.events.onreadystatechange)!=null){var b;var c;for(c in handlers){b=handlers[c];var l=b(a);if(l){return false}}}};h.callOnCompleteAll=function(){var a=h.info;if((handlers=h.events.oncompleteall)!=null){var b;var c;for(c in handlers){b=handlers[c];var d=b(a);if(d){return false}}}};h.waitForLoad=function(){if((top||0).document===null){setTimeout(h.waitForLoad,500);return false}if(window.top.document.getElementById(h.window)===null){setTimeout(h.waitForLoad,500);return false}var a=application.getWindow(h.window);if(a===null){setTimeout(h.waitForLoad,500);return false}a=a.document.getElementById(h.container);if(a===null){setTimeout(h.waitForLoad,500);return false}h.createFlashObject(a);application.removeEvent(window,"load",h.waitForLoad)};h.waitCreateObject=function(){h.uploaderObject=application.getFlashObject(application.getWindow(h.window),h.instanceName);if(h.uploaderObject==null){setTimeout(function(){h.waitCreateObject()},500)}};bmCustomControl.prototype.create.call(this,e,f,g);this.ownEvents={onreadystatechange:-1,onaddfile:-1,onbrowsecomplete:-1,onprogress:-1,oncompletefile:-1,onerrorfile:-1,onerrorserver:-1,oncompleteall:-1};if(typeof(g.window)!="undefined"){this.window=g.window}if(typeof(g.container)!="undefined"){this.container=g.container}if(typeof(g.requestURI)!="undefined"){this.requestURI=g.requestURI}if(typeof(g.oneFile)!="undefined"){this.oneFile=g.oneFile}if(typeof(g.instanceName)!="undefined"){this.instanceName=g.instanceName}this.waitForLoad()};bmUploader.prototype.browseFiles=function(){this.uploaderObject.browseFiles(this.oneFile)};bmUploader.prototype.getBrowseSettings=function(){var d=(this.parameters.flashVariables||0).groups||"*.doc";var c=(this.parameters.flashVariables||0).titles||"Гивино";return[this.oneFile,c,d]};bmUploader.prototype.addFile=function(f){var d=this.generateId(f);var e=null;if(typeof(this.progressFiles[d])=="undefined"){this.progressFiles[d]=new bmFile(d,f);if(f.size>=this.UPLOADER_MAX_FILE_SIZE){this.progressFiles[d].status=this.FILE_STATUS_ERROR;this.progressFiles[d].errorType="216";this.progressFiles[d].errorMessage="Размер файла превысил максимально допустимый.";e=null;++this.info.countFiles;++this.info.errorFiles;if(this.progressFiles[d].type=="audio"){++this.info.audio.countFiles;++this.info.audio.errorFiles}else{++this.info.photo.countFiles;++this.info.photo.errorFiles}this.callOnErrorFile(d)}else{++this.info.countFiles;this.info.totalBytes=this.info.totalBytes+this.progressFiles[d].bytesTotal;if(this.progressFiles[d].type=="audio"){++this.info.audio.countFiles;this.info.audio.totalBytes=this.info.audio.totalBytes+this.progressFiles[d].bytesTotal}else{++this.info.photo.countFiles;this.info.photo.totalBytes=this.info.photo.totalBytes+this.progressFiles[d].bytesTotal}e=d}this.callOnAddFile(this.progressFiles[d])}return e};bmUploader.prototype.onBrowseComplete=function(){this.callOnBrowseComplete();this.startUpload()};bmUploader.prototype.startUpload=function(){if(application.objectLength(this.progressFiles)>0){this.uploaderObject.startUpload()}else{this.onCompleteAll()}};bmUploader.prototype.retryFile=function(b){this.uploaderObject.retryFile(b);this.progressFiles[b].status=this.FILE_STATUS_UPLOAD};bmUploader.prototype.retryAll=function(){this.uploaderObject.retryAll()};bmUploader.prototype.cancelFile=function(b){this.uploaderObject.cancelFile(b);this.info.uploadBytes=this.info.uploadBytes-this.progressFiles[b].bytesLoaded;this.info.totalBytes=this.info.totalBytes-this.progressFiles[b].bytesTotal;--this.info.countFiles;switch(this.progressFiles[b].type){case"audio":this.info.audio.uploadBytes=this.info.audio.uploadBytes-this.progressFiles[b].bytesLoaded;this.info.audio.totalBytes=this.info.audio.totalBytes-this.progressFiles[b].bytesTotal;break;case"photo":this.info.photo.uploadBytes=this.info.photo.uploadBytes-this.progressFiles[b].bytesLoaded;this.info.photo.totalBytes=this.info.photo.totalBytes-this.progressFiles[b].bytesTotal;break}this.progressFiles[b].bytesLoaded=0;this.progressFiles[b].status=this.FILE_STATUS_CANCEL;if(this.info.uploadedFiles+this.info.errorFiles<this.info.countFiles){this.startUpload()}else{this.onCompleteAll()}};bmUploader.prototype.cancelAll=function(){this.uploaderObject.cancelAll();this.info={audio:{countFiles:0,uploadedFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0},photo:{countFiles:0,uploadedFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0},countFiles:0,uploadedFiles:0,progressFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0,string:""};var b;for(b in this.progressFiles){this.progressFiles[b].status=this.FILE_STATUS_CANCEL}};bmUploader.prototype.onProgress=function(f,h,e){var g=0;g=h-this.progressFiles[f].bytesLoaded;this.info.uploadBytes=this.info.uploadBytes+g;switch(this.progressFiles[f].type){case"audio":this.info.audio.uploadBytes=this.info.audio.uploadBytes+g;break;case"photo":this.info.photo.uploadBytes=this.info.photo.uploadBytes+g;break}this.progressFiles[f].bytesLoaded=h;this.progressFiles[f].status=this.FILE_STATUS_UPLOAD;this.callOnProgress(this.progressFiles[f])};bmUploader.prototype.onCompleteFile=function(b){this.progressFiles[b].status=this.FILE_STATUS_COMLETE;++this.info.uploadedFiles;switch(this.progressFiles[b].type){case"audio":++this.info.audio.uploadedFiles;break;case"photo":++this.info.photo.uploadedFiles;break}this.callOnCompleteFile(this.progressFiles[b]);if(this.info.uploadedFiles+this.info.errorFiles<this.info.countFiles){this.startUpload()}else{this.onCompleteAll()}};bmUploader.prototype.onCompleteAll=function(){this.callReadyStateChange(this.UPLOADER_STATUS_READY);this.callOnCompleteAll()};bmUploader.prototype.onFileError=function(g,k,h,l,f){k=parseInt(k);if(k>0&&k!=200){this.callOnErrorServer(k);return}this.progressFiles[g].status=this.FILE_STATUS_ERROR;this.progressFiles[g].httpStatus=k;this.progressFiles[g].errorType=(f||0).code?f.code:-1;this.progressFiles[g].errorMessage=(f||0).message?f.message:"Техногенная катастрофа с номером "+l;this.callOnErrorFile(g);++this.info.errorFiles;switch(this.progressFiles[g].type){case"audio":++this.info.audio.errorFiles;break;case"photo":++this.info.photo.errorFiles;break}if(this.info.uploadedFiles+this.info.errorFiles<this.info.countFiles){this.startUpload()}else{this.onCompleteAll()}};bmUploader.prototype.removeItem=function(d){var c=(this.progressFiles[d].type=="audio"?true:false);switch(this.progressFiles[d].status){case this.FILE_STATUS:case this.FILE_STATUS_UPLOAD:this.uploaderObject.cancelFile(d);break;case this.FILE_STATUS_ERROR:this.info.errorFiles--;if(c){this.info.audio.errorFiles--}else{this.info.photo.errorFiles--}break;case this.FILE_STATUS_COMLETE:application.httpGateway.sendData("/modules/upload/rp/deleteSong.php",{uniqueName:d},function(){});this.info.uploadedFiles--;if(c){this.info.audio.uploadedFiles--}else{this.info.photo.uploadedFiles--}break}this.info.countFiles--;this.info.totalBytes-=this.progressFiles[d].bytesTotal;this.info.uploadBytes-=this.progressFiles[d].bytesLoaded;if(c){this.info.audio.countFiles--;this.info.audio.totalBytes-=this.progressFiles[d].bytesTotal;this.info.audio.uploadBytes-=this.progressFiles[d].bytesLoaded}else{this.info.photo.countFiles--;this.info.photo.totalBytes-=this.progressFiles[d].bytesTotal;this.info.photo.uploadBytes-=this.progressFiles[d].bytesLoaded}delete (this.progressFiles[d])};bmUploader.prototype.createFlashObject=function(c){var q="qwe";if(typeof(this.parameters.name)!="undefined"){q=this.parameters.name+"."}var o={debug:"0",upload_url:this.requestURI,cookie_name:"sessionHashW",userNameVar:"sessionHashW",idVar:"uniqueName",fileVar:"uploadedFile",getState:"getState",onStateChange:q+"callReadyStateChange",onReady:q+"callReadyStateChange(0)",browse:"browseFiles",start:"startUpload",retry:"retryFile",retryAll:"retryAll",addFile:q+"addFile",cancelFile:"cancelFile",cancelAll:"cancelAll",onProgress:q+"onProgress",onOpen:q+"onOpen",onBrowseComplete:q+"onBrowseComplete",onCompleteFile:q+"onCompleteFile",onCompleteAll:q+"onCompleteAll",onFileError:q+"onFileError",onInitError:q+"onInitError",getBrowseSettings:q+"getBrowseSettings",buttonImage:"/images/flash/big_upload_button.png",progressTimer:"200",groups:"*.mp3",titles:"Музыка",delimiter:"|"};if(application.isIE()){var m=application.cgi.getCookie(o.cookie_name);if(m){o.upload_url+=(o.upload_url.lastIndexOf("?"!=-1)?"&":"?")+o.cookie_name+"="+m;delete (o.cookie_name);o.userNameVar="flashSession"}}if(typeof(this.parameters.flashVariables)!="undefined"){var r;for(r in this.parameters.flashVariables){o[r]=this.parameters.flashVariables[r]}}var p=(this.parameters||0).width||1;var l=(this.parameters||0).height||1;var n=application.createMovie(this.instanceName,"/flash/hidden-uploader.swf",p,l,o);if(/Webkit/i.test(navigator.userAgent)){application.updateElement(c,n,c.ownerDocument)}else{c.innerHTML=n}this.uploaderObject=application.getFlashObject(application.getWindow(this.window),this.instanceName)};bmUploader.prototype.getSizes=function(){this.info={audio:{countFiles:0,uploadedFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0},photo:{countFiles:0,uploadedFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0},countFiles:0,uploadedFiles:0,progressFiles:0,errorFiles:0,totalBytes:0,uploadBytes:0,string:""};for(key in this.progressFiles){if(this.progressFiles[key].type=="audio"){++this.info.audio.countFiles;this.info.audio.totalBytes+=this.progressFiles[key].bytesTotal;this.info.audio.uploadBytes+=this.progressFiles[key].bytesLoaded;switch(this.progressFiles[key].status){case this.FILE_STATUS_COMLETE:++this.info.audio.uploadedFiles;break;case this.FILE_STATUS_ERROR:++this.info.audio.errorFiles;break}}else{++this.info.photo.countFiles;this.info.photo.totalBytes+=this.progressFiles[key].bytesTotal;this.info.photo.uploadBytes+=this.progressFiles[key].bytesLoaded;switch(this.progressFiles[key].status){case this.FILE_STATUS_COMLETE:++this.photo.audio.uploadedFiles;break;case this.FILE_STATUS_ERROR:++this.photo.audio.errorFiles;break}}this.info.totalBytes+=this.progressFiles[key].bytesTotal;this.info.uploadBytes+=this.progressFiles[key].bytesLoaded;++this.info.countFiles;switch(this.progressFiles[key].status){case this.FILE_STATUS_COMLETE:++this.info.uploadedFiles;break;case this.FILE_STATUS_ERROR:++this.info.errorFiles;break;case this.FILE_STATUS_UPLOAD:++this.info.progressFiles;break}}this.info.string=this.info.uploadedFiles+this.info.progressFiles+" / "+this.info.countFiles+" "+application.declineNumber(this.info.countFiles,["файл","файла","файлов"]);return this.info};bmUploader.prototype.generateId=function(c){var d=[c.name,c.size,c.type,c.creationDate.getTime(),c.creator||"unknown",c.modificationDate.getTime()];d=d.join(":");d=d.replace(/[^a-zA-Z0-9]/gi,"");d=d.toLowerCase().MD5();return d};function bmFile(d,c){this.uniqueName=d;this.fileReference=c;this.bytesTotal=c.size;this.type=c.name.toLowerCase().indexOf("mp3")!=-1?"audio":"photo"}bmFile.prototype.uniqueName="";bmFile.prototype.dbId="";bmFile.prototype.fileReference="";bmFile.prototype.type="";bmFile.prototype.bytesLoaded=0;bmFile.prototype.bytesTotal=0;bmFile.prototype.httpStatus=-1;bmFile.prototype.errorType="";bmFile.prototype.errorMessage="";bmFile.prototype.status=-1;bmFile.prototype.infoDisplay=null;bmFile.prototype.itemProgress=null;bmFile.prototype.itemTitle=null;bmFile.prototype.relation=0;function bmHintPopup(e,f,g){var h=this;h.currentItem={identifier:0,title:"",index:0};h.callOnItemSelect=function(){var a=h.currentItem;if((handlers=h.events.onitemselect)!=null){var b;var c;for(c in handlers){b=handlers[c];var d=b(a);if(d){return false}}}};h.onItemMouseOver=function(a){var b=e.getOriginalEventElement(a);if(b.tagName.toLowerCase()!="li"){b=b.parentNode}h.setItem(b);e.eventPreventDefault(a);return false};h.onItemMouseOut=function(a){var b=e.getOriginalEventElement(a);if(b.tagName.toLowerCase()!="li"){b=b.parentNode}b.className=b.className.replace(/Hover$/,"");h.currentItem={identifier:0,title:"",index:0};e.eventPreventDefault(a);return false};h.onItemClick=function(a){var b=e.getOriginalEventElement(a);if(h.activeElement===b){e.eventPreventDefault(a);return false}if(e.elementInContainer(b,h.instance,h.window)){if((b.tagName.toLowerCase()=="li"&&b.className.indexOf("item")==0)||(b.tagName.toLowerCase()=="span"&&b.className.indexOf("text")==0)){h.callOnItemSelect()}}h.hide();e.eventPreventDefault(a);return false};h.onItemKeyup=function(d){var b=e.isIE()?d.keyCode:d.which;var c=false;var a=false;switch(b){case 13:if(h.currentItem.index>0){h.callOnItemSelect()}case 27:c=true;h.hide();break;case 40:h.currentItem.index++;c=true;a=true;break;case 38:h.currentItem.index--;c=true;a=true;break;case 9:h.hide();c=false;break}if(a){var n=h.instance.childNodes.length-2;h.currentItem.index=h.currentItem.index<1?1:h.currentItem.index;h.currentItem.index=h.currentItem.index>n?n:h.currentItem.index;var m=h.instance.childNodes;h.setItem(m[h.currentItem.index])}if(c){e.eventPreventDefault(d);return false}};h.setResizeInterval=function(){h.resizeInterval=h.window.setInterval(function(){h.onWindowResize()},10)};h.clearResizeInterval=function(){h.window.clearInterval(h.resizeInterval);h.resizeInterval=null};h.onWindowResize=function(a){h.instance.style.left=h.leftOffset+e.getElementLeft(h.activeElement)+10+"px";h.instance.style.top=h.topOffset+e.getElementTop(h.activeElement)+h.activeElement.offsetHeight+"px";h.resizeMenu()};h.resizeMenu=function(){if(h.activeElement!=null){var a=e.getElementWidth(h.instance);var b=e.getElementWidth(h.activeElement);if(h.visible){if(h.itemCache.length>0){h.correctTextItems()}}}};h.correctTextItems=function(){var b=e.getElementWidth(h.instance);var a=e.getElementWidth(h.activeElement);var r=h.instance.childNodes;var t=parseInt((a)/8,10);h.countItemsChange=0;var u=1;var d=0;for(d=1;d<(r.length-1);d++){var s=r[d];var v=s.id;v=v.substr(4);var c=h.itemCache[v].trim();if(c.length>t){var q=c.substr(0,t-3);q+="...";q+=currentNodeText.substr(c.length-3);s.childNodes[2].firstChild.nodeValue=q;h.countItemsChange++}else{s.childNodes[2].firstChild.nodeValue=h.itemCache[v].trim()}}};if(g!==false){this.create(e,f,g)}}bmHintPopup.inherit(bmCustomControl);bmHintPopup.prototype.instance=null;bmHintPopup.prototype.itemTemplate="li_hintPopup";bmHintPopup.prototype.template="ul_hintPopup";bmHintPopup.prototype.currentItem=null;bmHintPopup.prototype.visible=false;bmHintPopup.prototype.window=null;bmHintPopup.prototype.activeElement=null;bmHintPopup.prototype.resize=0;bmHintPopup.prototype.follow=true;bmHintPopup.prototype.cache=null;bmHintPopup.prototype.timeOutSeted=false;bmHintPopup.prototype.leftOffset=0;bmHintPopup.prototype.leftOffset=0;bmHintPopup.prototype.timeOuts={};bmHintPopup.prototype.resizeInterval=null;bmHintPopup.prototype.itemCache=null;bmHintPopup.prototype.lastWidthActiveElement=null;bmHintPopup.prototype.countItemsChange=0;bmHintPopup.prototype.maxWidthInstance=0;bmHintPopup.prototype.create=function(d,e,f){bmCustomControl.prototype.create.call(this,d,e,f);this.ownEvents={onitemselect:null};if(typeof(f.window)=="undefined"){f.window="content"}this.window=application.getWindow(f.window);if(typeof(f.instance)!="undefined"){if(typeof(f.instance)!="object"){f.instance=this.window.document.getElementById(f.instance)}this.instance=f.instance}else{this.instance=this.window.document.getElementById("hintPopup");if(this.instance==null){application.updateElement(this.window.document.getElementsByTagName("body")[0],application.applyTemplate(this.template,{identifier:"hintPopup"},window),this.window.document,"append");this.instance=this.window.document.getElementById("hintPopup")}}if(typeof(f.activeElement)!="undefined"){this.setActiveElement(f.activeElement)}if(typeof(f.follow)=="undefined"){this.follow=true}else{this.follow=f.follow}if(typeof(f.leftOffset)!="undefined"){this.leftOffset=f.leftOffset}else{this.leftOffset=0}if(typeof(f.topOffset)!="undefined"){this.topOffset=f.topOffset}else{this.topOffset=0}this.itemCache=new Array()};bmHintPopup.prototype.checkCache=function(d){var c=this.cache.getElementById(d);if(c===null){return false}this.updateFromCache(d);return true};bmHintPopup.prototype.setCache=function(g,f,h){var k=this.window.document.createElement("ul");k.id=f;k=this.cache.appendChild(k);for(l in g){if(typeof(g[l])!="object"){g[l]={identifier:"_",title:g[l]}}application.updateElement(k,application.applyTemplate(this.itemTemplate,g[l],window),this.window.document,"append")}if(h!=null){var l;for(l in h){k.style[l]=h[l]}}this.updateFromCache(f);return k};bmHintPopup.prototype.clear=function(){var b=this.instance.childNodes;while(b.length>2){application.removeEvent(this.window.document,"keydown",this.onItemKeyup);application.removeEvent(this.window.document,"click",this.onItemClick);this.instance.removeChild(b[1])}this.instance.style.width="";this.instance.firstChild.style.width="";this.instance.lastChild.style.width="";application.getElementWidth(this.instance)+"px"};bmHintPopup.prototype.update=function(items){var lastItem=this.instance.childNodes;lastItem=lastItem[lastItem.length-1];var maxItem="";this.hide();this.clear();this.itemCache=new Array();var itemTitle="";var widthInput=application.getElementWidth(this.activeElement);var maxSymbolsInItem=parseInt((widthInput)/8,10);var i;for(i in items){if(typeof(items[i])!="object"){items[i]={identifier:i,title:items[i]}}this.itemCache[i]=items[i].title;if(items[i].title.length>maxItem.length){maxItem=items[i].title}if(items[i].title.length>maxSymbolsInItem){var itemTitle=items[i].title.substr(0,maxSymbolsInItem-3);itemTitle+="...";itemTitle+=items[i].title.substr(-3,3);items[i].title=itemTitle}var html=application.applyTemplate(this.itemTemplate,items[i],window);application.updateElement(this.instance,html,this.window.document,"insert",lastItem);var newLi=this.instance.childNodes[this.instance.childNodes.length-2];application.attachEvent(newLi,"mouseover",this.onItemMouseOver);application.attachEvent(newLi,"mouseout",this.onItemMouseOut)}maxItem=maxItem.replace(/[^0-9a-zа-я]/ig," ");maxItem=maxItem.replace(/[\d]/g,"+5");maxItem=maxItem.replace(/[A-ZА-Я]/g,"+11");maxItem=maxItem.replace(/[a-zа-я ]/g,"+8");var maxWidth=eval(maxItem);maxWidth=maxWidth+70;this.maxWidthInstance=maxWidth;return name};bmHintPopup.prototype.updateFromCache=function(f){if(f==null){throw new TypeError;return false}var h=this.cache.getElementById(f);var g=this.instance.childNodes;g=g[g.length-1];this.clear();var e=h.childNodes.length-1;for(e;e>-1;--e){g=this.instance.insertBefore(h.childNodes[e].cloneNode(),g);application.attachEvent(g,"mouseover",this.onItemMouseOver);application.attachEvent(g,"mouseout",this.onItemMouseOut)}this.setStyle(h.style);return f};bmHintPopup.prototype.show=function(h){this.visible=true;var f=this.window.document;var g=this.onItemClick;var e=this.onItemKeyup;this.currentItem={identifier:0,title:"",index:0};if((this.timeOuts||0).click!=null){this.window.clearTimeout(this.timeOuts.click)}this.timeOuts.click=this.window.setTimeout(function(){application.attachEvent(f,"click",g)},100);if((this.timeOuts||0).keydown!=null){this.window.clearTimeout(this.timeOuts.keydown)}this.timeOuts.keydown=this.window.setTimeout(function(){application.attachEvent(f,"keydown",e)},100);this.instance.style.display="block";this.instance.firstChild.style.width=application.getElementWidth(this.instance)+"px";this.instance.lastChild.style.width=application.getElementWidth(this.instance)+"px";this.resize=application.getElementLeft(this.activeElement);this.setResizeInterval()};bmHintPopup.prototype.showWait=function(b){if(b!=null){this.setStyle(b)}this.clear();this.hide();hpiwait=application.applyTemplate("li_hintPopupWait",{},window);application.updateElement(this.instance,hpiwait,this.window.document,"insert",this.instance.lastChild);this.show()};bmHintPopup.prototype.hide=function(){this.currentItem={identifier:0,title:"",index:0};this.visible=false;application.removeEvent(this.window.document,"click",this.onItemClick);application.removeEvent(this.window.document,"keydown",this.onItemKeyup);application.removeEvent(this.window,"resize",this.onWindowResize);this.instance.style.display="none";this.instance.style.width="";this.resize=0;this.clear();this.clearResizeInterval();this.itemCache=new Array()};bmHintPopup.prototype.setActiveElement=function(b){if(typeof(b)=="string"){b=this.window.document.getElementById(b)}this.activeElement=b};bmHintPopup.prototype.unsetActiveElement=function(){this.activeElement=null};bmHintPopup.prototype.setStyle=function(c){var d;for(d in c){this.instance.style[d]=c[d]}};bmHintPopup.prototype.setOffset=function(c,d){if(typeof(c)!="undefined"){this.leftOffset=c}if(typeof(d)!="undefined"){this.topOffset=d}};bmHintPopup.prototype.setItem=function(f){var e=this.instance.childNodes;for(var d=1;d<e.length-1;++d){if(e[d]===f){this.currentItem.index=d;this.currentItem.identifier=e[d].id.match(/([^_]*)$/)[0];this.currentItem.title=e[d].lastChild.lastChild.nodeValue;e[d].className=e[d].className+(e[d].className.indexOf("Hover")==-1?"Hover":"")}else{e[d].className=e[d].className.replace(/Hover$/,"")}}};bmHintPopup.prototype.parseElementValue=function(){var m=0;var r=this.activeElement.value;var l={items:new Array(),currentItem:-1,currentValue:"",cursorOffset:this.activeElement.selectionStart};var p=1;var n=false;var o="";var q=r;while((o=r.substring(p-1,p))){if(p==l.cursorOffset){l.items.push(r.substring(m,p).trim());l.currentItem=l.items.length-1;l.currentValue=l.items[l.currentItem];m=p}if(o==","){l.items.push(r.substring(m,p-1).trim());m=p+1}p++}var k=r.substring(m).trim();l.items.push(k);return l;return l};bmHintPopup.prototype.style=function(d,c){return this.getComputedStyle(d,c)||this.getCascadedStyle(d,c)||d.style[c]};bmHintPopup.prototype.getCascadedStyle=function(d,c){if(c=="all"){return d.currentStyle?d.currentStyle:null}else{return d.currentStyle?d.currentStyle[c]:null}};bmHintPopup.prototype.getComputedStyle=function(f,e){var g=this.window.document;if(g.defaultView&&g.defaultView.getComputedStyle){var h=g.defaultView.getComputedStyle(f,"");if(h){if(e=="all"){return h}else{return h[e]}}return null}};bmHintPopup.prototype.getItemValueById=function(b){if(this.itemCache[b]==null){return""}return this.itemCache[b]};function bmProgressBar(e,f,g){var h=this;h.onWindowResize=function(a){h.container.style.width=e.getElementWidth(g.element)+"px"};h.onUpdateHTML=function(){h.show()};h.setUpdateInterval=function(){h.moveInterval=g.window.setInterval(function(){h.onUpdateHTML()},50)};h.removeUpdateInterval=function(){g.window.clearInterval(h.moveInterval);h.moveInterval=null};if(g!==false){this.create(e,f,g)}}bmProgressBar.inherit(bmCustomControl);bmProgressBar.prototype.container=null;bmProgressBar.prototype.instance=null;bmProgressBar.prototype.template="div_uploadProgress";bmProgressBar.prototype.visible=false;bmProgressBar.prototype.resize=0;bmProgressBar.prototype.custom=false;bmProgressBar.prototype.moveInterval=null;bmProgressBar.prototype.create=function(d,e,f){if(typeof(f.window)=="undefined"){f.window="content"}f.window=application.getWindow(f.window);if(typeof(f.element)!="undefined"){if(typeof(f.element)!="object"){f.element=f.window.document.getElementById(f.element)}}else{if(typeof(f.instance)=="undefined"){throw new TypeError}}if(typeof(f.instance)!="undefined"){if(typeof(f.instance)!="object"){f.instance=f.window.document.getElementById(f.instance)}this.instance=f.instance}else{this.custom=true;if(typeof(f.follow)=="undefined"){f.follow=true}if(typeof(f.duration)=="undefined"){f.duration="bottom"}if(f.follow){application.updateElement(f.window.document.body,application.applyTemplate(this.template,{id:f.name},window),f.window.document,"append")}else{if(f.duration=="top"){application.updateElement(f.element.parentNode,application.applyTemplate(this.template,{id:f.name},window),f.window.document,"insert",f.element)}else{if(f.element.parentNode.lastChild==f.element){application.updateElement(f.element.parentNode,application.applyTemplate(this.template,{id:f.name},window),f.window.document,"append")}else{if(f.element.nextSibling!==null){application.updateElement(f.element.parentNode,application.applyTemplate(this.template,{id:f.name},window),f.window.document,"insert",f.element.nextSibling)}}}}this.instance=f.window.document.getElementById(f.name);this.setStyle({display:"none",background:"transparent url(/images/upload/progress.gif) repeat-x 0 0",height:"4px",maginTop:"1px"})}bmCustomControl.prototype.create.call(this,d,e,f)};bmProgressBar.prototype.setStyle=function(c){var d;for(d in c){this.instance.style[d]=c[d]}};bmProgressBar.prototype.show=function(){if(this.parameters.follow){var b={};b.left=application.getElementLeft(this.parameters.element)+"px";b.top=application.getElementTop(this.parameters.element);if(this.parameters.duration=="bottom"){b.top=b.top+application.getElementHeight(this.parameters.element)+1}else{if(this.parameters.duration=="top"){b.top=b.top-5}}b.top=b.top+"px";b.display="block";b.position="absolute";this.setStyle(b)}else{this.setStyle({display:"block"})}if(this.moveInterval==null){this.setUpdateInterval()}};bmProgressBar.prototype.hide=function(){this.setStyle({display:"none"});if(this.moveInterval!=null){this.removeUpdateInterval()}};bmProgressBar.prototype.setValue=function(b){b=b<0?0:b;b=b>1?1:b;if(this.parameters.follow){this.instance.style.width=Math.round(application.getElementWidth(this.parameters.element)*b)+"px"}else{this.instance.style.width=Math.round(b*100)+"%"}};bmProgressBar.prototype.setElement=function(b){this.parameters.element=b};function bmRoundProgress(e,f,g){var h=this;h.setVisible=function(){h.instance.style.display="block";clearTimeout(this.visibleTimeout);this.visibleTimeout=null};if(g!==false){this.create(e,f,g)}}bmRoundProgress.inherit(bmCustomControl);bmRoundProgress.prototype.instance=null;bmRoundProgress.prototype.resize=0;bmRoundProgress.prototype.visibleTimeout=null;bmRoundProgress.prototype.everShow=false;bmRoundProgress.prototype.create=function(d,e,f){if(typeof(f.window)=="undefined"){f.window="content"}if(typeof(f.window)!="object"){f.window=application.getWindow(f.window)}if(typeof(f.everShow)!="undefined"){this.everShow=f.everShow}if(typeof(f.instance)!="undefined"){if(typeof(f.instance)!="object"){f.instance=f.window.document.getElementById(f.instance)}this.instance=f.instance}else{this.instance=f.window.document.getElementById(f.name);this.setStyle({background:"transparent url(/images/upload/roundProgress.gif) no-repeat 0 0",height:"12px",width:"12px",display:(this.everShow?"block":"none")})}bmCustomControl.prototype.create.call(this,d,e,f)};bmRoundProgress.prototype.setStyle=function(c){var d;for(d in c){this.instance.style[d]=c[d]}};bmRoundProgress.prototype.setValue=function(f,e){var d=Math.floor((f/e)*11);this.setStyle({backgroundPosition:"0 -"+d*12+"px"});if(!this.everShow&&this.visibleTimeout===null){this.visibleTimeout=setTimeout(this.setVisible,1000)}};bmRoundProgress.prototype.setComplete=function(){this.setStyle({backgroundPosition:"0 -144px"})};bmRoundProgress.prototype.setError=function(){this.setStyle({backgroundPosition:"0 -156px"})};bmRoundProgress.prototype.hide=function(){if(this.visibleTimeout!==null){clearTimeout(this.visibleTimeout);this.visibleTimeout=null}this.setStyle({display:"none"})};function bmApplication(d,e,f){if(f!==false){this.create(d,e,f)}}bmApplication.inherit(bmObject);bmApplication.prototype.formName="";bmApplication.prototype.staticServer="http://alpha.weborama.ru";bmApplication.prototype.activeForm=null;bmApplication.prototype.path="/";bmApplication.prototype.templateCache=null;bmApplication.prototype.timeoutStack=null;bmApplication.prototype.httpGateway=null;bmApplication.prototype.cgi=null;bmApplication.prototype.player=null;bmApplication.prototype.playlist=null;bmApplication.prototype.customHandlers=null;bmApplication.prototype.contentProvider=null;bmApplication.prototype.similarGenre=new Array();bmApplication.prototype.create=function(d,e,f){bmObject.prototype.create.call(this,d,e,f);this.httpGateway=new bmHTTPRequest(this,this,null);this.cgi=new bmCGI(this,this,null);if(typeof(bmPlaylist)!="undefined"){this.playlist=new bmPlaylist(this,this,{name:"playlist"})}if(typeof(bmPlayer)!="undefined"){this.player=new bmPlayer(this,this,{name:"player"})}if(typeof(gUserId)!="undefined"){this.userId=gUserId;this.userMood=gUserMood;this.userMoodX=gUserMoodX;this.userMoodY=gUserMoodY;this.userAvatar=gUserAvatar}if(typeof(bmContentProvider)!="undefined"){this.contentProvider=new bmContentProvider(this,this,{name:"contentProvider"})}this.locale=new Object();this.templateCache=new Array();this.applyLocaleString=function(){var a=arguments[1];return application.locale[a]};this.applyGlobal=function(){var a=arguments[1];switch(a){case"location":return window.location.toString();break}};this.customHandlers={};this.timeoutStack={}};bmApplication.prototype.createObject=function(h,f,g,e){e=e||window;if(e[h]){return new e[h](this,f,g)}else{if((g||0).url){this.createScriptNode(g.url,{className:h,owner:f,parameters:g})}else{}}};bmApplication.prototype.createScriptNode=function(l,h){var g=application.getWindow("container").document;var k=g.getElementsByTagName("head")[0];var f=g.createElement("script");f.setAttribute("src",l);f.setAttribute("type","text/javascript");f=k.appendChild(f);this.attachEventPrototype(f,"load",this.createScriptNodeHandler,h)};bmApplication.prototype.createScriptNodeHandler=function(d,e){var f=application.createObject(d.className,d.owner,d.parameters)};bmApplication.prototype.p=function(f,e,d){alert("application.p is deprecated!")};bmApplication.prototype.checkTimeout=function(d,c){if(c==null){c=150}if(typeof(application.timeoutStack[d])=="undefined"){application.timeoutStack[d]=setTimeout(function(){application.clearTimeout(d)},c);return true}return false};bmApplication.prototype.clearTimeout=function(b){clearTimeout(application.timeoutStack[b]);delete (application.timeoutStack[b])};bmApplication.prototype.applyTemplate=function(g,k,l){if(l==null){var l=this.getWindow("content")}if(this.templateCache[g]==null){this.templateCache[g]=l.document.getElementById(g).firstChild.nodeValue}var f=this.templateCache[g];if(k){var h;for(h in k){f=f.replace(new RegExp("%"+h+"%","g"),k[h])}}f=f.replace(/%locale\.(.*)%/g,this.applyLocaleString);f=f.replace(/%global\.(.*)%/g,this.applyGlobal);return f};bmApplication.prototype.passMouseEvent=function(l,m){if(l.type.indexOf("mouse")==-1){throw new TypeException("There is no mouse event!");return}m.window=m.window||application.getWindow("content");m.document=m.document||m.window.document;m.element=typeof m.element=="string"?m.document.getElementById(m.element):m.element;var n=application.isIE();var h=n?m.document.createEventObject(l):m.document.createEvent("MouseEvents");var p=null,k={},o;for(o in l){k[o]=l[o]}application.eventPreventDefault(l);l=null;if(k.type.indexOf("mouseover")!=-1){if(n){h.toElement=m.element}else{p=m.element}}else{if(k.type.indexOf("mouseout")!=-1){if(n){h.fromElement=m.element}else{p=k.relativeTarget}}else{if(n){h.fromElement=m.element;h.toElement=m.element}else{p=k.relativeTarget}}}if(n){m.element.fireEvent("on"+k.type,h)}else{h.initMouseEvent(k.type,k.bubbles,k.cancelable,k.view,k.detail,k.screenX,k.screenY,k.clientX,k.clientY,k.ctrlKey,k.altKey,k.shiftKey,k.metaKey,k.button,p);m.element.dispatchEvent(h)}};bmApplication.prototype.attachEvent=function(e,f,h,g){if(!e){return}if(h!=null){if(g){e=e.instance}else{if(e.control){if((e.control!=null)&&(typeof e.control=="object")){e=e.control}}}if(typeof e.attachEvent=="object"){return e.attachEvent("on"+f,h)}else{if(typeof e.addEventListener=="function"){return e.addEventListener(f,h,false)}}}};bmApplication.prototype.attachEventPrototype=function(o,h,m,l){var n=this;this.removeEventPrototype(o,h,m);function k(a){m(l,a)}var p=o.tagName+o.className+o.id+h+m.toString();p=p.replace(/\n/g,"").MD5();this.customHandlers[p]={component:o,eventName:h,handler:m,customHandler:k};return this.attachEvent(o,h,k)};bmApplication.prototype.removeEvent=function(d,e,f){if(typeof d.detachEvent=="object"){return d.detachEvent("on"+e,f)}else{if(typeof d.removeEventListener=="function"){return d.removeEventListener(e,f,false)}}};bmApplication.prototype.removeEventPrototype=function(h,f,g){var e=h.tagName+h.className+h.id+f+g.toString();e=e.replace(/\n/g,"").MD5();if(typeof(this.customHandlers[e])!="undefined"){this.removeEvent(this.customHandlers[e].component,this.customHandlers[e].eventName,this.customHandlers[e].customHandler);delete this.customHandlers[e]}};bmApplication.prototype.setElementStyle=function(d,f){var e;for(e in f){d.style[e]=f[e]}};bmApplication.prototype.getMousePosition=function(c){var d={x:0,y:0};if(application.isIE()){d.x=c.clientX+document.body.scrollLeft;d.y=c.clientY+document.body.scrollTop}else{d.x=c.pageX;d.y=c.pageY}return d};bmApplication.prototype.getElementTop=function(d){var c=d.offsetTop;while(d=d.offsetParent){c+=d.offsetTop}return c};bmApplication.prototype.getElementLeft=function(d){var c=d.offsetLeft;while(d=d.offsetParent){c+=d.offsetLeft}return c};bmApplication.prototype.getElementHeight=function(b){return b.offsetHeight};bmApplication.prototype.getElementWidth=function(b){return b.offsetWidth};bmApplication.prototype.getBodyScrollTop=function(e){var d=typeof(e)=="object"?e:this.getWindow(e);var f=d.document;return d.pageYOffset||(f.documentElement&&f.documentElement.scrollTop)||(f.body&&f.body.scrollTop)};bmApplication.prototype.getScreenHeight=function(g){var f=typeof(g)=="object"?g:this.getWindow(g);var l=f.document;var k=l.getElementsByTagName("body")[0];var h=0;if(window.innerHeight){h=f.innerHeight}else{if(l.documentElement&&l.documentElement.clientHeight){h=l.documentElement.clientHeight}else{if(l.body){h=l.body.clientHeight}}}return h};bmApplication.prototype.createForm=function(d,e,f){if(e==null){e="_self"}return window.open(d,e,f)};bmApplication.prototype.eventPreventDefault=function(b){if(b.preventDefault){b.preventDefault();b.stopPropagation()}else{b.returnValue=false}};bmApplication.prototype.getOriginalEventElement=function(d,f){var e=null;if(typeof d.target in {object:1,"function":1}){e=d.target}else{e=d.srcElement}if(f!=null){while(e.nodeName.toLowerCase()!=f.toLowerCase()){e=e.parentNode}}return e};bmApplication.prototype.getStyle=function(l,f,k){if(typeof(f)=="string"){f=this.getWindow(f)}if(typeof(k)=="undefined"){k="all"}var g=f.document;var h="";if(g.defaultView&&g.defaultView.getComputedStyle){h=g.defaultView.getComputedStyle(l,"");if(k!="all"){h=h.getPropertyValue(k)}}else{if(l.currentStyle){k=k.replace(/\-(\w)/g,function(b,a){return a.toUpperCase()});h=l.currentStyle;switch(k){case"all":h=h;break;case"backgroundPosition":h=h.backgroundPositionX+" "+h.backgroundPositionY;break;default:h=h[k];break}}}return h};bmApplication.prototype.getEventElement=function(e,f){if(typeof e.currentTarget=="object"){return e.currentTarget}else{var d=e.srcElement;if(f!=null){while(d.nodeName!=f){d=d.parentNode}}return d}};bmApplication.prototype.getEventTargets=function(c){var d=new Array();if(typeof c.currentTarget=="object"){d.push(c.relatedTarget);d.push(c.explicitOriginalTarget)}else{d.push(c.fromElement);d.push(c.toElement)}return d};bmApplication.prototype.elementInContainer=function(f,e,d){result=false;d=(d==null)?window:d;f=typeof f in {object:1,"function":1}?f:d.document.getElementById(f);e=typeof e in {object:1,"function":1}?e:d.document.getElementById(e);while(f!=null&&f!==e){f=f.parentNode}if(f!=null){result=true}return result};bmApplication.prototype.upToParentCN=function(d,c){c=typeof c in {object:1,"function":1}?c.className:c;while(d!=null&&d.tagName.toLowerCase()!="body"){if(d.className.indexOf(c)!=-1){return d}d=d.parentNode}return false};bmApplication.prototype.pngFix=function(p){var u=navigator.appVersion.split("MSIE");var t=parseFloat(u[1]);if(p==""){p="content"}var s=application.getWindow(p).document;if((t>=5.5&&t<7)&&(s.body.filters)){for(var x=0;x<s.images.length;++x){var w=s.images[x];var q=w.src.toUpperCase();if(q.substring(q.length-3,q.length)=="PNG"){var v=(w.id)?"id='"+w.id+"' ":"";var o=(w.className)?"class='"+w.className+"' ":"";var y=(w.title)?"title='"+w.title+"' ":"title='"+w.alt+"' ";var r="display:inline-block;"+w.style.cssText;if(w.align=="left"){r="float:left;"+r}if(w.align=="right"){r="float:right;"+r}if(w.parentElement.href){r="cursor:hand;"+r}var z="<span "+v+o+y+' style="width:'+w.width+"px; height:"+w.height+"px;"+r+";filter:progid:DXImageTransform.Microsoft.betaImageLoader(src='"+w.src+"', sizingMethod='scale');\"></span>";w.outerHTML=z;x=x-1}}}};bmApplication.prototype.objectLength=function(e){var d=0,f;for(f in e){d++}return d};bmApplication.prototype.loadXML=function(e){if(window.ActiveXObject){var d=new ActiveXObject("Microsoft.XMLDOM");d.async="false";d.loadXML(e)}else{var f=new DOMParser();var d=f.parseFromString(e,"text/xml")}return d};bmApplication.prototype.getFlashObject=function(f,d){var e=null;if(navigator.appName.toLowerCase().indexOf("microsoft")==-1){e=f.document[d]}else{e=f[d]}if(typeof(e)=="undefined"){e=f.document.getElementById(d)}return e};bmApplication.prototype.getWindow=function(d){var c=null;if(d=="container"){c=window.top}else{if(d=="player"){c=window.top.document.getElementById("player").contentWindow}else{if(d=="content"){c=window.top.document.getElementById("content").contentWindow}}}if(c==null){c=window}return c};bmApplication.prototype.getSrcFromFilter=function(d){var c="";if(d.style.filter!=""){c=d.style.filter.match(/src="([^"]+)"/);c=RegExp.$1}return c};bmApplication.prototype.createMovie=function(m,o,p,k,n){if(n!=null){var q=new Array();for(key in n){q.push(key+"="+n[key])}var r=/Firefox/i.test(navigator.userAgent)?"&amp;":"&";n='<param name="flashvars" value="'+q.join(r)+'"/>'}else{n=""}p=(""+p).indexOf("%")!=-1?p:parseInt(p)+"px";k=(""+k).indexOf("%")!=-1?k:parseInt(k)+"px";var l='<object id="'+m+'" style="z-index: 0; width: '+p+"; height: "+k+';" type="application/x-shockwave-flash" data="'+o+'"><param name="wmode" value="transparent"/>'+n+'<param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="movie" value="'+o+'"/><param name="menu" value="false"/><param name="quality" value="high"/><param name="codebase" value="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" /></object>';return l};bmApplication.prototype.timeToString=function(k){var g="";k=Math.round(k/1000);var f=Math.floor(k/3600);if(f>0){if(f<10){g+="0"}g+=f+":"}var l=Math.floor(k/60);if(l<10){g+="0"}g+=l+":";var h=Math.floor(k%60);if(h<10){g+="0"}g+=h;return g};bmApplication.prototype.declineNumber=function(c,d){if(c>100){c=c%100}firstDigit=c%10;secondDigit=Math.floor(c/10);if(secondDigit!=1){if(firstDigit==1){return d[0]}else{if(firstDigit>1&&firstDigit<5){return d[1]}else{return d[2]}}}else{return d[2]}};bmApplication.prototype.smileTextArray={0:{text:":-|",color:"#000"},1:{text:"8-0",color:"#fff"},2:{text:":-D",color:"#000"},3:{text:":-)",color:"#000"},4:{text:";-)",color:"#fff"},5:{text:"X-|",color:"#fff"},6:{text:":'-(",color:"#fff"},7:{text:":-(",color:"#fff"},8:{text:"&gt;:-/",color:"#fff"}};bmApplication.prototype.selectorXY={0:{x:74,y:68},1:{x:74+45+6,y:68-20},2:{x:74+32,y:68-32},3:{x:74,y:68+45},4:{x:74+32,y:68+32},5:{x:74,y:68-45},6:{x:74-32,y:68+32},7:{x:74-45,y:68},8:{x:74-32,y:68-32}};bmApplication.prototype.trim=function(d){var f=/^\s*/;var e=/\s*$/;return d.replace(f,"").replace(e,"")};bmApplication.prototype.isIE=function(){var b=document.getElementsByTagName("body")[0];if(b.filters!=null){return true}return false};bmApplication.prototype.addFavicon=function(e,f){var d=document.createElement("link");d.id="ico";d.rel=f;d.href=e;window.top.document.getElementsByTagName("head")[0].appendChild(d)};bmApplication.prototype.removeFavicons=function(){var b=window.top.document.getElementById("ico");if(b){window.top.document.getElementsByTagName("head")[0].removeChild(b)}};bmApplication.prototype.changeFavicon=function(f,e){this.removeFavicons();var d="/modules/temp/fico.php?mood="+f+"&color="+e.substring(1,7);this.addFavicon(d,"shortcut icon")};bmApplication.prototype.updateElement=function(element,html,aDocument,method,anchor){aDocument=(typeof aDocument=="undefined")?document:aDocument;element=(typeof element=="string")?aDocument.getElementById(element):element;anchor=(typeof anchor=="string")?aDocument.getElementById(anchor):anchor;method=(typeof method=="undefined")?"replace":method;switch(method){case"append":break;case"insert":break;case"replace":while(element.childNodes.length>0){element.removeChild(element.firstChild,true)}break}html=html.preg_replace(new Array(/>\s*</g,/>\s*([^\s<>])/g,/([^\s<>])\s*</g),new Array("><!-- splitter --><","><!-- splitter -->$1","$1<!-- splitter --><"));html=html.split("<!-- splitter -->");var node=element;var token="";var i=0;for(i in html){token=html[i].trim();if(token.indexOf("</")==0){node=node.parentNode}else{if(token.indexOf("<")==0){var matches=token.match(/^<(\w+)(.+)?>$/);var notSet=true;switch(matches[1].toLowerCase()){case"tr":if(method=="insert"&&node==element){var newNode=node.insertRow(anchor.rowIndex);node=newNode;notSet=false}else{var newNode=node.insertRow(node.rows.length);node=newNode;notSet=false}break;case"td":if(method=="insert"&&node==element){var newNode=node.insertCell(anchor.cellIndex);node=newNode;notSet=false}else{var newNode=node.insertCell(node.cells.length);node=newNode;notSet=false}break;default:var newNode=aDocument.createElement(matches[1])}if(matches[2]){var attributes=matches[2].preg_match_all(/(\w+)="([^"]+)"/g);if(attributes){for(j in attributes){if((eventName=attributes[j][1].match(/^on([a-z]*)/i))){eventName=eventName[1];var eventHandlers=attributes[j][2].preg_match_all(/[^;]+/);var ieh=0;for(ieh=0;ieh<eventHandlers.length;++ieh){var eventHandler=eventHandlers[ieh][0].trim();if(eventHandler==""){continue}else{if(eventHandler=="return false"){this.attachEvent(newNode,eventName,function(event){return application.eventPreventDefault(event)})}else{if((eventParameters=eventHandlers[ieh][0].match(/\(([^\)]+)\)/))){eventParameters=eventParameters[1];if(/(\{[^\}]+\})(, event)/.test(eventParameters)!==false){eventParameters=eventParameters.preg_match_all(/(\{[^\}]+\})(, event)/)[0][1];eventParameters=eval("("+eventParameters+")")}else{eventParameters=eventParameters[1].split(/[\s]?,[\s]?/g);var iep=0;while(eventParameters[iep]){if(eventParameters[iep]=="this"){eventParameters[iep]=newNode}else{if(eventParameters[iep]=="event"){delete (eventParameters[iep])}else{eval('var newValue = "'+eventParameters[iep].replace(/\'/g,"")+'";');eventParameters.splice(iep,1,newValue)}}iep++}}this.attachEventPrototype(newNode,eventName,eval(eventHandler.replace(/\([^\)]*\)$/,"")),eventParameters)}else{this.attachEvent(newNode,eventName,eval(eventHandler.replace(/\([^\)]*\)$/,"")))}}}}}else{if(/&#([\d]+);/.test(attributes[j][2])){attributes[j][2]="'"+attributes[j][2].replace(/&#([\d]+);/g,"' + String.fromCharCode($1) + '")+"'";attributes[j][2]=eval(attributes[j][2])}if(this.isIE()){this.nodeSetAttributes(newNode,attributes[j][1],attributes[j][2])}else{newNode.setAttribute(attributes[j][1],attributes[j][2])}}}}}if(method=="insert"&&node==element&&notSet){node=node.insertBefore(newNode,anchor)}else{if(notSet){node=node.appendChild(newNode)}}if(token.match(/\/>$/)){node=node.parentNode}}else{token=token.replace(/'/g,"&#39;");token=token.replace(/</g,"&#060;");token=token.replace(/>/g,"&#062;");if(token.indexOf("&nbsp;")!=-1){if(/&#([\d]+);/.test(token)){token="'"+token.replace(/&#([\d]+);/g,"' + String.fromCharCode($1) + '")+"'";token=eval(token)}node.innerHTML=token}else{if(/&#([\d]+);/.test(token)){token="'"+token.replace(/&#([\d]+);/g,"' + String.fromCharCode($1) + '")+"'";token=eval(token)}text=aDocument.createTextNode(token);node.appendChild(text)}}}}};bmApplication.prototype.nodeSetAttributes=function(d,e,f){switch(e){case"style":d.style.cssText=f;break;case"class":d.setAttribute("className",f);break;case"colspan":d.setAttribute("colSpan",f);break;case"rowspan":d.setAttribute("rowSpan",f);break;default:d.setAttribute(e,f)}};bmApplication.prototype.toArray=function(d){var f,e=new Array();for(f=0;f<d.length;++f){e.push(d[f])}return e};bmApplication.prototype.elementIndex=function(f,d){var e;for(e in f){if(f[e]===d){return e}}return false};bmApplication.prototype.keyExists=function(e,f){var d;for(d in e){if(d==f){return true}}return false};bmApplication.prototype.cropString=function(g,n){n=n||9;if(g.length<=n){return g}var k=g.match(/\.[a-z]{3,4}/i);var h="...";var m=0;if(k!==null){k=k[0];n=n-k.length;m=g.lastIndexOf(k)-1}else{k=""}n=Math.floor(n/2)+2;while(--n){h=g.charAt(n-1)+h;var l=m>0?m:g.length;h=h+g.charAt(l-n+1)}return h+k};bmApplication.prototype.getElementsByClassName=function(f,l,g,h){var k=null;if(document.getElementsByClassName){k=function(s,d,a,e){s=s||"content";s=typeof s=="string"?application.getWindow(s):s;e=e||s.document;var v=e.getElementsByClassName(d),b=(a)&&a!="*"?new RegExp("\\b"+a+"\\b","i"):null,u=[],r;for(var t=0,c=v.length;t<c;t+=1){r=v[t];if(!b||b.test(r.nodeName)){u.push(r)}}return u}}else{if(document.evaluate){k=function(e,a,B,b){e=e||"content";e=typeof window=="string"?application.getWindow(e):e;B=B||"*";b=b||e.document;var y=a.split(" "),D="",d="http://www.w3.org/1999/xhtml",C=(document.documentElement.namespaceURI===d)?d:null,x=[],A,z;for(var w=0,v=y.length;w<v;w+=1){D+="[contains(concat(' ', @class, ' '), ' "+y[w]+" ')]"}try{A=document.evaluate(".//"+B+D,b,C,0,null)}catch(c){A=document.evaluate(".//"+B+D,b,null,0,null)}while((z=A.iterateNext())){x.push(z)}return x}}else{k=function(I,F,C,G){I=I||"content";I=typeof window=="string"?application.getWindow(I):I;C=C||"*";G=G||I.document;var d=F.split(" "),D=[],B=(C==="*"&&G.all)?G.all:G.getElementsByTagName(C),H,b=[],J;for(var c=0,A=d.length;c<A;c+=1){D.push(new RegExp("(^|\\s)"+d[c]+"(\\s|$)"))}for(var e=0,E=B.length;e<E;e+=1){H=B[e];J=false;for(var m=0,a=D.length;m<a;m+=1){J=D[m].test(H.className);if(!J){break}}if(J){b.push(H)}}return b}}}return k(f,l,g,h)};bmApplication.prototype.getOffsets=function(E,I){I=I||"content";I=typeof I=="string"?application.getWindow(I):I;var y=I.document;E=typeof E=="string"?y.getElementById(E):E;if("getBoundingClientRect" in y.documentElement){var D=E.getBoundingClientRect(),u=E.ownerDocument,C=u.body,w=u.documentElement,z=w.clientTop||C.clientTop||0,v=w.clientLeft||C.clientLeft||0,K=I.pageYOffset||w.scrollTop||C.scrollTop,x=I.pageXOffset||w.scrollLeft||C.scrollLeft,B=D.top+K-z,J=D.left+x-v;return{top:B,left:J}}else{application.offset.initialize();var L=E.offsetParent,G=E,u=E.ownerDocument,F,w=u.documentElement,C=u.body,A=u.defaultView,H=A?A.getComputedStyle(E,null):E.currentStyle,B=E.offsetTop,J=E.offsetLeft;while((E=E.parentNode)&&E!==C&&E!==w){if(application.offset.supportsFixedPosition&&H.position==="fixed"){break}F=A?A.getComputedStyle(E,null):E.currentStyle;B-=E.scrollTop;J-=E.scrollLeft;if(E===L){B+=E.offsetTop;J+=E.offsetLeft;if(application.offset.doesNotAddBorder&&!(application.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(E.nodeName))){B+=parseFloat(F.borderTopWidth)||0;J+=parseFloat(F.borderLeftWidth)||0}G=L,L=E.offsetParent}if(application.offset.subtractsBorderForOverflowNotVisible&&F.overflow!=="visible"){B+=parseFloat(F.borderTopWidth)||0;J+=parseFloat(F.borderLeftWidth)||0}H=F}if(H.position==="relative"||H.position==="static"){B+=C.offsetTop;J+=C.offsetLeft}if(application.offset.supportsFixedPosition&&H.position==="fixed"){B+=Math.max(w.scrollTop,C.scrollTop);J+=Math.max(w.scrollLeft,C.scrollLeft)}return{top:B,left:J}}return false};bmApplication.prototype.offset={initialize:function(){var o=document.body,u=document.createElement("div"),s,t,m,r,q=parseFloat(application.getStyle(o,"content","marginTop"))||0,p='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';var v,n={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(v in n){u.style[v]=n[v]}u.innerHTML=p;o.insertBefore(u,o.firstChild);s=u.firstChild;t=s.firstChild;r=s.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(t.offsetTop!==5);this.doesAddBorderForTableAndCells=(r.offsetTop===5);t.style.position="fixed",t.style.top="20px";this.supportsFixedPosition=(t.offsetTop===20||t.offsetTop===15);t.style.position=t.style.top="";s.style.overflow="hidden",s.style.position="relative";this.subtractsBorderForOverflowNotVisible=(t.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(o.offsetTop!==q);o.removeChild(u);o=u=s=t=m=r=null;application.offset.initialize=function(){}},bodyOffset:function(e){var f=e.offsetTop,d=e.offsetLeft;application.offset.initialize();if(application.offset.doesNotIncludeMarginInBodyOffset){f+=parseFloat(application.getStyle(e,"content","marginTop"))||0;d+=parseFloat(application.getStyle(e,"content","marginLeft"))||0}return{top:f,left:d}}};var application=new bmApplication(null,null,null);function bmMoodSelector(o,p,k,l,m,n){var h=this;h.aWindow=o;h.type=(n==null)?"dynamic":"fixed";h.area=h.aWindow.document.getElementById(p+"Area");h.handle=h.aWindow.document.getElementById(p+"Handle");h.smile=h.aWindow.document.getElementById(p+"Smile");h.smileText=h.aWindow.document.getElementById(p+"SmileText");h.selectorXY=application.selectorXY;h.smileTextArray=application.smileTextArray;h.setMood=function(a,b,c){if((b<=0)||(c<=0)){b=h.selectorXY[a].x;c=h.selectorXY[a].y}h.mood=a;h.selectorX=b;h.selectorY=c;h.smile.style.backgroundColor=(application.moodSelectorColorArray[b]!=null&&application.moodSelectorColorArray[b][c]!=null)?application.moodSelectorColorArray[b][c]:"#fff";h.smileText.innerHTML=h.smileTextArray[a].text;h.smileText.style.color=h.smileTextArray[a].color;b-=10;c-=10;h.handle.style.left=b+"px";h.handle.style.top=c+"px";if(a==0){h.handle.style.display="none"}else{h.handle.style.display="block"}};h.setMood(k,l,m);h.onAreaDown=function(f,d){var b=application.getOriginalEventElement(f);if((b.id!=p+"Handle")||(d)){if(h.type=="dynamic"){var a=f.pageX?f.pageX:f.offsetX+application.getElementLeft(b);var c=f.pageY?f.pageY:f.offsetY+application.getElementTop(b)}else{var a=f.clientX;var c=f.clientY}l=a-application.getElementLeft(h.area);m=c-application.getElementTop(h.area);var g=Math.sqrt((l-h.x0)*(l-h.x0)+(m-h.y0)*(m-h.y0));if(g<h.radius){if(g>(h.radius-10)){l=h.x0+Math.round((h.radius-10)*(l-h.x0)/g);m=h.y0-Math.round((h.radius-10)*(-m+h.y0)/g)}var e=h.getMood(l,m);h.setMood(e,l,m);h.dragok=true;h.dx=parseInt(h.selectorX-10);h.dy=parseInt(h.selectorY-10);h.x=f.clientX;h.y=f.clientY}}};h.onMouseMove=function(b){if(h.dragok){var a=h.dx+b.clientX-h.x+10;var d=h.dy+b.clientY-h.y+10;var c=Math.sqrt((a-h.x0)*(a-h.x0)+(d-h.y0)*(d-h.y0));if(c<(h.radius+20)){l=h.x0+Math.round((h.radius-10)*(a-h.x0)/c);m=h.y0-Math.round((h.radius-10)*(-d+h.y0)/c);if(c<(h.radius-10)){l=a;m=d}var e=h.getMood(l,m);h.setMood(e,l,m)}}return false};h.onMouseMoveForCursor=function(g){var c=application.getOriginalEventElement(g);if(c.id!=p+"Handle"){if(h.type=="dynamic"){var b=g.pageX?g.pageX:g.offsetX+application.getElementLeft(c);var d=g.pageY?g.pageY:g.offsetY+application.getElementTop(c)}else{var b=g.clientX;var d=g.clientY}var e=b-application.getElementLeft(h.area);var f=d-application.getElementTop(h.area);var a=Math.sqrt((e-h.x0)*(e-h.x0)+(f-h.y0)*(f-h.y0));if(a<h.radius){h.area.style.cursor="pointer"}else{h.area.style.cursor="default"}}};h.onHandleMouseDown=function(g){var c=application.getOriginalEventElement(g);if(h.type=="dynamic"){var b=g.pageX?g.pageX:g.offsetX+application.getElementLeft(c);var d=g.pageY?g.pageY:g.offsetY+application.getElementTop(c)}else{var b=g.clientX;var d=g.clientY}var e=b-application.getElementLeft(h.handle);var f=d-application.getElementTop(h.handle);var a=Math.sqrt((e-10)*(e-10)+(f-10)*(f-10));if(a<10){h.dragok=true;h.dx=parseInt(h.handle.offsetLeft);h.dy=parseInt(h.handle.offsetTop);h.x=g.clientX;h.y=g.clientY}else{h.onAreaDown(g,true)}};h.onMouseUp=function(a){if(h.dragok){h.dragok=false;if(h.onMoodChanged!=null){h.onMoodChanged({mood:h.mood,x:h.selectorX,y:h.selectorY})}}};h.onMouseOut=function(a){var b=(a.relatedTarget)?a.relatedTarget:a.toElement;if(b==null){h.dragok=false}};application.attachEvent(h.handle,"mousedown",h.onHandleMouseDown);application.attachEvent(h.aWindow.document,"mousemove",h.onMouseMove);application.attachEvent(h.area,"mousemove",h.onMouseMoveForCursor);application.attachEvent(h.aWindow.document,"mouseup",h.onMouseUp);application.attachEvent(h.aWindow.document,"mouseout",h.onMouseOut);application.attachEvent(h.area,"mousedown",h.onAreaDown)}bmMoodSelector.prototype.dragok=false;bmMoodSelector.prototype.inArea=false;bmMoodSelector.prototype.radius=65;bmMoodSelector.prototype.x0=74;bmMoodSelector.prototype.y0=68;bmMoodSelector.prototype.x=0;bmMoodSelector.prototype.y=0;bmMoodSelector.prototype.dx=0;bmMoodSelector.prototype.dy=0;bmMoodSelector.prototype.onMoodChanged=null;bmMoodSelector.prototype.mood=4;bmMoodSelector.prototype.selectorX=0;bmMoodSelector.prototype.selectorY=0;bmMoodSelector.prototype.getMood=function(l,m){var h=l-this.x0;var p=this.y0-m;var o=Math.sqrt(h*h+p*p);var n=(p<0)?(360-Math.acos(h/o)*180/Math.PI):(Math.acos(h/o)*180/Math.PI);var k=4;if(o<22){k=0}else{if((n<22.5)||(n>345.5)){k=3}else{if(n<67.5){k=2}else{if(n<112.5){k=1}else{if(n<157.5){k=8}else{if(n<202.5){k=7}else{if(n<247.5){k=6}else{if(n<292.5){k=5}else{if(n<345.5){k=4}}}}}}}}}return k};function bmCustomDropdown(d,e,f){if(f!==false){this.create(d,e,f)}}bmCustomDropdown.inherit(bmCustomControl);bmCustomDropdown.prototype.instance=null;bmCustomDropdown.prototype.contentContainer=null;bmCustomDropdown.prototype.visible=false;bmCustomDropdown.prototype.top=false;bmCustomDropdown.prototype.position=false;bmCustomDropdown.prototype.content="";bmCustomDropdown.prototype.followInterval=null;bmCustomDropdown.prototype.element=null;bmCustomDropdown.prototype.instanceWindow=null;bmCustomDropdown.prototype.elementWindow=null;bmCustomDropdown.prototype.fromPlayer=true;bmCustomDropdown.prototype.content="";bmCustomDropdown.prototype.correction=0;bmCustomDropdown.prototype.fullWidth=false;bmCustomDropdown.prototype.controls=false;bmCustomDropdown.prototype.controlIndex=-1;bmCustomDropdown.prototype.lastWidth=0;bmCustomDropdown.prototype.lastHeight=0;bmCustomDropdown.prototype.widthFactor=0;bmCustomDropdown.prototype.heightFactor=0;bmCustomDropdown.prototype.leftFactor=0;bmCustomDropdown.prototype.topFactor=0;bmCustomDropdown.prototype.style=null;bmCustomDropdown.prototype.create=function(e,f,g){this.ownEvents={itemselect:-1};bmCustomControl.prototype.create.call(this,e,f,g);this.element=g.element;if(typeof(g.elementWindow)=="undefined"){throw new TypeError()}this.elementWindow=g.elementWindow;this.instanceWindow=application.getWindow("content");this.fromPlayer=g.fromPlayer||(this.instanceWindow!=this.elementWindow);this.top=g.top||"default";this.position=g.position||"left";this.correction=g.correction||0;this.fullWidth=g.fullWidth||false;this.controls=g.controls||false;var h=this;h.callOnItemSelect=function(d){if(h.controls===false){return false}var a={originalElement:application.getOriginalEventElement(d),item:h.controls[h.controlIndex].instance,ctrl:d.ctrlKey};if(/^key/i.test(d.type)){a.eventType="key";a.key=application.isIE()?d.keyCode:d.which}else{a.eventType="mouse";a.button=d.button}if((handlers=h.events.itemselect)!=null){var b,c;for(c in handlers){b=handlers[c];var l=b(a);if(l){return false}}}};h.doFollow=function(){var a=application.getOffsets(h.element);var d=application.getElementHeight(h.element);if(!h.fromPlayer){h.instance.style.top=(a.top+d)+"px"}if(h.position=="left"){h.instance.style.left=a.left+h.correction+"px"}else{var c=application.getWindow("container").document.body.clientWidth-a.left-h.element.clientWidth;h.instance.style.right=c+h.correction+"px"}if(h.fullWidth){var b=application.getElementWidth(h.element)-h.correction*2;h.instance.style.width=b+"px"}};h.setFollowInterval=function(){h.clearFollowInterval();h.followInterval=h.instanceWindow.setInterval(h.doFollow,50)};h.clearFollowInterval=function(){if(h.followInterval!=null){h.instanceWindow.clearInterval(h.followInterval);h.followInterval=null}};h.documentOnClick=function(a){var b=application.getOriginalEventElement(a);var c=application.elementInContainer(b,h.instance,h.instanceWindow);var d=application.elementInContainer(b,h.element,h.instanceWindow);if(c){h.callOnItemSelect(a)}else{if(!d){h.hideInstance()}}};h.documentOnKeydown=function(d){var b=application.isIE()?d.keyCode:d.which;var c=false;var a=false;if(b==27||b==9){c=true;h.hideInstance()}else{if(h.controls){switch(b){case 13:if(h.controls[h.controlIndex]){h.callOnItemSelect(d);c=true}break;case 40:h.controlIndex++;c=true;a=true;break;case 38:h.controlIndex--;c=true;a=true;break}if(a){var l=h.controls.length-1;h.controlIndex=h.controlIndex<0?0:h.controlIndex;h.controlIndex=h.controlIndex>=l?l:h.controlIndex;h.setItem()}}}if(c){application.eventPreventDefault(d);return false}};h.onMouseOver=function(a){var b=application.getOriginalEventElement(a,"li");h.setItem(b)};h.onMouseOut=function(a){var b=application.getOriginalEventElement(a,"li");b.className=b.className.replace(/[\s]?hover[\s]?/gi,"")}};bmCustomDropdown.prototype.showInstance=function(){if(!this.visible){this.doFollow();this.setFollowInterval();this.attachEvents();this.instance.style.display="block";this.visible=true}};bmCustomDropdown.prototype.hideInstance=function(){if(this.visible){this.clearFollowInterval();this.removeEvents();this.instance.style.display="none";if(this.callOnHide){this.callOnHide()}this.visible=false}this.controlIndex=-1};bmCustomDropdown.prototype.updateInstance=function(){var b="";switch(this.top){case"rounded":b="div_dropdownRounded";break;case"default":b="div_dropdown";break;case"none":b="div_dropdownNone";break}b=application.applyTemplate(b,{identifier:this.parameters.name,content:this.content},window.top);this.instance=this.instanceWindow.document.getElementById(this.parameters.name);if(this.instance!=null){this.instance.parentNode.removeChild(this.instance)}application.updateElement(this.instanceWindow.document.body,b,this.instanceWindow.document,"append");this.instance=this.instanceWindow.document.getElementById(this.parameters.name);this.contentContainer=this.instanceWindow.document.getElementById(this.parameters.name+"Content");if(this.fromPlayer){this.instance.style.position="fixed"}};bmCustomDropdown.prototype.attachEvents=function(){var d=this.instanceWindow.document;var f=this.documentOnClick;var e=this.documentOnKeydown;setTimeout(function(){application.attachEvent(d,"mousedown",f)},500);setTimeout(function(){application.attachEvent(application.getWindow("player").document,"click",f)},500);setTimeout(function(){application.attachEvent(d,"keydown",e)},500);setTimeout(function(){application.attachEvent(application.getWindow("player").document,"keyup",e)},500)};bmCustomDropdown.prototype.removeEvents=function(){application.removeEvent(this.instanceWindow.document,"click",this.documentOnClick);application.removeEvent(application.getWindow("player").document,"click",this.documentOnClick);application.removeEvent(this.instanceWindow.document,"keydown",this.documentOnKeydown);application.removeEvent(application.getWindow("player").document,"keyup",this.documentOnKeydown)};bmCustomDropdown.prototype.setItem=function(h){h=h||this.controls[this.controlIndex].instance;var f=parseInt(h.getAttribute("controlIndex"));for(var e=0;e<this.controls.length;++e){var g=this.controls[e].instance.className;if(e==f){this.controls[e].instance.className+=" hover"}else{this.controls[e].instance.className=g.replace(/[\s]?hover[\s]?/g,"")}}this.controlIndex=f};bmCustomDropdown.prototype.setFollowElement=function(b){this.element=b};bmCustomDropdown.prototype.calculateFactors=function(){var g,h,f,e;f=this.instanceWindow.document.width;e=this.instanceWindow.document.height;if(this.fromPlayer){g=0;this.topFactor=0}else{g=application.getElementTop(this.element);this.topFactor=g/e}this.instance.style.top=g+"px";if(this.position=="left"){h=application.getElementLeft(this.element)}else{h=application.getElementLeft(this.element)+application.getElementWidth(this.element)}this.instance.style.left=h+"px";if(this.fullWidth){this.instance.style.width=application.getElementWidth(this.element)-this.correction*2+"px"}this.leftFactor=h/f;this.widthFactor=application.getElementWidth(this.element)/f;this.heigthFactor=application.getElementHeight(this.element)/f;this.lastWidth=f;this.lastHeight=e};function bmSuspendDropdown(d,e,f){if(f!==false){this.create(d,e,f)}}bmSuspendDropdown.inherit(bmCustomDropdown);bmSuspendDropdown.prototype.currentSong=null;bmSuspendDropdown.prototype.firstInputFocus=true;bmSuspendDropdown.prototype.inputText="в новый плейлист";bmSuspendDropdown.prototype.create=function(aApplication,owner,parameters){if(top.suspendDropdowns){top.suspendDropdowns.push(this)}else{top.suspendDropdowns=new Array();top.suspendDropdowns.push(this)}this.type="bmSuspendDropdown";this.className="bmSuspendDropdown";bmCustomDropdown.prototype.create.call(this,aApplication,owner,parameters);var sender=this;sender.onClick=function(event){if(event!="undefined"){var element=sender.getEventElement(event);var playlistId=element.getAttribute("playlistid");application.user.addSongsToPlayList(playlistId,sender.currentSong);sender.hide()}};sender.onSuspendItemClick=function(event){var suspendSongArray=new Array();suspendSongArray.push(sender.currentSong);application.user.suspendSongs(suspendSongArray);sender.hide()};sender.onSuspendToPlayerItemClick=function(event){var suspendSongArray=new Array();suspendSongArray.push(sender.currentSong);sender.suspendSongsInPlayer(suspendSongArray);sender.hide()};sender.onMouseOver=function(event){var element=sender.getEventElement(event);element.style.backgroundColor="#CFE6EF"};sender.onMouseOut=function(event){var element=sender.getEventElement(event);element.style.backgroundColor=""};sender.onFocusInput=function(event){var element=application.getOriginalEventElement(event,"input");if(sender.firstInputFocus){element.value="";sender.firstInputFocus=false;element.style.color="black"}};sender.onAddPlaylist=function(event){application.user.addSongsToPlayList(event.identifier,sender.currentSong);application.user.detachEvent("onaddplaylist",sender.onAddPlaylist)};sender.onSubmit=function(event){var reg=/[a-zа-я0-9]/i;var element=application.getWindow("content").document.getElementById("suspendInput");if((element)&&(reg.test(element.value.trim()))&&(element.value.trim()!=sender.inputText)){application.user.attachEvent("onaddplaylist",sender.onAddPlaylist);application.user.addPlaylist({title:element.value.trim(),mood:4});sender.firstInputFocus=true;sender.hide()}};sender.onBlurInput=function(event){var element=application.getOriginalEventElement(event,"input");if(element.value.trim()==""){element.value=sender.inputText;sender.firstInputFocus=true;element.style.color="#B2B2B2"}};sender.callOnHide=function(){if((handlers=sender.events.hide)!=null){var handler;for(i in handlers){handler=handlers[i];var result=handler();if(result){return false}}}};sender.suspendSongsInPlayerHandler=function(event){var data=eval("("+event.data+")");if((data||0).errorCode>0){}else{var insertPosition=1;if(application.player.readyState==application.player.PLAYER_READY){insertPosition=0}var newItems=new Array();if(insertPosition==1){newItems.push(application.playlist.items[0])}var length=application.playlist.items.length;for(var i=insertPosition;i<length;i++){if(application.playlist.items[i].suspend){newItems.push(application.playlist.items[i])}}for(var i in data.trackList){data.trackList[i].suspend=true;newItems.push(data.trackList[i])}for(var i=insertPosition;i<length;i++){if((!application.playlist.items[i].suspend)&&(newItems.length<11)){newItems.push(application.playlist.items[i])}}application.playlist.items=newItems;application.playlist.setAliases()}}};bmSuspendDropdown.prototype.suspendSongsInPlayer=function(e){var f=application.bmvPlayer;if(this.element!=f.buttons.suspend){var d=application.player;d.insertSongsToTrackList(e[0],null);if(d.readyState==d.PLAYER_READY){setTimeout(function(){f.setProgressText()},1000)}}};bmSuspendDropdown.prototype.getEventElement=function(c){var d=application.getOriginalEventElement(c);while((d.getAttribute("playlistid")==null)&&(d.tagName!="BODY")){d=d.parentNode}return d};bmSuspendDropdown.prototype.show=function(c){if(!this.visible){if(top.suspendDropdowns){for(var d in top.suspendDropdowns){if((top.suspendDropdowns[d])&&(top.suspendDropdowns[d]!=this)){top.suspendDropdowns[d].hide()}}}this.currentSong=c;this.firstInputFocus=true;if(typeof(this.currentSong)!="object"){this.currentSong=[c]}this.update();this.showInstance()}else{this.hide()}};bmSuspendDropdown.prototype.hide=function(){if(this.visible){this.hideInstance();this.callOnHide()}};bmSuspendDropdown.prototype.update=function(){var n="",s=0;var t="";var m="";var v={0:"#000000",1:"#f95000",2:"#ffab00",3:"#d8a903",4:"#00a635",5:"#0cacd1",6:"#7658e8",7:"#f20aff",8:"#ca0037"};if(application.user.identifier!=application.user.defaultUserIdentifier){n+=application.applyTemplate("suspendItem",null,top);if(this.element!=application.bmvPlayer.buttons.suspend){n+=application.applyTemplate("suspendToPlayerItem",null,top)}n+=application.applyTemplate("suspendItemDelimiter",null,top);if(application.user.playlists.length>0){while(application.user.playlists[s]){application.user.playlists[s].id="item_"+s;application.user.playlists[s].color=v[application.user.playlists[s].mood];n+=application.applyTemplate("suspendUserPlaylist",application.user.playlists[s],top);s++}}else{n+=application.applyTemplate("suspendNoPlaylist",{},top)}}else{if(this.element!=application.bmvPlayer.buttons.suspend){n+=application.applyTemplate("suspendToPlayerItem",null,top);n+=application.applyTemplate("suspendItemDelimiter",null,top)}n+=application.applyTemplate("suspendGuest",{},top);m='disabled="disabled"'}this.content=application.applyTemplate("suspendIndex",{playlists:n,disabledForm:m},window.top);this.updateInstance();var o=application.getWindow("content").document.getElementById("suspendInputForm");application.attachEvent(o,"submit",this.onSubmit);var p=application.getWindow("content").document.getElementById("suspendInput");application.attachEvent(p,"blur",this.onBlurInput);application.attachEvent(p,"focus",this.onFocusInput);if(this.element!=application.bmvPlayer.buttons.suspend){var r=application.getWindow("content").document.getElementById("suspendToPlayerItem");application.attachEvent(r,"click",this.onSuspendToPlayerItemClick);application.attachEvent(r,"mouseout",this.onMouseOut);application.attachEvent(r,"mouseover",this.onMouseOver)}if(application.user.identifier!=application.user.defaultUserIdentifier){var q=application.getWindow("content").document.getElementById("suspendItem");application.attachEvent(q,"click",this.onSuspendItemClick);application.attachEvent(q,"mouseout",this.onMouseOut);application.attachEvent(q,"mouseover",this.onMouseOver);if(application.user.playlists.length>0){var u;s=0;while(application.user.playlists[s]){u=application.getWindow("content").document.getElementById("item_"+s);application.attachEvent(u,"click",this.onClick);application.attachEvent(u,"mouseout",this.onMouseOut);application.attachEvent(u,"mouseover",this.onMouseOver);s++}}}this.calculateFactors()};function bmSettingsDropdown(e,f,g){var h=this;if(g!==false){this.create(e,f,g)}}bmSettingsDropdown.inherit(bmCustomDropdown);bmSettingsDropdown.prototype.mood=1;bmSettingsDropdown.prototype.moodX=115;bmSettingsDropdown.prototype.moodY=32;bmSettingsDropdown.prototype.moodSelector=null;bmSettingsDropdown.prototype.popularControl=null;bmSettingsDropdown.prototype.languageControl=null;bmSettingsDropdown.prototype.dateControlControl=null;bmSettingsDropdown.prototype.updateFilterTimeout=null;bmSettingsDropdown.prototype.mainGenreId="all";bmSettingsDropdown.prototype.selectedGenreId="all";bmSettingsDropdown.prototype.popularSettings=0;bmSettingsDropdown.prototype.languageSettings=0;bmSettingsDropdown.prototype.yearSettings="all";bmSettingsDropdown.prototype.tagSettings="all";bmSettingsDropdown.prototype.lastTagElement=null;bmSettingsDropdown.prototype.popularSettingsPercent=50;bmSettingsDropdown.prototype.languageSettingsPercent=50;bmSettingsDropdown.prototype.yearSettingsPercent=96;bmSettingsDropdown.prototype.create=function(aApplication,owner,parameters){this.type="bmSettingsDropdown";this.className="bmSettingsDropdown";bmCustomDropdown.prototype.create.call(this,aApplication,owner,parameters);var sender=this;sender.onLoadSimilarGenre=function(event){var match=event.url.match(/id=(\d+)$/);if(match){genreId=match[1];application.similarGenre[genreId]=eval("("+event.data+")")}sender.drawSimilarGenre(genreId)};sender.onSelectTag=function(event){var element=application.getOriginalEventElement(event,"a");sender.lowlightSelectedGenreElement(sender.getSelectedGenreElement(sender.selectedGenreId));sender.hilightSelectedGenreElement(element);sender.selectedGenreId=element.getAttribute("genreid");if(element.getAttribute("ismain")==1){sender.mainGenreId=element.getAttribute("genreid");if(sender.mainGenreId!="all"){if(application.similarGenre[sender.mainGenreId]){sender.drawSimilarGenre(sender.mainGenreId)}else{application.httpGateway.get("/dynamicScripts/getSimilarTags.php?id="+sender.mainGenreId,sender.onLoadSimilarGenre)}}else{sender.hideSimilarGenre()}}application.user.filter.tagSettings=sender.selectedGenreId;sender.updatePlaylistFilter()};sender.onMoodSelect=function(event){application.bmvPlayer.updatePlayerMood(event);sender.mood=event.mood;sender.moodX=event.x;sender.moodY=event.y;application.user.mood=sender.mood;application.user.moodX=sender.moodX;application.user.moodY=sender.moodY;application.httpGateway.get("/modules/user/changeMood.php?mood="+application.user.mood+"&moodX="+application.user.moodX+"&moodY="+application.user.moodY);sender.updatePlaylistFilter()};sender.popularControlChangePosition=function(event){if(event>66){sender.popularSettings=1}if((event<=66)&&(event>=33)){sender.popularSettings=0}if(event<33){sender.popularSettings=-1}sender.popularSettingsPercent=event;application.user.filter.popularSettings=sender.popularSettings;sender.updatePlaylistFilter()};sender.languageControlChangePosition=function(event){if(event>66){sender.languageSettings=1}if((event<=66)&&(event>=33)){sender.languageSettings=0}if(event<33){sender.languageSettings=-1}sender.languageSettingsPercent=event;application.user.filter.languageSettings=sender.languageSettings;sender.updatePlaylistFilter()};sender.yearControlChangePosition=function(event){sender.yearSettings=5;if(event>91){sender.yearSettings="all"}else{if(event>70){sender.yearSettings=10}else{if(event>57){sender.yearSettings=9}else{if(event>43){sender.yearSettings=8}else{if(event>30){sender.yearSettings=7}else{if(event>16){sender.yearSettings=6}}}}}}sender.yearSettingsPercent=event;application.user.filter.yearSettings=sender.yearSettings;sender.updatePlaylistFilter()};sender.changePlaylistFilter=function(){var filter=new Object();if(application.user.filter.yearSettings!="all"){filter.year=application.user.filter.yearSettings}if(application.user.filter.popularSettings!=0){filter.popularyty=application.user.filter.popularSettings}if(application.user.filter.languageSettings!=0){filter.foreign=application.user.filter.languageSettings}if(application.user.filter.tagSettings!="all"){filter.genreId=application.user.filter.tagSettings}if(application.getWindow("content").location.toString().indexOf("radio")!=-1){application.bmvMain.rotator.reset(filter,application.user.mood)}application.playlist.waitSongEnd=true;application.playlist.loadContent(0,"playlist","new",11,filter,application.user.mood);sender.updateFilterTimeout=null}};bmSettingsDropdown.prototype.getSelectedGenreElement=function(c){var d=null;if(c=="all"){d=application.getWindow("content").document.getElementById("allGenreSelector")}else{d=application.getWindow("content").document.getElementById("settingsDropDownTag_"+c)}return d};bmSettingsDropdown.prototype.hilightSelectedGenreElement=function(b){b.style.backgroundColor="#E9C268";b.className=b.className.replace(/settingsDropdownDashed/,"")};bmSettingsDropdown.prototype.lowlightSelectedGenreElement=function(b){b.style.backgroundColor="";if(b.className.indexOf("settingsDropdownDashed")==-1){b.className=b.className+" settingsDropdownDashed"}};bmSettingsDropdown.prototype.show=function(){if(!this.visible){this.mood=application.user.mood;this.moodX=application.user.moodX;this.moodY=application.user.moodY;this.update();if(this.mainGenreId!="all"){this.drawSimilarGenre(this.mainGenreId)}selectedGenreElement=this.getSelectedGenreElement(this.selectedGenreId);this.hilightSelectedGenreElement(selectedGenreElement);this.moodSelector=new top.bmMoodSelector(this.instanceWindow,"settingDropdownMoodSelector",this.mood,this.moodX,this.moodY,"fixed");this.moodSelector.onMoodChanged=this.onMoodSelect;this.showInstance()}else{this.hide()}};bmSettingsDropdown.prototype.updatePlaylistFilter=function(){if(this.updateFilterTimeout){application.getWindow("content").clearTimeout(this.updateFilterTimeout)}this.updateFilterTimeout=application.getWindow("content").setTimeout(this.changePlaylistFilter,2500)};bmSettingsDropdown.prototype.initLanguageControl=function(){this.languageControl.initPosition(this.languageSettingsPercent)};bmSettingsDropdown.prototype.initPopularControl=function(){this.popularControl.initPosition(this.popularSettingsPercent)};bmSettingsDropdown.prototype.initYearControl=function(){this.yearControl.initPosition(this.yearSettingsPercent)};bmSettingsDropdown.prototype.hide=function(){if(this.visible){this.moodSelector=null;this.languageControl=null;this.yearControl=null;this.popularControl=null;this.hideInstance()}};bmSettingsDropdown.prototype.getTagColor=function(k,g,l){l=0;var m={r:1,g:22,b:65};var n={r:181,g:190,b:205};var h=n;if((g-l)!=0){h.r=n.r+Math.round((k-l)*(m.r-n.r)/(g-l));h.g=n.g+Math.round((k-l)*(m.g-n.g)/(g-l));h.b=n.b+Math.round((k-l)*(m.b-n.b)/(g-l))}h=m;return h};bmSettingsDropdown.prototype.update=function(){var r=new Array();var l=0;var o=0;var p=0;for(var n in application.mainGenre){if(p<16){r.push(application.mainGenre[n]);r[r.length-1].tagId=n}if(p==0){l=application.mainGenre[n].rating}if(p==15){o=application.mainGenre[n].rating}p++}r.sort(function m(a,b){if(a.name<b.name){return -1}if(a.name>b.name){return 1}return 0});var q="";var k=null;for(var n=0;n<r.length;n++){k=this.getTagColor(r[n].rating,l,o);q+=application.applyTemplate("settingsDropDownTag",{tagName:r[n].name,tagId:r[n].tagId,colorR:k.r,colorG:k.g,colorB:k.b,mainFlag:1},window.top)}this.content=application.applyTemplate("div_settingsIndex",{tags:q},top);this.updateInstance()};bmSettingsDropdown.prototype.drawSimilarGenre=function(m){var p=new Array();var s=0;var n=0;var q=0;for(var o in application.similarGenre[m]){if(q<16){p.push(application.similarGenre[m][o]);p[p.length-1].tagId=o}if(q==0){s=application.similarGenre[m][o].rating}if(q==15){n=application.similarGenre[m][o].rating}q++}p.sort(function t(a,b){if(a.name<b.name){return -1}if(a.name>b.name){return 1}return 0});var l="";var r=null;for(var o=0;o<p.length;o++){r=this.getTagColor(p[o].rating,s,n);l+=application.applyTemplate("settingsDropDownTag",{tagName:p[o].name,tagId:p[o].tagId,colorR:r.r,colorG:r.g,colorB:r.b,mainFlag:0},window.top)}l+='<div class="clearBoth">&#32;</div>';application.updateElement(application.getWindow("content").document.getElementById("similarTags"),l,application.getWindow("content").document,"replace")};bmSettingsDropdown.prototype.hideSimilarGenre=function(){application.updateElement(application.getWindow("content").document.getElementById("similarTags"),"",application.getWindow("content").document,"replace")};function bmSlider(d,e,f){if(f!==false){this.create(d,e,f)}}bmSlider.inherit(bmCustomControl);bmSlider.prototype.selector=null;bmSlider.prototype.control=null;bmSlider.prototype.pressFlag=null;bmSlider.prototype.left=null;bmSlider.prototype.pressX=null;bmSlider.prototype.create=function(e,f,g){this.type="bmSlider";this.className="bmSlider";bmCustomControl.prototype.create.call(this,e,f,g);this.selector=g.selector;this.control=g.control;this.minLeft=g.minLeft;this.maxLeft=g.maxLeft;var h=this;h.selectorDown=function(){h.pressFlag=true;h.left=h.selector.style.left==""?0:parseInt(h.selector.style.left)};h.selectorUp=function(){if(h.pressFlag){h.pressFlag=false;h.left=null}};h.mouseMove=function(b){if(h.pressFlag){var a=h.left-h.pressX+b.clientX;h.setSelectorPosition(a)}else{h.pressX=b.clientX}};h.onPressControl=function(a){var b=application.getOriginalEventElement(a);if(b==h.control){h.setSelectorPosition(a.clientX-application.getElementLeft(b)-8);h.selectorDown()}};h.callOnChangePosition=function(a){var b=Math.round((a-h.minLeft)/(h.maxLeft-h.minLeft)*100);if((handlers=h.events.changePosition)!=null){var c;for(i in handlers){c=handlers[i];var d=c(b);if(d){return false}}}};application.attachEvent(this.selector,"mousedown",this.selectorDown);application.attachEvent(application.getWindow("content").document,"mouseup",this.selectorUp);application.attachEvent(application.getWindow("content").document,"mousemove",this.mouseMove);application.attachEvent(this.control,"mousedown",this.onPressControl)};bmSlider.prototype.setSelectorPosition=function(c,d){if(c<this.minLeft){c=this.minLeft}if(c>this.maxLeft){c=this.maxLeft}this.selector.style.left=c+"px";if(d!==false){this.callOnChangePosition(c)}};bmSlider.prototype.initPosition=function(d){var c=Math.round(this.minLeft+(this.maxLeft-this.minLeft)/100*d);this.setSelectorPosition(c,false)};function bmPlaylistDropdown(e,f,g){var h=this;if(g!==false){this.create(e,f,g)}}bmPlaylistDropdown.inherit(bmCustomDropdown);bmPlaylistDropdown.prototype.create=function(e,f,g){this.type="bmPlaylistDropdown";this.className="bmPlaylistDropdown";bmCustomDropdown.prototype.create.call(this,e,f,g);var h=this;h.onMouseOver=function(a){var b=application.getOriginalEventElement(a,"li");application.getWindow("content").document.getElementById("playlistCurrentSong").className=application.getWindow("content").document.getElementById("playlistCurrentSong").className.replace(/hover/,"");b.style.backgroundColor="#CFE6EF";if(b.className.indexOf("hover")==-1){b.className+=" hover"}};h.onMouseOut=function(a){var b=application.getOriginalEventElement(a,"li");b.style.backgroundColor="";b.className=b.className.replace(/hover/,"");if(application.getWindow("content").document.getElementById("playlistCurrentSong").className.indexOf("hover")==-1){application.getWindow("content").document.getElementById("playlistCurrentSong").className+=" hover"}};h.onSelectItem=function(a){var b=application.getOriginalEventElement(a,"li");var c=parseInt(b.getAttribute("shift"));application.player.playNew(c);h.hide()}};bmPlaylistDropdown.prototype.show=function(){if(!this.visible){this.update();this.showInstance()}else{this.hide()}};bmPlaylistDropdown.prototype.hide=function(){if(this.visible){this.hideInstance()}};bmPlaylistDropdown.prototype.update=function(){var e=0,d="";while(application.playlist.items[e]){if(e<21){var f=application.applyTemplate("li_playlistItem",{creator:application.playlist.items[e].creator,title:application.playlist.items[e].title,shift:e},window.top);if(e==0){f=f.replace("<li",'<li id="playlistCurrentSong" class="hover current relative"')}d+=f}e++}this.content=application.applyTemplate("div_playlistIndex",{songs:d},window.top);this.updateInstance();var e=0};function bmVolumeDropdown(d,e,f){if(f!==false){this.create(d,e,f)}}bmVolumeDropdown.inherit(bmCustomDropdown);bmVolumeDropdown.prototype.selector=null;bmVolumeDropdown.prototype.selectorId="volumeControlSelector";bmVolumeDropdown.prototype.volumeControlId="volumeControl";bmVolumeDropdown.prototype.volumeControl=null;bmVolumeDropdown.prototype.pressFlag=false;bmVolumeDropdown.prototype.pressX=null;bmVolumeDropdown.prototype.left=null;bmVolumeDropdown.prototype.minLeft=14;bmVolumeDropdown.prototype.maxLeft=174;bmVolumeDropdown.prototype.create=function(f,g,h){this.type="bmVolumeDropdown";this.className="bmVolumeDropdown";bmCustomDropdown.prototype.create.call(this,f,g,h);var l=new Image();l.src="/images/player/dropDown/volumePopUpSelectorPress.png";var k=this;k.selectorDown=function(){k.selector.style.backgroundImage='url("/images/player/dropDown/volumePopUpSelectorPress.png")';k.pressFlag=true;k.left=parseInt(k.selector.style.left)};k.selectorUp=function(){k.selector.style.backgroundImage='url("/images/player/dropDown/volumePopUpSelector.png")';if(k.pressFlag){k.pressFlag=false;k.left=null}};k.mouseMove=function(b){if(k.pressFlag){var a=k.left-k.pressX+b.clientX;k.setSelectorPosition(a)}else{k.pressX=b.clientX}};k.onPressControl=function(a){var b=application.getOriginalEventElement(a);if(b==k.volumeControl){k.setSelectorPosition(a.clientX-application.getElementLeft(b)-8);k.selectorDown()}};k.callOnChangeVolume=function(a){var b=a;if((handlers=k.events.changeVolume)!=null){var c;for(i in handlers){c=handlers[i];var d=c(b);if(d){return false}}}};k.changeVolume=function(a){application.player.setVolume(a);application.bmvPlayer.changeVolumeIcons(a)}};bmVolumeDropdown.prototype.setSelectorPosition=function(c){if(c<this.minLeft){c=this.minLeft}if(c>this.maxLeft){c=this.maxLeft}this.selector.style.left=c+"px";var d=0;d=Math.round((100/(this.maxLeft-this.minLeft))*(c-this.minLeft));this.callOnChangeVolume(d)};bmVolumeDropdown.prototype.show=function(){if(!this.visible){this.update();this.selector=application.getWindow("content").document.getElementById(this.selectorId);this.volumeControl=application.getWindow("content").document.getElementById(this.volumeControlId);application.attachEvent(this.volumeControl,"mousedown",this.onPressControl);this.setSelectorPosition(Math.round(application.player.volume/100*(this.maxLeft-this.minLeft)+this.minLeft));application.attachEvent(this.selector,"mousedown",this.selectorDown);application.attachEvent(application.getWindow("content").document,"mouseup",this.selectorUp);application.attachEvent(application.getWindow("player").document,"mouseup",this.selectorUp);application.attachEvent(application.getWindow("content").document,"mousemove",this.mouseMove);application.attachEvent(application.getWindow("player").document,"mousemove",this.mouseMove);this.volumeControl=application.getWindow("content").document.getElementById("volumeControl");this.attachEvent("changeVolume",this.changeVolume);this.showInstance()}else{this.hideInstance()}};bmVolumeDropdown.prototype.hide=function(){if(this.visible){application.removeEvent(this.volumeControl,"mousedown",this.onPressControl);application.removeEvent(this.selector,"mousedown",this.selectorDown);application.removeEvent(application.getWindow("content").document,"mouseup",this.selectorUp);application.removeEvent(application.getWindow("player").document,"mouseup",this.selectorUp);application.removeEvent(application.getWindow("content").document,"mousemove",this.mouseMove);application.removeEvent(application.getWindow("player").document,"mousemove",this.mouseMove);this.selector=null;this.volumeControl=null}};bmVolumeDropdown.prototype.callOnHide=function(){this.hide()};bmVolumeDropdown.prototype.update=function(){this.content='<div id="volumeControl"><div id="volumeControlSelector"></div></div>';this.updateInstance()};function bmSearchDropdown(d,e,f){if(f!==false){this.create(d,e,f)}}bmSearchDropdown.inherit(bmCustomDropdown);bmSearchDropdown.prototype.waitTimeout=null;bmSearchDropdown.prototype.listenInterval=null;bmSearchDropdown.prototype.oldValue="";bmSearchDropdown.prototype.hasResult=false;bmSearchDropdown.prototype.dataPath="/cache/search/helper/";bmSearchDropdown.prototype.currentRequest=null;bmSearchDropdown.prototype.lastResponce=null;bmSearchDropdown.prototype.maxLength=10;bmSearchDropdown.prototype.waitIterrations=0;bmSearchDropdown.prototype.create=function(aApplication,owner,parameters){this.type="bmSearchDropdown";this.className="bmSearchDropdown";bmCustomDropdown.prototype.create.call(this,aApplication,owner,parameters);var sender=this;sender.waitControl=function(){if((top||0).document===null){setTimeout(sender.waitControl,500);return false}if(window.top.document.getElementById("content")===null){setTimeout(sender.waitControl,500);return false}var container=application.getWindow("content");if(container===null){setTimeout(sender.waitControl,500);return false}container=container.document;if(container===null){setTimeout(sender.waitControl,100);return false}if(application.isIE()&&container.readyState!="complete"){setTimeout(sender.waitControl,20);return false}var element=container.getElementById("q");if(element===null&&sender.waitIterrations<50){sender.waitIterrations++;setTimeout(sender.waitControl,20);return false}sender.waitControlHandler();return;if(application.isIE()){var d=sender.elementWindow.document;var tempNode=d.createElement("document:ready");try{if(d.readyState!="complete"){return setTimeout(arguments.callee,0)}tempNode.doScroll("left");alert("window.onDocumentReady()");sender.waitControlHandler();tempNode=null}catch(err){setTimeout(arguments.callee,20)}}else{application.attachEvent(sender.elementWindow,"DOMContentLoaded",sender.waitControlHandler)}return};sender.waitControlHandler=function(){sender.reset();var element=sender.elementWindow.document.getElementById("q");if(element!==null){sender.element=element;sender.attachControlEvents();sender.createInstance();if(window.opera){application.attachEvent(sender.element,"keypress",sender.preventSubmit)}}};sender.onFocus=function(event){if(sender.listenInterval===null){sender.listenInterval=window.setInterval(function(){sender.onChange()},100)}if(sender.hasResult&&sender.element.value!=""&&sender.oldValue==sender.element.value){sender.show()}};sender.onBlur=function(event){if(sender.listenInterval!==null){window.clearInterval(sender.listenInterval);sender.listenInterval=null}};sender.onChange=function(event){if(sender.oldValue!=sender.element.value){sender.oldValue=sender.element.value;if(sender.element.value.length>sender.maxLength&&sender.lastResponce!=null){sender.parseLastResponce(sender.lastResponce)}else{if(sender.element.value.length>0){var handler=sender.onChangeHandler;if(sender.element.value.length>=sender.maxLength){handler=sender.parseLastResponce}var valueKey=sender.oldValue.length>sender.maxLength?sender.oldValue.substring(0,sender.maxLength):sender.oldValue;valueKey=valueKey.toLowerCase().MD5();if(sender.currentRequest!==null){application.httpGateway.deleteRequest(sender.currentRequest)}sender.currentRequest=application.httpGateway.get(sender.dataPath+valueKey.substring(0,2)+"/"+valueKey+".json",handler)}else{sender.hide()}}}};sender.onChangeHandler=function(event){sender.lastResponce=null;var eventData=eval("("+event.data+")");if(eventData.errorCode>0){sender.hasResult=false;sender.hide()}else{sender.hasResult=true;sender.update(eventData);sender.show()}};sender.parseLastResponce=function(event){sender.lastResponce=event;var eventData=eval("("+event.data+")");var needUpdate=false;var length=0;if(eventData.errorCode==0){var search=sender.element.value.toLowerCase();var result={errorCode:0,artist:new Array(),song:new Array(),album:new Array(),genre:new Array()};if((length=eventData.artist.length)>0){for(var i=0;i<length;++i){if(result.artist.length==3){break}if(eventData.artist[i].search.toLowerCase().indexOf(search)==0){result.artist.push(eventData.artist[i]);needUpdate=true}}}if((length=eventData.song.length)>0){for(var i=0;i<length;++i){if(result.song.length==3){break}if(eventData.song[i].search.toLowerCase().indexOf(search)==0){result.song.push(eventData.song[i]);needUpdate=true}}}if((length=eventData.album.length)>0){for(var i=0;i<length;++i){if(result.album.length==3){break}if(eventData.album[i].search.toLowerCase().indexOf(search)==0){result.album.push(eventData.album[i]);needUpdate=true}}}if((length=eventData.genre.length)>0){for(var i=0;i<length;++i){if(result.genre.length==3){break}if(eventData.genre[i].search.toLowerCase().indexOf(search)==0){result.genre.push(eventData.genre[i]);needUpdate=true}}}}if(needUpdate){sender.hasResult=true;sender.update(result);sender.show()}else{sender.hasResult=false;sender.hide()}};sender.onSelectItem=function(event){var tagName=event.originalElement.tagName.toLowerCase();var canPlay=eval(event.item.getAttribute("play")||"true");if(canPlay&&((event.ctrl&&event.eventType=="key")||(tagName!="a"&&event.eventType=="mouse"))){var id=(event.item.id.match(/_([\da-z]+)$/i)[1]||0);var type=(event.item.getAttribute("contentType")||"audio");var limit=type=="audio"?0:11;var filter=null;switch(type){case"artist":case"genre":filter={};filter[type+"Id"]=id;type="playlist";id=0;break}application.player.playContent(id,type,"new",limit,filter)}else{var href=event.item.getElementsByTagName("a")[0].getAttribute("href");if((event.eventType=="mouse"&&event.button===0)||event.eventType=="key"){application.getWindow("content").location.href=href}}};sender.preventSubmit=function(event){if(sender.controlIndex>=0&&event.which==13){application.eventPreventDefault(event);return false}};sender.attachEvent("itemselect",sender.onSelectItem)};bmSearchDropdown.prototype.attachControlEvents=function(){application.attachEvent(this.element,"focus",this.onFocus);application.attachEvent(this.element,"blur",this.onBlur);application.attachEvent(this.elementWindow,"beforeunload",this.onBlur);if(/\/index\/$/i.test(this.elementWindow.location.toString())){this.element.focus()}};bmSearchDropdown.prototype.show=function(b){if(!this.visible){this.showInstance()}};bmSearchDropdown.prototype.hide=function(){if(this.visible){this.hideInstance()}};bmSearchDropdown.prototype.update=function(u){var r="";var p=0;var m=this.element.value.toLowerCase();var t=u;var v=0;v=t.artist.length;if(v>0){var q=["исполнитель","группа"];for(var s=0;s<t.artist.length;++s){t.artist[s]["intro"]=q[t.artist[s].category];t.artist[s]["type"]="artist";t.artist[s]["index"]=p;t.artist[s]["title"]=this.switchArtistTitle(t.artist[s]);if(t.artist[s].image!=""&&/artist[\d]+\.png/i.test(t.artist[s].image)==false){t.artist[s].image=application.applyTemplate("searchDropdownImg",{image:t.artist[s].image},top)}if(t.artist[s].canPlay){r+=application.applyTemplate("searchDropdownItem",t.artist[s],top)}else{r+=application.applyTemplate("searchDropdownItemNoPlay",t.artist[s],top)}p++}}v=t.song.length;if(v>0){r+=(r!=""?application.applyTemplate("searchDropdownDelimiter",{text:"песни"},top):"");for(var s=0;s<t.song.length;++s){t.song[s]["intro"]=this.switchArtistTitle(t.song[s],"creator")+":";t.song[s]["type"]="audio";t.song[s]["index"]=p;t.song[s]["image"]="";r+=application.applyTemplate("searchDropdownItem",t.song[s],top);p++}}v=t.album.length;if(v>0){r+=(r!=""?application.applyTemplate("searchDropdownDelimiter",{text:"альбомы"},top):"");for(var s=0;s<t.album.length;++s){t.album[s]["intro"]=this.switchArtistTitle(t.album[s],"creator")+":";t.album[s]["type"]="album";t.album[s]["index"]=p;if(t.album[s].image!=""&&/default/i.test(t.album[s].image)==false){t.album[s].image=application.applyTemplate("searchDropdownImg",{image:t.album[s].image},top)}r+=application.applyTemplate("searchDropdownItem",t.album[s],top);p++}}v=t.genre.length;if(v>0){r+=r!=""?application.applyTemplate("searchDropdownDelimiter",{text:"жанры"},top):"";for(var s=0;s<t.genre.length;++s){t.genre[s]["intro"]="";t.genre[s]["type"]="genre";t.genre[s]["index"]=p;t.genre[s]["image"]="";if(t.genre[s].canPlay){r+=application.applyTemplate("searchDropdownItem",t.genre[s],top)}else{r+=application.applyTemplate("searchDropdownItemNoPlay",t.genre[s],top)}p++}}if(r==""){this.hasResult=false}this.content='<ul id="'+this.parameters.name+'Content">'+r+"</ul>";if(this.contentContainer!=null){this.instance.removeChild(this.contentContainer)}application.updateElement(this.instance,this.content,this.instanceWindow.document,"append");this.contentContainer=this.instanceWindow.document.getElementById(this.parameters.name+"Content");var o=new Array();var n=0;while(this.contentContainer.childNodes[n]){if((p=this.contentContainer.childNodes[n].getAttribute("controlIndex"))!=null){o[p]={instance:this.contentContainer.childNodes[n]}}n++}this.controls=o.length>0?o:false;this.controlIndex=-1};bmSearchDropdown.prototype.createInstance=function(){this.content="";this.updateInstance();this.calculateFactors()};bmSearchDropdown.prototype.reset=function(){if(this.listenInterval!=null){window.clearInterval(this.listenInterval)}this.listenInterval=null;this.visible=false;this.hasResult=false;this.oldValue="";this.element=null};bmSearchDropdown.prototype.switchArtistTitle=function(d,f){var e="";f=f||"title";if(application.user.displayNames<2){e=(d[f+"Ru"]!=""?d[f+"Ru"]:d[f])}else{e=(d.category==0&&d[f+"Ru"]!=""?d[f+"Ru"]:d[f])}return e};