eval(liligo.namespace);var DirectoryList=new Application({init:function(){this.dirIndex=$("dir-index");if(!$("directoryList")||!window.directories||!window.directories.length||!this.dirIndex){return }this.dirIndex.innerHTML="";this.key=window.index;this.index=0;this.keys={};if(config.directoryType=="supplier"){this.template=new liligo.VTemplate("/seo/v3/common/templates/directory/supplier.vm",function(F){var G=new liligo.__VT_StringCat(),D="function",E=0;if(F.velocityCount){E=F.velocityCount}if(F.showKey){G.push('<li class="key">');G.push(F.elem.key);G.push("</li>")}G.push('<li>	<a href="');G.push(F.elem.url);G.push('" title="');G.push(F.elem.suppName);G.push('">		<img src="/air/logo/');G.push(F.elem.suppCode);G.push('.gif" alt="');G.push(F.elem.suppName);G.push('" border="0" />	</a>	<span>		<a href="');G.push(F.elem.url);G.push('" title="');G.push(F.elem.suppName);G.push('">');G.push(F.elem.suppName);G.push("</a> :	</span>	<strong>");G.push(F.elem.suppCountry);G.push("</strong>");if(F.elem.code){G.push(" (");G.push(F.elem.code);G.push(")")}G.push("</li>							");return G.toString()})}else{this.template=new liligo.VTemplate("/seo/v3/common/templates/directory/country.vm",function(F){var G=new liligo.__VT_StringCat(),D="function",E=0;if(F.velocityCount){E=F.velocityCount}if(F.showKey){G.push('<li class="key">');G.push(F.elem.key);G.push("</li>")}G.push('<li><a href="');G.push(F.elem.url);G.push('" title="');G.push(F.elem.urlname);G.push('">');G.push(F.elem.urlname);G.push("</a>");if(F.elem.code){G.push(" (");G.push(F.elem.code);G.push(")")}G.push("</li>");return G.toString()})}var C;forEach(window.directories,function(D){if(D.key!=C){C=D.key;this.keys[C]=1}else{this.keys[C]++}},this);this.keyMode=true;if(this.keyMode){var B=0;forEach(this.keys,function(F,E){if(this.key==E){this.index=B}var D=document.createElement("a");D.innerHTML=E;__Eo(D,"click",bind(this.setPage,this,B++));D.href="javascript:void(0)";this.dirIndex.appendChild(D)},this)}else{this.limit=25;this.ranges=[];var A=0;forEach(this.keys,function(F,E){var D=(this.ranges.length?this.ranges[this.ranges.length-1]:null);if(D&&D.size<this.limit){D.keys.push(E);D.size+=F}else{D={};D.keys=[E];D.size=F;D.index=A++;this.ranges.push(D)}},this);forEach(this.ranges,function(E){var D=document.createElement("a");D.innerHTML=(E.keys.length>1)?E.keys[0]+"-"+E.keys[E.keys.length-1]:E.keys[0];__Eo(D,"click",bind(this.setPage,this,E.index));D.href="javascript:void(0)";this.dirIndex.appendChild(D)},this)}if(config.directoryType=="supplier"){this.setPage(this.index)}else{if($("dir-left").innerHTML.match(/^\s+$/)&&$("dir-right").innerHTML.match(/^\s+$/)){this.setPage(this.index)}}},setPage:function(B){var A=this.dirIndex.getElementsByTagName("a");forEach(A,function(F){Style.removeClass(F,"active")});var E=[];var D;if(this.keyMode){var C=A[B].innerHTML;forEach(window.directories,function(F){if(F.key==C){E.push(this.setElem(F,F.key!=D));D=C}},this)}else{forEach(this.ranges[B].keys,function(F){forEach(window.directories,function(G){if(G.key==F){E.push(this.setElem(G,G.key!=D));D=F}},this)},this)}$("dir-left").innerHTML=E.splice(0,Math.ceil(E.length/2)).join("");$("dir-right").innerHTML=E.join("");Style.addClass(A[B],"active");Style.show("directoryList")},setElem:function(B,A){return[this.template.process({elem:B,showKey:A})]}})
