(function () {
  'use strict';
	
  window.InsertBodyHtmlAfterBegin = function (HTML) {
    document.getElementsByTagName('body')[0].insertAdjacentHTML('afterbegin', HTML);		  
  };
 
   window.InsertBodyHtmlBeforeEnd = function (HTML) {
    document.getElementsByTagName('body')[0].insertAdjacentHTML('beforeend', HTML);		  
  };

   window.InsertAppBar = function (HTML) {
    document.getElementById('sidenav').insertAdjacentHTML('afterend', HTML);		  
  };

  window.AppendJS = function (src) {	  
	var script = document.createElement('script');
	script.src = src;
	document.getElementsByTagName('body')[0].appendChild(script);
  };

  window.Redirect = function (url) {	  
    location.replace(url);
  };
  
  window.DocTitle = function (title) {	  
    document.title = title;
  };
  
  window.SessStorageSet = function (key, value) {	  
    sessionStorage.setItem(key, value);
  };
  
  window.SessStorageGet = function (key) {
	var value = sessionStorage.getItem(key);
	if(value === null) {
      return "";
	}else{
	  return value;
	}
  };
  
  window.SessStorageDel = function (key) {	  
    sessionStorage.removeItem(key);
  };

  window.OpenModalHTML = function (title, width, height, HTML) {
    var modal = document.getElementById("modal");
	var modal_header = document.getElementById("modal-header");
	var modal_content = document.getElementById("modal-content");
	var modal_body = document.getElementById("modal-body");
	
	modal_header.innerHTML = title;
	modal_content.style.width = width;
	modal_content.style.height = height;
	modal_body.innerHTML="";
	modal_body.insertAdjacentHTML('afterbegin', HTML);
	modal.style.display = "block";
  };

}());