window.fn = {};

window.fn.toggleMenu = function () {
  document.getElementById('appSplitter').right.toggle();
};

window.fn.loadView = function (index) {
  document.getElementById('appTabbar').setActiveTab(index);
  document.getElementById('sidemenu').close();
};

window.fn.loadLink = function (url) {
  window.open(url, '_blank');
};

window.fn.pushPage = function (page, anim) {

	//Open and send json file that is equivalent with the especification.
	var request = new XMLHttpRequest();
	request.open("GET", "Server/" + page.title.toUpperCase() + ".json", false);
	request.send(null)
	var artesanos = JSON.parse(request.responseText);

  if (anim) {
    document.getElementById('myNavigator').pushPage(page.id, { data: { title: page.title, esp: page.esp, json: artesanos } , animation: anim });
  } else {
    document.getElementById('myNavigator').pushPage(page.id, { data: { title: page.title, esp: page.esp, json: artesanos } });
  }
};



