window.ModalDialog =
{
	cont_id: 'show_dialog_container_div',
	wind_id: 'show_dialog_window_div',
	show: function(html, args)
	{
		if (typeof args != 'object') { args = {}; }
		var o_cont = document.getElementById(this.cont_id);
		var o_wind = document.getElementById(this.wind_id);

		var adjust = function()
		{
			if (o_wind && o_wind.style.display != 'none')
			{
				o_wind.style.top = document.body.scrollTop + Math.ceil(window.innerHeight ? (window.innerHeight - o_wind.offsetHeight)/2 : 100) + 'px';
				o_cont.style.height = document.body.scrollHeight + 'px';
			}
		};
		
		if (!o_cont || !o_wind)
		{
			o_cont = document.createElement('DIV');
			o_cont.id = this.cont_id;
			o_cont.style.cssText = 'display: none; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: #000000; opacity: 0.5; zoom: 1; filter: alpha(opacity=50);';
			o_cont.innerHTML = '<span></span>';
			o_wind = document.createElement('DIV');
			o_wind.id = this.wind_id;
			o_wind.style.cssText = 'display: none; position: absolute; top: 0px; left: 0px; width: 100%;';
			document.body.appendChild(o_cont);
			document.body.appendChild(o_wind);
		}
		
		var dialog_html = ''; 
		dialog_html += '<table onclick="event.cancelBubble = true;" style="margin: 0px auto; ' + (args.outer_style ? args.outer_style : '50%') + ';">';
		dialog_html += '<tr><td style="background: #f5f5f5; border: 3px solid black; padding: 0px; ' + (args.inner_style ? args.inner_style : '') + '">';
		dialog_html += html;
		dialog_html += '</td></tr>';
		dialog_html += '</table>';
	
		o_wind.innerHTML = dialog_html;

		o_cont.style.display = 'block';
		o_wind.style.display = 'block';

		o_wind.onclick = (args.modal ? null : function() { window.ModalDialog.close(); })
		o_cont.onclick = (args.modal ? null : function() { window.ModalDialog.close(); })
		
		adjust();
	},
	
	close: function()
	{
		var o_cont = document.getElementById(this.cont_id);
		var o_wind = document.getElementById(this.wind_id);
		if (o_cont) { o_cont.style.display = 'none'; }
		if (o_wind) { o_wind.style.display = 'none'; }
	}
}

function show_scan_video(html)
{
	ModalDialog.show(html,
	{
		inner_style: 'border: 2px solid #ffffff;',
		outer_style: '-moz-box-shadow: 3px 3px 6px #000; -webkit-box-shadow: 3px 3px 4px #000; box-shadow: 3px 3px 6px #000; -ms-filter: &lt;progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=135, Color=\'#000000\')&gt;; filter: progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=135, Color=\'#000000\');'
	});
}

function enlarge_image(url, width, height, name)
{
	var w = window.open('', '', 'width=' + width + ', height=' + height);
	var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
	html += '<html><head><title></title><style type="text/css">body { margin: 0px; padding: 0px; }</style></head><body><img src="' + url + '" width="' + width + '" height="' + height + '" border="0"></body></html>';
	w.document.open();
	w.document.write(html);
	w.document.close();
	return false;
}
