var $IE=document.all||false;var $NN6=document.getElementById&&!document.all;var $cookieEnabled=navigator.cookieEnabled;if("undefined"==typeof console){console={log:function(a){}}}if(window.XMLHttpRequest){if(window.ActiveXObject){$Browser="IE7"}else{$Browser="FIREFOX"}}else{$Browser="IE6"}var $TOPELEMENT=$NN6?"HTML":"BODY";var EventUtil=new Object;EventUtil.addEventHandler=function(b,c,a){ev=$NN6?"e":"window.event";regexp=new RegExp("(\\(.*)(event)","gm");a=a.replace(regexp,"$1"+ev);if(b.addEventListener){b.addEventListener(c,new Function("e",a),false)}else{if(b.attachEvent){b.attachEvent("on"+c,new Function(a))}else{b["on"+c]=$NN6?new Function("e",a):new Function(a)}}};EventUtil.removeEventHandler=function(b,c,a){if(b.removeEventListener){b.removeEventListener(c,a,false)}else{if(b.detachEvent){b.detachEvent("on"+c,a)}else{b["on"+c]=null}}};String.prototype.trim=function(){return this.replace(/^\s*|\s*$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s*/g,"")};String.prototype.chop=function(a){return(this.length":"%3E","?":"%3F","/":"|","+":"%2B",'"':"%22","`":"%60",";":"%3B","@":"%40","=":"%3D","$":"%24",",":"%2C","#":"%23"," ":"+",_:"%5f"};var a=this.replace(/\r\n/g,"\n").trim();var d="";for(var e=0;e
";for(var b=2;b"}var f=arguments[b].label;var d=arguments[b].func;var c=arguments[b].type;e+='"}Win.createPopup(e,true,false,400)},apply:function(type,func){type=(type||"").toLowerCase();if("cancel"===type){this.destory()}else{if("continue"){var callback=this.callback;var owner=this.owner;var args=[];for(var i=0;icnt?cnt:offset;for(var idx=offset;idxfield_j){this.swap(i,j)}}}}}; var iLoud=new function(baseURL,module,action,browser){this.elemnts=[];this.loaded=false;this.floater=null;this.onload=function(){this.loaded=true;if($IE&&$int($GLOBALS.version)<7){iLoud.SelectItems.init()}this.floater=$("oDiv")};this.alter=function(element,id){id=id||$getAt(element,"alter");$hide(element);$(id).style.display=""};this.reCall={delay:50,list:new List(),timerId:false,pos:0,init:function(){this.timerId=window.setInterval(function(){iLoud.reCall.check()},this.delay)},add:function(func,delay){var item={id:iLoud.uniqId(),func:func,delay:delay};this.list.addItem(item);if(!this.timerId){onLoad.add(function(){iLoud.reCall.init()})}return item.id},remove:function(func){var total=this.list.count();var list=this.list.getList();for(var i=0;i=0?select.options[select.selectedIndex].text:"";$show(input);$hide(select)}}};this.init=function(baseURL,module,action,browser,perms,perfs){this.baseURL=baseURL;this.imageDir=this.baseURL+"/img/";this.module=module;this.action=action;this.browser=browser;this.perms=perms;this.perfs=perfs};this.Rate={position:{small:{top:-59,left:-128,maxRate:5,heightStar:6,widthStar:7},medium:{top:-112,left:-146,maxRate:5,heightStar:11,widthStar:11},"medium-over":{top:-101,left:-146,maxRate:5,heightStar:11,widthStar:11}},create:function(container,rate,type,className){className=className?className:"rate-small mainPNG";var pro=this.getProperties(rate,type);return $newEl("div",container,{"class":className,title:pro.title,style:"background-position:"+pro.left+"px "+pro.top+"px;"})},set:function(element,rate,type){var pro=this.getProperties(rate,type);$setAt(element,{style:"background-position:"+pro.left+"px "+pro.top+"px;",title:pro.title})},over:function(element,pos,type){type=type+"-over";var widthStar=this.position[type].widthStar;var rate=Math.ceil(pos/widthStar);rate=rate?rate:1;var pro=this.getProperties(rate,type);$setAt(element,{style:"background-position:"+pro.left+"px "+pro.top+"px;",title:""})},get:function(element,pos,type){var widthStar=this.position[type].widthStar;var rate=Math.ceil(pos/widthStar);return rate},getProperties:function(rate,type){rate=rate||0;var pos={left:-128,top:-59,title:""};type=type||"small";if("undefined"!=this.position[type]&&rate>=0&&rate<=this.position[type].maxRate){var maxRate=this.position[type].maxRate;var heightStar=this.position[type].heightStar;var widthStar=this.position[type].widthStar;var baseTop=this.position[type]["top"];var baseLeft=this.position[type]["left"];if(rate!=(topRate=Math.ceil(rate))){var top=baseTop-heightStar;var left=baseLeft+topRate*widthStar}else{var top=baseTop;var left=baseLeft+rate*widthStar}pos={left:left,top:top,title:Math.round(rate*100)/100+"/"+maxRate}}return pos}};this.Hint={show:function(element){$setAt(iLoud.floater,{data:""});var div=$newEl("div",iLoud.floater,{"class":"hint",data:$getAt(element,"hint")});var pos=iLoud.getPosition(element);iLoud.floater.style.left=pos.x+element.offsetWidth+"px";iLoud.floater.style.top=pos.y+"px";iLoud.show(iLoud.floater)},hide:function(){$hide(iLoud.floater)}};this.TextScroll={timerId:false,callId:false,element:null,delay:($IE&&$int($GLOBALS.version)>=7)?20:25,setWidth:function(element){if($IE){$setAt(element,{"real-width":element.offsetWidth})}else{var span=$newEl("span",false,{data:$getAt(element,"data"),style:"visibility1:hidden; font-size:11px"});$setAt(element,{"real-width":span.offsetWidth});$removeEl(span)}},scroll:function(element,reverse){var marginLeft=$int(element.style.marginLeft);var offsetWidth=$int($getAt(element,"real-width"));var maxWidth=offsetWidth-element.parentNode.offsetWidth;var step=1;this.element=element;element.style.cursor="pointer";if(!reverse){if(Math.abs(marginLeft)<=maxWidth){element.style.marginLeft=marginLeft-step+"px";this.callId=window.setTimeout(function(){iLoud.TextScroll.scroll(element)},this.delay)}else{this.callId=window.setTimeout(function(){iLoud.TextScroll.scroll(element,true)},1000)}}else{if(marginLeft<0){element.style.marginLeft=marginLeft+step+"px";this.callId=window.setTimeout(function(){iLoud.TextScroll.scroll(element,true)},this.delay)}else{if(!$isTrue(element,"stop-scroll")){this.callId=window.setTimeout(function(){iLoud.TextScroll.scroll(element)},1000)}else{this.element=null}}}},reset:function(){if(this.callId){this.element.style.marginLeft="0px";this.element=null;window.clearTimeout(this.callId);this.callId=false}},stop:function(element){$setAt(element,{"stop-scroll":true});if(this.timerId){window.clearTimeout(this.timerId);this.timerId=false}},start:function(element){if(element!=this.element){if(!$getAt(element,"real-width")){this.setWidth(element)}if($int($getAt(element,"real-width"))>(element.parentNode.offsetWidth+4)){$setAt(element,{"stop-scroll":false});element.onmouseout=function(){iLoud.TextScroll.stop(element)};if(this.element){this.reset()}this.timerId=window.setTimeout(function(){iLoud.TextScroll.scroll(element)},1000)}}}};this.Image={swap:function(img,type){if(!$isTrue(img,"banImgSwap")){var swaped=$isTrue(img,"imgSwaped");var src=img.src;switch(type){case"click":if(swaped){iLoud.Image.swap(img)}img.src=$getAt(img,"ocsrc");$setAt(img,{ocsrc:src});if(!$isTrue(img,"canImgSwap")){}break;default:if("mouseover"==type||swaped){img.src=$getAt(img,"osrc");$setAt(img,{osrc:src});$setAt(img,{imgSwaped:!swaped})}break}}},ban:function(img){$setAt(img,{banImgSwap:true})},free:function(img){$setAt(img,{banImgSwap:false})}};this.Class={P_hilite:{color:"#FF6600"},swap:function(element,type){if(!$isTrue(element,"banClassSwap")){var swaped=$isTrue(element,"classSwaped");var className=element.className;switch(type){case"click":if(swaped){iLoud.Class.swap(element)}var className=element.className;element.className=$getAt(element,"osclass");$setAt(element,{osclass:className});this.ban(element);break;default:if("mouseover"==type||swaped){element.className=$getAt(element,"oclass");$setAt(element,{oclass:className});$setAt(element,{classSwaped:!swaped})}break}}else{if("click"==type&&$isTrue(element,"unselect")){var className=element.className;this.free(element);element.className=$getAt(element,"osclass");$setAt(element,{osclass:className})}}},hilite:function(element){if($isTrue(element,"classSwaped")){iLoud.Class.swap(element)}element.style.color=this.P_hilite.color;this.ban(element)},_hilite:function(element){element.style.color="";this.free(element)},ban:function(element){$setAt(element,{banClassSwap:true})},free:function(element){$setAt(element,{banClassSwap:false})}};this.ImageButton={parent:null,isShow:function(){return this.parent},show:function(event,element){this.parent=element;iLoud.show(this.parent.getElementsByTagName("span")[1])},hide:function(event,element){if(this.isShow()&&!iLoud.isChild(this.parent,event)){iLoud.hide(this.parent.getElementsByTagName("span")[1]);this.parent=null}}};this.vlist={};this.BoxExpand={first:true,element:null,timer:null,varname:"box_expand",step:25,run:function(element){this.element=this.init(element);if(this.element){this.expand(this.element)}},expand:function(element){element.style.cssText="overflow: hidden; display: block; height: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;";var max=iLoud.getOffsetHeight(element);this.changeHeight(element,max,this.step,0);Cookie.set(this.varname,element.id)},collapse:function(element){var max=$int(iLoud.getOffsetHeight(element));element.style.cssText="overflow: hidden; display: block; height:"+max+"px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;";this.changeHeight(element,0,-this.step,max);Cookie.unset(this.varname)},changeHeight:function(element,max,step,height){var stop=false;height+=step;height=height<0?0:(max>0&&height>max?max:height);if(height>0){if(max>0&&max<=height){element.style.cssText='display:"block"';stop=true}else{setTimeout(function(){iLoud.BoxExpand.changeHeight(element,max,step,height)},10)}}if(!stop){element.style.height=height+"px"}},init:function(element){if(this.first&&(id=Cookie.get(this.varname))){this.element=$getEl(id)}if(this.element){this.collapse(this.element)}var target=$getEl($getAt(element,"expandable"));this.first=false;return target==this.element?null:target}};this.FlowButton={owner:null,icon:"oImg",popupOpen:false,isOpen:function(){return this.owner},isPopupOpen:function(){return this.popupOpen},show:function(event,element){if(!$isTrue(element,"banFlowButton")){try{this.hidePopup(event,element);this.owner=element;var className=$getAt(this.owner,"flowButton");this.icon="object"==typeof this.icon?this.icon:$getEl(this.icon);this.icon.className=className;$show(this.icon);this.owner.parentNode.appendChild(this.icon)}catch(e){}}},hide:function(event){if(this.isOpen()&&!this.isPopupOpen()&&!iLoud.isInArea(this.owner.parentNode,event)){iLoud.hide(this.icon);this.owner=null}},showPopup:function(event){iLoud.Popup.show(event,this.icon,this.owner);this.popupOpen=true},hidePopup:function(event,element){if(this.isOpen()&&element!=this.owner){if(this.isPopupOpen()){iLoud.Popup.hide(event);this.popupOpen=false}this.hide(event)}}};this.BugButton={owner:null,icon:null,on:false,show:function(element,section){if(this.on){try{var section=section;if(!this.icon){this.icon=$getEl("bug.icon")}this.owner=element;var pos=iLoud.getPosition(this.owner);this.icon.style.left=pos.x+"px";this.icon.style.top=pos.y+"px";this.icon.onclick=function(){ajaxRequest.send("bugs/list/","get",{section:section,target_module:$GLOBALS.module,target_action:$GLOBALS.action,target_url:$GLOBALS.currentURL.urlencode()},false,"LAYER",{width:650});return false};$show(this.icon)}catch(e){}}},hide:function(event){if(this.owner&&!iLoud.isInArea(this.owner,event)){$hide(this.icon);this.owner=null}},swap:function(element){$setAt(element,{data:this.on?"Show Bug":"Hide Bug"});this.on=!this.on}};this.Bug={state:false,swap:function(){this.state=!this.state;if(this.state){this.show()}else{this.hide()}},hide:function(){var icons=document.getElementsByClass("bugs");if(icons.length>0){for(var i=0;i0){for(var i in json.data){if("function"!=typeof json.data[i]){var bug_section=json.data[i].section;for(var j=0;jIf nothing happens after a few seconds Click Here')};this.logout=function(){if(iLoud.loaded){ajaxRequest.send("users/logout","post",{},function(){iLoud.manualRedirect()},"LAYER")}return false};this.getVar=function(name){return"undefined"!=typeof this[name]?this[name]:("undefined"!=typeof this.perms[name]?"y"===this.perms[name]:("undefined"!=typeof this.perfs[name]?this.perfs[name]:("undefined"!=typeof this.rateInfo[name]?this.rateInfo[name]:null)))};this.show=function(element,show){element="object"==typeof element?element:$getEl(element);if(element){var elementStyle=element.style;if(elementStyle.visibility){elementStyle.visibility="visible"}else{show=show||"inline";elementStyle.display=show}}};this.hide=function(element){var element="object"==typeof element?element:$getEl(element);if(element){var elementStyle=element.style;if(elementStyle.visibility){elementStyle.visibility="hidden"}else{elementStyle.display="none"}}};this.isVisible=function(element){var element="object"==typeof element?element:$getEl(element);if(element){var elementStyle=element.style;return("hidden"===elementStyle.visibility||"none"===elementStyle.display)?false:true}};this.SWvisible=function(element,event,show){event=event||false;if(!event){this.isVisible(element)?this.hide(element):this.show(element,show)}else{"mouseout"==event.type?this.hide(element):this.show(element,show)}};this.SWshow=function(element){this.SWvisible(element,false,"block")};this.getPosition=function(oNode){try{var oCurrentNode=oNode;var iLeft=0;var iTop=0;while(oCurrentNode&&oCurrentNode.tagName!="HTML"&&oCurrentNode.tagName!="BODY"){if(oCurrentNode.offsetLeft){iLeft+=oCurrentNode.offsetLeft}if(oCurrentNode.offsetTop){iTop+=oCurrentNode.offsetTop}oCurrentNode=oCurrentNode.offsetParent}iLeft+=document.body.scrollLeft;iTop+=document.body.scrollTop;return{x:iLeft,y:iTop}}catch(e){return{x:0,y:0}}};this.getOffsetHeight=function(parent){var children=$NN6?parent.childNodes:parent.children;var offsetHeight=0;for(var i=0;i=x1&&curPos.x<=x2&&curPos.y>=y1&&curPos.y<=y2)?true:false}catch(e){}};this.isChild=function(parent,event){try{parent="object"==typeof parent?parent:$(parent);var element=event.target||event.srcElement||event;while(element.tagName!="HTML"&&element.tagName!="BODY"&&element!=parent&&element.parentNode){element=element.parentNode}return(element==parent)}catch(e){}};this.addShadow=function(element){$newEl("div",element.parentNode,{style:"font-family: Arial,Helvetica,sans-serif; font-weight: bold; font-size: 16px; color: rgb(255, 255, 255); margin-top: -21px; margin-left: 2px;",label:$getAt(element,"data")});element.style.color="#000"};this.getCenterPos=function(width,height){width=width||0;height=height||0;var screen_width=window.screen.width;var screen_height=window.screen.height;var left=(screen_width-width)/2;var top=(screen_height-height)/4;return{left:left,top:top}};this.getFirstElement=function(element,focusElements){focusElements=focusElements||["text","select-one","selecet-multi","radio","checkbox"];var ret=false;var child=null;var children=$NN6?element.childNodes:element.children;for(var i=0;i0){if(false!==(ret=this.getFirstElement(child))){return ret}}}return false};this.json_decode=function(json){try{if(json.is_empty()){return""}return eval("("+json+")")}catch(e){}};this.json_encode=function(){var self=arguments.length?arguments[0]:this,result,tmp;if(self===null){result="null"}else{if(self!==undefined&&(tmp=$[typeof self](self))){switch(tmp){case Array:result=[];for(var i=0,j=0,k=self.length;j=start&&i100)?100:(opacity<1)?0:opacity;opacityAsDecimal=opacity/100;element.style.opacity=(opacityAsDecimal);element.style.filter="alpha(opacity="+opacity+")"};this.fade=function(element,reverse){reverse=reverse||1;this.opacity=this.opacity+reverse*1||0;this.setOpacity(element,this.opacity);if(0===this.opacity){reverse=1;this.opacity++}else{if(70===this.opacity){reverse=-1;this.opacity--}}setTimeout(function(){iLoud.fade(element,reverse)},150)}}; var URL2={target:null,params:[],qString:"",addParams:function(a,b){this.target=a;this.params=JSON.decode(b)},go:function(c,d){try{var a=this.getQString();this.clear(d,a);this.add(c);var b=this.toString();if(!this.qString.is_empty()){if("/"!=b.substring(b.length-1)){b+="/"}b+="?"+this.qString}window.location=b}catch(f){console.log(f)}},getQString:function(){var f=[];var c=window.location.toString().replace(/#.*/,"");if(-1!=c.indexOf("?")){this.qString=c.substring(c.lastIndexOf("?")+1);if(!this.qString.is_empty()){var e=this.qString.split("&");for(var b=0;b>2;g=((k&3)<<4)|(h>>4);e=((h&15)<<2)|(f>>6);d=f&63;if(isNaN(h)){e=d=64}else{if(isNaN(f)){d=64}}a=a+this._keyStr.charAt(j)+this._keyStr.charAt(g)+this._keyStr.charAt(e)+this._keyStr.charAt(d)}return a+"="},decode:function(c){var a="";var k,h,f;var j,g,e,d;var b=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(b>4);h=((g&15)<<4)|(e>>2);f=((e&3)<<6)|d;a=a+String.fromCharCode(k);if(e!=64){a=a+String.fromCharCode(h)}if(d!=64){a=a+String.fromCharCode(f)}}a=Base64._utf8_decode(a);return a},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},_utf8_decode:function(a){var d="";var f=0;var h=0;var g=0;var b,e=0;while(f191)&&(h<224)){e=a.charCodeAt(f+1);d+=String.fromCharCode(((h&31)<<6)|(e&63));f+=2}else{e=a.charCodeAt(f+1);b=a.charCodeAt(f+2);d+=String.fromCharCode(((h&15)<<12)|((e&63)<<6)|(b&63));f+=3}}}return d}}; String.prototype.trim=function(){return this.replace(/^\s*|\s*$/g,"")};String.prototype.empty=function(){return(0===this.trim().length)?true:false};Array.prototype.empty=function(){return(0===this.length)?true:false};var ajaxTools=function(onComplete,onWait,parameters,useCache){this.xmlHttp=null;this.onComplete=null;this.onWait=null;this.parameters=parameters||{};this.useCache=useCache;this.url="";this.ReadyState=["Uninitialized","Loading","Loaded","Interactive","Complete"];this.WaitState=["NONE","BAR","PAGE"];this.init=function(onComplete,onWait,parameters,useCache){this.setXmlHttp();this.onComplete=onComplete||this.ParseResult;this.onWait=onWait||"NONE"};this.onChange=function(readyState){switch(this.ReadyState[readyState]){case"Uninitialized":case"Loading":case"Loaded":case"Interactive":break;case"Complete":this.onSuccess();break}};this.onSuccess=function(){if($loadObject("JSON",this)){return}var json=this.getHeader("X-JSON")||false;if(json){json=this.evalJSON(json)}else{try{json=this.evalJSON(this.xmlHttp.responseText);if("undefined"==typeof json){json=false;this.evalScript(this.xmlHttp.responseText)}}catch(e){try{this.evalScript(this.xmlHttp.responseText)}catch(e){}}}try{if(this.useCache){var data=json?json:this.xmlHttp.responseText;ajaxRequest.cache.set(this.url,data)}this.onComplete(this.xmlHttp,json)}catch(e){}this.finish()};this.evalJSON=function(json){return JSON.decode((json))};this.evalScript=function(data){var matchAll=new RegExp("]*>([\u0001-\uFFFF]*?)<\/script>","img");var matchOne=new RegExp("]*>([\u0001-\uFFFF]*?)<\/script>","im");if(matchAll.test(data)){var arrMatches=data.match(matchAll);for(var i=0;i]*>([\u0001-\uFFFF]*?)<\/script>","img");var matchOne=new RegExp("]*>([\u0001-\uFFFF]*?)<\/script>","im");if(matchAll.test(data)){var arrMatches=data.match(matchAll);for(var i=0;i';this.setContent(a)}}}else{window.setTimeout(function(){Win.createPopup(c,h,d,b)},250)}},switchCloseBtn:function(a){if("on"==a.toLowerCase()){$show("popup_close_botton")}else{$hide("popup_close_botton")}},createErrorPopup:function(c,d,b,a){var c='
'+c+'
';this.createPopup(c,d,b,a)},setContent:function(a){$setAt(this.popupContent,{data:a})},moveContent:function(a){this.setContent("");a="object"==typeof a?a:$(a);var b=$newEl("div",this.popupContent);this.popupContent.replaceChild(a,b)},createLayer:function(){if(!this.layer){var a=this.getPageSize();this.layer=$newEl("div",document.body,{"class":"layer",style:"position:absolute;left:0px;top:0px;z-index:999999;width:100%;height:"+a.pageHeight+"px"})}},close:function(){this.destory();this.showing=false},destory:function(){if(this.popup){$hide(this.popup)}if(this.progress){try{$removeEl(this.progress)}catch(a){}this.progress=null}if(this.layer){$removeEl(this.layer);this.layer=null}},getPageSize:function(d){d=d||document.body;var c,g;var e,b;if(d!=document.body){c=d.getWidth();g=d.getHeight();b=d.scrollWidth;e=d.scrollHeight}else{var f,a;if(window.innerHeight&&window.scrollMaxY){f=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){f=document.body.scrollWidth;a=document.body.scrollHeight}else{f=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){c=self.innerWidth;g=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;g=$("wrapper")?$("wrapper").offsetHeight:document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;g=document.body.clientHeight}}}if(a=this.getMinChar()},yes:function(a){return this.getElement(a)==this.get("element")}},lock:{flag:false,start:function(){this.flag=true},end:function(){this.flag=false},yes:function(){return this.flag}},queue:{list:[],add:function(a){var b=this.get();b.push(a);this.set([a])},get:function(){return this.list},set:function(a){this.list=a},pop:function(){var b=this.get();var a=false;if(b.length){a=b.pop();this.set(b)}return a}},handle:function(b){if(this.current.yes(b)){var c=b.keyCode||b.which;var a=false;switch(c){case 38:case 40:autoComplete.View.scroll(c-39);break;case 13:autoComplete.View.List.hide();break;case 27:autoComplete.View.List.hide();break;case 9:case 37:case 39:break;default:var a=true;break}return a}},onScroll:function(b){var a=autoComplete.Controler.getBox();if(!autoComplete.Controler.current.getScroll()&&(a.scrollHeight-(a.offsetHeight+a.scrollTop))<=100){autoComplete.Controler.current.setScroll(a.offsetHeight+a.scrollTop);this.scroll()}else{if(!autoComplete.Controler.lock.yes()){autoComplete.Controler.current.setScroll(0)}}},getBox:function(){return $(this.boxId)},getBoxList:function(){return $(this.boxId+".list")},getLoader:function(){return $(this.boxId+".list.loading")},typing:function(b){if(this.isTargetElement(b)){this.getBox().onscroll=function(c){autoComplete.Controler.onScroll()};if(this.isWord(b)){var a=this.getPhrase(b);if(this.current.hasMinChar(a)){autoComplete.Controler.reset(b,a);autoComplete.View.select({text:a,idx:""});this.wait(a)}else{autoComplete.View.List.hide()}}}},reset:function(b,a){this.current.init(b);this.current.setPhrase(a)},wait:function(a){this.cancel();autoComplete.View.List.clear();this.timerId=window.setTimeout(function(){autoComplete.Controler.suggest(a,true)},this.delay)},suggest:function(a){if(!autoComplete.Controler.lock.yes()){var b=autoComplete.Model.get(a,autoComplete.Controler.current.getTarget(),autoComplete.Controler.current.getType(),autoComplete.Controler.current.getOffset(),autoComplete.Controler.current.getLimit());if(b){autoComplete.View.show(b);if(autoComplete.Controler.queue.pop()){autoComplete.Controler.scroll()}}}},scroll:function(){if(!autoComplete.Controler.lock.yes()){var a=autoComplete.Controler.current.getOffset();if(ae){data=[];for(var a=e;a0){var g=f.data;for(var d in g){if("function"!=typeof g[d]){if(g[d].text.toLowerCase()==h.toLowerCase()){c=g[d].idx;break}}}}}}}return c},isExist:function(a,b){return"undefined"!=typeof this.buffer[b]&&"undefined"!=typeof this.buffer[b][a]},load:function(a,e,d,f,b,g,c){ajaxRequest.send(e,"POST",{type:d,phrase:a,offset:f,limit:b},function(i,h){autoComplete.Model.fill(h,a,d,f,b,g,c)},function(){autoComplete.Model.wait()})},wait:function(){autoComplete.Controler.lock.start();var b=autoComplete.Controler.current.getElement();var c=$("autoComplete.box.loading");var a=iLoud.getPosition(b);c.style.left=a.x+b.offsetWidth-18+"px";c.style.top=a.y+2+"px";$show(c)},fill:function(e,a,d,f,b,g,c){autoComplete.Controler.lock.end();$hide($("autoComplete.box.loading"));if(e&&"Success"==e.status){this.add(d,a,e.rows,e.cnt);if(this.read(a,d,f)){g.apply(null,c)}}},getTotal:function(a,b){return this.isExist(a,b)?this.buffer[b][a]["total"]:0},add:function(b,a,d,c){if("undefined"==typeof this.buffer[b]){this.buffer[b]={}}if("undefined"==typeof this.buffer[b][a]){this.buffer[b][a]={data:[],total:0}}this.buffer[b][a]["total"]=c;for(idx in d){if("function"!=typeof d[idx]){this.buffer[b][a]["data"].push({idx:idx,text:d[idx]})}}}},View:{pos:-1,List:{create:function(){var d=autoComplete.Controler.getBoxList();for(var b=0;b=0&&a=(b.length-10)){autoComplete.Controler.scroll()}},isEmpty:function(){return this.getListItems().length?false:true},getListItems:function(){var a=autoComplete.Controler.getBoxList();return a.getElementsByTagName("li")},getItem:function(b){var a=this.getListItems();return a[b].getElementsByTagName("a")[0]},select:function(c){if(c){var b=autoComplete.Controler.current.getElement();var a=autoComplete.Controler.current.getIdField();b.value=c.text;if(a){a.value=c.idx||$getAt(c,"idx")}}},over:function(d){if(this.pos>=0){this.out(this.pos)}var c=autoComplete.Controler.getBox();var b=this.getItem(d);$setAt(b,{"class":"over"});var a=Math.floor(c.offsetHeight/b.offsetHeight);this.select(b);if(d>this.pos){if((d*b.offsetHeight-c.scrollTop)>(a-1)*b.offsetHeight){c.scrollTop+=b.offsetHeight}}else{if(dc.offsetHeight){c.scrollTop-=b.offsetHeight}}}this.pos=d},out:function(a){$setAt(this.getItem(a),{"class":""})}}};$attachEvent(document,"keydown","autoComplete.Controler.handle(event)");$attachEvent(document,"keyup","autoComplete.Controler.typing(event)");$attachEvent(document,"click","autoComplete.Controler.click(event)"); var SearchBox=new function(){this.form=null;this.searchType=null;this.searchInput=null;this.searchDiv=null;this.selectedID="selectedsearchOptions";this.suggestion=autoComplete;this.init=function(){this.form=document.forms["search-box"];this.searchType=this.form.stype;this.searchInput=this.form.phrase;this.searchDiv=$("vPhrase");this.searchDiv.onclick=function(){SearchBox.startTyping()};this.searchInput.onblur=function(){SearchBox.endTyping()};$("search.go").onclick=function(){SearchBox.go()};$("search.goplus").onclick=function(){SearchBox.go(true)};var a=$GLOBALS.baseURL+"share/suggestion/"};this.setType=function(c,d,e){if(!this.form){this.init()}var b=$(this.selectedID);if(b!=c){$setAt(b,{id:""});$setAt(c,{id:this.selectedID});this.searchType.value=d;this.form.action=$GLOBALS.baseURL+e+"/";$setAt(this.searchInput,{autocomp_type:d});var a="Search "+d;$setAt(this.searchDiv,{data:a})}return false};this.startTyping=function(){if(!this.form){this.init()}iLoud.show(this.searchInput,"block");iLoud.hide(this.searchDiv);this.searchInput.focus()};this.endTyping=function(){if(!this.form){this.init()}if(this.searchInput.value.is_empty()){iLoud.hide(this.searchInput);iLoud.show(this.searchDiv,"block")}};this.go=function(b){if(!this.form){this.init()}if(!this.searchInput.value.is_empty()){if(b){var a=window.location.toString().replace(/#.*/,"");if(-1!=a.indexOf("?")){this.form.action=a.substring(0,a.lastIndexOf("?"))+"/"}else{this.form.action=a+"/"}}this.form.submit()}return false}}; var MPlayer=function(){this.url=false;this.sampleUrlBase=false;this.playlist=null;this.timeDelay=500;this.ready=false;this.track=null;this.trackIDX=false;this.trackId=false;this.load=false;this.mute=false;this.volume=false;this.pasTime=0;this.remTime=0;this.totalTime=false;this.state=false;this.buffer=false;this.postion=false;this.copy=function(){var a={};for(i in this){a[i]=this[i]}return a};this.get=function(a){return this[a]};this.set=function(){var a=this.copy();var d=arguments.length;for(var c=0;c0){this.activePreviousBtn()}}};this.update=function(playlistTitle,totalTrack,trackIDX,currentTrackIDX,currentTrack,loud,track){var trackTitle=loudTitle="";loud=loud||false;track=track||false;if(!this.hiliteLink(currentTrack,track)){var obj=this;window.setTimeout(function(){obj.hiliteLink(currentTrack,track)},1000)}var trackTitle=loudTitle="";var loud_rate=track_rate=0;if(false!==trackIDX){var rowNum=(trackIDX>=0)?(trackIDX+1):"";var hasTrackArtist=!(""+track.artistName).is_empty();var hasTrackTitle=!(""+track.trackTitle).is_empty();var hasLoudArtist=!(""+loud.artistName).is_empty();var hasLoudTitle=!(""+loud.loudTitle).is_empty();trackTitle=rowNum+((hasTrackArtist||hasTrackTitle)?"-":"")+track.artistName+((hasTrackArtist&&hasTrackTitle)?" - ":"")+track.trackTitle;loudTitle=loud.artistName+((hasLoudArtist&&hasLoudTitle)?" - ":"")+loud.loudTitle;loud_rate=loud.rate;track_rate=track.rate}$setAt(this.trackTitle,{data:trackTitle});$setAt(this.loudTitle,{data:loudTitle});iLoud.Rate.set(this.loudRateImg,loud_rate);iLoud.Rate.set(this.trackRateImg,track_rate);this.playlist.update(playlistTitle,totalTrack,trackIDX);this.setButtons(trackIDX,totalTrack)};this.playpause=function(play){this.playing=!play;if(true===this.playing){this.chngBuuton(this.playBtn,"pause")}else{this.chngBuuton(this.playBtn,"play")}};this.setMute=function(state,notChngVol){this.mute=state;this.chngBuuton(this.speaker,state?"mute":"unmute");if(!notChngVol){this.setVolumeBar(state?0:this.ClientPlayer.get("volume"),true)}};this.setLoadBar=function(load){this.loadBar.style.width=load+"%";this.scrubActive=load>0?true:false};this.time2width=function(pasTime,remTime,totalTime){var totalWidth=this.bar.offsetWidth-this.scrubWidth;this.totalTime=totalTime||remTime+pasTime;var width=this.totalTime>0?(pasTime/this.totalTime)*totalWidth:0;return width+"px"};this.event2width=function(ev){return ev.clientX-iLoud.getPosition(this.loadBar).x};this.width2time=function(width){var totaltime=this.totalTime;var time=width*(totaltime)/(this.bar.offsetWidth-this.scrubWidth);return time};this.moveTime=function(ev){this.ClientPlayer.goTime(this.width2time(this.event2width(ev)))};this.sec2time=function(sec){sec=Math.round(sec);var min=Math.floor(sec/60);min=min<10?"0"+min:min;sec=sec-min*60;sec=sec<10?"0"+sec:sec;return min+":"+sec};this.changeTimerMode=function(event){try{$prvntEv(event);this.timerMode="PASS"==this.timerMode?"REMAIN":"PASS";Cookie.set("timerMode",this.timerMode);this.applyTimer(this.ClientPlayer.get("pasTime"),this.ClientPlayer.get("remTime"),this.ClientPlayer.get("totalTime"))}catch(e){}};this.applyTimer=function(pasTime,remTime,totalTime){try{if(this.timer){var time=this.sec2time("PASS"==this.timerMode?pasTime:remTime);var otherTime=this.sec2time("PASS"==this.timerMode?remTime:pasTime);$setAt(this.timer,{data:time,alt:otherTime,title:otherTime})}}catch(e){}};this.moveBar=function(pasTime,remTime,totalTime,applyTimer){if(false===this.scrubDragStart){if(applyTimer){this.applyTimer(pasTime,remTime,totalTime)}this.progBar.style.width=this.time2width(pasTime,remTime,totalTime)}};this.isSelected=function(element,ev){var target=$NN6?ev.target:ev.srcElement;while(target&&target!=$TOPELEMENT&&target!=element){target=$NN6?target.parentNode:target.parentElement}return(target==element)};this.startDrag=function(ev){if(this.scrubActive&&!this.dragVolumeStart&&this.isSelected(this.scrub,ev)){this.draging=this.scrubDragStart=true;this.scrubDragMousePosX=ev.clientX;this.scrub.style.cursor="pointer";this.loadBar.style.cursor="";$prvntEv(ev)}else{if(!this.mute&&!this.scrubDragStart&&this.isSelected(this.volumeProgBar,ev)){this.draging=this.dragVolumeStart=true}}};this.drag=function(ev){if(true===this.scrubDragStart){var width=this.event2width(ev);if(width100?100:volume<0?0:volume;this.ClientPlayer.setVolume(volume)};this.moveVolumeProgress=function(ev){for(i=0;i=0){currentTrack+=1;current=currentTrack+"/"}position=" ( "+current+totalTrack+" ) "}else{}var header="";if(totalTrack>0){header=playlist.title+position;$setAt("player.popup.playlist.date",{data:(playlist.date||this.now())});$show("player.popup.playlist.titlebar")}else{header="(Playlist is Empty)";$hide("player.popup.playlist.titlebar")}$setAt("player.popup.playlist.headerbar",{data:header});$setAt("player.box.playlist.title",{data:header})},getIDX:function(item){var currentIDX=false;for(var idx=0;idx0){this.set("volume",b,"mute",false)}this.skin.setVolumeBar(b);if(!a&&this.serverIsStable()){this.windowServer.MPlayerServer.setVolume(b)}};MPlayerClient.nextTrack=function(){this.playitem(this.trackIDX?this.trackIDX+1:1)};MPlayerClient.prevTrack=function(){if(this.trackIDX>0){this.playitem(this.trackIDX-1)}};MPlayerClient.openConnection=function(a){if(false!==this.openTimerId){clearTimeout(this.openTimerId);this.openTimerId=false}if(!this.serverIsOpen()){this.set("status","OPEN");this.openingPopup=true;this.windowServer=window.open(this.url+"player.html?a=1.48","player","left=0,top=0,height=200,width=400,menubar=0,locationbar =0,titlebar=0,statusbar=0,titlebar=0,scrollbar=0");if(this.serverIsReady()){this.windowServer.MPlayerServer=null;this.openTimerId=window.setTimeout("MPlayerClient.openConnection("+a+")",this.timeDelay);return}}if(!this.serverIsReady()){this.set("status","PREPARING");this.openTimerId=window.setTimeout("MPlayerClient.openConnection("+a+")",this.timeDelay);return}else{if(!this.isCorrectOpener()){this.windowServer=null;this.openConnection(a);return}}this.playitem(a)};MPlayerClient.closeServer=function(a){this.openingPopup=false;this.windowServer=null;if("PLAYING"==this.get("status")){this.skin.playpause(true)}this.handleEvent({type:"update",state:"time",param1:0,param2:0});this.handleEvent({type:"update",state:"load",param1:0});this.set("status",a)};MPlayerClient.serverIsStable=function(){return this.serverIsOpen()&&this.serverIsReady()&&this.isCorrectOpener()};MPlayerClient.serverIsOpen=function(){return(this.windowServer&&this.windowServer.isOpen)||this.openingPopup};MPlayerClient.serverIsReady=function(){return this.windowServer&&this.windowServer.MPlayerServer&&this.windowServer.MPlayerServer.playerObj};MPlayerClient.IsReady=function(){return iLoud.loaded};MPlayerClient.isCorrectOpener=function(){return(window==this.windowServer.MPlayerServer.opener)};MPlayerClient.savePlaylistOnServer=function(){if(false!==this.saveTimerId){clearTimeout(this.saveTimerId);this.saveTimerId=false}ajaxRequest.send("temp_playlist/save","post",{trackId:this.saveTrackIDs,playlistId:this.savePlaylistId,loudId:this.saveLoudIDs});this.saveLoudIDs=[];this.saveTrackIDs=[]};MPlayerClient.savePlaylist=function(b,a){a=a||this.playlist.getSelected();if(false!==this.saveTimerId){clearTimeout(this.saveTimerId);this.saveTimerId=false}if(this.savePlaylistId&&a&&this.savePlaylistId!=a&&this.saveTrackIDs.length>0){clearTimeout(this.saveTimerId);this.savePlaylistOnServer()}this.savePlaylistId=a;this.saveTrackIDs.push(b);this.saveLoudIDs.push(this.getTrack(b).loudId);this.saveTimerId=setTimeout("MPlayerClient.savePlaylistOnServer()",this.timeDelay)};MPlayerClient.deletePlaylist=function(a){a=a||this.playlist.getSelected();ajaxRequest.send("temp_playlist/delete","post",{playlistId:a,type:"clear"})};MPlayerClient.deleteFromPlaylist=function(a){ajaxRequest.send("temp_playlist/delete","post",{playlistId:this.playlist.getSelected(),loudId:a.loudId,trackId:a.id})};MPlayerClient.isNextBtnActive=function(){return this.skin.isNextBtnActive()};MPlayerClient.isPreviousBtnActive=function(){return this.skin.isPreviousBtnActive()};MPlayerClient.getCurrentTrack=function(){return this.getCurrent().track};MPlayerClient.getCurrentLoud=function(){return this.getCurrent().loud};MPlayerClient.getCurrent=function(){var a=loud=false;var a=this.get("track");if(a){loud=this.playlist.getLoudInfo(a.loudId)}return{track:a,loud:loud}};MPlayerClient.setCurrent=function(c,f){var g=this.get("trackIDX");var h=this.get("track");var b=this.getPlaylistInfo();var e=this.getTotalTrack();if(false!==c){var a=this.getTrack(c,true);if(a&&a.id===f){var d=this.playlist.getLoudInfo(a.loudId);this.skin.update(b,e,c,g,h,d,a);this.set("trackIDX",c,"trackId",f,"track",a)}}else{this.skin.update(b,e,c,g,h);this.set("trackIDX",c,"trackId",f)}};MPlayerClient.handleEvent=function(c,a){if(c.type){a=a||false;switch(c.type){case"skinresize":this.skin.toolbarSwapSize();break;case"additem":f=c.item.id;h=this.getTrack(f);var m=this.isLoading();var j=!m;this.skin.additem2playlist(this.getPlaylistInfo(),this.getTotalTrack(),this.trackIDX,h,j);if(false===m){this.savePlaylist(f)}if(2==c.total){}if(!this.isLoading()){this.setCurrent(this.get("trackIDX"),this.get("trackId"))}if(this.serverIsStable()){this.playlist.exportData(this.windowServer.MPlayerServer.playlist,c.item)}break;case"duplicate":$prvntEv(c);if(!this.isLoading()){alert("This track already exist!")}break;case"empty":this.skin.clearPlaylist(this.getPlaylistInfo());this.deletePlaylist();this.setCurrent(false,false);if(this.serverIsStable()){this.windowServer.MPlayerServer.clearPlaylist()}break;case"unempty":this.skin.activePlayBtn();break;case"removeditem":var l=this.getTotalTrack();if(l>0){var p=c.idx;var h=this.getTrack(p,true);this.skin.removeFromPlaylist(this.getPlaylistInfo(),l,p);if((h=this.getTrack(p,true))){this.deleteFromPlaylist(h)}if(this.serverIsStable()){this.windowServer.MPlayerServer.removeTrack(p)}var k=this.get("trackIDX");var d=p<=k?k-1:k;this.setCurrent(d,this.getTrack(d,true).id)}break;case"update":var b=c.state;var i=c.param1;var g=c.param2;switch(b){case"state":switch(i){case"COMPLETED":this.skin.playpause(true);this.setCurrent(false,false);break;case"PLAYING":this.skin.playpause(false);break;case"PAUSED":this.skin.playpause(true);break;case"CLOSED":this.closeServer(i);break;case"IDLE":if("PLAYING"==g&&this.getTotalTrack()){this.skin.playpause(true);this.setCurrent(false,false)}break}this.set("old_status",this.get("status"));this.set("status",i);break;case"load":this.skin.setLoadBar(i);if(100==i){var h=this.get("track");if(h){var n=$int(h.sample_length);if(0==n){var f=h.id}}}break;case"buffer":break;case"item":this.setCurrent(i,g);break;case"volume":break;case"mute":break;case"time":if(false!==g){this.pasTime=i;this.totalTime=g;this.remTime=this.totalTime-this.pasTime;this.skin.moveBar(this.pasTime,this.remTime,this.totalTime,true)}break;case"retrieve":if(!this.isLoading()){try{this.Retrieving=true;object=c.target;this.windowServer=object.child;this.handleEvent(i.state,true);this.handleEvent(i.item,true);this.handleEvent(i.time);this.totalTime=this.remTime+this.pasTime;this.handleEvent(i.load);this.handleEvent(i.volume);this.Retrieving=false}catch(o){}}break}break}}};MPlayerClient.json_decode=function(json){try{if((json+"").is_empty()){return""}return eval("("+json+")")}catch(e){return json}};