
var g_form,g_searchInput,g_activeInput;document.documentElement.id="js";function addEvent(obj,type,func){if(obj.addEventListener){obj.addEventListener(type,func,0);}else if(obj.attachEvent){obj.attachEvent("on"+type,func);}}
function commonKeydown(e){if(!e){e=window.event;}
var key=e.keyCode;if(e.ctrlKey){if(!g_activeInput){if((key==13)&&(document.forms.length==1)){g_form.submit();}else if(key==38){g_searchInput.focus();}else if(key==37){var p=document.getElementById('previous_page');if(p){location.href=p.href;}}else if(key==39){var n=document.getElementById('next_page');if(n){location.href=n.href;}}}else if((key==38)&&(document.forms[0]==g_activeInput.form)&&g_activeInput.select){g_activeInput.select();}}
else if((key==27)&&(typeof(keydownEsc)=='function')){keydownEsc(e);}}
function commonInit(focus){g_form=document.forms[0];addEvent(document,"keydown",commonKeydown);if(g_form){if(typeof(initTabs)=='function'){initTabs(g_form);}
for(var i=0,l=document.forms.length;i<l;i++){var f=document.forms[i];for(var j=0,lj=f.length;j<lj;j++){var inp=f.elements[j];if((inp.tagName.toLowerCase()=='textarea')||(inp.type&&inp.type=='text')){if(!g_searchInput){g_searchInput=inp;}
addEvent(inp,"focus",function(){g_activeInput=this});addEvent(inp,"blur",function(){g_activeInput=null});}}}
if(focus&&g_searchInput){g_searchInput.focus();}}
if(typeof(addEmptyTitleAndBorderToAllImages)=='function'){addEmptyTitleAndBorderToAllImages(document);}
if(typeof(applyDecoration)=='function'){applyDecoration(document);}}
function addEmptyTitleAndBorderToAllImages(_parent){var elements=_parent.getElementsByTagName("img");for(var i=0,l=elements.length;i<l;i++){elements[i].border="0";if(!elements[i].title){elements[i].title="";}}}
function WrapableTable(id,minWidth,space){this.container=document.getElementById(id);if(!this.container){return;}
this.table=this.container.getElementsByTagName("table")[0];this.minWidth=minWidth;this.space=space;this.cells=new Array();this.classes=new Array();this.columns=0;this.init();}
WrapableTable.prototype={init:function(){var rows=this.table.rows;for(var j=0,lj=rows.length;j<lj;j++){var c=rows[j].className;var index=c.match(/\s*r(\d+?)\s*/)[1];this.classes[j]=c;if(!this.cells[index-1]){this.cells[index-1]=new Array();}
for(var i=0,li=rows[j].cells.length;i<li;i++){this.cells[index-1].push(rows[j].cells[i]);}}
this.columns=this.cells[0].length;var self=this;this.resize();setInterval(function(){self.resize()},250);},count:function(){var c=Math.floor(this.container.parentNode.offsetWidth/(this.minWidth+this.space));return c>0?c:1;},resize:function(){var cols=this.count();if(this.columns==cols){return;}
this.columns=cols;var newTable=document.createElement("table");var tbody=document.createElement("tbody");var rows=this.cells[0].length/cols;var width=100/cols;for(var k=0;k<rows;k++){for(var j=0,lj=this.cells.length;j<lj;j++){var row=document.createElement("tr");row.className=this.classes[j].replace(/(^|\s+)(r\d+)(\s+|$)/,function($0,$1,$2){return $0.replace($2,"r"+(j+1))});for(var i=0;i<cols;i++){var cell=this.cells[j][k*cols+i];if(!cell){break;}
cell.style.width=width+"%";row.appendChild(cell);}
tbody.appendChild(row);}}
newTable.appendChild(tbody);this.container.appendChild(newTable);this.table.parentNode.removeChild(this.table);this.table=newTable;}}
function init(focus){commonInit(focus);}
var r=function(a,w){return Lego.c(w,a);}
var redirect=function(a,url){var href=a.href;a.href=url;setTimeout(function(){a.href=href;},500);}
function parseQuery(s){s=s.substring(s.indexOf('?')+1);var q=s.split('&');var r={};for(var i=0;i<q.length;i++){var t=q[i].split('=');r[t[0]]=t[1];}
return r;}
var escapeHTMLRe=/[&<\"\']/g;escapeHTMLReplacer=function(c){return'&#'+c.charCodeAt(0)+';';}
function escapeHTML(str){return str.replace(escapeHTMLRe,escapeHTMLReplacer);}
function changeWord(n,w1,w2,w3){if(n%100>=11&&n%100<=20)return w3;if(n%10==1)return w1;if(n%10>=2&&n%10<=4)return w2;return w3;}
function trunc(s,n){if(!n){n=25;}
if(s.length>n){return(s.substr(0,n)+'\u2026');}
return s;}
function wbrRe(s){return escapeHTML(s)+'<wbr/>';}
function wbr(s,n){if(!n){n=15;}
var a=s.split(/\s/);var re=new RegExp("(\\S{"+n+"})","g");for(var i=0,l=a.length;i<l;i++){a[i]=a[i].replace(re,wbrRe);}
return a.join(' ');}