function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}


function screenSize() {
    var w, h; // Объявляем переменные, w - длина, h - высота
    w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
    h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
    return {w:w, h:h};
}

function tip_init(){	if (getCookie('tipview')!='0'){		tip_view();	}}

function tip_view(){	if (typeof(stop_show) != 'undefined') stop_show();	var div_src = document.getElementById('tip');	var div = document.createElement('div');
	div.className = 'tip_wnd';
	div.style.width = '500px';
	div.style.height = '300px';
	var top = Math.round((parseInt(screenSize().h)-parseInt(div.style.height))/2);
	var left = Math.round((parseInt(screenSize().w)-parseInt(div.style.width))/2);
	var html = div_src.innerHTML;
	div.style.top = top+'px';
	div.style.left = left+'px';
	div.innerHTML = html;
	div.id = 'tip_wnd';
	document.body.appendChild(div);
}
function tip_close(){	var date = new Date(2020,12,12);	if (document.getElementById('tip_view').checked == true) setCookie('tipview','0',date.toUMCString,'/','',''); else  deleteCookie('tipview','/','');	document.body.removeChild(document.getElementById('tip_wnd'));}