
var _classReCache={};emptyImageUrl=window.emptyImageUrl||'s.gif';var
ua=navigator.userAgent.toLowerCase(),isOpera=!!window.opera,isIE=!!(window.attachEvent&&!window.opera),isIE6,isIE7,isIE8;if(isIE){if(ua.indexOf("msie 8")>-1){isIE8=true;}else if(ua.indexOf("msie 7")>-1){isIE7=true;}else if(ua.indexOf("msie 6")>-1){isIE6=true;}}
var
isChrome=(/chrome/).test(ua),isSafari=!isChrome&&(/webkit|khtml/).test(ua),isSafari3=isSafari&&ua.indexOf('webkit/5')>-1,isGecko=!isChrome&&!isSafari&&ua.indexOf('gecko')>-1,isGecko3=isGecko&&ua.indexOf('rv:1.9')>-1,isMobileSafari=!!ua.match(/apple.*mobile.*safari/),isStrict=document.compatMode=="CSS1Compat",isBorderBox=isIE&&!isStrict
Object.extend=function(to,from){if(from&&typeof from=='object'){for(var property in from){to[property]=from[property];}}
return to;}
function bind(method,scope){return function(){method.apply(scope||window,arguments);}}
function addClass(node,className){if(className&&!hasClass(node,className)){node.className=node.className+' '+className;}}
function removeClass(node,className){if(className&&hasClass(node,className)){var re=_classReCache[className];if(!re){re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)',"g");_classReCache[className]=re;}
node.className=node.className.replace(re," ");}}
function hasClass(node,className){return(' '+node.className+' ').indexOf(' '+className+' ')!=-1;}
function getPosition(node,local){if(!node){return{x:0,y:0}}
if(node.getBoundingClientRect){var pos=node.getBoundingClientRect();return{x:pos.left,y:pos.top};}else{var left=0,top=0,scroll=getScroll();do{left+=node.offsetLeft;top+=node.offsetTop;}while(node=node.offsetParent);return{x:left-scroll.left,y:top-scroll.top}}}
function getSize(node){return{width:node.offsetWidth,height:node.offsetHeight};}
function within(container,containee){if(container==null||containee==null){return false;}
if(container==containee){return true;}
if(container.contains){return container.contains(containee);}else if(container.compareDocumentPosition){return!!(container.compareDocumentPosition(containee)&16);}else{console.log('within: unsupported browser');return false;}}
function getViewportWidth(){return isStrict?document.documentElement.clientWidth:document.body.clientWidth;}
function getViewportHeight(){if(isIE){return isStrict?document.documentElement.clientHeight:document.body.clientHeight;}else{return self.innerHeight;}}
function getDocumentWidth(){var w=isStrict?document.documentElement.scrollWidth:document.body.scrollWidth;return Math.max(w,getViewportWidth())-1;}
function getDocumentHeight(){var h=isStrict?document.documentElement.scrollHeight:document.body.scrollHeight;return Math.max(h,getViewportHeight());}
function getViewportSize(){return{width:getViewportWidth(),height:getViewportHeight()};}
function getScroll(){var mode=document.compatMode,doc=document,l,t;if(isIE&&isStrict){l=doc.documentElement.scrollLeft||(doc.body.scrollLeft||0);t=doc.documentElement.scrollTop||(doc.body.scrollTop||0);}else{l=window.pageXOffset||(doc.body.scrollLeft||0);t=window.pageYOffset||(doc.body.scrollTop||0);}
return{left:l,top:t};}
function getScrollBarWidth(){var inner=document.createElement('p');inner.style.width="100%";inner.style.height="200px";var outer=document.createElement('div');outer.style.position="absolute";outer.style.top="0px";outer.style.left="0px";outer.style.visibility="hidden";outer.style.width="200px";outer.style.height="150px";outer.style.overflow="hidden";outer.appendChild(inner);document.body.appendChild(outer);var w1=inner.offsetWidth;outer.style.overflow='scroll';var w2=inner.offsetWidth;if(w1==w2)w2=outer.clientWidth;document.body.removeChild(outer);return(w1-w2);};function attachEventListener(node,eventName,func){if(node.addEventListener){node.addEventListener(eventName,func,false);}else if(node.attachEvent){node.attachEvent('on'+eventName,func);}}
function detachEventListener(node,eventName,func){if(node.removeEventListener){node.removeEventListener(eventName,func,false);}else if(node.detachEvent){node.detachEvent('on'+eventName,func);}}
(function(){var timer,_domReadyCallbacks=[];function onDomReady(callback,scope){_domReadyCallbacks.push([callback,scope||window]);};window.onDomReady=onDomReady;if(document.on){var fireContentLoadedEvent=function(){var i,item,len=_domReadyCallbacks.length;for(i=0;i<len;i++){item=_domReadyCallbacks[i];item[0].call(item[1]);}}
document.on('dom:loaded',fireContentLoadedEvent);return;}
var fireContentLoadedEvent=function(){if(document.loaded){return;}
if(timer){window.clearInterval(timer);}else if(document.removeEventListener){document.removeEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}
document.loaded=true;var i,item,len=_domReadyCallbacks.length;for(i=0;i<len;i++){item=_domReadyCallbacks[i];item[0].call(item[1]);}};if(document.addEventListener){if(isSafari){timer=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){fireContentLoadedEvent();}},0);window.addEventListener('load',fireContentLoadedEvent,false);}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false);}}else{var dummy=location.protocol=="https:"?"https://javascript:void(0)":"javascript:void(0)";document.write("<script id=\"__onDOMContentLoaded\" defer=\"defer\" src=\""+dummy+"\"><\/script>");var defer=document.getElementById('__onDOMContentLoaded');defer.onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;defer.parentNode.removeChild(defer);defer=null;fireContentLoadedEvent();}};}
window.onDomReady(function(){var bd=document.body;var cls=isIE?("x-ie "+(isIE6?'x-ie6':isIE7?'x-ie7':isIE8?'x-ie7':'')):isGecko?"x-gecko":isOpera?"x-opera":isSafari?"x-safari":isChrome?"x-chrome x-safari":'';if(isBorderBox){cls+=' x-border-box';}
if(isStrict){var p=bd.parentNode;if(p){if(p.className&&p.className!=''){p.className+=' x-strict';}else{p.className='x-strict';}}}
addClass(bd,cls);});}());

