var bnd=function(c,b,a){c.addEventListener(b,a,false)
};
var m=function(f,d,g){d=document;
g=d.createElement("p");
g.innerHTML=f;
f=d.createDocumentFragment();
while(d=g.firstChild){f.appendChild(d)
}return f
};
var $=function(d,c){d=d.match(/^(\W)?(.*)/);
return(c||document)["getElement"+(d[1]?d[1]=="#"?"ById":"sByClassName":"sByTagName")](d[2])
};
var j=function(b){for(b=0;
b<4;
b++){try{return b?new ActiveXObject([,"Msxml2","Msxml3","Microsoft"][b]+".XMLHTTP"):new XMLHttpRequest
}catch(c){}}};
function domForEach(b,a){return Array.prototype.forEach.call(b,a)
}e=function(b){return document.createElement(b)
};
function onLoad(b){var a=window.onload;
if(typeof a!="function"){window.onload=b
}else{window.onload=function(){a();
b()
}
}}function addClass(b,a){b.className+=" "+a
}function removeClass(f,c){var b=f.className.split(/\s+/),a=b.length;
for(var d=0;
d=200&&g.status<300){h(g.responseText)
}else{console.log("XHR ERR :",i,a,"->",g.status,g.responseText,g);
c(g.status,g.responseText)
}};
try{g.send(f)
}catch(b){console.log("XHR EXC :",i,a,"->",b);
c(599,b)
}}function dispatchJson(f,d,c){var a;
try{a=JSON.parse(f)
}catch(b){console.log("JSON parse error: "+b+". In: "+f);
c(500,"JSON parse error: "+b);
return
}d(a)
}function ajaxJson(d,a,c,b){ajaxReq(d,a,function(f){dispatchJson(f,c,b)
},b)
}function ajaxSpin(d,a,c,b){$("#spinner").removeAttribute("hidden");
ajaxReq(d,a,function(f){$("#spinner").setAttribute("hidden","");
c(f)
},function(f,g){$("#spinner").setAttribute("hidden","");
b(f,g)
})
}function ajaxJsonSpin(d,a,c,b){ajaxSpin(d,a,function(f){dispatchJson(f,c,b)
},b)
}function hidePopup(a){addClass(a,"popup-hidden");
addClass(a.parentNode,"popup-target")
}onLoad(function(){var a=$("#layout");
var d=a.childNodes[0];
a.insertBefore(m(''),d);
a.insertBefore(m('