function getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	return [pageWidth,pageHeight];
}
function MyAlert(txt, title, alt1, alt2){
	var div_txt = document.createElement('div');
	var div_title = document.createElement('div');
	var div_curtain = document.createElement('div');
	var br = document.createElement('br');
	var input_ok = document.createElement('input');
	var input_anuluj = document.createElement('input');
	input_ok.id = 'myok';
	input_ok.type = 'button';
	input_ok.onclick = function() {
		$('#curtain').remove();
		$('#MyAlert').remove();
		if(alt1) eval(alt1);
	};
	input_anuluj.id = 'mycancel'
	input_anuluj.type = 'button';
	input_anuluj.onclick = function() {
		$('#curtain').remove();
		$('#MyAlert').remove();
		if(alt2) eval(alt2);
	};
	
	div_curtain.id = 'curtain';
	size = getPageSize();
	div_curtain.style.height = size[1]+'px';
	div_title.innerHTML = title
	div_txt.id = 'MyAlert';
	div_txt.appendChild(div_title);
	div_txt.innerHTML += "<div style='background: none; margin: 5px; font-weight: normal; text-align: center;'>"+txt+"</div>";
	div_txt.appendChild(br);
	div_txt.appendChild(input_ok);
	if(arguments.length > 3) div_txt.appendChild(input_anuluj);
	document.body.appendChild(div_curtain);
	document.body.appendChild(div_txt);
	
	document.getElementById('myok').focus();
	if(document.getElementById('myok')) document.getElementById('myok').value = 'Ok';
	if(document.getElementById('mycancel')) document.getElementById('mycancel').value = 'Cancel';
}