(function(){function _toQueryString(uri,object,prepend){switch(typeof object){case'number':case'string':case'boolean':if(prepend===''){throw new Error("At first object must be passed!");}
uri.push(prepend+'='+encodeURIComponent(object));break;case'object':if(object!==null&&object.constructor===Array){if(prepend===''){throw new Error("At first object must be passed!");}
for(var i=0,len=object.length;i<len;i++){_toQueryString(uri,object[i],prepend+'['+i+']');}}else{for(var key in object){var value=object[key];if(typeof value==='function')continue;_toQueryString(uri,value,prepend===''?key:(prepend+'['+key+']'));}}
break;}}
var isSafari=(/webkit|khtml/).test(navigator.userAgent.toLowerCase());function Request(url,options){if(typeof url==='string'){this.url=url;}else{options=url;}
if(options){this.applyOptions(options);}
this.method=this.method.toUpperCase();this.requestDone=false;this.data=this.data||this.postBody||this.parameters;this.xhr=this.getTransport();if(typeof this.data!=='string'){this.data=this.toQueryString(this.data);}
if(this.data&&(this.method==='GET')){this.url+=((this.url.lastIndexOf('?')>-1)?"&":"?")+this.data;this.data=null;}
if(this.username){this.xhr.open(this.method,this.url,this.async,this.username,this.password);}else{this.xhr.open(this.method,this.url,this.async);}
this.xhr.onreadystatechange=this.getBind(this.onReadyStateChange);try{this.setRequestHeaders();}catch(e){}
if(this.async&&(this.timeout>0)){this.timeoutId=setTimeout(this.getBind(this._onTimeout),this.timeout);}
try{this.xhr.send(this.data);}catch(e){}
if(!this.async){this.onReadyStateChange();}}
Request.prototype={method:'post',contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:null,onComplete:null,onFailure:null,parameters:null,postBody:null,data:null,async:true,timeout:0,username:null,password:null,applyOptions:function(options){if(options&&typeof options=='object'){for(var property in options){this[property]=options[property];}}
return this;},getBind:function(method){var obj=this;return function(){return method.apply(obj,arguments);}},toQueryString:function(object){var uri=[];_toQueryString(uri,object,'');return uri.join('&');},abort:function(){this.xhr.onreadystatechange=function(){};if(this.timerId){clearTimeout(this.timerId);this.timerId=null;}
this.xhr.abort();},getTransport:function(){var xhr=null,func=function(){return null;};if(window.ActiveXObject){try{xhr=new ActiveXObject('Microsoft.XMLHTTP');func=function(){return new ActiveXObject('Microsoft.XMLHTTP');};}catch(e){}}else if(window.XMLHttpRequest){xhr=new XMLHttpRequest();func=function(){return new XMLHttpRequest();};}
Request.prototype.getTransport=func;return xhr;},setRequestHeaders:function(){this.xhr.setRequestHeader('Content-Type',this.contentType+
(this.encoding?'; charset='+this.encoding:''));this.xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');this.xhr.setRequestHeader('Accept','text/javascript, text/html, application/xml, text/xml, */*');},_onTimeout:function(){if(this.xhr){this.xhr.abort();}
if(!this.requestDone){this.onReadyStateChange('timeout');}},onReadyStateChange:function(isTimeout){isTimeout=isTimeout=='timeout';if(this.requestDone||!this.xhr||((this.xhr.readyState!=4)&&(!isTimeout))){return;}
this.requestDone=true;var status=isTimeout&&'Timeout'||!this.isSuccessCode()&&'Failure'||'Success',handler='on'+status;if(!isTimeout&&this.timerId){clearTimeout(this.timerId);this.timerId=null;}
if(this[handler]){this[handler].call(this.scope,this.xhr,this);}
if(this.onComplete){this.onComplete.call(this.scope,this.xhr,this);}
this.xhr.onreadystatechange=this.stub;this.xhr=null;},stub:function(){},isSuccessCode:function(){try{var status=this.xhr.status;return!status&&location.protocol=="file:"||(status>=200&&status<300)||status==304||status==1223||isSafari&&status==undefined;}catch(e){}
return false;}};if(typeof window.Ajax=='undefined'){window.Ajax={};}
if(!window.Ajax.Request){window.Ajax.Request=Request;}}());

(function(){function Fieldset(config){Object.extend(this,config);if(this.applyTo){var applyTo=this.applyTo;delete this.applyTo;this.apply(applyTo);}}
Fieldset.prototype={title:'',apply:function(to){if(typeof to=='string'){to=document.getElementById(to);}
if(to.nodeName!='FIELDSET'){return false;}
var legend=to.getElementsByTagName('legend')[0];if(legend){this.title=legend.innerHTML;}else{this.title='';legend=document.createElement('legend');if(to.firstChild){to.insertBefore(legend,to.firstChild);}else{to.appendChild(legend);}}
addClass(to,'fieldset');legend.innerHTML='<a href="javascript:"><img src="'+emptyImageUrl+'" /> '+this.title+'</a>';var wrapEl=document.createElement('div');wrapEl.className='fieldset-body-wrap';to.appendChild(wrapEl);var i,node,nodes=to.childNodes,len=nodes.length-1,toMove=[];for(i=0;i<len;i++){node=nodes[i];if(node.nodeName!='LEGEND'){toMove.push(node);}}
len=toMove.length;for(i=0;i<len;i++){node=toMove[i];wrapEl.appendChild(node);}
this.collapsed=hasClass(to,'fieldset-collapsed');legend.onclick=bind(this.onClick,this);this.dom=to;this.legendEl=legend;this.wrapEl=wrapEl;return true;},toggle:function(){this[this.collapsed?'expand':'collapse']();},expand:function(){removeClass(this.dom,'fieldset-collapsed');this.collapsed=false;},collapse:function(){addClass(this.dom,'fieldset-collapsed');this.collapsed=true;},onClick:function(e){this.toggle();}};Fieldset.applyAll=function(){var fieldsets=document.getElementsByTagName('fieldset'),len=fieldsets.length,i,node,res=[];for(i=0;i<len;i++){node=fieldsets[i];if(!hasClass(node,'fieldset')){res.push(new Fieldset({applyTo:node}));}}
return res;}
window.Fieldset=Fieldset;}());

(function(){function Layer(config){this._resizeDelegate=bind(this._onResize,this);this._resizeDelegate2=bind(this.onResize,this);this._scrollDelegate=bind(this.onScroll,this);this._keyUpDelegate=bind(this.onKeyUp,this);Object.extend(this,config);if(this.visible){this.show();}}
Layer.prototype={title:'',content:'',visible:false,closeAction:'close',alignOnResize:true,rtl:false,render:function(){var to=document.body,html=this._getHtml();if(to.insertAdjacentHTML){to.insertAdjacentHTML('beforeEnd',html);this.dom=to.childNodes[to.childNodes.length-1];}else{var r=document.createRange();r.setStartBefore(to);var fragment=r.createContextualFragment(html);to.appendChild(fragment);this.dom=to.lastChild;}
this.maskEl=this.dom.previousSibling;this.rendered=true;var dom=this.dom.rows[1].cells[1].firstChild;dom.onclick=bind(this.onIconClick,this);},_getHtml:function(){var html='<div class="layer-mask" style="display: none;"></div>'+'<table cellspacing="0" class="popup-layer'+(this.rtl?' rtl':'')+'"><tbody>'+'<tr><td class="top" colspan="3">'+'<div class="top-l"><div class="top-r"><div class="top-c"></div></div></div>'+'</td></tr>'+'<tr>'+'<td class="mdl-l"><div></div></td>'+'<td class="mdl-c"><h3>'+this.title+'<a name="close" class="layer-icon-close" href="javascript:"></a></h3> '+
this.content+'<td class="mdl-r"><div></div></td>'+'</tr>'+'<tr><td class="btm" colspan="3">'+'<div class="btm-l"><div class="btm-r"><div class="btm-c"></div></div></div>'+'</td></tr>'+'</tbody></table>';return html;},alignTo:function(alignEl,alignment){alignment=alignment||'center';this.alignEl=alignEl;this.alignment=alignment;if(!this.dom){return;}
if(typeof alignEl=='string'){alignEl=document.getElementById(alignEl);}
var alignPos,alignSize;if(alignEl!=document.body){alignPos=getPosition(alignEl);alignSize=getSize(alignEl);}else{alignPos={x:0,y:0};alignSize=getViewportSize();}
var size=getSize(this.dom),scroll=getScroll(),vpSize=getViewportSize(),top=left=0;switch(alignment){case'left':top=alignPos.y;left=alignPos.x-size.width;break;case'right':top=alignPos.y;left=alignPos.x+alignSize.width;break;case'top':top=alignPos.y-size.height;left=alignPos.x;break;case'bottom':top=alignPos.y+alignSize.height;if(alignPos.x+size.width<=vpSize.width){left=alignPos.x;}else if(alignPos.x+alignSize.width-size.width>=0){left=alignPos.x+alignSize.width-size.width-2;}else{left=0;}
break;case'center':top=(alignPos.y+alignSize.height-size.height)/2;left=(alignPos.x+alignSize.width-size.width)/2;break;}
this.dom.style.top=top+scroll.top+'px';this.dom.style.left=left+scroll.left-(this.rtl&&isIE?getScrollBarWidth():0)+'px';},show:function(alignEl,alignment){if(!this.rendered){this.render();}
alignEl=alignEl||this.alignEl||document.body;alignment=alignment||this.alignment;this.alignTo(alignEl,alignment);this.maskEl.style.width=getDocumentWidth()+'px';this.maskEl.style.height=getDocumentHeight()+'px';this.maskEl.style.display='';this.dom.style.visibility='visible';attachEventListener(window,'resize',this._resizeDelegate);attachEventListener(window,'scroll',this._scrollDelegate);attachEventListener(document,'keyup',this._keyUpDelegate);this.visible=true;},hide:function(){this.visible=false;if(this.rendered){this.maskEl.style.display='none';this.dom.style.visibility='';this.dom.style.top='-10000px';detachEventListener(window,'resize',this._resizeDelegate);detachEventListener(window,'scroll',this._scrollDelegate);detachEventListener(document,'keyup',this._keyUpDelegate);}},close:function(){if(this.visible){this.hide();}
if(this.rendered){document.body.removeChild(this.dom);document.body.removeChild(this.maskEl);if(isIE){this.dom.outerHTML='';this.maskEl.outerHTML='';}
this.dom=null;this.maskEl=null;this.rendered=false;}},onIconClick:function(e){e=e||window.event;var target=e.srcElement||e.target;if(target.nodeName=='A'){var name=target.getAttribute('name');if(name=='close'){this[this.closeAction]();}}},_onResize:function(){if(this._resizeTimer){clearTimeout(this._resizeTimer);}
this._resizeTimer=setTimeout(this._resizeDelegate2,100);},onResize:function(){if(this.maskEl){this.maskEl.style.width='0px';this.maskEl.style.height='0px';}
if(this.alignEl){this.alignTo(this.alignEl,this.alignment);}
if(this.maskEl){this.maskEl.style.width=getDocumentWidth()+'px';this.maskEl.style.height=getDocumentHeight()+'px';}},onScroll:function(){if(this.alignEl){this.alignTo(this.alignEl,this.alignment);}},onKeyUp:function(e){e=e||window.event;if(e.keyCode==27){this[this.closeAction]();}}};window.Layer=Layer;}());

(function(){var menuItemsCounter=0;function Menu(config){config=config||{};Object.extend(this,config);if(config.assignTo){var assignTo=config.assignTo;delete config.assignTo;this.assign(assignTo);}
this._itemsHashByName={};var items=this.items,i,len=items&&items.length||0;this.items=[];this.subMenus=[];this._bodyClickListener=bind(this.onBodyClick,this);for(i=0;i<len;i++){this.addItem(items[i]);}
if(!this.parentMenu){this.updateParentMenu(null);}
if(!this.lazyRender){this.render();}}
Menu.prototype={openOn:'mouseover',hideDelay:1000,zIndex:999,assign:function(to){if(typeof to=='string'){to=document.getElementById(to);}
var eventName='on'+this.openOn;to[eventName]=bind(this.onTrigger,this);to['onmouseout']=bind(this.onTriggerMouseOut,this);this.assignEl=to;this.minWidth=to.offsetWidth;},onTrigger:function(){this.show();},onTriggerMouseOut:function(e){e=e||window.event;var to=e.relatedTarget||e.toElement;if(within(this.dom,to)){}else{this.deferHide();}},addItem:function(item){if(item=='-'){item=new MenuItemSeparator();}else if(!item.render){item=new MenuItem(item);}
if(!item.getName()){item.setName('menuitem'+(++menuItemsCounter));}
if(item){item.setMenu(this);this.items.push(item);this._itemsHashByName[item.getName()]=item;if(item.subMenu){this.subMenus.push(item.subMenu);}}},show:function(alignTo,align){this.cancelHide();if(this.lazyRender&&!this.rendered){this.render();}
if(!this.parentMenu&&this.addClass){addClass(this.assignEl,this.addClass);}
alignTo=alignTo||this.assignEl;align=align||'bottom';var size=getSize(this.dom),alignSize=getSize(alignTo),pos=getPosition(alignTo),left=0,top=0,scroll=getScroll(),flipX=false,flipY=false;if(align=='bottom'){var vpHeight=getViewportHeight(),hAlign=this.customStyle=='rtl'?'left':'right';if(hAlign=='right'){left=scroll.left+pos.x+alignSize.width-size.width;}else if(hAlign=='left'){left=scroll.left+pos.x;}else if(hAlign=='center'){alert('not implemented center hAlign');}
if(pos.y+alignSize.height+size.height>vpHeight){top=scroll.top+pos.y-size.height;flipY=true;}else{top=scroll.top+pos.y+alignSize.height;}}else if(align=='right'){var vpWidth=getViewportWidth();top=pos.y+scroll.top-1;if(pos.x+alignSize.width+size.width>vpWidth){left=scroll.left+pos.x-size.width;flipX=true;left+=3;}else{left=scroll.left+pos.x+alignSize.width;left-=3;}}
if(isIE6||isIE7||isIE8){top+=flipY?2:-2;left+=flipX?2:-2;}
var s=this.dom.style;s.left=left-(this.customStyle=='rtl'&&isIE?getScrollBarWidth():0)+'px';s.top=top+'px';if(this.parentMenu){this.zIndex=this.parentMenu.zIndex+1;}
s.zIndex=this.zIndex;s.visibility='visible';this.visible=true;attachEventListener(document.body,'click',this._bodyClickListener);this.cancelParentHide();},cancelParentHide:function(){if(this.parentMenu){this.parentMenu.cancelHide();this.parentMenu.cancelParentHide();}},hide:function(){detachEventListener(document.body,'click',this._bodyClickListener);this.dom.style.visibility='';this.dom.style.top='-10000px';if(!this.parentMenu&&this.addClass){removeClass(this.assignEl,this.addClass);}
this.visible=false;if(this.subMenus.length>0){var i=this.subMenus.length;while(i--){if(this.subMenus[i].visible){this.subMenus[i].hide();}}}},deferHideWithParent:function(){this.deferHide();if(this.parentMenu){this.parentMenu.deferHideWithParent();}},hideWithParent:function(){this.hide();if(this.parentMenu){this.parentMenu.hideWithParent();}},deferHide:function(){this.cancelHide();this._timerId=setTimeout(bind(this.hide,this),this.hideDelay);},cancelHide:function(){if(this._timerId){clearTimeout(this._timerId);this._timerId=null;}},render:function(){var to=document.body,html=this._getHtml(this),dom;if(to.insertAdjacentHTML){to.insertAdjacentHTML('beforeEnd',html);dom=to.childNodes[to.childNodes.length-1];}else{var r=document.createRange();r.setStartBefore(to);var fragment=r.createContextualFragment(html);to.appendChild(fragment);dom=to.lastChild;}
this.dom=dom;this.rendered=true;if(!this.minWidth){var w=dom.offsetWidth-2;if(w<0){w=0;}
dom.style.width=w+'px';}
var nodes=dom.getElementsByTagName('li'),items=this.items,i=items.length,item;while(i--){item=items[i];item.dom=nodes[i];item.rendered=true;}
this.rendered=true;dom.onclick=bind(this.onClick,this);dom.onmouseover=bind(this.onMouseOver,this);dom.onmouseout=bind(this.onMouseOut,this);},onBodyClick:function(e){e=e||window.event;var target=e.srcElement||e.target;if(this.visible&&!within(this.assignEl,target)){this.hide();}},getItemByName:function(name){return this._itemsHashByName[name];},updateParentMenu:function(parentMenu){this.parentMenu=parentMenu;if(parentMenu){this.hideDelay=parentMenu.hideDelay;}
var i=this.items.length,item;while(i--){item=this.items[i];if(item.subMenu){item.subMenu.updateParentMenu(this);}}},_getHtml:function(){var html=[],items=this.items,len=items&&items.length||0,i;if(!this.customStyle){this.customStyle='';}
html.push('<table cellspacing="0" class="menu '+this.customStyle+'" style="zIndex:'+this.zIndex+'"><tr><td><ul>');for(i=0;i<len;i++){html.push(items[i]._getHtml());}
if(this.minWidth){html.push('<li class="menu-minwidth" style="width:'+(this.minWidth-2)+'px;"></li>');}
html.push('</ul></td></tr></table>');return html.join('');},_getEventItem:function(e){var dom=e.srcElement||e.target;while(dom!=this.dom&&dom.nodeName!='LI'){dom=dom.parentNode;}
if(hasClass(dom,'menu-item')){var name=dom.getAttribute('name');return this.getItemByName(name);}
return null;},onClick:function(e){e=e||window.event;var item=this._getEventItem(e);if(item){item.onClick(e);}},onMouseOver:function(e){e=e||window.event;this.cancelHide();var item=this._getEventItem(e);if(item){if(this._lastHoverItem!=item){if(this._lastHoverItem){this._lastHoverItem.onDeactivate(e);}
item.onActivate(e);this._lastHoverItem=item;}}
this.cancelParentHide();},onMouseOut:function(e){e=e||window.event;var to=e.relatedTarget||e.toElement;var item=this._lastHoverItem;if(item&&item.subMenu&&within(item.subMenu.dom,to)){}else if(this.parentMenu&&within(this.parentMenu.dom,to)){if(item){item.onDeactivate(e);this._lastHoverItem=null;}}else{if(item){item.onDeactivate(e);this._lastHoverItem=null;}
this.deferHideWithParent();}},onMouseLeave:function(e){if(this._lastHoverItem){this._lastHoverItem.onDeactivate(e);this._lastHoverItem=null;}
this.deferHide();}};function MenuItem(config){Object.extend(this,config);if(this.items){var items=this.items;delete this.items;this.subMenu=new Menu({items:items,parentMenu:true});}}
MenuItem.prototype={constructor:MenuItem,getName:function(){return this.name;},setName:function(name){this.name=name;},setMenu:function(menu){this.menu=menu;},_getHtml:function(){var html=[];html.push('<li name="'+this.name+'" class="menu-item'+
(this.subMenu?' menu-item-submenu':'')+'"><a target="'+(this.target||'')+'" href="'+(this.href||'javascript:')+'">'+(this.icon?('<img alt="" src="'+this.icon+'" />'):'')+'<span>'+(this.text||'')+'</span></a>');if(this.subMenu){}
html.push('</li>');return html.join('');},onActivate:function(e){addClass(this.dom,'menu-item-hover');if(this.subMenu){this.subMenu.show(this.dom,'right');}},onDeactivate:function(e){removeClass(this.dom,'menu-item-hover');if(this.subMenu){this.subMenu.hide();}},onClick:function(e){if(this.subMenu){}else{if(this.handler){this.handler.call(this.scope||window,this);}
this.menu.hideWithParent();}}};function MenuItemSeparator(config){Menu.prototype.constructor.call(this,config);}
MenuItemSeparator.prototype=new MenuItem();Object.extend(MenuItemSeparator.prototype,{constructor:MenuItemSeparator,_getHtml:function(){return'<li class="menu-item-separator"></li>';}});window.MenuItem=MenuItem;window.MenuItemSeparator=MenuItemSeparator;window.Menu=Menu;}());

(function(){function Quickbar(config){Object.extend(this,config);if(this.applyTo){var applyTo=this.applyTo;delete this.applyTo;this.apply(applyTo);}}
Quickbar.prototype={title:'',template:'<div class="quickbar-top">'+'<div class="quickbar-l"><div class="quickbar-r"><div class="quickbar-c"></div></div></div>'+'</div>'+'<div class="quickbar-mdl">'+'<div class="quickbar-l"><div class="quickbar-r"><div class="quickbar-c">'+'<div class="quickbar-title">'+'<img src="'+emptyImageUrl+'"/>&nbsp;'+'<h2></h2>'+'</div>'+'<div class="quickbar-content-wrap">'+'<div class="quickbar-content"></div>'+'</div>'+'</div></div></div>'+'</div>'+'<div class="quickbar-btm">'+'<div class="quickbar-l"><div class="quickbar-r"><div class="quickbar-c"></div></div></div>'+'</div>',apply:function(to){if(typeof to=='string'){to=document.getElementById(to);}
if(to.nodeName!='FIELDSET'){return false;}
var legend=to.getElementsByTagName('legend')[0];if(legend){this.title=legend.innerHTML;}else{this.title='';}
legend.parentNode.removeChild(legend);legend=null;this.collapsed=hasClass(to,'fieldset-collapsed');this.dom=this.renderDom();this.titleEl=this.dom.getElementsByTagName('h2')[0];this.contentEl=this.titleEl.parentNode.nextSibling.firstChild;this.setTitle(this.title);if(this.collapsed){addClass(this.dom,'quickbar-collapsed');}
while(to.firstChild){this.contentEl.appendChild(to.firstChild);}
to.parentNode.replaceChild(this.dom,to);this.titleEl.parentNode.onclick=bind(this.onClick,this);return true;},renderDom:function(){var d=document,dom=d.createElement('div');dom.className='quickbar';dom.innerHTML=this.template;return dom;},setTitle:function(v){this.title=v;if(this.dom){this.titleEl.innerHTML=v;}},toggle:function(){this[this.collapsed?'expand':'collapse']();},expand:function(){removeClass(this.dom,'quickbar-collapsed');this.collapsed=false;},collapse:function(){addClass(this.dom,'quickbar-collapsed');this.collapsed=true;},onClick:function(e){this.toggle();}};Quickbar.applyAll=function(){var fieldsets=document.getElementsByTagName('fieldset'),i=fieldsets.length,i,node,res=[];while(i--){node=fieldsets[i];res.push(new Quickbar({applyTo:node}));}
return res;};window.Quickbar=Quickbar;}());

(function(){var nodeLastUniqueId=1;function Node(config){this.childNodes=[];Object.extend(this,config);if(typeof this.id=='undefined'){this.id='autogenerated'+nodeLastUniqueId++;}
if(config.child){this.loaded=true;}
if(this.child){var children=this.child,len=children.length,i,node;delete this.child;for(i=0;i<len;i++){node=new Node(children[i]);this.appendChild(node);}}}
Node.prototype={loadingText:'Loading...',showArticleNumber:false,appendChild:function(node){this.childNodes[this.childNodes.length]=node;node.parentNode=this;node.setTree(this.tree);},removeChild:function(node){if(node.tree){node.tree.unregisterNode(node);node.tree=null;}
node.parentNode=null;node.dom=null;},remove:function(){if(this.parentNode){this.parentNode.removeChild();}},render:function(){},hasChildNodes:function(){return this.childNodes.length>0;},hasLeaves:function(){var children=this.childNodes,i=children.length;while(i--){if(children[i].leaf){return true;}}
return false;},isFirst:function(){if(this.parentNode){return this.parentNode.childNodes[0]==this;}
return true;},isLast:function(){if(this.parentNode){var parentChildren=this.parentNode.childNodes;return parentChildren[parentChildren.length-1]==this;}
return true;},getAllNodes:function(){var res=[],children=this.childNodes,len=children.length,i,child;for(i=0;i<len;i++){child=children[i];res=res.concat(child);res=res.concat(child.getAllNodes());}
return res;},setTree:function(tree){if(this.tree==tree){return;}
if(this.tree){this.tree.unregisterNode(this);}
this.tree=tree;this.cascade(this._setTreeCallback,this);},_setTreeCallback:function(node){if(this.tree){this.tree.registerNode(node);}
node.tree=this.tree;},_getExpIconClass:function(){var pos='';if(this.isLast()){pos='last';}else if(this.isFirst()){}
var type=this.leaf?'leaf':'dir';return'tree-node-expicon-'+pos+type;},_textRenderer:function(){return!this.leaf&&this.tree.showArticleNumber?('<span class="node-caption">'+this.text+'</span> <span class="ltr">['+(typeof this.totalArticles=='undefined'?'?':this.totalArticles)+']</span>'):this.text;},_getHtml:function(){var html=[],nodeId='tree-node-'+this.id,styleClasses=[],nodeClasses=['tree-node'],containerClasses=['tree-node-children-container'],expIcoClass=this._getExpIconClass(),iconClass=this.leaf?'tree-node-icon-leaf':'tree-node-icon';if(this.expanded){styleClasses.push('tree-node-expanded');this.expand();containerClasses.push('tree-node-expanded');}
if(this.isLast()){containerClasses.push('tree-node-last');}
if(this.leaf){styleClasses.push('tree-node-item-leaf');}
if(!this.parentNode){styleClasses.push('tree-node-root');containerClasses.push('tree-node-root');}
if(this.loading){styleClasses.push('tree-node-loading');containerClasses.push('tree-node-loading');}
if(this.selected){styleClasses.push('tree-node-selected');}
if(this.noChild){styleClasses.push('tree-node-nochild');}
if(this.styleClass){styleClasses.push(this.nodeClass);}
if(this.nodeClass){nodeClasses.push(this.nodeClass);}
nodeClasses=nodeClasses.join('');styleClasses=styleClasses.join(' ');containerClasses=containerClasses.join(' ');html.push('<li id="'+nodeId+'" class="'+nodeClasses+'"'+'">');html.push('<div class="tree-node-item '+styleClasses+'">');html.push('<img class="'+expIcoClass+'" src="'+emptyImageUrl+'" />');html.push('<img class="'+iconClass+'" src="'+emptyImageUrl+'" />');html.push('<a href="'+(this.href||'#')+'">'+this._textRenderer()+'</a>');html.push('</div>');var i,children=this.childNodes,len=children.length;html.push('<ul class="'+containerClasses+'">');if(len>0){for(i=0;i<len;i++){html.push(children[i]._getHtml());}}
if(this.loading){html.push('<span>'+this.loadingText+'</span>');}
html.push('</ul>');html.push('</li>');return html.join('');},toggleCollapsed:function(){this[this.expanded?'collapse':'expand']();},expand:function(deep){if(this.tree&&this.tree.async){if(this.loading){return;}
if(this.tree.expand_collapse){if(!this.tree.loadedLeaves)this._loadLeaves();this.tree.loadedLeaves=true;}
else{if(!this.loaded){if(!this.noChild){this.loadChildNodes();}}else if(this.tree.loadLeaves){if(this.noLeaves||this.hasLeaves()||this.noChild){this.leavesLoaded=true;}else if(!this.leavesLoaded){this._loadLeaves();}}}}
this.expanded=true;if(this.dom){this._addStyleClass('tree-node-expanded');addClass(this.dom.lastChild,'tree-node-expanded');if(!this.leaf){this.dom.firstChild.firstChild.className=this._getExpIconClass();}}
if(deep){this.expandChildNodes(true);}},expandChildNodes:function(deep){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].expand(deep);}},collapse:function(deep){this.expanded=false;if(this.dom&&(this.tree&&(this.tree.hiddenRoot&&!hasClass(this.dom.firstChild,'tree-node-root')||!this.tree.hiddenRoot))){this._removeStyleClass('tree-node-expanded');removeClass(this.dom.lastChild,'tree-node-expanded');if(!this.leaf){this.dom.firstChild.firstChild.className=this._getExpIconClass();}}
if(deep){this.collapseChildNodes(true);}},collapseChildNodes:function(deep){var cs=this.childNodes;for(var i=0,len=cs.length;i<len;i++){cs[i].collapse(deep);}},cascade:function(func,scope){var children=this.childNodes,len=children.length,i;func.call(scope||window,this);for(i=0;i<len;i++){children[i].cascade(func,scope);}},_addStyleClass:function(cls){addClass(this.dom.firstChild,cls);},_removeStyleClass:function(cls){removeClass(this.dom.firstChild,cls);},_loadLeaves:function(){this.loading=true;this.removeLeaves();if(this.dom){this._addStyleClass('tree-node-loading');var loadingEl=document.createElement('span');this.dom.lastChild.appendChild(loadingEl);loadingEl.innerHTML=this.loadingText;}
if(this.tree.expand_collapse){var id=[];for(el in this.tree.nodes){el=parseInt(el);if(el)id.push(el);}}
else{var id=this.id;}
this._request2=new Ajax.Request({url:this.tree.dataUrl,data:{parentId:id,leaves:true},scope:this,onSuccess:this._onLoadLeavesSuccess,onFailure:this._onLoadLeavesFailure,onComplete:this._onLoadComplete});},_onLoadLeavesSuccess:function(transport){var response,spanNode=this.dom.lastChild.lastChild;if(spanNode.nodeName=='SPAN'){spanNode.parentNode.removeChild(spanNode);}
try{response=eval('('+transport.responseText+')');}catch(e){}
if(response&&response.done){for(el in response.tree){var p=this.tree.getNodeById(el);this.loadLeavesJson(p,response.tree[el]);this.leavesLoaded=true;}
this.tree.expand_collapse=false;this.tree.leavesLoaded=true;removeClass(this.dom.parentNode.parentNode.parentNode.firstChild.lastChild,'icon-loading');}else{}},_onLoadLeavesFailure:function(response){},removeLeaves:function(){var i=this.childNodes.length,ch;if(i==0){return;}
while(i--){ch=this.childNodes[i];if(ch.leaf){ch.dom.parentNode.removeChild(ch.dom);this.removeChild(ch);}}
if(this.dom){}},loadChildNodes:function(){this.loading=true;this.removeChildren();if(this.dom){this._addStyleClass('tree-node-loading');this.dom.lastChild.innerHTML=this.loadingText;}
if(this.tree.expand_collapse){var id=[];for(el in this.tree.nodes){id.push(el);}}
else{var id=this.id;}
this._request=new Ajax.Request({url:this.tree.dataUrl,data:{parentId:id},scope:this,onSuccess:this._onLoadSuccess,onFailure:this._onLoadFailure,onComplete:this._onLoadComplete});},_onLoadSuccess:function(transport){var response;try{response=eval('('+transport.responseText+')');}catch(e){}
if(response&&response.done){try{this.loadJson(response.tree);this.loading=false;this.loaded=true;if(this.tree.loadLeaves&&!this.leavesLoaded){this._loadLeaves();}}catch(e){console.log(e);}}else{console.log('fail');}},_onLoadFailure:function(response){console.log('fail');},_onLoadComplete:function(response){this.loading=false;if(this.dom){this._removeStyleClass('tree-node-loading');}},removeChildren:function(){var i=this.childNodes.length;if(i==0){return;}
while(i--){this.removeChild(this.childNodes[i]);}
this.childNodes=[];if(this.dom){this.dom.lastChild.innerHTML='';}},loadJson:function(childNodes){var i,node,len=childNodes.length,node;this.removeChildren();var html=[];for(i=0;i<len;i++){node=new Node(childNodes[i]);this.appendChild(node);}
if(this.dom){for(i=0;i<len;i++){html[i]=this.childNodes[i]._getHtml();}
this.dom.lastChild.innerHTML=html.join('');var nodes=this.getAllNodes(),lis=this.dom.getElementsByTagName('li');i=nodes.length;while(i--){node=nodes[i];node.dom=lis[i];node.rendered=true;}}},loadLeavesJson:function(parentNode,childNodes){childNodes=childNodes||[];var i,node,len=childNodes.length,node;parentNode.removeLeaves();var html=[],oldLen=parentNode.childNodes.length;for(i=0;i<len;i++){node=new Node(childNodes[i]);parentNode.appendChild(node);}
if(parentNode.dom&&len>0){for(i=0;i<len;i++){html[i]=parentNode.childNodes[oldLen+i]._getHtml();}
html=html.join('');var to=parentNode.dom.lastChild,dom;if(to.insertAdjacentHTML){to.insertAdjacentHTML('beforeEnd',html);dom=to.lastChild;}else{var r=document.createRange();r.setStartBefore(to);var fragment=r.createContextualFragment(html);to.appendChild(fragment);dom=to.lastChild;}
var nodes=parentNode.getAllNodes(),lis=to.getElementsByTagName('li');i=nodes.length;while(i--){node=nodes[i];node.dom=lis[i];node.rendered=true;}}}};function Tree(config){Object.extend(this,config);this.nodes={};if(!this.root.render){var root=this.root;delete this.root;this.root=new Node(root);}
this.root.setTree(this);}
Tree.prototype={hiddenRoot:false,noPath:false,loadLeaves:false,expandButton:true,collapseButton:true,render:function(to){if(typeof to=='string'){to=document.getElementById(to);}
to.innerHTML=this._getHtml();var lis=to.getElementsByTagName('li'),nodes=this.getAllNodes(),i=nodes.length,node;while(i--){node=nodes[i];node.dom=lis[i];node.rendered=true;}
this.rendered=true;var dom=to.firstChild;this.dom=dom;dom.onclick=bind(this.onClick,this);if(isIE6){dom.onmouseover=bind(this.onMouseOver,this);dom.onmouseleave=bind(this.onMouseLeave,this);}},getAllNodes:function(){var res=[this.root];res=res.concat(this.root.getAllNodes());return res;},_getHtml:function(){var styles=[],classes=['tree'],containerClasses=['tree-container'];if(this.width){styles.push('width:'+this.width+'px');}
if(this.height){styles.push('height:'+this.height+'px');}
if(this.hiddenRoot){containerClasses.push('tree-hiddenroot');}
if(this.noPath){containerClasses.push('tree-nopath');}
classes=classes.join(' ');containerClasses=containerClasses.join(' ');var buts='';if(this.expandButton||this.collapseButton){buts+='<div><div class="tree-loading">';if(this.expandButton)buts+='<a href="#" id="tree-expand-all" style="font-size: 10px; padding: 0 4px;">'+i18n.lbl_expand+'</a>';if(this.collapseButton)buts+='<a href="#" id="tree-collapse-all" style="font-size: 10px;">'+i18n.lbl_collapse+'</a>';buts+='<img src="'+emptyImageUrl+'" /></div>';}
var html=buts+'<div class="'+classes+'" style="'+styles.join(';')+'">'+'<ul class="'+containerClasses+'">'+
this.root._getHtml()+'</ul>'+'</div>';if(buts!='')html+='</div>';return html;},onClick:function(e){e=e||window.event;var target=e.srcElement||e.target;var dom=target;while(dom!=this.dom&&dom.nodeName!='LI'){dom=dom.parentNode;}
if(dom.nodeName=='LI'){var id=dom.id.substring(10),node=this.getNodeById(id);if(node){if(target.nodeName=='IMG'){if((' '+target.className).indexOf(' tree-node-expicon-')!=-1&&!node.leaf&&!node.noChild){node.toggleCollapsed();}}}}
else if(dom.nodeName=='DIV'){if(target.id=='tree-expand-all'){this.expand_collapse=true;if(this.showLoader)addClass(this.dom.firstChild.lastChild,'icon-loading');this.root.expand(true);if(this.leavesLoaded){removeClass(this.dom.firstChild.lastChild,'icon-loading');}}
else if(target.id=='tree-collapse-all'){removeClass(this.dom.firstChild.lastChild,'icon-loading');this.root.collapse(true);}}},onMouseOver:function(e){e=e||window.event;var target=e.srcElement||e.target;var dom=target;while(dom!=this.dom&&dom.nodeName!='DIV'){dom=dom.parentNode;}
if(hasClass(dom,'tree-node-item')){if(this._lastHoverNode!=dom){this.onMouseLeave();addClass(dom,'tree-node-item-hover');this._lastHoverNode=dom;}}else{this.onMouseLeave();}},onMouseLeave:function(){if(this._lastHoverNode){removeClass(this._lastHoverNode,'tree-node-item-hover');this._lastHoverNode=null;}},registerNode:function(node){if(this.nodes[node.id]){throw new Error("Tree.registerNode Exception: Node with id='"+node.id+"' is already registered!");}
this.nodes[node.id]=node;},unregisterNode:function(node){if(this.nodes[node.id]){delete this.nodes[node.id];}else{throw new Error("Tree.unregisterNode Exception: Node with id='"+node.id+"' is not registered!");}},getNodeById:function(id){return this.nodes[id];}};window.Tree=Tree;window.Node=Node;}());

(function(){window.Autocompleter=function(config){this.initialize(config);};window.Autocompleter.prototype={dom:null,inputValue:'',suggestionsLayer:null,suggested:false,hideDelay:100,lastItem:null,suggestions:null,align:'bottom',hAlign:'right',correctLeft:0,rtl:false,timeout:300,request:null,requestTask:null,config:{assignTo:'',url:'',baseParams:{}},initialize:function(config){Object.extend(this.config,config);if(config.hAlign){this.hAlign=config.hAlign;}
if(config.correctLeft){this.correctLeft=config.correctLeft;}
if(config.rtl){this.rtl=config.rtl;this.correctLeft=this.correctLeft*-1;if(this.hAlign=='left'){this.hAlign='right';}else{this.hAlign='left';}}
if(this.config.assignTo){this.assign(this.config.assignTo);}
this.prepereSuggestions();document.body['onclick']=bind(this.onBodyClick,this);this.suggestionsLayer['onmouseover']=bind(this.onMouseOver,this);this.suggestions=new window.Autocompleter.SuggestionCollection({holder:this.suggestionsLayer});},assign:function(holder){if(holder){this.config.assignTo=holder;}
if(typeof this.config.assignTo=='string'){this.dom=document.getElementById(this.config.assignTo);}
if(!this.dom)alert('Autocompleter assign failed! Dom target is undefined. Check config assignTo property.');this.dom['onkeydown']=bind(this.onKeyDown,this);this.dom['onkeyup']=bind(this.onKeyUp,this);this.inputValue=this.dom.value;},onBodyClick:function(e){this.hide();},onMouseOver:function(e){e=e||window.event;var item=this._getEventItem(e);var lastItem=this.lastItem;if(item&&lastItem!=item){item.activate();if(lastItem){lastItem.deactivate();}
this.lastItem=item;this.dom.focus();}},_getEventItem:function(e){var dom=e.srcElement||e.target;while(dom!=this.suggestionsLayer&&dom.nodeName!='LI'){dom=dom.parentNode;}
return this.suggestions.getItemByDOM(dom);},onKeyUp:function(e){e=e||window.event;if(this.dom.value!=this.inputValue){this.onChangeValue();}},onKeyDown:function(e){e=e||window.event;switch(e.keyCode){case 27:this.hide();break;case 38:var item=this.suggestions.getPrev();if(item){item.activate();if(this.lastItem){this.lastItem.deactivate();}
this.lastItem=item;}
break;case 40:var item=this.suggestions.getNext();if(item){item.activate();if(this.lastItem){this.lastItem.deactivate();}
this.lastItem=item;}
break;case 13:if(this.dom.value.length>=3&&this.suggestions.getItem()){window.location.href=this.suggestions.getItem().dom.firstChild.href;return false;}
break;}
return false;},hide:function(){setTimeout(bind(this.hideSuggest,this),this.hideDelay);},onChangeValue:function(){this.inputValue=this.dom.value;if(this.requestTask){clearTimeout(this.requestTask);}
if(this.request){try{this.request.abort();}catch(e){;}}
if(this.inputValue.length>=3){this.requestTask=setTimeout(bind(function(){this.request=new Ajax.Request({url:this.config.url,data:Object.extend(this.config.baseParams,{searchText:this.inputValue}),scope:this,onSuccess:this.onDataResponse});},this),this.timeout);}else{this.hide();}},onDataResponse:function(an){try{eval('var data='+an.responseText+';');this.suggestions.data=data;this.showSuggest();}catch(e){alert(e.message);}},showSuggest:function(){this.dom.blur();this.dom.focus();this.suggestionsLayer.style.width='auto';this.suggestions.build();if(this.suggestions.items.length){this.lastItem=this.suggestions.getPrev(0);this.suggestionsLayer.style.display='';var align=this.align,size=getSize(this.suggestionsLayer),alignSize=getSize(this.dom),pos=getPosition(this.dom),left=0,top=0,scroll=getScroll(),flipX=false,flipY=false;if(size.width<200){size.width=200;this.suggestionsLayer.style.width='200px';}
if(align=='bottom'){var vpHeight=getViewportHeight(),hAlign=this.hAlign;if(hAlign=='right'){left=scroll.left+pos.x+alignSize.width-size.width;}else{if(hAlign=='left'){left=scroll.left+pos.x;}}
if(pos.y+alignSize.height+size.height>vpHeight){top=scroll.top+pos.y-size.height;flipY=true;}else{top=scroll.top+pos.y+alignSize.height;}}
if(isIE){top+=flipY?2:-2;left+=flipX?2:-2;}
var s=this.suggestionsLayer.style;s.left=left+this.correctLeft-(this.rtl&&isIE?getScrollBarWidth():0)+'px';s.top=top+'px';s.zIndex=1000;this.suggested=true;}else{this.hide();}},hideSuggest:function(){this.suggestionsLayer.style.display='none';this.suggested=false;},prepereSuggestions:function(){this.suggestionsLayer=document.createElement('table');this.suggestionsLayer.className='x-suggestions'+(this.rtl?' rtl':'');this.suggestionsLayer.style.display='none';var tbody=document.createElement('TBODY');var tr=document.createElement('TR');tbody.appendChild(tr);var td=document.createElement('TD');td.innerHTML='<ul class="x-suggesstion"></ul>';tr.appendChild(td);this.suggestionsLayer.appendChild(tbody);document.body.appendChild(this.suggestionsLayer);}}
window.Autocompleter.SuggestionItem=function(config){this.initialize(config);}
window.Autocompleter.SuggestionItem.prototype={caption:'',image:'',dom:null,holder:null,action:'',template:'<a href="{action}">{caption}</a>',initialize:function(config){Object.extend(this,config);if(this.holder){this.render();}},render:function(holder){if(holder){this.holder=holder;}
var tpl=this.template.replace(/{action}/,this.action).replace(/{caption}/,this.caption);var li=document.createElement('LI');li.innerHTML=tpl;li.style.backgroundImage=('url({image})').replace(/{image}/,this.image);this.holder.appendChild(li);this.dom=li;},activate:function(){addClass(this.dom,'active');},deactivate:function(){removeClass(this.dom,'active');}}
window.Autocompleter.Separator=function(config){this.initialize(config);}
window.Autocompleter.Separator.prototype={dom:null,holder:null,initialize:function(config){Object.extend(this,config);if(this.holder){this.render();}},render:function(holder){if(holder){this.holder=holder;}
var li=document.createElement('LI');li.className='x-suggestions-separator';this.holder.appendChild(li);this.dom=li;}}
window.Autocompleter.SuggestionCollection=function(config){this.initialize(config);}
window.Autocompleter.SuggestionCollection.prototype={data:{},currentItemIndex:0,items:[],holder:null,initialize:function(config){Object.extend(this,config);this.holder=this.holder.firstChild.firstChild.firstChild.firstChild;},build:function(){if(!this.data)return false;this.clear();if(this.data){for(var block=0;block<this.data.length;block++){for(var item=0;item<this.data[block].length;item++){var element=this.data[block][item];var cfg={caption:element.text,image:element.image,action:element.action,holder:this.holder}
this.addItem(new window.Autocompleter.SuggestionItem(cfg));}
if(block<this.data.length-1){new window.Autocompleter.Separator({holder:this.holder});}}}},getItemByDOM:function(dom){for(var i=0;i<this.items.length;i++){if(dom==this.items[i].dom){this.currentItemIndex=i;return this.items[i];}}
return false;},getNext:function(i){if(!i&&i!==0){i=this.currentItemIndex;}
i++;if(i<this.items.length){this.currentItemIndex=i;}else{this.currentItemIndex=0;}
return this.items[this.currentItemIndex];},getPrev:function(i){if(!i&&i!==0){i=this.currentItemIndex;}
i--;if(i>=0){this.currentItemIndex=i;}else{this.currentItemIndex=this.items.length-1;}
return this.items[this.currentItemIndex];},getItem:function(i){if(!i&&i!==0){i=this.currentItemIndex;}
return this.items[i];},addItem:function(obj){this.items[this.items.length]=obj;},clear:function(){this.holder.innerHTML='';this.currentItemIndex=0;this.items=[];}}})();

