function pageWidth() {
  return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

// calculate the current window height //
function pageHeight() {
  return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

// calculate the current window vertical offset //
function topPosition() {
  return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

// calculate the position starting at the left of the window //
function leftPosition() {
  return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

function show_dialog(id)
{
	//alert(id);
	
	dialog = document.createElement('div');
   	dialog.id = 'dialog-mask';
	dialog.className='dialog-mask-active';
	
	dialogmessage = document.createElement('div');
    dialogmessage.id = 'dialog-message';	
	dialogmessage.className='dialog-message-active';
	dialogmessage.innerHTML=document.getElementById('dialog-mssage-text'+id).innerHTML;
	
	document.body.appendChild(dialog);
	document.body.appendChild(dialogmessage);
	
	var width = pageWidth();
	var height = pageHeight();
	var left = leftPosition();
	var top = topPosition();
	var dialogwidth = dialogmessage.offsetWidth;
	var dialogheight = dialogmessage.offsetHeight;
	var topposition = top + (height / 3) - (dialogheight / 2) + 100;
	var leftposition = left + (width / 2) - (dialogwidth / 2);
	
	dialogmessage.style.top = topposition + "px";
	
	dialogmessage.style.left = leftposition + "px";

}

function hide_dialog()
{
	document.body.removeChild(document.getElementById('dialog-mask'));
	document.body.removeChild(document.getElementById('dialog-message'));
}
function confirm_age()
{
		hide_dialog();
}



