(function()
{
var tabMenu = document.getElementById('tabMenu');
for(var tM = 0; tM < tabMenu.children.length; tM++)
{
tabMenu.children[tM].children[0].onclick = function()
{
history.pushState(null, null, this.href);
ajax('POST', '/app/controllers/route.php', 'controller=' + location.pathname);
return false;
}
}
function ajax(method, puth, param)
{
var xhr = new XMLHttpRequest();
xhr.open(method, puth, true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onreadystatechange = function()
{
if(xhr.readyState === 4)
{
if(xhr.status === 200)
{
var fh5comain = document.getElementById('fh5co-main');
fh5comain.innerHTML = xhr.responseText;
}
}
}
xhr.send(param);
}
window.onpopstate = function()
{
ajax('POST', '/app/controllers/route.php', 'controller=' + location.pathname);
}
}());